Skip to content

land: engram-catalog-startup - #498

Merged
ualtinok merged 6 commits into
mainfrom
land/engram-catalog-startup
Oct 18, 2026
Merged

ualtinok merged 6 commits into
mainfrom
land/engram-catalog-startup

Conversation

@aft-alfonso

@aft-alfonso aft-alfonso Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Accepted agent delivery; branch-keyed search descriptor included.


Summary by cubic

The daemon now writes the ENGRAM backup catalog (engram-catalog.json), so a freshly provisioned machine is covered without a hand-written file. Previously the catalog only existed when written manually; now every subc and standalone startup derives it from what is on disk, and sensitive folders are no longer captured.

  • Declares only paths that exist as real files or directories, not symlinks; a declared path that is missing would halt the whole fleet capture. aft.db is captured page by page, and creating the database refreshes the catalog so a fresh machine's database is declared right away instead of at the next restart. Undo history, checkpoints, task output, logs, diagnostics, caches, and generated shims are declared excluded with a reason.
  • Undo backups keep their earlier entry ids, matching the hand-written catalog (for example aft/backups-mcp-claude-code), so ENGRAM records the switch to excluded on the same entries. Ids are otherwise kept per path from the catalog already on disk, so removing a folder never renames a survivor.
  • The catalog is written only when the storage root's folder is named aft, since ENGRAM looks nowhere else. The write is atomic, skipped when the bytes are unchanged, refused for dev/test builds pointed at the account's real storage, and never stops startup on failure.

Written for commit 4eb289d. Summary will update on new commits.

View guided diff Turn on auto-fix

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

The daemon now writes engram-catalog.json at startup from paths that exist on disk.

  • AFT builds ENGRAM's backup catalog from its storage files.

All three earlier findings are addressed: unsupported roots are skipped, surviving folders keep their IDs, and newly created databases are declared.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Daemon starts] --> B[Write catalog for existing paths]
  B --> C[Accept requests]
  C --> D[Open aft.db]
  D --> E{File was missing?}
  E -->|Yes| F[Refresh catalog with database entry]
  E -->|No| G[Reuse existing catalog]
Loading

Reviews (3) · Last reviewed commit: "engram catalog: declare aft.db as soon a..." · Reviewed by Greptile

ualtinok and others added 3 commits October 17, 2026 23:11
The daemon (subc and standalone) now writes <storage root>/engram-catalog.json
once at startup, derived from the per-harness backups folders that exist at
that moment (device-local filetree entries, keeping the ids of the
hand-written catalog). The write is atomic, skipped when the bytes match,
refused for dev/test builds pointed at the account's real storage, and never
fails startup.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
…ib.rs

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Comment thread crates/aft/src/engram_catalog.rs
Comment thread crates/aft/src/engram_catalog.rs Outdated
ualtinok and others added 2 commits October 18, 2026 00:53
The startup catalog now declares, for whatever exists at write time:
- aft.db as device-local page-db with writer_interaction
  read-transaction-live (ENGRAM's agreed wording; sidecars are never
  declared on their own);
- trusted-filter-projects.json as a device-local single-file filetree;
- per-harness checkpoints and bash-tasks, the root-level legacy copies,
  logs, diagnostics, caches and generated shims as excluded, each with a
  reason.

Undo backups (<harness>/backups, backups.parked-*) are now excluded with
the reason "earlier copies of edited files; may include secrets", by
decision, under exactly the ids they had before, so ENGRAM records the
change on the same entries. The class lives in UNDO_BACKUPS_CLASS.
todays_backup_folders_keep_todays_entry_ids keeps asserting the same ids
and paths but now expects the excluded class and reason; the old golden
bytes test became a_backups_only_tree_renders_exact_bytes for the same
reason.

Two fixes to the writer:
- the catalog is written only when the storage root's folder is named
  aft; ENGRAM looks only at <fleet data home>/<module id>/ and rejects a
  module_id that differs from the folder name, so an AFT_STORAGE_DIR
  elsewhere now gets one info log and no file;
- ids are kept per path from the catalog already on disk, so removing
  one of two MCP folders that share a readable client name no longer
  renames the survivor. Fresh ids avoid kept ones; an unreadable or
  malformed previous catalog starts ids fresh with a warning.

only_folders_that_exist_are_declared used semantic/backups as its
"not a harness" fixture; semantic is now an excluded cache, so the
fixture is not-a-harness/backups (same property).

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Comment thread crates/aft/src/engram_catalog.rs
The startup catalog runs before a fresh machine has aft.db, so the db entry
stayed absent until the next daemon restart. App::open_db now refreshes the
catalog after it creates the database file (outside the database slot lock).
write_catalog_at_startup is renamed refresh_catalog since it is no longer
startup-only.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
@ualtinok
ualtinok added this pull request to the merge queue Oct 17, 2026
Merged via the queue into main with commit c029ed4 Oct 18, 2026
49 checks passed
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