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