fix(memory): close the content gap so agents can actually write and retrieve learnings

- run-selected-prompt.mjs: set SCHEDULER_MEMORY_FILE env var before spawning each agent so
  store.mjs has a well-known path to read from (memory-updates/<ts>__<agent>.md)
- retrieve.mjs: format memories.md using m.summary + date/tags in readable markdown sections
  instead of raw m.content blobs; agents can now scan injected context at a glance
- store.mjs: remove semantically-empty fallback placeholder events that polluted the store
  and degraded retrieval quality; also fix default cadence 'weekly' -> 'daily' to match retrieve
- scheduler-flow.md: replace vague "write insights" instruction with a concrete three-section
  template (Key findings / Patterns / Warnings) and clarify that $SCHEDULER_MEMORY_FILE is
  set by the scheduler automatically

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Sonnet 4.6 committed 2026-02-20 10:51:03 -05:00
1 parent 87d6b3ef0c
commit 8a9080e7c3
4 files changed
+39 -32

No files matched your search

+15 -1
View File
@@ -38,7 +38,21 @@ Every agent prompt invoked by the schedulers (daily/weekly) MUST enforce this co
- **Agent Action**: Review `.scheduler-memory/latest/<cadence>/memories.md` for relevant context.
5. **Store memory after implementation and before completion publish**:
- **Agent Action**: Write any new insights, learnings, or patterns to the file specified by `$SCHEDULER_MEMORY_FILE` (defaulting to `memory-updates/<timestamp>__<agent>.md`).
- **Agent Action**: Write any new insights, learnings, or patterns to the file specified by `$SCHEDULER_MEMORY_FILE`. The scheduler sets this env var to `memory-updates/<timestamp>__<agent>.md` automatically — do not compute a path yourself.
- **What to write** — use this template (keep each bullet to 1-2 lines; omit sections with nothing to say):
```markdown
# Memory Update — <agent-name> — <YYYY-MM-DD>
## Key findings
- <concrete fact discovered this run, e.g. "ESLint v9 requires flat config">
## Patterns / reusable knowledge
- <technique or pattern that will help this agent on its next run>
## Warnings / gotchas
- <env quirk, test failure, or constraint to watch for>
```
- Write only facts that will help the **same agent** on its **next run**. Skip meta-commentary about the task structure.
- Run configured memory storage workflow after prompt execution (for example via `scheduler.memoryPolicyByCadence.<cadence>.storeCommand`)
- Storage command MUST call real memory services (`src/services/memory/index.js#ingestEvents`, which uses ingestor/summarizer pipeline) and MUST emit deterministic marker `MEMORY_STORED`.
- Storage command MUST ingest content from the file at `$SCHEDULER_MEMORY_FILE` (or fallback to `memory-update.md` if present).