Files
boxmaker/docs/plans/M5a/04-memoryd-entries-check.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

2.1 KiB

M5a task 04: entries and the check

Branch: m5a (run git switch m5a; git status --short must be empty, otherwise stop) Commit subject: memoryd: entries, and the check on every memory write

Goal

Two small modules (M5a spec, section 3 and section 5, "The check"):

  • entries: memory.md and user.md are entries separated by a line holding only §. Parse, render, and measure a file in characters.
  • check: every entry the agent writes, and every identity entry going into the prompt, is refused if it holds a control character (other than newline and tab), an invisible or direction-changing character, chat-template markup, or one of six instruction phrases. The table of invisible characters is written in the skeleton, from Unicode 16's Default_Ignorable_Code_Point property, plus six more.

Files

  • Copy (skeletons): crates/memoryd/src/entries.rs, crates/memoryd/src/check.rs
  • Copy (tests): crates/memoryd/tests/entries.rs, crates/memoryd/tests/check.rs
  • Modify: crates/memoryd/src/lib.rs, docs/implementer-log.md

The edits, exactly

crates/memoryd/src/lib.rs: add pub mod check; before pub mod config;, and pub mod entries; after it. The file then lists check, config, entries, socket.

The skeletons

entries.rs: fill parse, push, render, size. check.rs: Refused and its sentences, DEFAULT_IGNORABLE, ALSO_INVISIBLE, MARKUP and PHRASES are written; fill invisible and check. Do not change the tables.

Steps

  • 1. Copy the four files; edit lib.rs.
  • 2. See it fail. cargo test -p memoryd --test entries --test check: entries 3 failed, check 6 failed.
  • 3. Fill the six functions. cargo fmt --all.
  • 4. See it pass. The same command: 3 and 6 passed.
  • 5. Run the gate. make gate: gate: ok, 9 more tests than before (about 877).
  • 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.