Workspace and index !6

merged merged by cmc on 2026-10-05 00:18 UTC · krz/orgstar:phase1-workspace-index into main

Discussion

cmc

Adds OrgIndex and OrgWorkspace and the plan for them.

  • FileRecord: index rows from a file's bytes (headings, tags and properties with inherited flags, planning/body timestamps, clocks, links, ARCHIVE state, body text, hash, settings version). Conflict copies get no rows.
  • IndexStore (GRDB, FTS5): one transaction per change; word-prefix search; ID lookup and duplicate IDs; an overlay of unsaved-buffer records replaces those files' rows in every query; results carry the content hash.
  • WorkspaceScanner: classifies Syncthing temp and conflict files, iCloud placeholders, Emacs backups and our temp files; skips hidden folders. AgendaScope globs.
  • Reconciler: size/mtime/hash/settings-version comparison, touches, rename detection by hash, removals; whole-root and changed-path modes; asks iCloud to download placeholders.
  • FSEventsWatcher: file-level events; dropped or coalesced events and root changes become rescans.
  • 20 new tests; all 157 pass; OrgWorkspace builds for iOS.

Gates on this Mac (release): 10,000 files (95 MB) indexed in 23.2 s (target 30 s); no-change reconcile 0.31 s (target 2 s). Needs a check on the M1 Air reference machine.