Files
boxmaker/docs/plans/M5a/05-memoryd-files.md
T
kyleandClaude Opus 5.5 de1032157b Plan M5a: local memory in 15 tasks
memoryd (files, the check, edits, journal, index, recall, serving),
the memory tools and built-in grants in brokerd, the memory block in
loopd, bxctl reindex and memory, and the device checks with memoryd.

Each task was built as a reference and gated. Each was replayed on its
own at its end state (854 to 936 tests) and mutation-checked. Each
skeleton compiles and fails its tests. Every todo comment was read
beside its signature.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 15:32:54 -07:00

1.7 KiB

M5a task 05: the memory files and the block

Branch: m5a (run git switch m5a; git status --short must be empty, otherwise stop) Commit subject: memoryd: the memory files, and the block a new session starts with

Goal

Store, the directory memory/ (M5a spec, sections 3 and 4): created at 0700 with each missing file at 0600 (soul.md from the starter, the others empty), never overwriting anything; reading and rewriting an identity file's entries (through a temporary file and a rename); appending; and the block, the text a new session's prompt gets: soul.md, then memory.md and user.md with how full each is. A file over its limit stops the block; an identity entry that fails the check is left out of it and reported.

Files

  • Copy (skeleton): crates/memoryd/src/files.rs
  • Copy (test): crates/memoryd/tests/files.rs
  • Modify: crates/memoryd/src/lib.rs (pub mod files; after pub mod entries;), docs/implementer-log.md

The skeleton

Written: SOUL_LIMIT, Store, Block, fail, Store::new, Store::path. Fill: grouped, init, create, entries, write_entries, append, block.

Steps

  • 1. Copy the two files; edit lib.rs.
  • 2. See it fail. cargo test -p memoryd --test files: 8 failed.
  • 3. Fill the seven functions, block last. cargo fmt --all.
  • 4. See it pass. The same command: 8 passed.
  • 5. Run the gate. make gate: gate: ok, 8 more tests than before (about 885).
  • 6. Log and commit. git add -A crates/memoryd docs/implementer-log.md Cargo.lock && git commit

Done when

  • make gate prints gate: ok.

Stop and report if

  • A test fails after the functions follow their comments exactly.