Summary
prepareStep in the agent orchestrator calls store.read({ limit: 50 }) which returns the 50 most recent entries across ALL types combined, then filters by type in memory. After many iterations, work_log entries dominate and push out strategic_context, decision, and project_knowledge entries entirely.
Problem / Context
The memory injection is the agent's learning mechanism. If strategic context and decisions are absent from the prompt after ~50 work logs, the agent loses its long-term knowledge — defeating the purpose of permanent memory types.
Proposed Solution
Make separate reads per type to guarantee each category is represented:
const recentLogs = await store.read({ type: 'work_log', limit: 5 });
const knowledge = await store.read({ type: 'project_knowledge', limit: 3 });
const decisions = await store.read({ type: 'decision', limit: 2 });
const strategic = await store.read({ type: 'strategic_context', limit: 1 });
This trades 1 disk read for 4, but each is bounded and guarantees category representation.
Files to Modify
| File |
Changes |
src/agent/orchestrator.ts |
Replace single store.read({ limit: 50 }) with per-type reads |
Acceptance Criteria
Summary
prepareStepin the agent orchestrator callsstore.read({ limit: 50 })which returns the 50 most recent entries across ALL types combined, then filters by type in memory. After many iterations,work_logentries dominate and push outstrategic_context,decision, andproject_knowledgeentries entirely.Problem / Context
The memory injection is the agent's learning mechanism. If strategic context and decisions are absent from the prompt after ~50 work logs, the agent loses its long-term knowledge — defeating the purpose of permanent memory types.
Proposed Solution
Make separate reads per type to guarantee each category is represented:
This trades 1 disk read for 4, but each is bounded and guarantees category representation.
Files to Modify
src/agent/orchestrator.tsstore.read({ limit: 50 })with per-type readsAcceptance Criteria