docs: M5d-2 task 03 updates the main.rs m5c() count

ask_memory_tool pins Registry::m5c() in main.rs at exactly one call.
Heartbeat's check_summarise adds two more; the task now edits that count
to 3 and still forbids m2b/m3a/m5a.

Co-Authored-By: Grok 4.6 <noreply@x.ai>
This commit is contained in:
2026-10-03 01:43:00 -07:00
co-authored by Grok 4.6
parent c4a8f9488d
commit e697589b98
+33 -9
View File
@@ -22,6 +22,7 @@ The starter `config/heartbeat.md` is copied like `config/system.md`. Nothing tic
|---|---|
| `crates/loopd/src/config.rs` | `Heartbeat`; field; `load` joins the prompt; `heartbeat_prompt`; `check_summarise` |
| `crates/loopd/src/main.rs` | after each `Config::load`, `check_summarise(&Registry::m5c())` |
| `crates/loopd/tests/ask_memory_tool.rs` | `Registry::m5c()` count in `main.rs` is 3 (edit A1) |
| `config/heartbeat.md` | new, given starter |
| `crates/loopd/tests/config_heartbeat.rs` | new, given |
| everything else | **no change** |
@@ -31,7 +32,7 @@ The starter `config/heartbeat.md` is copied like `config/system.md`. Nothing tic
- Copy, from `docs/plans/M5d2/files/` (the same path under it): the new test
`crates/loopd/tests/config_heartbeat.rs` and the starter `config/heartbeat.md`.
- Modify: `crates/loopd/src/config.rs`, `crates/loopd/src/main.rs`,
`docs/implementer-log.md`.
`crates/loopd/tests/ask_memory_tool.rs`, `docs/implementer-log.md`.
- Do not touch: any other file.
## Facts you need
@@ -174,6 +175,27 @@ become
If `main.rs` already has `use loopd::tools::{Registry, ToolPort};`, write `Registry::m5c()`.
### `crates/loopd/tests/ask_memory_tool.rs`
**A1.** `loopd_serve_uses_the_m5c_registry` counts `Registry::m5c()` in `main.rs`. Today that
count is 1 (`Context::new`). M1 and M2 add two more. The lines
```rust
main.matches("Registry::m5c()").count(),
1,
"main.rs uses m5c()"
```
become
```rust
main.matches("Registry::m5c()").count(),
3,
"main.rs uses m5c()"
```
The test still forbids `m2b()`, `m3a()` and `m5a()` in `main.rs`. Do not weaken that.
## Steps
- [ ] **1. Copy the given files.**
@@ -186,12 +208,13 @@ If `main.rs` already has `use loopd::tools::{Registry, ToolPort};`, write `Regis
- [ ] **2. See it fail.** `cargo build --tests --keep-going -p loopd`, timeout 600000 ms: test
target `config_heartbeat` does not compile (`E0609` no field `heartbeat`, `E0599` no method
`heartbeat_prompt` / `check_summarise`). Every other target compiles.
- [ ] **3. The edits.** H1 to H4, M1, M2, in order. `cargo check -p loopd` prints no error and
- [ ] **3. The edits.** H1 to H4, M1, M2, A1, in order. `cargo check -p loopd` prints no error and
no warning.
- [ ] **4. The tests.** `cargo test -p loopd --test config_heartbeat --test config --test
config_compact`: every test passes, 8 in `config_heartbeat`.
- [ ] **5. Check.** `git diff --stat` lists `crates/loopd/src/config.rs` and
`crates/loopd/src/main.rs`. `git status --short` shows the new test and `config/heartbeat.md`.
config_compact --test ask_memory_tool`: every test passes, 8 in `config_heartbeat`.
- [ ] **5. Check.** `git diff --stat` lists `crates/loopd/src/config.rs`,
`crates/loopd/src/main.rs` and `crates/loopd/tests/ask_memory_tool.rs`. `git status --short`
shows the new test and `config/heartbeat.md`.
- [ ] **6. Run the gate.** `cargo fmt --all`, then `make gate`, timeout 600000 ms. Last line
`gate: ok`. Test count **1526** (1518 before, plus 8).
- [ ] **7. Log and commit.** Task cell `M5d2/03-loopd-heartbeat-config`. Stage with
@@ -202,14 +225,15 @@ If `main.rs` already has `use loopd::tools::{Registry, ToolPort};`, write `Regis
- `make gate` prints `gate: ok` with 1526 tests.
- `git diff HEAD~1 --stat` lists only `crates/loopd/src/config.rs`, `crates/loopd/src/main.rs`,
`crates/loopd/tests/config_heartbeat.rs`, `config/heartbeat.md` and the log.
`crates/loopd/tests/ask_memory_tool.rs`, `crates/loopd/tests/config_heartbeat.rs`,
`config/heartbeat.md` and the log.
## Stop and report if
- The branch check fails; a "before" block is not found exactly once; step 2 differs; `cargo
check` warns; a test fails; the gate count is not 1526; you join `heartbeat.prompt` onto
`system.md`'s directory instead of the config file's parent; you reject an empty `summarise`
list; you check names inside `parse`.
check` warns; a test fails; the gate count is not 1526; you leave the `m5c()` count at 1;
you join `heartbeat.prompt` onto `system.md`'s directory instead of the config file's parent;
you reject an empty `summarise` list; you check names inside `parse`.
## What the given tests pin