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

+5 -30
View File
@@ -3,7 +3,7 @@ import { mkdirSync, readFileSync, writeFileSync, existsSync } from 'node:fs';
import path from 'node:path';
// Parse environment variables
const fallbackCadence = 'weekly';
const fallbackCadence = 'daily';
const cadence = process.env.SCHEDULER_CADENCE || fallbackCadence;
const agentId = process.env.SCHEDULER_AGENT || `scheduler-memory-${cadence}`;
const promptPath = process.env.SCHEDULER_PROMPT_PATH || '';
@@ -69,34 +69,9 @@ if (memoryContent) {
}
});
} else {
// Fallback if no file provided (preserve existing behavior for compatibility)
console.warn(`No memory input found (checked --file, env SCHEDULER_MEMORY_FILE=${envFile}, or default ${defaultFile}). using fallback placeholder.`);
events = [
{
agent_id: agentId,
content: `Store memory event A for ${cadence} :: ${promptIntent}`,
timestamp: baseTs,
tags: ['scheduler', cadence, 'store'],
metadata: {
session_id: runId,
source: 'scheduler-store',
importance: 0.55,
prompt_path: promptPath
}
},
{
agent_id: agentId,
content: `Store memory event B for ${cadence} :: ${promptIntent}`,
timestamp: baseTs + 1,
tags: ['scheduler', cadence, 'store'],
metadata: {
session_id: runId,
source: 'scheduler-store',
importance: 0.55,
prompt_path: promptPath
}
}
];
// No memory file found — skip ingest rather than storing meaningless placeholder events.
// Placeholder events pollute the store and degrade retrieval quality on future runs.
console.warn(`No memory input found (checked --file, env SCHEDULER_MEMORY_FILE=${envFile}, and default ${defaultFile}). Skipping ingest.`);
}
try {
@@ -120,7 +95,7 @@ try {
promptPath,
promptIntent,
events: events.length,
sourceFile: targetFile || 'fallback'
sourceFile: targetFile || 'none'
},
outputs: {
storedCount: stored.length,