You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/memory/src/agents/architect.ts
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,16 @@ Your messages may include \`<project-memory>\` blocks containing memories automa
64
64
65
65
These memories may be stale or irrelevant. Use your judgement — if a memory seems outdated, note it in your plan and recommend updating or deleting it via memory-edit or memory-delete.
66
66
67
+
## Project KV Store
68
+
69
+
You have access to a project-scoped key-value store with 24-hour TTL for ephemeral state:
70
+
- \`memory-kv-set\`: Store planning progress, research findings, or any project state
71
+
- \`memory-kv-get\`: Retrieve previously stored state
72
+
- \`memory-kv-list\`: See all active entries for the project
73
+
- \`memory-kv-delete\`: Remove entries no longer needed
74
+
75
+
KV entries are scoped to the current project and expire after 24 hours. Use this for state that needs to survive compaction but isn't permanent enough for memory-write.
76
+
67
77
## Workflow
68
78
69
79
1. **Research** — Read relevant files, search the codebase, delegate to @Memory subagent for conventions, decisions, and prior plans
systemPrompt: `You are a code reviewer with access to project memory. You are invoked by other agents to review code changes and return actionable findings.
14
14
@@ -111,13 +111,65 @@ If no issues are found, say so clearly and briefly.
111
111
112
112
You are read-only on source code. Do not edit files, run destructive commands, or make any changes. Only read, search, analyze, and report findings.
113
113
114
+
If a memory seems outdated, update it with memory-edit or flag it for the calling agent.
115
+
116
+
## Persisting Findings
117
+
118
+
After completing a review, store each **bug** and **warning** finding in the project KV store so it can be retrieved in subsequent reviews. Do NOT store suggestions — only actionable issues.
119
+
120
+
Use \`memory-kv-set\` with a structured key and JSON value:
"description": "Missing null check on user.session before accessing .token — throws TypeError when session expires mid-request.",
132
+
"scenario": "User's session expires between the auth check and token access on line 45.",
133
+
"status": "open",
134
+
"date": "2026-03-07"
135
+
}
136
+
\`\`\`
137
+
138
+
The KV store upserts by key, so storing a finding for the same file:line automatically updates the previous entry. No dedup checks needed.
139
+
140
+
When the calling agent reports that a finding has been fixed, update the finding by calling \`memory-kv-set\` with the same key and the status changed to "resolved" with a resolution date added.
141
+
142
+
Findings expire after 24 hours automatically. If an issue persists, the next review will re-discover it.
143
+
144
+
## Retrieving Past Findings
145
+
146
+
At the start of every review, before analyzing the diff:
147
+
1. Call \`memory-kv-list\` to get all active KV entries for the project
148
+
2. Filter entries with keys starting with \`review-finding:\` that match files in the current diff
149
+
3. If open findings exist for files being changed, include them under a "### Previously Identified Issues" heading before new findings
150
+
4. Check if any previously open findings have been addressed by the current changes — if so, update their status to "resolved" via \`memory-kv-set\` with the same key
151
+
152
+
## Memory Tools
153
+
154
+
You have access to these tools:
155
+
- **memory-read**: Search permanent memories for conventions and decisions (query, scope, limit)
156
+
- **memory-kv-set**: Store review findings with 24h TTL (key, value as JSON string)
157
+
- **memory-kv-get**: Retrieve a specific finding by key
158
+
- **memory-kv-list**: List all active KV entries for the project
159
+
- **memory-kv-delete**: Remove a finding that is no longer relevant
160
+
- **memory-health**: Check memory system status
161
+
162
+
## Project KV Store
163
+
164
+
Review findings are stored in the project KV store with 24-hour TTL. Use \`memory-kv-set\` to persist findings, \`memory-kv-get\` to retrieve specific findings, \`memory-kv-list\` to see all active entries, and \`memory-kv-delete\` to remove stale findings. Entries expire automatically after 24 hours.
165
+
114
166
## Injected Memory
115
167
116
168
Your messages may include \`<project-memory>\` blocks containing memories automatically retrieved based on semantic similarity to the current message. Each entry has the format \`#<id> [<scope>] <content>\`.
117
169
118
170
- **[convention]**: Rules to check code against
119
171
- **[decision]**: Architectural constraints that may apply
120
-
- **[context]**: Reference information
172
+
- **[context]**: Reference information and persisted review findings
121
173
122
-
These memories may be stale or irrelevant. If a memory seems outdated, note it in your review observations. You do not have write access to memory — flag stale memories for the calling agent to handle.`,
174
+
These memories may be stale or irrelevant. If a memory seems outdated, note it in your review observations.`,
Copy file name to clipboardExpand all lines: packages/memory/src/agents/code.ts
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -72,5 +72,9 @@ Your messages may include \`<project-memory>\` blocks containing memories automa
72
72
73
73
These memories may be stale or irrelevant to the current task. Use your judgement. If a memory seems outdated or incorrect for the current task, you can ignore it.
74
74
If you notice patterns of outdated or incorrect memories, consider asking the user to curate them. Use the @Memory subagent to perform memory research and contradiction resolution.
75
+
76
+
## Project KV Store
77
+
78
+
Use \`memory-kv-get\` to check for active project state (e.g., planning progress, code review patterns). Use \`memory-kv-set\` to store ephemeral findings. Entries expire after 24 hours. Use \`memory-kv-list\` to see all active entries.
@@ -372,6 +376,7 @@ export function createMemoryPlugin(config: PluginConfig): Plugin {
372
376
cleaned=true
373
377
logger.log('Cleaning up plugin resources...')
374
378
memoryInjection.destroy()
379
+
kvService.destroy()
375
380
awaitmemoryService.destroy()
376
381
closeDatabase(db)
377
382
logger.log('Plugin cleanup complete')
@@ -547,6 +552,74 @@ export function createMemoryPlugin(config: PluginConfig): Plugin {
547
552
return`Implementation session created and plan sent.\n\nSession: ${newSessionId}\nTitle: ${sessionTitle}\nModel: ${modelInfo}\n\nSwitch to this session to begin. You can change the model from the session dropdown.`
548
553
},
549
554
}),
555
+
'memory-kv-set': tool({
556
+
description: 'Store a key-value pair for the current project. Values expire after 24 hours by default. Use for ephemeral project state like planning progress, code review patterns, or session context.',
557
+
args: {
558
+
key: z.string().describe('The key to store the value under'),
559
+
value: z.string().describe('The value to store (JSON string)'),
560
+
ttlMs: z.number().optional().describe('Time-to-live in milliseconds (default: 24 hours)'),
return`${entries.length} active KV entries:\n\n${formatted.join('\n')}`
621
+
},
622
+
}),
550
623
},
551
624
config: createConfigHandler(agents),
552
625
'chat.message': sessionHooks.onMessage,
@@ -623,7 +696,7 @@ export function createMemoryPlugin(config: PluginConfig): Plugin {
623
696
text: `<system-reminder>
624
697
Plan mode is active. You MUST NOT make any file edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supersedes any other instructions you have received.
625
698
626
-
You may ONLY: observe, analyze, plan, and use memory tools (memory-read, memory-write, memory-edit, memory-delete, memory-health, memory-plan-execute).
699
+
You may ONLY: observe, analyze, plan, and use memory tools (memory-read, memory-write, memory-edit, memory-delete, memory-health, memory-plan-execute, memory-kv-set, memory-kv-get, memory-kv-delete, memory-kv-list).
0 commit comments