docs: M5d-2 checklist: retain, Tally, mutation counts

Task 08 filters pending after the records walk so a ToolResult
before its ToolSummary is not summarised twice. Task 10 names
Tally to satisfy clippy type_complexity. Task 06 does not
return from tick when every_s is 0. README records 12/12
mutations caught.

Co-Authored-By: Grok 4.6 <noreply@x.ai>
This commit is contained in:
2026-10-03 02:42:06 -07:00
co-authored by Grok 4.6
parent f426b46ae7
commit 72e87076bc
4 changed files with 21 additions and 19 deletions
+5 -6
View File
@@ -41,9 +41,10 @@ The starter `config/summarise.md` is copied like `config/heartbeat.md`.
## Facts you need
- **Which results.** Walk `session.records()` once. From each `Assistant`, remember
`tool_calls` by `id → name`. From each `ToolSummary`, remember `call: CallId`. Then for
each `ToolResult` whose `tool_call_id` maps to a name in `cfg.compact.summarise` and whose
`call` is not already summarised, queue it. Do not append while iterating `records()`.
`tool_calls` by `id → name`. From each `ToolSummary`, remember `call: CallId`. Queue each
opted-in `ToolResult` during the walk; **after** the walk, drop any whose `call` is in
`done`. A `ToolResult` can appear before its `ToolSummary` in the same epoch, so an in-walk
`done.contains` still queues it. Do not append while iterating `records()`.
- **The call.** `messages_with_carry(session.baseline(), session.records(), session.carry())`,
then one `ChatMessage::User` whose content is
`format!("{}\n\n{}", prompt.trim_end(), crate::compact::cap_chars(result_content, cfg.r#loop.tool_result_cap))`
@@ -129,9 +130,6 @@ pub fn missing(
untrusted,
..
} => {
if done.contains(&call.0) {
continue;
}
let Some(name) = names.get(tool_call_id) else {
continue;
};
@@ -149,6 +147,7 @@ pub fn missing(
_ => {}
}
}
pending.retain(|(call, ..)| !done.contains(&call.0));
for (call, tool_call_id, content, class, untrusted) in pending {
let mut messages = messages_with_carry(session.baseline(), session.records(), session.carry());
messages.push(ChatMessage::User {