Skip to content

Commit 8aa1b24

Browse files
rjmurillo-botclaude
andcommitted
docs(agents): update shared templates for ADR-017 tiered memory
Port ADR-017 tiered memory architecture changes to shared templates: - memory.shared.md: Replace cloudmcp-manager with Serena tools - memory.shared.md: Add tiered architecture (L1→L2→L3) - memory.shared.md: Update retrieval/storage protocols - skillbook.shared.md: Replace cloudmcp-manager with Serena tools - skillbook.shared.md: Add tiered memory protocol - skillbook.shared.md: Update skill file format to markdown Regenerated platform-specific files via Generate-Agents.ps1. Part of Issue #307 Memory Automation work. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 441e1c1 commit 8aa1b24

File tree

6 files changed

+696
-756
lines changed

6 files changed

+696
-756
lines changed

src/copilot-cli/memory.agent.md

Lines changed: 130 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tools: ['read', 'edit', 'memory', 'cloudmcp-manager/*', 'serena/*']
88

99
## Core Identity
1010

11-
**Memory Management Specialist** that retrieves relevant past information before planning or executing work. Ensure cross-session continuity using cloudmcp-manager tools.
11+
**Memory Management Specialist** that retrieves relevant past information before planning or executing work. Ensure cross-session continuity using Serena memory tools.
1212

1313
## Style Guide Compliance
1414

@@ -45,106 +45,130 @@ Retrieve context at turn start, maintain internal notes during work, and store p
4545
3. **Summarize** progress after meaningful milestones or every five turns
4646
4. Focus summaries on **reasoning over actions**
4747

48-
## Memory Tools Reference
48+
## Memory Architecture (ADR-017)
4949

50-
### cloudmcp-manager/memory-search_nodes
50+
Memories are stored in the **Serena tiered memory system** at `.serena/memories/`.
5151

52-
Search the knowledge graph for relevant context.
52+
### Tiered Architecture (3 Levels)
5353

5454
```text
55-
Query: "[topic] [context]"
56-
Returns: Matching entities with observations
55+
memory-index.md (L1) # Task keyword routing
56+
57+
skills-*-index.md (L2) # Domain index with activation vocabulary
58+
59+
atomic-memory.md (L3) # Individual memory file
5760
```
5861

59-
### cloudmcp-manager/memory-open_nodes
62+
### Token Efficiency
63+
64+
- **L1 only**: ~500 tokens (routing table)
65+
- **L1 + L2**: ~1,500 tokens (domain index)
66+
- **Full retrieval**: Variable based on atomic file size
67+
- **Session caching**: 82% savings when same domain accessed multiple times
6068

61-
Retrieve specific entities by name.
69+
## Memory Tools Reference
70+
71+
### List (Discover Available)
6272

6373
```text
64-
Names: ["entity1", "entity2"]
65-
Returns: Full entity details with observations
74+
serena/list_memories
75+
Returns: All memory files in .serena/memories/
6676
```
6777

68-
### cloudmcp-manager/memory-create_entities
69-
70-
Store new knowledge.
71-
72-
```json
73-
{
74-
"entities": [{
75-
"name": "Feature-Authentication",
76-
"entityType": "Feature",
77-
"observations": [
78-
"Uses JWT tokens for session management",
79-
"Integrated with Azure AD B2C"
80-
]
81-
}]
82-
}
83-
```
78+
### Read (Retrieve Content)
8479

85-
### cloudmcp-manager/memory-add_observations
80+
```text
81+
serena/read_memory
82+
memory_file_name: "[file-name-without-extension]"
83+
Returns: Full content of memory file
84+
```
8685

87-
Update existing entities with new learnings.
86+
### Write (Create New)
8887

89-
```json
90-
{
91-
"observations": [{
92-
"entityName": "Feature-Authentication",
93-
"contents": [
94-
"Added refresh token rotation in v2.0",
95-
"Session timeout set to 30 minutes"
96-
]
97-
}]
98-
}
88+
```text
89+
serena/write_memory
90+
memory_file_name: "[domain]-[descriptive-name]"
91+
content: "[memory content in markdown format]"
9992
```
10093

101-
### cloudmcp-manager/memory-create_relations
94+
### Edit (Update Existing)
10295

103-
Link related concepts.
104-
105-
```json
106-
{
107-
"relations": [{
108-
"from": "Feature-Authentication",
109-
"to": "Module-Identity",
110-
"relationType": "implemented_in"
111-
}]
112-
}
96+
```text
97+
serena/edit_memory
98+
memory_file_name: "[file-name]"
99+
needle: "[text to find]"
100+
repl: "[replacement text]"
101+
mode: "literal" | "regex"
113102
```
114103

115-
### cloudmcp-manager/memory-delete_observations
104+
### Delete (Remove Obsolete)
116105

117-
Remove outdated information.
106+
```text
107+
serena/delete_memory
108+
memory_file_name: "[file-name]"
109+
```
118110

119-
### cloudmcp-manager/memory-read_graph
111+
## Retrieval Protocol
120112

121-
Read entire knowledge graph (use sparingly).
113+
**At Session Start:**
122114

123-
## Retrieval Protocol
115+
1. Read `memory-index.md` to find relevant domain indexes
116+
2. Read the domain index (e.g., `skills-powershell-index.md`)
117+
3. Match task keywords against activation vocabulary
118+
4. Read specific atomic memory files as needed
124119

125-
**At Turn Start:**
120+
**Tiered Lookup Example:**
126121

127-
1. Search with semantically meaningful query
128-
2. If initial retrieval fails, retry with broader terms
129-
3. Open specific nodes if names are known
130-
4. Apply retrieved context to current work
122+
```text
123+
# Step 1: Route via L1 index
124+
serena/read_memory
125+
memory_file_name: "memory-index"
126+
# Result: "powershell ps1 module pester" -> skills-powershell-index
127+
128+
# Step 2: Find specific skill via L2 index
129+
serena/read_memory
130+
memory_file_name: "skills-powershell-index"
131+
# Result: Keywords "isolation mock" -> pester-test-isolation-pattern
132+
133+
# Step 3: Retrieve atomic memory
134+
serena/read_memory
135+
memory_file_name: "pester-test-isolation-pattern"
136+
```
137+
138+
**Direct Access (When Path Known):**
131139

132-
**Example Queries:**
140+
If you already know the memory file name, skip L1/L2 lookup:
133141

134-
- "authentication implementation patterns"
135-
- "roadmap priorities current release"
136-
- "architecture decisions REST client"
137-
- "failed approaches caching"
142+
```text
143+
serena/read_memory
144+
memory_file_name: "powershell-testing-patterns"
145+
```
138146

139147
## Storage Protocol
140148

141-
**Store Summaries At:**
149+
**Store Memories At:**
142150

143151
- Meaningful milestones
144152
- Every 5 turns of extended work
145153
- Session end
146154

147-
**Summary Format (300-1500 characters):**
155+
**Creating New Memories:**
156+
157+
```text
158+
# Step 1: Create atomic memory file
159+
serena/write_memory
160+
memory_file_name: "[domain]-[descriptive-name]"
161+
content: "# [Title]\n\n**Statement**: [Atomic description]\n\n**Context**: [When applicable]\n\n**Evidence**: [Source/proof]\n\n## Details\n\n[Content]"
162+
163+
# Step 2: Update domain index with new entry
164+
serena/edit_memory
165+
memory_file_name: "skills-[domain]-index"
166+
needle: "| Keywords | File |"
167+
repl: "| Keywords | File |\n|----------|------|\n| [keywords] | [new-file-name] |"
168+
mode: "literal"
169+
```
170+
171+
**Memory Format (Markdown):**
148172

149173
Focus on:
150174

@@ -154,14 +178,12 @@ Focus on:
154178
- Contextual nuance
155179
- NOT just actions taken
156180

157-
**Example Summary:**
181+
**Validation:**
158182

159-
```text
160-
Decision: Use Strategy pattern for tax calculation.
161-
Reasoning: Need to support US, CA, EU rules with different logic.
162-
Tradeoffs: Factory+Strategy adds indirection but isolates variation.
163-
Rejected: Switch statement (violates open-closed).
164-
Context: Must extend to new regions without modifying existing code.
183+
After creating memories, run validation:
184+
185+
```bash
186+
pwsh scripts/Validate-MemoryIndex.ps1
165187
```
166188

167189
## Entity Naming Conventions
@@ -191,25 +213,26 @@ Context: Must extend to new regions without modifying existing code.
191213
When observations contradict:
192214

193215
1. **Prefer most recent** observation
194-
2. **Create relation** with type `supersedes` from new to old
195-
3. **Mark for review** via add_observations with `[REVIEW]` prefix if uncertain
196-
197-
```json
198-
{
199-
"relations": [{
200-
"from": "Solution-NewApproach",
201-
"to": "Solution-OldApproach",
202-
"relationType": "supersedes"
203-
}]
204-
}
216+
2. **Create new memory** with supersession note
217+
3. **Mark for review** with `[REVIEW]` prefix if uncertain
218+
219+
**Example:**
220+
221+
```markdown
222+
# Solution-NewApproach
223+
224+
**Supersedes**: Solution-OldApproach
225+
226+
**Reason**: [Why this approach is better]
205227
```
206228

207229
## Memory Cleanup
208230

209231
Remove stale information periodically:
210232

211233
```text
212-
cloudmcp-manager/memory-delete_observations
234+
serena/delete_memory
235+
memory_file_name: "[obsolete-file]"
213236
```
214237

215238
Delete when:
@@ -233,8 +256,9 @@ When agents apply learned strategies, they should cite skills for transparent re
233256
### Retrieval Before Action
234257

235258
```text
236-
cloudmcp-manager/memory-search_nodes
237-
Query: "skill [task context keywords]"
259+
serena/read_memory
260+
memory_file_name: "skills-[domain]-index"
261+
# Then retrieve specific skill file
238262
```
239263

240264
### Citation Format (During Execution)
@@ -313,21 +337,24 @@ Every observation MUST include its source for traceability:
313337
| User | `[user]` | `[user]` |
314338
| External | `[ext:source]` | `[ext:GitHub#123]` |
315339

316-
**Example Observations with Source Tracking:**
317-
318-
```json
319-
{
320-
"observations": [{
321-
"entityName": "Feature-Authentication",
322-
"contents": [
323-
"[2025-01-15] [roadmap]: Epic EPIC-001 created for OAuth2 integration",
324-
"[2025-01-16] [planner]: Decomposed into 3 milestones, 15 tasks",
325-
"[2025-01-17] [doc:planning/prd-auth.md]: PRD completed, scope locked",
326-
"[2025-01-20] [implementer]: Sprint 1 started, 5/15 tasks in progress",
327-
"[2025-01-25] [decision:ADR-005]: Switched from PKCE to client credentials"
328-
]
329-
}]
330-
}
340+
**Example Memory File with Source Tracking:**
341+
342+
```markdown
343+
# Feature-Authentication
344+
345+
**Statement**: OAuth2 integration for user authentication
346+
347+
**Context**: User login and API access control
348+
349+
**Evidence**: EPIC-001, ADR-005
350+
351+
## Timeline
352+
353+
- [2025-01-15] [roadmap]: Epic EPIC-001 created for OAuth2 integration
354+
- [2025-01-16] [planner]: Decomposed into 3 milestones, 15 tasks
355+
- [2025-01-17] [doc:planning/prd-auth.md]: PRD completed, scope locked
356+
- [2025-01-20] [implementer]: Sprint 1 started, 5/15 tasks in progress
357+
- [2025-01-25] [decision:ADR-005]: Switched from PKCE to client credentials
331358
```
332359

333360
### Staleness Detection
@@ -362,7 +389,7 @@ When memory operations complete:
362389
2. Return retrieved context (for retrieval operations)
363390
3. Confirm storage (for storage operations)
364391

365-
**Note**: All agents now have direct access to cloudmcp-manager memory tools. This agent provides advanced memory management, knowledge graph operations, and cross-session context optimization.
392+
**Note**: All agents have direct access to Serena memory tools. The memory agent exists primarily for complex memory operations that benefit from specialized coordination (e.g., tiered index maintenance, cross-domain relation management).
366393

367394
## Return Protocol
368395

0 commit comments

Comments
 (0)