Skip to content

AI, fully local on your computer.

35.5 KB
Raw Blame

Drive & Workspace Layout

How the app finds its data

At startup (main/index.ts → initBackend()), the app picks a root path with services/workspace.ts → locateDriveRoot() and derives the paths from it with resolvePaths(), in this priority:

  1. HILBERTRAUM_DRIVE_ROOT environment variable — explicit override (the drive launchers set it; also used for testing). If the root contains config/drive.json, it is treated as a prepared drive. An empty or blank value counts as unset (#858).
  2. The drive the app runs from — findPreparedDriveRoot walks up, at most six folders, from where the app really is: the Windows portable exe's folder (PORTABLE_EXECUTABLE_DIR), a Linux AppImage's file (APPIMAGE; the executable itself runs from a temporary mount), or the executable's folder. So an app started directly on a Kit, without the launcher, still opens the drive's workspace. A macOS app that Gatekeeper translocates runs from elsewhere and is not found this way; the drive's launcher covers it.
  3. App-data fallback — app.getPath('userData') for a normal install / dev run.

From the root, these paths are derived and created (idempotently) on first run:

<root>/
├── workspace/
│   ├── hilbertraum.sqlite        # all app data (spec §8 tables) — hilbertraum.sqlite.enc at rest in
│   │                      # encrypted mode (decrypted to hilbertraum.sqlite only while unlocked)
│   │                      # while the app runs, SQLite keeps -wal/-shm sidecars next to it (WAL
│   │                      # mode); a clean quit checkpoints + removes them in BOTH modes (#51) —
│   │                      # sidecars present at rest mean the last session ended uncleanly
│   │                      # hilbertraum.sqlite.recovery: a copy a start set aside for the next unlock to roll
│   │                      # forward (a failed lock's session, CODE-1b; or the only copy of the workspace when
│   │                      # .enc was missing, #911); plaintext until that unlock
│   ├── documents/         # stored copies of imported files (<id><ext>.enc in encrypted mode)
│   ├── images/            # saved image-analysis history copies (<id><ext>.enc in encrypted mode)
│   └── zim-transient/     # generated library XML for the knowledge-pack server (plaintext while
│                          #   present; removed at lock/quit/session start — #301 P3b)
├── app-skills/            # app-shipped Skills (read-only, PLAIN folders — NOT encrypted; Skills S3/S9)
│   └── <id>/SKILL.md      #   non-secret product content, provisioned like model-manifests
├── user-skills/           # user-installed/dropped-in Skills (read-write, PLAIN folders — NOT encrypted; S3)
│   └── <id>/SKILL.md      #   non-secret task knowledge (DS20); a drop-in installs DISABLED until enabled
├── models/                # GGUF weights (git-ignored, never committed); per role: chat/ embeddings/
│                          #   reranker/ transcriber/ vision/ translation/ (vision = the GGUF + its mmproj
│                          #   projector; translation = the TranslateGemma GGUF, its own sidecar)
├── logs/
│   └── app.log[.enc]      # local rotating logs (never uploaded; .enc on an encrypted workspace)
└── config/                # drive.json / policy.json / checksums.json / workspace.json (vault descriptor)
                           #   working-copy-lost.json: only after a lock that kept the last saved state
                           #   because the working file was gone or damaged (#875), or a start that
                           #   shredded the session an unclean end left (#892); content-free, bound
                           #   to that .enc snapshot, removed by the next unlock

Skills live OUTSIDE workspace/, in the clear (Skills plan §0/§7, revised 2026-06-17). A skill package is non-secret task knowledge, not user content (DS20), so both app-skills/ (read-only) and user-skills/ (read-write) are plain folders, not part of the encrypted vault — keeping workspace/ as the single encrypted zone. Disk is the source of truth: the skills table is a derived index re-built from these folders on every reconcile, so a DB rebuild loses no skill. A folder a power user drops into user-skills/ is discovered but installs disabled (DS19); a deliberate zip-import via Settings → Skills installs enabled-with-warning (DS7). Because user-skills/ is a top-level dir (not inside workspace/), a workspace backup must include it (DS20). app-skills/ is empty on a normal install until prepare-drive populates it; in a dev build it falls back to the committed repo app-skills/ source dir (resolveAppSkillsDir, the resolveManifestsDir precedent).

buildDriveStatus() reports root/workspace/models/logs paths, prepared-drive flag, writability, free space, the size of workspace/images/ (0 when empty, unknown when unreadable), and OS/arch — surfaced on the Diagnostics screen.

Prepared external drive (commercial layout, spec §6)

A prepared drive uses the fuller layout below. The app detects it via the config/drive.json marker and uses the drive's models/ and workspace/ directly, so the same workspace moves between laptops (spec success criterion #10).

HILBERTRAUM/
├── Start HilbertRaum.cmd                  # Windows launcher ── DOUBLE-CLICK THIS
├── Start HilbertRaum.command              # macOS launcher
├── start-hilbertraum.sh                   # Linux launcher
├── READ ME FIRST.txt                           # friendly first-run + SmartScreen note
├── LICENSE                                     # the app's own GPL-3.0-or-later text (LIC-1)
├── THIRD-PARTY-NOTICES.md                      # bundled npm-package notices (also ships inside the packaged app)
├── DRIVE-NOTICES.md                            # GENERATED drive-wide notices: runtime binaries + model weights + GPL source statement (scripts/generate-drive-notices.mjs)
├── HilbertRaum-<version>-portable.exe   # the portable build — signed for commercial
├── runtime/llama.cpp/{win,mac,linux}/          # default sidecar build (Vulkan on win/linux)
│   ├── .hilbertraum-runtime.json                       # install marker: { version, backend, os, arch }
│   └── cpu/                                     # pure-CPU safety-net build + its own marker (win/linux only)
├── runtime/<family>/<os>.new/, <os>.old/       # TRANSIENT (#986): an in-app install's staged copy and the copy
│                                                #   it replaces, beside the install (and <os>/cpu.new/, cpu.old/);
│                                                #   gone after the job, finished or rolled back at the next start
├── runtime/whisper.cpp/{win,mac,linux}/        # SECOND sidecar family: the whisper-cli transcriber
│   └── .hilbertraum-runtime.json                       # same marker scheme; win = upstream prebuilt, mac/linux = source-build (see below)
├── models/{chat,embeddings,reranker,transcriber,vision,translation}/ # weights (git-ignored; transcriber/ = whisper GGML .bin + the Silero VAD .bin its manifest requires since #504; vision/ = the GGUF + its mmproj projector, image understanding V1–V5; translation/ = TranslateGemma GGUF, TG wave)
├── runtime/kiwix-tools/{win,mac,linux}/        # THIRD sidecar family: kiwix-serve + kiwix-manage + kiwix-search
│   ├── .hilbertraum-runtime.json                       #   (knowledge packs; OPTIONAL — never a readiness prerequisite). Install
│   │                                            #   marker: a hash per executable + per ICU DLL (win only). An in-app
│   │                                            #   install writes it (#339 P8-1/P8-2, the Knowledge-packs-panel /
│   │                                            #   AI-Model-screen consent dialog); `fetch-runtime --family kiwix_tools`
│   │                                            #   is the scripted DIY path (P8-3); a hand-placed bundle still works as a
│   │                                            #   last-resort fallback but carries no marker (rag-design §17 D-Z17)
│   └── source/                                  # complete corresponding source for the five copyleft components
│       └── SOURCES.md                           #   (kiwix-tools/libkiwix/libzim/xapian-core/libmicrohttpd tarballs + a
│                                                #   generated record) — ONE dir per drive, OS-independent. A preloaded Kit
│                                                #   carrying kiwix_tools binaries carries this too, installed + verified by
│                                                #   `build-commercial-drive --kiwix-source-dir <archive dir>` via
│                                                #   `scripts/install-kiwix-source-bundle.mjs` (#339 P8-4); the sell gate's
│                                                #   `checkSourceBundle` fails a drive that ships the binaries without a
│                                                #   complete, hash-matching bundle. A DIY drive built with `fetch-runtime`
│                                                #   alone has no `source/` — that is fine until binaries actually ship.
├── ocr/                                        # OCR data: {deu,eng,osd}.traineddata.gz — plain sha256-verified, git-ignored
├── zim/                                        # Knowledge packs: ZIM archives (offline Wikipedia etc.) — PLAIN read-only
│                                                #   files, never copied into the encrypted workspace (not the document
│                                                #   store); discovered at session start (after unlock/create/plaintext
│                                                #   start) and on Refresh, never continuously; ships EMPTY (rag-design
│                                                #   §17; git-ignored). Resolved first at `<drive>/zim/<leaf>`, then at
│                                                #   the recorded path (an external file, or the same leaf after a
│                                                #   drive-letter change) — both checked against the archive's header UUID.
│   └── NOTICES/<uuid>.md                        #   generated per-archive licence notice (title, UUID, language, tags,
│                                                #   a "Content licence" section stating plainly what is NOT knowable
│                                                #   offline) written by `scripts/generate-zim-notices.mjs`, a MANUAL
│                                                #   build-time step run once the kiwix-tools binaries and the packs are
│                                                #   on the drive (#339 P8-4); neither builder script runs it. Invisible
│                                                #   to the app (only `*.zim` is enumerated); absent until someone runs it.
├── model-manifests/{chat,embeddings,reranker,transcriber,vision,translation}/ # committed YAML (the only model metadata in git)
│   └── runtime-sources.yaml                     # sidecar download manifest (llama_cpp + whisper_cpp + kiwix_tools + ocr blocks)
├── app-skills/                                 # app-shipped Skills (read-only PLAIN folders; provisioned + asserted, S3/S9)
├── user-skills/                                # user Skills (read-write PLAIN folders) — EMPTY on a sold drive
├── workspace/                                  # hilbertraum.sqlite (encrypted or plaintext) — EMPTY on a sold drive:
│                                                #   the sell gate refuses any file or link in it and any
│                                                #   non-empty folder; empty documents/, images/ and
│                                                #   zim-transient/ are fine (#893)
├── logs/                                       # app.log.enc (app.log in plaintext dev mode) — EMPTY on a sold
│                                                #   drive, by the same sell-gate rule (#893)
├── docs/                                       # user guide, privacy, troubleshooting
└── config/{drive.json,policy.json,checksums.json}  # + workspace.json once a workspace exists, and
                                                #   working-copy-lost.json only after a lock kept the last
                                                #   saved state (#875) or a start shredded the session an
                                                #   unclean end left (#892); a workspace created here removes a
                                                #   leftover one. The sell gate refuses both, and either
                                                #   one's temporary copy (`<name>.*`, #893)

Skills on a commercial drive (S3 lays the dirs; S9 provisions + asserts). app-skills/ carries the bundled product skills (nine today: bank-statement, invoice, document-redaction, document-edit — all Tier-2 kind:'tool' — plus the Tier-1 instruction skills meeting-protocol (Meeting Minutes), contract-brief, deadline-obligation-finder, what-changed, and share-safe-review), copied wholesale from the committed repo app-skills/ tree by prepare-drive, the same copy step as model-manifests/ (DS17 — text-only, never network-fetched); user-skills/ is created empty. The S9 commercial-drive gate (assertCommercialDrive + the build scripts) verifies at least one app skill is present (a folder with a SKILL.md) and asserts user-skills/ is empty on a sold drive — the "no user data" invariant, extended to the plaintext skills area. Both dirs are plain (unencrypted) by design: a skill is non-secret task knowledge (DS20).

Integrity residual (accepted, §22-M2). On a removable drive app-skills/ is writable, so a shipped skill's trusted_level: app is assigned by location, not a signature — "verified" means build-time provisioning, not a runtime hash. A hash manifest on the same writable drive would be unanchored; real integrity needs off-drive signing (a Tier-3 prerequisite). This is the same accepted residual as the engine binary — see security-model.md / known-limitations.md.

Launchers. The Start HilbertRaum.* files sit at the drive root beside the portable app and set HILBERTRAUM_DRIVE_ROOT from their own location every launch — never a hardcoded drive letter — so the same drive continues the same encrypted workspace on any laptop (success criterion #10). tests/integration/launcher-execution.test.ts runs each launcher in a scratch root. A commercial (sellable) drive ships policy.json in the commercial posture (encryption required, plaintext off, models must verify, no phone-home — model downloads are a permitted user action, but update-checks + telemetry are denied) and contains no user data — built + asserted by scripts/build-commercial-drive.{ps1,sh} (canonical: services/commercial-drive.ts). See packaging.md.

Portability is a whole-stack property, not just the launcher (issue #188). The launcher deriving the root from its own location is necessary but was not sufficient: until wave 188, documents.stored_path recorded each stored copy as an absolute path, so a drive that came back under a different letter still resolved its ROOT correctly while every stored document looked missing — and "Delete document" silently stopped shredding. Nothing on this drive may persist an absolute path. The portable spellings, all of which resolve against a dir computed at runtime: documents.stored_name and image_sessions.stored_name (leaf under workspace/documents / workspace/images), skills.path (folder basename), the checksum cache (driveRelKey), the runtime install marker (markerBinaryKey, posix separators), and the local_path fields in config/*.json. The one deliberate exception is documents.original_path, which names a file on the user's own machine and is therefore expected not to survive a move — it is a last-resort fallback, never the source of truth. See architecture.md "Portable stored copies — design record".

Naming reconciliation. This layout reflects what the code actually reads, which is the source of truth:

  • Sidecar OS sub-dirs are win / mac / linux (resolved by services/runtime/sidecar.ts llamaOsDir), not the spec's prose windows/macos/linux.
  • Model manifests live in a top-level model-manifests/ dir (discovered by services/models.ts resolveManifestsDir), not models/manifests/.
  • The spec §6 sketch also shows updates/{incoming,applied}/, workspace/{encrypted, plaintext-dev,backups}/, and runtime/embeddings/ — not shipped: there is no update mechanism yet (see Updating a drive below), the workspace is a single flat dir whose DB is hilbertraum.sqlite or hilbertraum.sqlite.enc (mode is an attribute, not a directory), and the embeddings sidecar reuses the same runtime/llama.cpp/<os>/ binary.

The apps/desktop/src/main/services/drive.ts module (DRIVE_LAYOUT_DIRS) is the canonical, unit-tested list of these directories; the prepare-drive scripts create exactly that set.

Updating a drive (manual — spec §12.3)

There is no in-app updater (by design: the app makes no internet calls of its own). Updating a prepared drive is the same flow as building it, run again from a machine with the repo:

  1. prepare-drive --target <drive> refreshes model-manifests/ + the bundled skills, docs and notices (the workspace and weights are untouched). Run it without --force: an existing config/drive.json and config/policy.json are kept, and --force would rewrite both to the defaults, resetting a drive owner's policy (docs/packaging.md, "To move a drive to the repo's pin").
  2. fetch-models / fetch-runtime download anything new (present + verified files are skipped). An engine that the app updated past the drive's pin is kept as it is (#873); --allow-downgrade replaces it with the drive's pin. On a Kit, fetch-models --bundled: plain fetch-models would preload the whole catalog (#766).
  3. Delete every prior app artifact at the drive root — HilbertRaum-<old>-portable.exe, HilbertRaum-<old>.AppImage, HilbertRaum-<old>-mac-arm64.app.zip — and any extracted HilbertRaum.app, and only then copy the new build (and launchers) in. Two app versions on one drive must never run: an older build beside a newer one can destroy the workspace, so the launchers refuse to start while more than one is present and name what to delete (#235). Start the app and verify the version shown under Settings → Diagnostics ("App version").
  4. verify-models --target <drive> --strict confirms every weight still verifies; on a Kit, --kit checks what it ships and leaves the in-app catalog alone (#766).

An update does not edit your workspace/ files itself. The first time a newer version opens the workspace it may upgrade the database inside it (new columns, indexes and search tables) and records the schema version it wrote. Versions 0.1.60 and later refuse to open a workspace whose schema version is newer than their own, so after an update that raises it, an older version can no longer open that workspace; 0.1.59 and older do not check. No release so far has raised it: it has been 1 since 0.1.60.

Preparing a drive (scripts)

The scripts/ directory lays out and verifies a drive. The scripts are self-contained (no Node/npm needed to prepare a drive); their logic mirrors the unit-tested services/drive.ts. See packaging.md for the full flow.

# Windows
.\scripts\prepare-drive.ps1 -Target E:\ -DryRun                 # print the plan, create nothing
.\scripts\prepare-drive.ps1 -Target E:\                         # create dirs + manifests + config
.\scripts\prepare-drive.ps1 -Target E:\ -WithAssets -AcceptLicense  # + download & verify assets
.\scripts\verify-models.ps1  -Target E:\ -Generate              # checksum + write config/checksums.json
# macOS / Linux
scripts/prepare-drive.sh --target /Volumes/HILBERTRAUM --dry-run
scripts/prepare-drive.sh --target /Volumes/HILBERTRAUM
scripts/prepare-drive.sh --target /Volumes/HILBERTRAUM --with-assets --accept-license
scripts/verify-models.sh  --target /Volumes/HILBERTRAUM --generate

prepare-drive creates the directory tree, copies the committed manifests + user docs onto the drive, copies the three root license/attribution notices (LICENSE, THIRD-PARTY-NOTICES.md, DRIVE-NOTICES.md — LIC-1, full-audit 2026-07-12b; unconditional, dev drives get them too), and generates config/drive.json (the prepared-drive marker) + config/policy.json (no-phone-home posture — model downloads permitted, update-checks + telemetry denied; --dev/-Dev for a plaintext developer drive). DRIVE-NOTICES.md is a committed, GENERATED file (node scripts/generate-drive-notices.mjs — derived from model-manifests/** + the pinned texts under licenses/); the commercial sell gate fails a drive where any of the three is missing or empty (see packaging.md + model-policy.md).

By default it does not download artifacts. --with-assets/-WithAssets then runs fetch-models (weights) + fetch-runtime (the llama-server sidecar) — each download is resumable and SHA-256-verified before it counts as installed (mismatch → delete partial + exit 1; placeholder hash → UNVERIFIED). For a fast setup --with-assets fetches a small default set — the default chat model (Ministral 3 8B) + the embeddings model + the reranker + the Whisper transcriber model + the vision model — plus both sidecar runtimes (llama.cpp + whisper.cpp, the latter Windows-only/best-effort); the user pulls any other models (larger chat models) from the app's AI Model screen on demand. Add --all-models/-AllModels to provision every model up front (runtimes either way). You can still drop artifacts in by hand (R5). verify-models SHA-256s each present weight against its manifest hash, and --generate captures real hashes into config/checksums.json. The asset download/verify/plan logic mirrors the unit-tested services/assets.ts, but the default-set model-id list lives only in the two prepare-drive shells ($DefaultModelIds in .ps1, DEFAULT_MODEL_IDS in .sh), kept in sync with each other and with model-manifests/ — not in assets.ts. The sidecar build comes from model-manifests/runtime-sources.yaml. See packaging.md + model-policy.md for the full flow + license gate.

Sidecar builds: Vulkan default + CPU safety net

runtime-sources.yaml (see the architecture.md GPU record §6) is vulkan-first on Windows/Linux:

  • runtime/llama.cpp/<os>/ holds the Vulkan full build — it ships every CPU backend variant alongside the Vulkan one (dynamic backend loading), so on a machine with no usable GPU it is the CPU build. This is the binary services/runtime/sidecar.ts resolves, unchanged.
  • runtime/llama.cpp/<os>/cpu/ (win/linux only) holds the pure-CPU safety net — used only if the default binary itself cannot start (the app's fallback ladder rung 3). Fetch it with fetch-runtime --backend cpu.
  • mac is unchanged: the arm64 Metal build, no cpu/ subdir.
  • Each extraction dir carries a .hilbertraum-runtime.json install marker ({ version, backend, os, arch, binaries }), written by fetch-runtime after a verified extraction (and by the app's in-app install). binaries holds the SHA-256 of every file of that copy, keyed by its path relative to the dir with / (since #998 every file the archive put there, not only the programs; a nested cpu/, cpu.new or cpu.old has its own marker and is never in it), so the app, the start's recovery and the sell gate judge each copy by its own list. A marker that is there but is no marker (cut short, garbled; the rules are in data-contracts.md, #1028) makes its copy damaged: the app does not start it and offers to install it again, and fetch-runtime fetches it again (both twins read the marker as the app does). Should a script still report the engine already installed, delete the engine folder and run it again. Re-runs skip only when the marker matches the pinned version + backend and every file it records is there — so bumping the pin or switching a CPU-era drive to the Vulkan default actually re-fetches (mere binary presence is not trusted). Canonical logic: services/assets.ts (runtimeInstallCurrent, readRuntimeMarker, engineFolderComplete).

Existing DIY drives keep working untouched: their flat <os>/ dir holds a CPU build that resolves exactly as before (it just re-fetches as the Vulkan default on the next fetch-runtime run).

Transient swap folders (#986). An in-app install, update or reinstall never deletes the engine first. It builds the new copy in <os>.new/ beside the install folder (the cpu/ net in <os>/cpu.new/), marks it, then moves the install to <os>.old/ (cpu.old/) and the new copy in, and deletes .old after the job. No resolver ever reads these names. A kill, an unplug or a crash between the steps can leave them; the app's next start on that OS finishes or rolls back the swap before anything starts an engine (recoverEngineSwaps, architecture.md "In-app engine updates" §6), and so does the next engine job, before it downloads. Only these exact names are touched: any other folder beside the install (the app-update plan's <os>@<pin>/) is left alone. A Kit must not ship one: the sell gate and the Kit gate scripts refuse a leftover beside a pinned build.

Second sidecar family: the whisper.cpp transcriber

Audio transcription uses a separate, pinned whisper.cpp CLI under runtime/whisper.cpp/<os>/ (resolved by services/transcriber/cli.ts resolveWhisperCliPath; HILBERTRAUM_WHISPER_BIN overrides for dev). It rides the SAME distribution machinery as the llama family:

  • The pin lives in runtime-sources.yaml under the additive whisper_cpp: block (same { version, builds[] } shape, own tag — currently v1.8.6). A pre-Phase-36 app ignores the block entirely (verified forward-compatibility).
  • Fetch with fetch-runtime --family whisper_cpp (-Family whisper_cpp on PowerShell) — same verify-before-trust + .hilbertraum-runtime.json marker idempotency.
  • CPU-only by design (the E5/reranker precedent: transcription is a batch job).
  • Upstream ships prebuilt binaries for WINDOWS ONLY (R-W1, 2026-06-11). The mac/linux dirs exist in the layout, but provisioning them means compiling the pinned tag from source (cmake -B build && cmake --build build -j --config Release, then copy build/bin/whisper-cli + libs into runtime/whisper.cpp/<os>/ and write the marker). A drive without a whisper binary still works fully — audio imports fail per-file with friendly copy pointing at the AI Model screen.
  • Weights are a NORMAL model manifest (model-manifests/transcriber/, role: transcriber) → fetch-models and the Phase-18 in-app downloader cover them with zero new code; they land in models/transcriber/.

OCR language files

Local OCR ("Make searchable (OCR)" for scanned PDFs; photo imports) uses tesseract.js, which ships INSIDE the app as pinned npm dependencies — the drive carries ONLY the language data under ocr/:

  • The pin lives in runtime-sources.yaml under the additive ocr: block — a NEW asset class (D32): plain files { lang, url, sha256, dest }, no extraction, no install marker. Idempotency IS the hash: present + matching sha256 ⇒ skip.
  • In the app (#410): a failed scan or photo row in Documents, or the quiet "Text recognition for scans and photos (optional)" row on the AI Model screen, offers Download OCR files — a facts-only confirmation, then the pinned deu + eng files (and osd, #538) land in ocr/. The app pins their sha256 + exact size in code (services/ocr-install.ts, drift-tested against the yaml); from the yaml it takes only the URL, never the dest. Each file comes from the drive's yaml when its entry carries the pinned hash, else from the app's own copy (#841); a file neither list pins that way is refused.
  • Offline / DIY: fetch with fetch-runtime --family ocr (-Family ocr on PowerShell) — one run covers every OS (the data is platform-independent).
  • Shipped files: deu.traineddata.gz (1.27 MB) + eng.traineddata.gz (2.82 MB), the tessdata_best-integerized variant (R-O3), and osd.traineddata.gz (4.12 MB, #538) — the orientation data that turns sideways pages upright, never a recognition language — exactly as tesseract.js reads them (langPath + gzip — never decompressed on the drive). A drive with only deu + eng reads pages as they come; the in-app download fetches just osd there, and it is used at once (the engine looks for it at each orientation check).
  • A drive WITHOUT the ocr/ files still works fully: detected scans show the friendly notice without the OCR offer, and photo imports fail per-file with friendly copy. assertCommercialDrive + both build-commercial-drive script gates verify the files on a SOLD drive.
  • Activation: the in-app download activates OCR without a restart — once every file is in place the app re-reads ocr/ and fills an empty OCR slot (a packaged build proves the recognizer starts first). A running recognizer is never replaced mid-session, so files that GROW its language set (e.g. eng added to a deu-only drive) take effect after a restart, and files copied onto the drive by hand while the app runs are not noticed until the next start.

Portability notes

  • No hardcoded absolute paths; everything derives from the resolved root (spec rule).
  • Path separators handled via node:path; works on Windows/macOS/Linux.
  • A plaintext (developer) workspace is self-contained: moving the workspace/ folder moves all its data. An encrypted workspace is two places, always moved together: workspace/ holds the encrypted data, and config/workspace.json holds the key it is encrypted with (wrapped by the password-derived key, with the salt and the password verifier). No password opens workspace/ without its config/workspace.json (the lock screen says the key file is missing or can't be read, #807), and config/workspace.json alone opens nothing (the lock screen says the encrypted workspace file is missing, #911). The rest of config/ (drive.json, policy.json, checksums.json) belongs to the drive and stays (troubleshooting, "I forgot my workspace password", #931).

Filesystem

For a kit that must be read and written on Windows, macOS and Linux, format the drive as exFAT — it is the one filesystem all three write natively. (A single-OS drive can use that OS's native filesystem — NTFS, APFS, ext4 — which the app also supports.)

exFAT carries one durability caveat worth stating where the format is chosen. The app commits every durability-critical write by fsyncing the file and then renaming it into place, so the data inside a file is flushed before the rename. It does not flush the containing directory afterwards: there is no directory-flush primitive exposed through Node on Windows, and the write-through rename primitive (MoveFileEx with MOVEFILE_WRITE_THROUGH) is not reachable from the runtime. On exFAT/FAT32 that leaves a narrow window in which a hard power cut or unplug immediately after a rename can roll the new name back to the old one. The design is old-or-new by construction — the last successfully locked snapshot always survives a rollback; you never get a torn mix — so the exposure is the changes since that lock, the same window a mid-session crash already carries (see security-model.md "Lock failure & durability"). The practical mitigation is the ordinary one: quit the app and eject the drive safely before unplugging (see troubleshooting.md "Windows asks to scan and fix the drive"). Owner decision #223 (2026-09-03) ruled this caveat documented, not engineered around — no directory flush or write-through is added — with one manual crash-cut on an exFAT kit before the first kit ships (a hard unplug during a lock on a scratch kit; after re-plug the workspace must open cleanly — either at the last locked snapshot or, when the cut landed in the encrypt phase, with the session rolled forward through .recovery; machine, OS, date and outcome recorded): packaging.md "Manual pre-ship checklist" item 9 (#243). Repeating it once per shipping platform is recommended, not part of the ruling.

First real-drive bring-up — durable lessons (design record, 2026-06-10)

Moved here from BUILD_STATE.md §9 on 2026-08-20 (doc-lifecycle rule: durable provisioning/path/manifest facts belong in the topic doc, not the handoff file). A BUILD_STATE §9 stub keeps the existing citations resolvable; this is the text they name.

The first real-drive provisioning + RAG run surfaced a cluster of provisioning, path, manifest-source and embedding bugs — all fixed same-day (the full narrative is in git history). What still matters:

  • PowerShell arg forwarding = hashtable splatting, never array splatting. @('-Target', $t, '-AcceptLicense') binds positionally (the --prefixed string is NOT a parameter name), which broke prepare-drive -WithAssets. Convention recorded in §3; both call sites use hashtables now.
  • Bare-drive-root containment false positive: resolve('D:\') keeps the trailing separator, so the base + sep prefix check doubled it (D:\\) and rejected every legitimate weight — latent because only a real drive-root launch hits it. weightPath/resolveWithinRoot normalize (prefix = base.endsWith(sep) ? base : base + sep); regression-tested with a real root (parse(process.cwd()).root).
  • Hash promotion is durable only in the REPO manifests: verify-models --generate writes config/checksums.json, never the manifest sha256, and any prepare-drive re-run overwrites drive-local manifest edits. Promote real hashes into the repo manifest, then re-sync to the drive.
  • Broken upstream sources found by the fetch: qwen3-1.7b-instruct-q4 → 404 (the official repo ships no Q4_K_M) — manifest dropped; the 4B took over TINY/UNKNOWN (recommended_profiles). multilingual-e5-small quant repo went 401 — switched to the cstr/ mirror, provenance recorded in the manifest license note.
  • The E5 embedder GGUF must be F16 on b9585 (the failure mode tests/manual/rerank-smoke.test.ts guards against): q8_0 builds either lack token_type_count (BERT/XLM-R metadata) or crash warmup (binary_op: unsupported types: dst f32, src1 q8_0). Shipped keisuke-miyako/multilingual-e5-small-gguf-f16 (242 MB, 384-dim, VERIFIED); the -q8 manifest id is kept as the opaque vector tag.
  • The first real-drive hallucination was the plain-Chat tab, not the RAG engine — the question never reached retrieval (the grounded path has a hard empty-corpus guard). This finding motivated Phase 17 (rag-design.md §10). Related: a document ingested under the mock embedder is invisible to E5 retrieval (vectors are scoped by embedder.id) — re-upload/re-index after an embedder change.