@dug-21/unimatrix 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,296 +0,0 @@
1
- ---
2
- name: "retro"
3
- description: "Post-merge retrospective — extracts patterns, procedures, and lessons from shipped features into Unimatrix. Use after a feature PR is merged."
4
- ---
5
-
6
- # Retro — Post-Merge Knowledge Extraction
7
-
8
- ## What This Skill Does
9
-
10
- Analyzes a shipped feature and extracts reusable knowledge — patterns, procedures, and lessons — into Unimatrix. This is how the project learns.
11
-
12
- ---
13
-
14
- ## Inputs
15
-
16
- From the invoker:
17
- - Feature ID (e.g., `col-011`)
18
- - PR number (merged)
19
- - GH Issue number
20
-
21
- ---
22
-
23
- ## Phase 1: Data Gathering & Retrospective Analysis
24
-
25
- Gather all evidence about the shipped feature:
26
-
27
- 1. **Run retrospective analysis** (if observation data exists):
28
- ```
29
- mcp__unimatrix__context_cycle_review(feature_cycle: "{feature-id}")
30
- ```
31
- This returns structured data: metrics, hotspots, baseline comparisons, narratives, and recommendations.
32
-
33
- 2. **Analyze the retrospective data** — extract actionable findings:
34
-
35
- a. **Hotspots by severity** — Classify each hotspot:
36
- - `Warning` hotspots → potential lessons or procedure gaps
37
- - `Info` hotspots → note trends, may not need action
38
- - Key hotspot types to watch:
39
- - `orphaned_calls` → tool invocations with no terminal event — check context overflow or parallel call management
40
- - `sleep_workarounds` → agents using sleep instead of run_in_background
41
- - `cold_restart` → context loss after gaps, agents re-reading files
42
- - `coordinator_respawns` → SM lifetime/handoff issues
43
- - `post_completion_work` → significant work after task marked done (scope issue?)
44
- - `lifespan` → agent running too long (context overflow risk)
45
- - `mutation_spread` → touching too many files (coupling/scope creep?)
46
- - `file_breadth` / `reread_rate` → agents inefficiently navigating codebase
47
-
48
- b. **Baseline outliers** — Any metric with `status: "Outlier"` deserves attention:
49
- - Is it a positive shift (e.g., higher `parallel_call_rate`)? Note as trend.
50
- - Is it a problem (e.g., high `post_completion_work`)? Extract lesson.
51
- - Is it a `NewSignal`? First time this metric has a non-zero value — note for future tracking.
52
-
53
- c. **Recommendations** — The retrospective returns specific actionable recommendations.
54
- Each one maps to either a procedure update or a lesson learned.
55
-
56
- d. **Narratives** — Temporal clustering of events. Look for:
57
- - Burst patterns (many events in short window → agent struggling)
58
- - Sequence patterns (repeated cycles → inefficient workflow)
59
- - Top files (which files caused the most friction)
60
-
61
- 3. **Read feature artifacts**:
62
- - `product/features/{id}/architecture/ARCHITECTURE.md`
63
- - `product/features/{id}/pseudocode/OVERVIEW.md`
64
- - `product/features/{id}/testing/RISK-COVERAGE-REPORT.md`
65
- - `product/features/{id}/reports/gate-3a-report.md`
66
- - `product/features/{id}/reports/gate-3b-report.md`
67
- - `product/features/{id}/reports/gate-3c-report.md`
68
-
69
- 4. **Check for rework signals**: Did any gate fail before passing? Read the gate report for what went wrong.
70
-
71
- 5. **Review the git log** for this feature's branch:
72
- ```bash
73
- git log main..HEAD --oneline
74
- ```
75
- Look for rework commits (`fix(gate):`) — these indicate where the process struggled.
76
-
77
- ---
78
-
79
- ## Phase 1b: Stewardship Quality Review
80
-
81
- Before extracting new patterns, review the quality of entries agents stored during this feature cycle.
82
-
83
- 1. **Query entries stored during the feature**:
84
- ```
85
- mcp__unimatrix__context_search(
86
- query: "{feature-id}",
87
- k: 20
88
- )
89
- ```
90
- Also search by feature_cycle tag if available. Use content/title matching as fallback — not all agents tag consistently.
91
-
92
- 2. **Assess each entry against its category template**:
93
- - **Patterns**: Has what/why/scope structure? Is "why" substantive (not "it works")?
94
- - **Lessons**: Has what-happened/root-cause/takeaway? Is takeaway actionable?
95
- - **Procedures**: Has numbered steps? Are steps specific (not generic)?
96
-
97
- 3. **Curate**:
98
- - **Low-quality entries** (missing structure, no substantive "why", API docs disguised as patterns): deprecate via `context_deprecate` with reason.
99
- - **High-quality entries** confirmed by successful delivery: note for the architect to validate during pattern extraction.
100
- - **Miscategorized entries** (lesson stored as pattern, or vice versa): note for correction.
101
-
102
- 4. **Report** the stewardship review results before proceeding to Phase 2:
103
- ```
104
- Stewardship Quality Review:
105
- - Entries found: {N}
106
- - Quality: {N} good, {N} deprecated (low quality), {N} flagged for recategorization
107
- - Details: {list each entry with assessment}
108
- ```
109
-
110
- ---
111
-
112
- ## Phase 2: Pattern & Procedure Extraction (MUST be a subagent)
113
-
114
- **Before spawning the architect**, prepare a structured retrospective briefing from Phase 1. This replaces the vague "paste summary" — give the architect concrete data to work with.
115
-
116
- Build the briefing:
117
-
118
- ```
119
- RETROSPECTIVE BRIEFING for {feature-id}
120
- ========================================
121
-
122
- Session stats: {session_count} sessions, {total_records} records, {total_tool_calls} tool calls, {total_duration_secs}s
123
-
124
- HOTSPOTS ({count} detected):
125
- {For each hotspot: "- [{severity}] {rule_name}: {claim} (measured: {measured}, threshold: {threshold})"}
126
-
127
- BASELINE OUTLIERS:
128
- {For each baseline entry with status "Outlier" or "NewSignal":
129
- "- {metric_name}: {current_value} vs mean {mean} (stddev {stddev}) — {status}"}
130
-
131
- RECOMMENDATIONS FROM RETROSPECTIVE:
132
- {For each recommendation: "- [{hotspot_type}] {action} — {rationale}"}
133
-
134
- REWORK SIGNALS:
135
- {gate failures, rework commits from Phase 1 step 4-5}
136
- ```
137
-
138
- Spawn `uni-architect` to review what was built and extract reusable knowledge:
139
-
140
- ```
141
- Agent(uni-architect, "
142
- Your agent ID: {feature-id}-retro-architect
143
- Your Unimatrix agent_id: uni-architect
144
- MODE: retrospective (not design)
145
- Feature: {feature-id}
146
-
147
- You are reviewing a SHIPPED feature to extract reusable knowledge.
148
- You are NOT designing anything new.
149
-
150
- Read these artifacts:
151
- - product/features/{id}/architecture/ARCHITECTURE.md
152
- - product/features/{id}/pseudocode/OVERVIEW.md (component structure)
153
- - product/features/{id}/reports/gate-3a-report.md (design review)
154
- - product/features/{id}/reports/gate-3b-report.md (code review)
155
- - product/features/{id}/reports/gate-3c-report.md (risk validation)
156
- - product/features/{id}/testing/RISK-COVERAGE-REPORT.md
157
-
158
- {paste the RETROSPECTIVE BRIEFING from above}
159
-
160
- YOUR TASKS:
161
-
162
- 1. PATTERN EXTRACTION — For each component implemented:
163
- a. Use /query-patterns to find existing patterns for the affected crate(s)
164
- b. If the component followed an existing pattern: verify it's still accurate.
165
- If the pattern drifted, use /store-procedure or context_correct to update it.
166
- c. If the component established a NEW reusable structure (used in 2+ features
167
- or clearly generic): store it via context_store(category: 'pattern').
168
- d. If the component was one-off: skip — don't store patterns for unique work.
169
-
170
- 2. PROCEDURE REVIEW — Check if any HOW-TO changed:
171
- a. Did the build/test/integration process change?
172
- b. Did schema migration steps change?
173
- c. Was there a new technique that future developers need?
174
- If yes: use /store-procedure (new) or context_correct (update existing).
175
-
176
- 3. ADR VALIDATION — For each ADR created during this feature:
177
- a. Was the decision validated by successful implementation?
178
- b. Did implementation reveal that an ADR was wrong or incomplete?
179
- If so: flag for supersession (do NOT supersede without human approval).
180
-
181
- 4. LESSON EXTRACTION — Two sources:
182
-
183
- A. From gate failures and rework:
184
- a. What went wrong? (root cause, not symptoms)
185
- b. Is the lesson generalizable beyond this feature?
186
- c. If yes: use /store-lesson.
187
-
188
- B. From retrospective hotspots and recommendations:
189
- For each Warning-severity hotspot, ask:
190
- - Is this a recurring problem (check baseline — is it consistently above threshold)?
191
- - Can it be prevented by a procedure change or config update?
192
- - If yes: store as lesson (/store-lesson) or procedure (/store-procedure).
193
-
194
- For each recommendation from the retrospective:
195
- - Check if a matching procedure already exists (/query-patterns).
196
- - If not, and the recommendation is actionable: store as procedure.
197
- - If it updates existing guidance: use context_correct.
198
-
199
- C. From baseline outliers:
200
- - Positive outliers (improvements): note what changed and why — may be a new pattern.
201
- - Negative outliers (regressions): root-cause and store as lesson if generalizable.
202
-
203
- Return:
204
- 1. Patterns: [new entries with IDs, updated entries with IDs, skipped with reason]
205
- 2. Procedures: [new/updated with IDs]
206
- 3. ADR status: [validated ADRs, flagged-for-supersession ADRs with reason]
207
- 4. Lessons: [new entries with IDs]
208
- 5. Retrospective findings: [hotspot-derived lessons, recommendation actions taken, outlier notes]")
209
- ```
210
-
211
- ---
212
-
213
- ## Phase 3: ADR Supersession (if flagged)
214
-
215
- If the architect flagged any ADRs for supersession:
216
-
217
- 1. Present each flagged ADR to the human:
218
- ```
219
- ADR #{entry-id}: "{title}"
220
- Architect's finding: {why it should be superseded}
221
- Proposed replacement: {what the new decision should be}
222
-
223
- Approve supersession?
224
- ```
225
-
226
- 2. If human approves: spawn architect to perform the supersession via `/store-adr`.
227
- 3. If human disagrees: note as "ADR validated with caveat".
228
-
229
- ---
230
-
231
- ## Phase 4: Worktree Cleanup
232
-
233
- Worker agents spawned with `isolation: "worktree"` create directories under `.claude/worktrees/`. Each contains a full `target/` build directory (~1-2GB). Clean up after merge.
234
-
235
- ```bash
236
- # List worktrees to find stale agent-created ones
237
- git worktree list
238
-
239
- # Remove each stale worktree (safe — feature is merged)
240
- git worktree remove .claude/worktrees/{agent-id}/ 2>/dev/null
241
-
242
- # Prune stale entries
243
- git worktree prune
244
- ```
245
-
246
- If a worktree has uncommitted changes, warn the human — do NOT force-remove.
247
-
248
- ---
249
-
250
- ## Phase 5: Summary & Outcome
251
-
252
- Collect all knowledge base changes from Phases 2-3.
253
-
254
- Use `/record-outcome` with:
255
- - Feature: `{feature-id}`
256
- - Type: `retro`
257
- - Phase: `retro`
258
- - Result: `pass`
259
- - Content: `Retrospective complete. {N} patterns, {N} procedures, {N} lessons extracted. {N} ADRs validated. Hotspots: {count} ({warning_count} warnings). Outliers: {list outlier metric names}.`
260
-
261
- **Return format:**
262
- ```
263
- RETROSPECTIVE COMPLETE — Knowledge base updated.
264
-
265
- Feature: {feature-id}
266
- PR: #{pr-number} (merged)
267
-
268
- Retrospective summary:
269
- - Sessions: {session_count}, Tool calls: {total_tool_calls}, Duration: {duration}
270
- - Hotspots: {count} ({warning_count} warnings, {info_count} info)
271
- - Baseline outliers: {list metric names and status}
272
-
273
- Knowledge extracted:
274
- - Patterns: {count} new, {count} updated
275
- - Procedures: {count} new, {count} updated
276
- - Lessons learned: {count} new ({count} from hotspots, {count} from gate failures)
277
- - ADRs validated: {count}
278
- - ADRs superseded: {count}
279
-
280
- Details:
281
- {list each entry with Unimatrix ID, title, and whether new or updated}
282
- ```
283
-
284
- ---
285
-
286
- ## When to Go Lightweight
287
-
288
- Not every feature needs a full retro:
289
-
290
- | Situation | Action |
291
- |---|---|
292
- | Zero gate failures, no rework, zero hotspots | Skip lesson extraction. Focus on patterns/procedures only. |
293
- | Minor enhancement (1-2 components) | Check for pattern drift only, skip procedure review. |
294
- | New infrastructure introduced | Full retro — high likelihood of new patterns and procedures. |
295
- | Multiple SCOPE FAILs or heavy rework | Full retro — prioritize lesson extraction. |
296
- | Many Warning hotspots or baseline outliers | Full retro — prioritize hotspot-driven lessons and procedure updates. |
@@ -1,128 +0,0 @@
1
- ---
2
- name: "review-pr"
3
- description: "PR security review and merge readiness check. Use after delivery or bugfix opens a PR, or standalone when human wants to review a PR."
4
- ---
5
-
6
- # Review PR — Security Review + Merge Readiness
7
-
8
- ## What This Skill Does
9
-
10
- Verifies gate results, spawns a fresh-context security reviewer, and assesses merge readiness. Works as:
11
- - **Auto-invoked** by `uni-scrum-master` at the end of delivery/bugfix protocols
12
- - **Standalone** when human invokes `/review-pr {pr-number}` directly
13
-
14
- ---
15
-
16
- ## Inputs
17
-
18
- From the invoker (SM or human):
19
- - PR number or URL
20
- - Feature ID (if available)
21
- - GH Issue number (if available)
22
-
23
- If invoked standalone with just a PR number, extract feature ID and GH Issue from the PR body.
24
-
25
- ---
26
-
27
- ## Step 1: Verify Gate Results
28
-
29
- Read the feature directory for gate reports:
30
-
31
- - `product/features/{id}/reports/gate-3a-report.md` — exists and shows PASS
32
- - `product/features/{id}/reports/gate-3b-report.md` — exists and shows PASS
33
- - `product/features/{id}/reports/gate-3c-report.md` — exists and shows PASS
34
- - `product/features/{id}/testing/RISK-COVERAGE-REPORT.md` — exists
35
-
36
- For bugfix PRs, check for the single gate report instead.
37
-
38
- If any gate report is missing or shows FAIL, **stop and report** — delivery is incomplete.
39
-
40
- ---
41
-
42
- ## Step 2: Security Review (Fresh Context — MUST be a subagent)
43
-
44
- Spawn `uni-security-reviewer` as a subagent for fresh-context review:
45
-
46
- ```
47
- Agent(uni-security-reviewer, "
48
- Your agent ID: {feature-id}-security-reviewer
49
- Your Unimatrix agent_id: uni-security-reviewer
50
- SECURITY REVIEW — Fresh context. Read the PR diff cold.
51
-
52
- PR: #{pr-number} on branch {branch-name}
53
- Feature: {feature-id}
54
- GH Issue: #{issue-number}
55
-
56
- Read these with fresh eyes:
57
- - git diff main...HEAD (the full change set)
58
- - product/features/{id}/architecture/ARCHITECTURE.md (if exists)
59
- - product/features/{id}/RISK-TEST-STRATEGY.md (if exists)
60
-
61
- Assess:
62
- - OWASP concerns: injection, access control, deserialization, input validation
63
- - Blast radius: worst case if code has a subtle bug
64
- - Regression risk: could this break existing functionality
65
- - Dependency safety: new dependencies, known vulnerabilities
66
- - Secrets: no hardcoded credentials, tokens, or keys
67
-
68
- Comment findings on the PR via gh CLI.
69
- If any finding is blocking: use gh pr review --request-changes.
70
-
71
- Return: risk level (low/medium/high/critical), findings summary,
72
- blocking findings (yes/no + details).")
73
- ```
74
-
75
- ---
76
-
77
- ## Step 3: Merge Readiness Assessment
78
-
79
- After security review returns, check all criteria:
80
-
81
- - [ ] All delivery gates passed (from gate reports)
82
- - [ ] Security review completed — no blocking findings
83
- - [ ] PR description references GH Issue
84
- - [ ] No merge conflicts with main
85
-
86
- If all pass → `Merge readiness: READY`
87
- If any blocking item → `Merge readiness: BLOCKED` with specific items listed
88
-
89
- ---
90
-
91
- ## Step 4: Report
92
-
93
- Post security review result to GH Issue:
94
- ```
95
- ## Security Review — {PASS|BLOCKED}
96
- - Summary: {risk level} — {findings summary}
97
- - Merge readiness: {READY|BLOCKED}
98
- - Issues: [blocking items if any]
99
- ```
100
-
101
- **Return format** (to SM or human):
102
- ```
103
- PR REVIEW COMPLETE
104
-
105
- PR: {URL}
106
- Feature: {feature-id}
107
-
108
- Security Review: {risk level} — {summary}
109
- Blocking findings: {yes/no + details}
110
- Merge readiness: {READY | BLOCKED}
111
-
112
- If BLOCKED:
113
- - Blocking items: [list]
114
- - Recommended action: [fix items or discuss]
115
-
116
- Human action required: Approve and merge, or address blocking items.
117
- ```
118
-
119
- ---
120
-
121
- ## Step 5: Record Outcome
122
-
123
- Use `/record-outcome` with:
124
- - Feature: `{feature-id}`
125
- - Type: `feature` (or `bugfix`)
126
- - Phase: `review`
127
- - Result: `pass` (or `blocked`)
128
- - Content: `PR review complete. Security: {risk level}. Merge readiness: {READY|BLOCKED}.`
@@ -1,142 +0,0 @@
1
- ---
2
- name: "store-adr"
3
- description: "Store an architectural decision record in Unimatrix. ADRs live in Unimatrix only — no ADR files. Use after each design decision."
4
- ---
5
-
6
- # Store ADR — Architectural Decisions in Unimatrix
7
-
8
- ## What This Skill Does
9
-
10
- Stores an architectural decision record in Unimatrix as the **sole authoritative store**. ADRs are NOT written as files — Unimatrix provides search, supersession chains, and cross-feature discovery that files cannot.
11
-
12
- **Use this AFTER each design decision.** The architect is the sole ADR authority.
13
-
14
- ---
15
-
16
- ## How to Store a New ADR
17
-
18
- ### Step 1: Search for prior ADRs in the same domain (MANDATORY)
19
-
20
- ```
21
- mcp__unimatrix__context_search(query: "{decision domain}", category: "decision", k: 5)
22
- ```
23
-
24
- Check if any existing ADR covers the same concern. If so, you may need to supersede it (see "How to Supersede" below).
25
-
26
- ### Step 2: Store the ADR
27
-
28
- ```
29
- mcp__unimatrix__context_store(
30
- title: "ADR-NNN: {decision title}",
31
- content: "## Context\n{why this decision is needed}\n\n## Decision\n{what we decided}\n\n## Consequences\n{what follows from this decision}",
32
- topic: "{feature-id}",
33
- category: "decision",
34
- tags: ["adr", "{phase-prefix}", "{domain-tags}"],
35
- source: "architect",
36
- feature_cycle: "{feature-id}",
37
- agent_id: "{your role name, e.g. uni-architect}"
38
- )
39
- ```
40
-
41
- ### Step 3: Record the entry ID
42
-
43
- Note the Unimatrix entry ID returned. Pass it to the coordinator — downstream agents and the synthesizer need ADR entry IDs to reference decisions.
44
-
45
- ### Step 4: Reference in ARCHITECTURE.md
46
-
47
- In your ARCHITECTURE.md, reference ADRs by Unimatrix entry ID:
48
-
49
- ```markdown
50
- ## Decisions
51
- | ADR | Title | Unimatrix ID |
52
- |-----|-------|--------------|
53
- | ADR-001 | Use rmcp 0.16 with stdio | #77 |
54
- | ADR-002 | Additive confidence model | #85 |
55
- ```
56
-
57
- ---
58
-
59
- ## How to Supersede an Existing ADR
60
-
61
- When a new decision replaces a prior one:
62
-
63
- ### Step 1: Find the old ADR
64
-
65
- ```
66
- mcp__unimatrix__context_search(query: "{domain of old decision}", category: "decision")
67
- ```
68
-
69
- Note the old entry's ID.
70
-
71
- ### Step 2: Use context_correct to supersede
72
-
73
- ```
74
- mcp__unimatrix__context_correct(
75
- original_id: {old entry ID},
76
- content: "## Context\n{why the old decision is being replaced}\n\n## Decision\n{new decision}\n\n## Consequences\n{what changes}",
77
- title: "ADR-NNN: {new decision title}",
78
- reason: "Superseded by {feature-id}: {short explanation}"
79
- )
80
- ```
81
-
82
- This automatically:
83
- - Deprecates the old entry
84
- - Creates a new entry with supersession chain
85
- - Preserves the old decision for historical reference
86
-
87
- ---
88
-
89
- ## ADR Content Guidelines
90
-
91
- **Keep ADRs to 300-800 characters.** They capture the decision, not the implementation.
92
-
93
- ```
94
- ## Context
95
- The briefing tool returns duties, conventions, and semantic matches.
96
- Duties duplicate what's already in agent definition files, consuming
97
- ~200 tokens for zero new information.
98
-
99
- ## Decision
100
- Remove duties from Unimatrix categories and context_briefing responses.
101
- Agent defs are the sole authority for role responsibilities.
102
-
103
- ## Consequences
104
- - Briefing returns 2 sections (conventions + relevant context) instead of 3
105
- - ~200 tokens freed per briefing call for more useful content
106
- - 28 existing duty entries deprecated
107
- - uni-init bootstrap no longer extracts duties
108
- ```
109
-
110
- NOT a full design document. NOT implementation details. Just: why, what, and so-what.
111
-
112
- ---
113
-
114
- ## Tagging Conventions
115
-
116
- | Tag Type | Examples |
117
- |----------|----------|
118
- | Always | `adr` |
119
- | Phase prefix | `nexus`, `vinculum`, `collective`, `cortical`, `alcove` |
120
- | Domain | `storage`, `serialization`, `mcp`, `embedding`, `security`, `confidence` |
121
- | Cross-cutting | `error-handling`, `async`, `thread-safety`, `api-design` |
122
-
123
- ---
124
-
125
- ## Self-Verification
126
-
127
- After storing:
128
- - Confirm entry ID returned
129
- - If **near-duplicate warning**: review existing entry — you may need to supersede rather than create
130
- - Record entry ID in your agent report and ARCHITECTURE.md decisions table
131
-
132
- ---
133
-
134
- ## What NOT to Store as ADRs
135
-
136
- | Don't Store | Why |
137
- |-------------|-----|
138
- | Draft decisions under discussion | Store only finalized decisions |
139
- | Implementation details (how) | ADRs capture the why — code captures the how |
140
- | Decisions by other agents | Architect is the sole ADR authority |
141
- | Coding conventions | Use `convention` category instead |
142
- | Step-by-step procedures | Use `/store-procedure` instead |
@@ -1,109 +0,0 @@
1
- ---
2
- name: "store-lesson"
3
- description: "Store a lesson learned from a failure, gate rejection, or unexpected issue. Use after bugfixes and gate failures to prevent recurrence."
4
- ---
5
-
6
- # Store Lesson — Failure Knowledge
7
-
8
- ## What This Skill Does
9
-
10
- Stores a lesson learned in Unimatrix. Lessons capture what went wrong, why, and the takeaway. They surface in future briefings and searches to prevent the same failure from recurring.
11
-
12
- **Use after:** gate failures, bug diagnoses, unexpected issues, rework cycles.
13
-
14
- ---
15
-
16
- ## How to Store
17
-
18
- ### Step 1: Check for existing lessons in the same area
19
-
20
- ```
21
- mcp__unimatrix__context_search(
22
- query: "{what went wrong}",
23
- category: "lesson-learned",
24
- k: 3
25
- )
26
- ```
27
-
28
- If a matching lesson already exists, go to Step 2b (supersede) instead of creating a duplicate.
29
-
30
- ### Step 2a: Store NEW lesson (no prior exists)
31
-
32
- ```
33
- mcp__unimatrix__context_store(
34
- title: "{concise description of what went wrong}",
35
- content: "{structured lesson content}",
36
- topic: "{feature-id or crate}",
37
- category: "lesson-learned",
38
- tags: ["{domain}", "{failure-type}"],
39
- agent_id: "{your role name, e.g. uni-architect}"
40
- )
41
- ```
42
-
43
- ### Step 2b: Supersede EXISTING lesson (prior exists but is incomplete or outdated)
44
-
45
- ```
46
- mcp__unimatrix__context_correct(
47
- original_id: {old entry ID},
48
- content: "{updated lesson with new evidence or broader scope}",
49
- reason: "Updated: {what new evidence or context was added}"
50
- )
51
- ```
52
-
53
- This deprecates the old lesson and creates a corrected version with a supersession chain. Future searches return the latest version.
54
-
55
- ### When to deprecate without replacing
56
-
57
- If a lesson is simply wrong or no longer applies (e.g., the underlying code was redesigned):
58
-
59
- ```
60
- mcp__unimatrix__context_deprecate(id: {entry ID}, reason: "{why it no longer applies}")
61
- ```
62
-
63
- ---
64
-
65
- ## Content Format
66
-
67
- Structure as: **What happened -> Root cause -> Takeaway** (200-500 chars):
68
-
69
- ```
70
- Gate 3b rejected: confidence calculation used f32 intermediate values
71
- despite f64 pipeline decision (ADR-003). Root cause: rust-dev didn't
72
- read ADR before implementing. Takeaway: MANDATORY ADR read step in
73
- rust-dev pseudocode consumption is not optional — validator should
74
- check ADR compliance explicitly.
75
- ```
76
-
77
- NOT a full incident report. NOT a narrative. Just the facts that prevent recurrence.
78
-
79
- ---
80
-
81
- ## Tagging Conventions
82
-
83
- | Tag type | Examples |
84
- |----------|----------|
85
- | Failure type | `gate-failure`, `bug`, `rework`, `regression`, `scope-fail` |
86
- | Gate | `gate-3a`, `gate-3b`, `gate-3c` |
87
- | Domain | `confidence`, `storage`, `mcp`, `testing` |
88
- | Severity | `minor`, `major`, `critical` |
89
-
90
- ---
91
-
92
- ## Who Stores Lessons
93
-
94
- | Agent | When |
95
- |-------|------|
96
- | uni-bug-investigator | After diagnosing root cause — store the generalizable pattern |
97
- | uni-validator | After gate failure — store what the gate caught and why |
98
- | Coordinator | After rework cycle — store what caused the rework |
99
- | Retrospective agents | After analyzing session data — store systemic issues |
100
-
101
- ---
102
-
103
- ## What Makes a Good Lesson
104
-
105
- **Generalizable** — applies beyond this one incident. "Off-by-one in loop" is not a lesson. "Boundary conditions at table scan limits not covered by unit tests" is.
106
-
107
- **Actionable** — the takeaway prevents recurrence. "Be more careful" is not actionable. "Add boundary condition tests for every table scan method" is.
108
-
109
- **Concise** — 200-500 chars. If it needs more, it's probably a procedure or a pattern, not a lesson.