# 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.