Skip to content

Phase 5 Windows: DLL + source-built tokenizer, on-device verified [draft, stacks on #6] - #7

Closed
NestorCanales wants to merge 8 commits into
feat/xplat-macos-intelfrom
feat/xplat-windows
Closed

Phase 5 Windows: DLL + source-built tokenizer, on-device verified [draft, stacks on #6]#7
NestorCanales wants to merge 8 commits into
feat/xplat-macos-intelfrom
feat/xplat-windows

Conversation

@NestorCanales

Copy link
Copy Markdown
Collaborator

What

Windows x64 support — the final Phase 5 platform. Stacks on #6#4#3#2; review in order. With this, the local model runs out-of-the-box, offline, on every platform the app ships.

Built and verified natively on a Windows PC, driven from the dev Mac over SSH (Tailscale).

Changes

  • assets/manifest.jsonwindows-amd64: official Microsoft ONNX Runtime DLL (onnxruntime-win-x64-1.26.0.zip, member-pinned) + our source-built libtokenizers.a.
  • libtokenizers.a source-built — no upstream Windows prebuilt exists. Built from daulet/tokenizers v1.27.0 with the GNU Rust toolchain (must match MinGW gcc; MSVC yields an unlinkable .lib). Published as tokenizers-1.27.0-windows-x64, SHA-256 pinned. (The v1.27.0 layout emits libtokenizers_ffi.a, renamed to the canonical libtokenizers.a.)
  • assets_embed_windows.go — embeds onnxruntime.dll.
  • Makefile — three Windows-only additions, all guarded by GOOS=windows (macOS/Linux verified unaffected):
    1. .zip archive extraction in make assets (unzip → Windows tar.exe fallback).
    2. LINK_LIBS appends NT/Winsock/crypto syscall libs the Rust static lib needs (-lntdll -lws2_32 -lbcrypt -luserenv -ladvapi32 -lkernel32 -lncrypt) — MinGW doesn't link them by default.
    3. winhdr step stages sqlite3.h/sqlite3ext.h (which sqlite-vec's cgo needs; Windows has no system copy) from the headers mattn/go-sqlite3 already bundles, version-matched.
  • Documentation/windows-build.md — full build + provenance recipe. Epic updated with findings.

Two Windows-only build gaps (found live, fixed permanently)

Both surfaced only on Windows and are now baked into the Makefile behind a GOOS=windows guard, so they self-resolve on the next Windows build and don't touch the other platforms:

  1. Tokenizer linkundefined reference to Nt*/Rtl* (Rust std syscalls).
  2. sqlite3.h: No such file — sqlite-vec needs the header the system provided on Mac/Linux.

Verification (native Windows x64)

  • make assets — all four artifacts download + checksum-verify, incl. .zip extraction and our published tokenizer release
  • Integration test links + passes — cosine ordering 0.140 < 0.171 < 0.286, matching every platform
  • make buildagent-memory.exe (193 MB PE32+ GUI x86-64)
  • The exe extracts embedded assets to windows-amd64-<fingerprint>/ and answers an MCP search on a Mac-indexed DB ("how do I cook italian pasta" → carbonara-recipe.md) — cross-platform vector compatibility confirmed
  • Network not forcibly disabled (SSH), but the local provider makes no outbound calls by design; the --network none Linux/Intel runs already proved that

Phase 5 status

All four targets built & verified. Remaining: linux-amd64 runtime smoke (artifacts pinned, needs an x64 Linux box) + Phase 6 cleanup.

🤖 Generated with Claude Code

NestorCanales and others added 8 commits July 17, 2026 14:54
… assets

Adds windows-amd64 to assets/manifest.json: the official Microsoft ONNX
Runtime DLL (onnxruntime-win-x64-1.26.0.zip, member-pinned) and our
source-built libtokenizers.a. daulet/tokenizers ships no Windows prebuilt,
so it is built from the v1.27.0 tag with the GNU Rust toolchain (must match
MinGW gcc that CGo links with) and hosted in this repo's releases
(tokenizers-1.27.0-windows-x64), SHA-256 pinned like every artifact.

- assets_embed_windows.go: per-platform go:embed of onnxruntime.dll.
- Makefile: extract .zip archives (unzip, else Windows System32 tar) so
  make assets works on Windows — tars stay the path for the others.
- Documentation/windows-build.md: full build + artifact-provenance recipe
  (toolchain versions, the GNU-must-match-MinGW constraint, the
  libtokenizers_ffi.a -> libtokenizers.a rename in the v1.27.0 layout).

Tokenizer lib compiled on Windows x64 (rustc 1.97.1 GNU, Go 1.26.5, MinGW
gcc 16.1.0). App build + on-device verification run next on the PC.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ilt tokenizer

The Windows libtokenizers.a (Rust std, GNU toolchain) references Nt*/Rtl*,
Winsock and crypto syscalls that MinGW does not link by default, so the
Windows `make build` failed with "undefined reference to NtCreateFile" etc.
Makefile LINK_LIBS now appends -lntdll -lws2_32 -lbcrypt -luserenv
-ladvapi32 -lkernel32 -lncrypt when GOOS=windows; empty on macOS/Linux
(verified LINK_LIBS = -ltokenizers there), so those builds are unchanged.

Observed and resolved during the first on-device Windows build; the
integration test then linked and passed (cosine ordering 0.140 < 0.171 <
0.286, matching every other platform).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sqlite-vec's cgo bindings #include sqlite3.h / sqlite3ext.h. macOS (SDK) and
Linux (system libsqlite3) supply those; Windows has neither, so the full
`make build` failed with "sqlite3.h: No such file or directory" (after the
tokenizer link was resolved). New Windows-only `winhdr` prerequisite copies
the headers mattn/go-sqlite3 already bundles (its sqlite3-binding.h IS the
amalgamation sqlite3.h) into build/winhdr and points CGO_CFLAGS there —
guaranteeing they match the SQLite mattn compiles in, no download or vendor.

macOS/Linux unchanged: WIN_PREREQ + CGO_EXTRA_CFLAGS expand empty there
(verified LINK_LIBS=-ltokenizers, no winhdr prereq, CGO_CFLAGS="").

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…fied

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Windows GUI smoke (headless SSH couldn't open a window), full untagged
test suite on Windows (watcher TestOnCreate presumably fails pre-PR#5,
unverified), and the linux-amd64 on-device runtime smoke. Coverage gaps,
not known defects — recorded so they survive the session.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…d, fix verified 3/3 on Windows

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…only

defaultClaudeDesktopConfigPath hardcoded the macOS location
(~/Library/Application Support/Claude/). On Windows the button therefore
wrote a well-formed config to a path Claude Desktop never reads — and
reported success. Found live during the Phase 5 Windows GUI smoke: the
misplaced file existed at C:\Users\<u>\Library\Application Support\...
while Claude Desktop (reading %APPDATA%\Claude\) fell back to manual
filesystem browsing instead of the MCP tool.

Now per-OS: windows → %APPDATA%\Claude\; darwin → unchanged; linux →
$XDG_CONFIG_HOME/Claude or ~/.config/Claude. Stdlib runtime aliased as
goruntime (wails runtime already owns the name in app.go).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@NestorCanales

Copy link
Copy Markdown
Collaborator Author

Consolidated into #2 (single reviewable branch per Bo's review-workflow preference) — all commits from this PR are now in feat/local-embeddings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant