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.5 KiB
2.5 KiB
M5a task 06: notes and the memory edits
Branch: m5a (run git switch m5a; git status --short must be empty, otherwise stop)
Commit subject: memoryd: notes.md, and the five memory actions with routing by trust
Goal
What a memory call does (M5a spec, section 5):
noteappends tonotes.md, in any session, labelled by the session: its class, anduntrustedwhen the session has read untrusted content.add,replace,removeandconsolidateeditmemory.mdoruser.md(identity), and only a session that has not read untrusted content may use them. In one that has,addbecomes a note (SAVED_AS_NOTE) and the other three are refused.- Entries are named by their full text. An edit made against an old view of the file fails safely; an entry named twice, a duplicate, or a file over its limit is refused, and nothing changes.
removeandconsolidatenever lose anything: what they take out goes tonotes.mdasdroppedormoved.
Files
- Copy (skeletons):
crates/memoryd/src/notes.rs,crates/memoryd/src/edit.rs - Copy (tests):
crates/memoryd/tests/notes.rs,crates/memoryd/tests/edit.rs - Modify:
crates/memoryd/src/lib.rs(pub mod edit;afterpub mod config;,pub mod notes;afterpub mod files;),docs/implementer-log.md
The skeletons
notes.rs: Kind, Note, class_name, file_of are written; fill minute, Note::header,
Note::render, parse_header, parse. edit.rs: Context, Change, Outcome, the sentences
(over_limit, untrusted_refusal, SAVED_AS_NOTE, stale), and the helpers checked, note,
position are written; fill apply, edited, noted, consolidate. edited still needs
an arm for a note, which apply never passes it: its comment says what that arm returns.
Steps
- 1. Copy the four files; edit
lib.rs. - 2. See it fail.
cargo test -p memoryd --test notes --test edit:notes3 failed,edit8 failed. - 3. Fill
notes.rsfirst, thenedit.rs(noted,consolidate,edited,apply).cargo fmt --all. - 4. See it pass. The same command: 3 and 8 passed.
- 5. Run the gate.
make gate:gate: ok, 11 more tests than before (about 896). - 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.