Skip to content

Commit 441e1c1

Browse files
rjmurillo-botclaude
andcommitted
docs(agents): update memory and skillbook agents for ADR-017
Update agent documentation to use Serena tiered memory system: - memory.md: Replace cloudmcp-manager with Serena memory tools - memory.md: Add tiered architecture documentation (L1→L2→L3) - memory.md: Update retrieval protocol with lookup examples - memory.md: Update storage protocol with creation workflow - memory.md: Convert JSON examples to markdown format - skillbook.md: Replace cloudmcp-manager with Serena memory tools - skillbook.md: Add tiered architecture for skill storage - skillbook.md: Update skill file format to markdown 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 893dcfd commit 441e1c1

File tree

2 files changed

+215
-125
lines changed

2 files changed

+215
-125
lines changed

src/claude/memory.md

Lines changed: 124 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ argument-hint: Specify the context to retrieve or milestone to store
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

@@ -38,7 +38,12 @@ Key requirements:
3838

3939
You have direct access to:
4040

41-
- **cloudmcp-manager memory tools**: All memory operations
41+
- **Serena memory tools**: Memory storage in `.serena/memories/`
42+
- `mcp__serena__list_memories`: List all available memories
43+
- `mcp__serena__read_memory`: Read specific memory file
44+
- `mcp__serena__write_memory`: Create new memory file
45+
- `mcp__serena__edit_memory`: Update existing memory
46+
- `mcp__serena__delete_memory`: Remove obsolete memory
4247
- **Read/Grep**: Context search in codebase
4348
- **TodoWrite**: Track memory operations
4449

@@ -53,67 +58,67 @@ Retrieve context at turn start, maintain internal notes during work, and store p
5358
3. **Summarize** progress after meaningful milestones or every five turns
5459
4. Focus summaries on **reasoning over actions**
5560

56-
## Memory Tools Reference
61+
## Memory Architecture (ADR-017)
5762

58-
### Search (Find Context)
63+
Memories are stored in the **Serena tiered memory system** at `.serena/memories/`.
64+
65+
### Tiered Architecture (3 Levels)
5966

6067
```text
61-
mcp__cloudmcp-manager__memory-search_nodes
62-
Query: "[topic] [context keywords]"
63-
Returns: Matching entities with observations
68+
memory-index.md (L1) # Task keyword routing
69+
70+
skills-*-index.md (L2) # Domain index with activation vocabulary
71+
72+
atomic-memory.md (L3) # Individual memory file
6473
```
6574

66-
### Open (Get Specific Entities)
75+
### Token Efficiency
76+
77+
- **L1 only**: ~500 tokens (routing table)
78+
- **L1 + L2**: ~1,500 tokens (domain index)
79+
- **Full retrieval**: Variable based on atomic file size
80+
- **Session caching**: 82% savings when same domain accessed multiple times
81+
82+
### Memory Tools Reference
83+
84+
### List (Discover Available)
6785

6886
```text
69-
mcp__cloudmcp-manager__memory-open_nodes
70-
Names: ["entity1", "entity2"]
71-
Returns: Full entity details
87+
mcp__serena__list_memories
88+
Returns: All memory files in .serena/memories/
7289
```
7390

74-
### Create (Store New Knowledge)
75-
76-
```json
77-
mcp__cloudmcp-manager__memory-create_entities
78-
{
79-
"entities": [{
80-
"name": "Feature-[Name]",
81-
"entityType": "Feature",
82-
"observations": ["Observation 1", "Observation 2"]
83-
}]
84-
}
91+
### Read (Retrieve Content)
92+
93+
```text
94+
mcp__serena__read_memory
95+
memory_file_name: "[file-name-without-extension]"
96+
Returns: Full content of memory file
8597
```
8698

87-
### Update (Add to Existing)
99+
### Write (Create New)
88100

89-
```json
90-
mcp__cloudmcp-manager__memory-add_observations
91-
{
92-
"observations": [{
93-
"entityName": "Feature-[Name]",
94-
"contents": ["New observation"]
95-
}]
96-
}
101+
```text
102+
mcp__serena__write_memory
103+
memory_file_name: "[domain]-[descriptive-name]"
104+
content: "[memory content in markdown format]"
97105
```
98106

99-
### Link (Create Relations)
100-
101-
```json
102-
mcp__cloudmcp-manager__memory-create_relations
103-
{
104-
"relations": [{
105-
"from": "Feature-A",
106-
"to": "Module-B",
107-
"relationType": "implemented_in"
108-
}]
109-
}
107+
### Edit (Update Existing)
108+
109+
```text
110+
mcp__serena__edit_memory
111+
memory_file_name: "[file-name]"
112+
needle: "[text to find]"
113+
repl: "[replacement text]"
114+
mode: "literal" | "regex"
110115
```
111116

112-
### Read All (Inspect Graph)
117+
### Delete (Remove Obsolete)
113118

114119
```text
115-
mcp__cloudmcp-manager__memory-read_graph
116-
Use sparingly - returns entire graph
120+
mcp__serena__delete_memory
121+
memory_file_name: "[file-name]"
117122
```
118123

119124
## Entity Naming Conventions
@@ -145,27 +150,63 @@ Use sparingly - returns entire graph
145150

146151
**At Session Start:**
147152

148-
1. Search with semantically meaningful query
149-
2. If initial retrieval fails, retry with broader terms
150-
3. Open specific nodes if names known
151-
4. Apply context to current work
153+
1. Read `memory-index.md` to find relevant domain indexes
154+
2. Read the domain index (e.g., `skills-powershell-index.md`)
155+
3. Match task keywords against activation vocabulary
156+
4. Read specific atomic memory files as needed
157+
158+
**Tiered Lookup Example:**
159+
160+
```text
161+
# Step 1: Route via L1 index
162+
mcp__serena__read_memory
163+
memory_file_name: "memory-index"
164+
# Result: "powershell ps1 module pester" -> skills-powershell-index
165+
166+
# Step 2: Find specific skill via L2 index
167+
mcp__serena__read_memory
168+
memory_file_name: "skills-powershell-index"
169+
# Result: Keywords "isolation mock" -> pester-test-isolation-pattern
170+
171+
# Step 3: Retrieve atomic memory
172+
mcp__serena__read_memory
173+
memory_file_name: "pester-test-isolation-pattern"
174+
```
175+
176+
**Direct Access (When Path Known):**
152177

153-
**Example Queries:**
178+
If you already know the memory file name, skip L1/L2 lookup:
154179

155-
- "authentication implementation patterns"
156-
- "roadmap priorities current release"
157-
- "architecture decisions REST client"
158-
- "failed approaches caching"
180+
```text
181+
mcp__serena__read_memory
182+
memory_file_name: "powershell-testing-patterns"
183+
```
159184

160185
## Storage Protocol
161186

162-
**Store Summaries At:**
187+
**Store Memories At:**
163188

164189
- Meaningful milestones
165190
- Every 5 turns of extended work
166191
- Session end
167192

168-
**Summary Format (300-1500 characters):**
193+
**Creating New Memories:**
194+
195+
```text
196+
# Step 1: Create atomic memory file
197+
mcp__serena__write_memory
198+
memory_file_name: "[domain]-[descriptive-name]"
199+
content: "# [Title]\n\n**Statement**: [Atomic description]\n\n**Context**: [When applicable]\n\n**Evidence**: [Source/proof]\n\n## Details\n\n[Content]"
200+
201+
# Step 2: Update domain index with new entry
202+
mcp__serena__edit_memory
203+
memory_file_name: "skills-[domain]-index"
204+
needle: "| Keywords | File |"
205+
repl: "| Keywords | File |\n|----------|------|\n| [keywords] | [new-file-name] |"
206+
mode: "literal"
207+
```
208+
209+
**Memory Format (Markdown):**
169210
Focus on:
170211

171212
- Reasoning and decisions made
@@ -174,6 +215,14 @@ Focus on:
174215
- Contextual nuance
175216
- NOT just actions taken
176217

218+
**Validation:**
219+
220+
After creating memories, run validation:
221+
222+
```bash
223+
pwsh scripts/Validate-MemoryIndex.ps1
224+
```
225+
177226
## Skill Citation Protocol
178227

179228
When agents apply learned strategies:
@@ -231,21 +280,24 @@ Every observation MUST include its source for traceability:
231280
| User | `[user]` | `[user]` |
232281
| External | `[ext:source]` | `[ext:GitHub#123]` |
233282

234-
**Example Observations with Source Tracking:**
235-
236-
```json
237-
{
238-
"observations": [{
239-
"entityName": "Feature-Authentication",
240-
"contents": [
241-
"[2025-01-15] [roadmap]: Epic EPIC-001 created for OAuth2 integration",
242-
"[2025-01-16] [planner]: Decomposed into 3 milestones, 15 tasks",
243-
"[2025-01-17] [doc:planning/prd-auth.md]: PRD completed, scope locked",
244-
"[2025-01-20] [implementer]: Sprint 1 started, 5/15 tasks in progress",
245-
"[2025-01-25] [decision:ADR-005]: Switched from PKCE to client credentials"
246-
]
247-
}]
248-
}
283+
**Example Memory File with Source Tracking:**
284+
285+
```markdown
286+
# Feature-Authentication
287+
288+
**Statement**: OAuth2 integration for user authentication
289+
290+
**Context**: User login and API access control
291+
292+
**Evidence**: EPIC-001, ADR-005
293+
294+
## Timeline
295+
296+
- [2025-01-15] [roadmap]: Epic EPIC-001 created for OAuth2 integration
297+
- [2025-01-16] [planner]: Decomposed into 3 milestones, 15 tasks
298+
- [2025-01-17] [doc:planning/prd-auth.md]: PRD completed, scope locked
299+
- [2025-01-20] [implementer]: Sprint 1 started, 5/15 tasks in progress
300+
- [2025-01-25] [decision:ADR-005]: Switched from PKCE to client credentials
249301
```
250302

251303
### Staleness Detection
@@ -274,7 +326,7 @@ When memory operations complete:
274326
2. Return retrieved context (for retrieval operations)
275327
3. Confirm storage (for storage operations)
276328

277-
**Note**: All agents have direct access to cloudmcp-manager memory tools. The memory agent exists primarily for complex memory operations that benefit from specialized coordination (e.g., skill graph maintenance, cross-entity relation management).
329+
**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).
278330

279331
## Handoff Options
280332

0 commit comments

Comments
 (0)