Skip to content

Commit 1d983cc

Browse files
rjmurillo-botclaude
andcommitted
docs(agents): fix critic-identified gaps in memory and skillbook agents
Memory agent fixes (5 gaps -> all [FIXED]): - Add Create vs Update Decision mermaid flowchart - Add Domain Selection table with memory-index.md lookup - Fix table insertion: read last row, append after (not header) - Add File Naming vs Entity IDs clarification - Add Relations encoding with markdown syntax Skillbook agent fixes (4 gaps -> all [FIXED]): - Add Skill ID Numbering procedure with grep command - Define CRITICAL/BLOCKING criteria (Impact>=9, protocol gate, #P0) - Clarify "Has BLOCKS/ENABLES relationships" meaning - Fix Index Update Procedure with 3-step process Both agents verified by critic for amnesiac agent reproducibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 66f4028 commit 1d983cc

File tree

8 files changed

+356
-103
lines changed

8 files changed

+356
-103
lines changed

src/claude/memory.md

Lines changed: 85 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -121,30 +121,46 @@ mcp__serena__delete_memory
121121
memory_file_name: "[file-name]"
122122
```
123123

124-
## Entity Naming Conventions
125-
126-
| Type | Pattern | Example |
127-
|------|---------|---------|
128-
| Feature | `Feature-[Name]` | `Feature-Authentication` |
129-
| Module | `Module-[Name]` | `Module-Identity` |
130-
| Decision | `ADR-[Number]` | `ADR-001` |
131-
| Pattern | `Pattern-[Name]` | `Pattern-StrategyTax` |
132-
| Problem | `Problem-[Name]` | `Problem-CachingRace` |
133-
| Solution | `Solution-[Name]` | `Solution-LockingCache` |
134-
| Skill | `Skill-[Category]-[Number]` | `Skill-Build-001` |
135-
136-
## Relation Types
137-
138-
| Relation | Meaning |
139-
|----------|---------|
140-
| `implemented_in` | Feature in module |
141-
| `depends_on` | Entity requires another |
142-
| `replaces` | New replaces old |
143-
| `supersedes` | Newer version |
144-
| `related_to` | General association |
145-
| `blocked_by` | Progress blocked |
146-
| `solved_by` | Problem has solution |
147-
| `derived_from` | Skill from learning |
124+
## File Naming vs Entity IDs
125+
126+
**File Names** (Serena storage):
127+
128+
- Pattern: `[domain]-[descriptive-name].md`
129+
- Case: lowercase with hyphens
130+
- Example: `pr-review-security.md`, `pester-test-isolation.md`
131+
132+
**Entity IDs** (inside file content):
133+
134+
- Pattern: `[Type]-[Name]` or `Skill-[Category]-[NNN]`
135+
- Case: PascalCase with hyphen separator
136+
- Example: `Skill-PR-001`, `Feature-Authentication`
137+
138+
| Type | Entity ID Pattern | File Name Pattern |
139+
|------|-------------------|-------------------|
140+
| Skill | `Skill-[Category]-[NNN]` | `[domain]-[topic].md` |
141+
| Feature | `Feature-[Name]` | `feature-[name].md` |
142+
| Decision | `ADR-[Number]` | `adr-[number]-[topic].md` |
143+
| Pattern | `Pattern-[Name]` | `pattern-[name].md` |
144+
145+
## Relations (Encoded in File Content)
146+
147+
Relations are encoded as markdown in the memory file:
148+
149+
```markdown
150+
## Relations
151+
152+
- **supersedes**: [previous-file-name]
153+
- **depends_on**: [dependency-file-name]
154+
- **related_to**: [related-file-name]
155+
```
156+
157+
| Relation | Use When | Example |
158+
|----------|----------|---------|
159+
| `supersedes` | New version replaces old | `supersedes: adr-003-old-auth` |
160+
| `depends_on` | Requires another memory | `depends_on: session-init-serena` |
161+
| `related_to` | Loose association | `related_to: pr-review-security` |
162+
| `blocks` | This memory blocks another | `blocks: implementation-start` |
163+
| `enables` | This memory enables another | `enables: skill-validation` |
148164

149165
## Retrieval Protocol
150166

@@ -190,19 +206,60 @@ memory_file_name: "powershell-testing-patterns"
190206
- Every 5 turns of extended work
191207
- Session end
192208

193-
**Creating New Memories:**
209+
### Create vs Update Decision
210+
211+
```mermaid
212+
flowchart TD
213+
START([New Learning]) --> Q1{Existing memory<br/>covers this topic?}
214+
Q1 -->|YES| UPDATE[Update existing<br/>with edit_memory]
215+
Q1 -->|NO| Q2{Related domain<br/>index exists?}
216+
Q2 -->|YES| CREATE[Create new file<br/>Add to domain index]
217+
Q2 -->|NO| Q3{5+ memories<br/>expected for topic?}
218+
Q3 -->|YES| NEWDOMAIN[Create new domain<br/>index + memory file]
219+
Q3 -->|NO| RELATED[Add to closest<br/>related domain]
220+
```
221+
222+
**Update existing** when: Adding observation, refining pattern, source-tracked timeline entry.
223+
**Create new** when: Distinct atomic unit, new capability, no existing coverage.
224+
225+
### Domain Selection
226+
227+
Consult `memory-index.md` to find correct domain:
228+
229+
```text
230+
mcp__serena__read_memory
231+
memory_file_name: "memory-index"
232+
```
233+
234+
Match memory topic against Task Keywords column to find domain index.
235+
236+
| Memory Topic | Domain Index | File Name Pattern |
237+
|--------------|--------------|-------------------|
238+
| PowerShell patterns | skills-powershell-index | `powershell-[topic].md` |
239+
| GitHub CLI usage | skills-github-cli-index | `github-cli-[topic].md` |
240+
| PR review workflows | skills-pr-review-index | `pr-review-[topic].md` |
241+
| Testing patterns | skills-pester-testing-index | `pester-[topic].md` |
242+
| Documentation | skills-documentation-index | `documentation-[topic].md` |
243+
| Session init | skills-session-init-index | `session-init-[topic].md` |
244+
245+
### Creating New Memories
194246

195247
```text
196248
# Step 1: Create atomic memory file
197249
mcp__serena__write_memory
198250
memory_file_name: "[domain]-[descriptive-name]"
199251
content: "# [Title]\n\n**Statement**: [Atomic description]\n\n**Context**: [When applicable]\n\n**Evidence**: [Source/proof]\n\n## Details\n\n[Content]"
200252
201-
# Step 2: Update domain index with new entry
253+
# Step 2: Read domain index to find last table row
254+
mcp__serena__read_memory
255+
memory_file_name: "skills-[domain]-index"
256+
# Find the LAST row in the Activation Vocabulary table
257+
258+
# Step 3: Insert new row AFTER the last existing row
202259
mcp__serena__edit_memory
203260
memory_file_name: "skills-[domain]-index"
204-
needle: "| Keywords | File |"
205-
repl: "| Keywords | File |\n|----------|------|\n| [keywords] | [new-file-name] |"
261+
needle: "| [last-existing-keywords] | [last-existing-file] |"
262+
repl: "| [last-existing-keywords] | [last-existing-file] |\n| [new-keywords] | [new-file-name] |"
206263
mode: "literal"
207264
```
208265

src/claude/skillbook.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ flowchart TD
261261
```
262262

263263
**CRITICAL/BLOCKING Definition** (any one triggers Format A):
264+
264265
- Impact score >= 9
265266
- Blocks a protocol gate (SESSION-PROTOCOL.md)
266267
- Tagged with `#P0` or `#BLOCKING`
@@ -291,6 +292,7 @@ flowchart TD
291292
3. **Fallback to related**: If <5 skills expected, add to closest related domain.
292293

293294
**Example decisions:**
295+
294296
- Skill about PR security → `skills-pr-review-index.md` (PR workflow context)
295297
- Skill about skill formatting → `skills-documentation-index.md` (documentation context)
296298
- Skill about Pester mocking → `skills-pester-testing-index.md` (testing context)
@@ -320,6 +322,7 @@ memory_file_name: "memory-index"
320322
Match skill keywords against the Task Keywords column. The Essential Memories column shows which index to use.
321323

322324
**Creating new domains**: Only create `skills-{domain}-index.md` when:
325+
323326
1. 5+ skills exist or are planned for the topic
324327
2. No existing domain covers the topic adequately
325328
3. Keywords are distinct from all existing domains
@@ -355,6 +358,7 @@ grep -r "Skill-PR-" .serena/memories/ | grep -oE "Skill-PR-[0-9]+" | sort -t'-'
355358
```
356359

357360
**Rules:**
361+
358362
- Numbers are sequential within category (001, 002, 003...)
359363
- Do NOT reuse numbers from deleted skills
360364
- Gaps are acceptable (001, 002, 005 if 003-004 were deleted)

src/copilot-cli/memory.agent.md

Lines changed: 85 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,60 @@ memory_file_name: "powershell-testing-patterns"
152152
- Every 5 turns of extended work
153153
- Session end
154154

155-
**Creating New Memories:**
155+
### Create vs Update Decision
156+
157+
```mermaid
158+
flowchart TD
159+
START([New Learning]) --> Q1{Existing memory<br/>covers this topic?}
160+
Q1 -->|YES| UPDATE[Update existing<br/>with edit_memory]
161+
Q1 -->|NO| Q2{Related domain<br/>index exists?}
162+
Q2 -->|YES| CREATE[Create new file<br/>Add to domain index]
163+
Q2 -->|NO| Q3{5+ memories<br/>expected for topic?}
164+
Q3 -->|YES| NEWDOMAIN[Create new domain<br/>index + memory file]
165+
Q3 -->|NO| RELATED[Add to closest<br/>related domain]
166+
```
167+
168+
**Update existing** when: Adding observation, refining pattern, source-tracked timeline entry.
169+
**Create new** when: Distinct atomic unit, new capability, no existing coverage.
170+
171+
### Domain Selection
172+
173+
Consult `memory-index.md` to find correct domain:
174+
175+
```text
176+
serena/read_memory
177+
memory_file_name: "memory-index"
178+
```
179+
180+
Match memory topic against Task Keywords column to find domain index.
181+
182+
| Memory Topic | Domain Index | File Name Pattern |
183+
|--------------|--------------|-------------------|
184+
| PowerShell patterns | skills-powershell-index | `powershell-[topic].md` |
185+
| GitHub CLI usage | skills-github-cli-index | `github-cli-[topic].md` |
186+
| PR review workflows | skills-pr-review-index | `pr-review-[topic].md` |
187+
| Testing patterns | skills-pester-testing-index | `pester-[topic].md` |
188+
| Documentation | skills-documentation-index | `documentation-[topic].md` |
189+
| Session init | skills-session-init-index | `session-init-[topic].md` |
190+
191+
### Creating New Memories
156192

157193
```text
158194
# Step 1: Create atomic memory file
159195
serena/write_memory
160196
memory_file_name: "[domain]-[descriptive-name]"
161197
content: "# [Title]\n\n**Statement**: [Atomic description]\n\n**Context**: [When applicable]\n\n**Evidence**: [Source/proof]\n\n## Details\n\n[Content]"
162198
163-
# Step 2: Update domain index with new entry
199+
# Step 2: Read domain index to find last table row
200+
serena/read_memory
201+
memory_file_name: "skills-[domain]-index"
202+
# Find the LAST row in the Activation Vocabulary table
203+
204+
# Step 3: Insert new row AFTER the last existing row
164205
serena/edit_memory
165206
memory_file_name: "skills-[domain]-index"
166-
needle: "| Keywords | File |"
167-
repl: "| Keywords | File |\n|----------|------|\n| [keywords] | [new-file-name] |"
207+
needle: "| [last-existing-keywords] | [last-existing-file] |"
208+
repl: "| [last-existing-keywords] | [last-existing-file] |\n| [new-keywords] | [new-file-name] |"
168209
mode: "literal"
169210
```
170211

@@ -186,27 +227,46 @@ After creating memories, run validation:
186227
pwsh scripts/Validate-MemoryIndex.ps1
187228
```
188229

189-
## Entity Naming Conventions
190-
191-
| Type | Pattern | Example |
192-
|------|---------|---------|
193-
| Feature | Feature-[Name] | Feature-Authentication |
194-
| Module | Module-[Name] | Module-Identity |
195-
| Decision | ADR-[Number] | ADR-001 |
196-
| Pattern | Pattern-[Name] | Pattern-StrategyTax |
197-
| Problem | Problem-[Name] | Problem-CachingRace |
198-
| Solution | Solution-[Name] | Solution-LockingCache |
199-
200-
## Relation Types
201-
202-
| Relation | Meaning |
203-
|----------|---------|
204-
| implemented_in | Feature is implemented in Module |
205-
| depends_on | Entity requires another |
206-
| replaces | New approach replaces old |
207-
| related_to | General association |
208-
| blocked_by | Progress blocked by issue |
209-
| solved_by | Problem has solution |
230+
## File Naming vs Entity IDs
231+
232+
**File Names** (Serena storage):
233+
234+
- Pattern: `[domain]-[descriptive-name].md`
235+
- Case: lowercase with hyphens
236+
- Example: `pr-review-security.md`, `pester-test-isolation.md`
237+
238+
**Entity IDs** (inside file content):
239+
240+
- Pattern: `[Type]-[Name]` or `Skill-[Category]-[NNN]`
241+
- Case: PascalCase with hyphen separator
242+
- Example: `Skill-PR-001`, `Feature-Authentication`
243+
244+
| Type | Entity ID Pattern | File Name Pattern |
245+
|------|-------------------|-------------------|
246+
| Skill | `Skill-[Category]-[NNN]` | `[domain]-[topic].md` |
247+
| Feature | `Feature-[Name]` | `feature-[name].md` |
248+
| Decision | `ADR-[Number]` | `adr-[number]-[topic].md` |
249+
| Pattern | `Pattern-[Name]` | `pattern-[name].md` |
250+
251+
## Relations (Encoded in File Content)
252+
253+
Relations are encoded as markdown in the memory file:
254+
255+
```markdown
256+
## Relations
257+
258+
- **supersedes**: [previous-file-name]
259+
- **depends_on**: [dependency-file-name]
260+
- **related_to**: [related-file-name]
261+
```
262+
263+
| Relation | Use When | Example |
264+
|----------|----------|---------|
265+
| `supersedes` | New version replaces old | `supersedes: adr-003-old-auth` |
266+
| `depends_on` | Requires another memory | `depends_on: session-init-serena` |
267+
| `related_to` | Loose association | `related_to: pr-review-security` |
268+
| `blocks` | This memory blocks another | `blocks: implementation-start` |
269+
| `enables` | This memory enables another | `enables: skill-validation` |
210270

211271
## Conflict Resolution
212272

src/copilot-cli/skillbook.agent.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ flowchart TD
223223
```
224224

225225
**CRITICAL/BLOCKING Definition** (any one triggers Format A):
226+
226227
- Impact score >= 9
227228
- Blocks a protocol gate (SESSION-PROTOCOL.md)
228229
- Tagged with `#P0` or `#BLOCKING`
@@ -253,6 +254,7 @@ flowchart TD
253254
3. **Fallback to related**: If <5 skills expected, add to closest related domain.
254255

255256
**Example decisions:**
257+
256258
- Skill about PR security → `skills-pr-review-index.md` (PR workflow context)
257259
- Skill about skill formatting → `skills-documentation-index.md` (documentation context)
258260
- Skill about Pester mocking → `skills-pester-testing-index.md` (testing context)
@@ -282,6 +284,7 @@ memory_file_name: "memory-index"
282284
Match skill keywords against the Task Keywords column. The Essential Memories column shows which index to use.
283285

284286
**Creating new domains**: Only create `skills-{domain}-index.md` when:
287+
285288
1. 5+ skills exist or are planned for the topic
286289
2. No existing domain covers the topic adequately
287290
3. Keywords are distinct from all existing domains
@@ -317,6 +320,7 @@ grep -r "Skill-PR-" .serena/memories/ | grep -oE "Skill-PR-[0-9]+" | sort -t'-'
317320
```
318321

319322
**Rules:**
323+
320324
- Numbers are sequential within category (001, 002, 003...)
321325
- Do NOT reuse numbers from deleted skills
322326
- Gaps are acceptable (001, 002, 005 if 003-004 were deleted)

0 commit comments

Comments
 (0)