feat(memory): missions remember their verdicts, per repository

Until now missions wrote no memory. The chat path records every turn into
the claw's .brain, but a mission's crew is minted per mission, so a brain
keyed by agent would be written once and never read. What persists across
missions is the repository: mission_memory keeps one .brain per repo_id,
writes each judge verdict into it (reason when met, sanitized guidance when
not — the operator reason may quote the acceptance text), and recalls
against the next phase's task text into the brief, under a heading all
three executors carry because it rides on the task.

Recall is BM25 over the keyword index, no embedder; the harness asserts the
brief carries the section once the repo has one judged mission behind it,
and says 'first mission' rather than failing before that. OpenClaw's
flush-before-compaction was the other half of this item and is moot here:
the chat loop has no compaction and already remembers both halves of
every turn.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WZb5A2kfVfjpdwSochkuHz
This commit is contained in:
Omar Sobh
2026-09-20 22:11:55 -05:00
co-authored by Claude Opus 5
parent 76ac3714f1
commit 13f7fb3aff
6 changed files with 311 additions and 4 deletions
+3 -1
View File
@@ -15,7 +15,9 @@ use std::path::PathBuf;
use cm_brain::ClawBrain;
fn brain_dir() -> PathBuf {
/// Where the working `.brain` files live. Shared with `cm_api::mission_memory`,
/// which keeps the per-repository brains beside the per-claw ones.
pub fn brain_dir() -> PathBuf {
std::env::var("CLAWMATES_BRAIN_DIR")
.map(PathBuf::from)
.unwrap_or_else(|_| std::env::temp_dir().join("clawmates-brains"))
+1 -1
View File
@@ -2,7 +2,7 @@
//! executes tools, and journals every event before any observer sees it
//! (the gateway streams exactly this journal, live or replayed).
mod brain;
pub mod brain;
mod events;
pub mod outbox;
mod runtime;