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>
2.0 KiB
2.0 KiB
M5a task 07: the journal, undo and review
Branch: m5a (run git switch m5a; git status --short must be empty, otherwise stop)
Commit subject: memoryd: the edit journal, undo of the latest edit, and review
Goal
M5a spec, section 5, "Seeing writes", "Undo" and "Review":
- Every applied write is one JSON line in
memory/edits/YYYY-MM.jsonl, with an id numbered from 1 each day (2026-09-24-0001), the entries before and after, and where it went.loglists the last N. undoreverts an edit only if it is the latest edit of its identity file and the file still holds exactly what it left; the undo is journalled too. Notes are append-only and never undone.- With review on, identity writes wait in
memory/pending.jsonluntil the owner accepts one (applied then, against the file as it is) or rejects it (journalled).
Files
- Copy (skeletons):
crates/memoryd/src/journal.rs,crates/memoryd/src/review.rs - Copy (test):
crates/memoryd/tests/journal.rs - Modify:
crates/memoryd/src/lib.rs(pub mod journal;afterpub mod files;,pub mod review;afterpub mod notes;),docs/implementer-log.md
The skeletons
journal.rs: Record and file_of are written; fill records, append, record, log,
undo. append is pub(crate) because review::reject journals through it. review.rs:
Line is written; fill lines, add, waiting, submit, list, accept, reject.
Steps
- 1. Copy the three files; edit
lib.rs. - 2. See it fail.
cargo test -p memoryd --test journal: 4 failed. - 3. Fill
journal.rs, thenreview.rs.cargo fmt --all. - 4. See it pass. The same command: 4 passed.
- 5. Run the gate.
make gate:gate: ok, 4 more tests than before (about 900). - 6. Log and commit.
git add -A crates/memoryd docs/implementer-log.md Cargo.lock && git commit
Done when
make gateprintsgate: ok.
Stop and report if
- A test fails after the functions follow their comments exactly. Do not edit a test.