@dug-21/unimatrix 0.5.5
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.
- package/bin/unimatrix.js +62 -0
- package/lib/init.js +267 -0
- package/lib/merge-settings.js +188 -0
- package/lib/resolve-binary.js +69 -0
- package/package.json +32 -0
- package/postinstall.js +61 -0
- package/skills/knowledge-lookup/SKILL.md +120 -0
- package/skills/knowledge-search/SKILL.md +113 -0
- package/skills/query-patterns/SKILL.md +110 -0
- package/skills/record-outcome/SKILL.md +96 -0
- package/skills/retro/SKILL.md +296 -0
- package/skills/review-pr/SKILL.md +128 -0
- package/skills/store-adr/SKILL.md +142 -0
- package/skills/store-lesson/SKILL.md +109 -0
- package/skills/store-pattern/SKILL.md +124 -0
- package/skills/store-procedure/SKILL.md +114 -0
- package/skills/uni-git/SKILL.md +117 -0
- package/skills/uni-init/SKILL.md +169 -0
- package/skills/uni-knowledge-lookup/SKILL.md +120 -0
- package/skills/uni-knowledge-search/SKILL.md +113 -0
- package/skills/uni-query-patterns/SKILL.md +110 -0
- package/skills/uni-record-outcome/SKILL.md +96 -0
- package/skills/uni-release/SKILL.md +210 -0
- package/skills/uni-retro/SKILL.md +296 -0
- package/skills/uni-review-pr/SKILL.md +128 -0
- package/skills/uni-seed/SKILL.md +271 -0
- package/skills/uni-store-adr/SKILL.md +142 -0
- package/skills/uni-store-lesson/SKILL.md +109 -0
- package/skills/uni-store-pattern/SKILL.md +124 -0
- package/skills/uni-store-procedure/SKILL.md +114 -0
- package/skills/unimatrix-init/SKILL.md +171 -0
- package/skills/unimatrix-seed/SKILL.md +271 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "uni-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 `/uni-store-procedure` instead |
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "uni-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.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "uni-store-pattern"
|
|
3
|
+
description: "Store a reusable implementation pattern in Unimatrix. Use when you discover a gotcha, trap, or reusable solution that future agents should know."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Store Pattern — Implementation Knowledge
|
|
7
|
+
|
|
8
|
+
## What This Skill Does
|
|
9
|
+
|
|
10
|
+
Stores a reusable pattern in Unimatrix. Patterns capture implementation gotchas, traps, and solutions — knowledge invisible in source code that you only learn by hitting it. They surface in future `/uni-query-patterns` results so the next agent doesn't repeat the discovery.
|
|
11
|
+
|
|
12
|
+
**Use when:** you discover something that compiles but breaks at runtime, a non-obvious integration requirement, a crate-specific trap, or a reusable solution to a recurring problem.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Pattern vs Lesson vs Procedure
|
|
17
|
+
|
|
18
|
+
| Type | When to use | Example |
|
|
19
|
+
|------|------------|---------|
|
|
20
|
+
| **Pattern** (`/uni-store-pattern`) | Reusable solution or gotcha applicable regardless of failure context | "Don't hold lock_conn() across await — deadlocks under concurrent requests" |
|
|
21
|
+
| **Lesson** (`/uni-store-lesson`) | Triggered by a specific failure; takeaway is preventive | "Gate 3b failed because rust-dev didn't read ADR before implementing" |
|
|
22
|
+
| **Procedure** (`/uni-store-procedure`) | Ordered steps to accomplish a task | "How to add a new MCP tool: step 1, 2, 3..." |
|
|
23
|
+
|
|
24
|
+
**Decision rule:** If the knowledge was triggered by a specific failure and the takeaway is "don't do X," use `/uni-store-lesson`. If the knowledge is a reusable solution applicable regardless of failure context — "when doing X, use approach Y because Z" — use `/uni-store-pattern`.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## How to Store
|
|
29
|
+
|
|
30
|
+
### Step 1: Check for existing patterns in the same area
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
mcp__unimatrix__context_search(
|
|
34
|
+
query: "{what the pattern is about}",
|
|
35
|
+
category: "pattern",
|
|
36
|
+
k: 3
|
|
37
|
+
)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If a matching pattern already exists, go to Step 2b (supersede) instead of creating a duplicate.
|
|
41
|
+
|
|
42
|
+
### Step 2a: Store NEW pattern (no prior exists)
|
|
43
|
+
|
|
44
|
+
Assemble the content from three required fields:
|
|
45
|
+
|
|
46
|
+
- **What**: The pattern in one sentence (max 200 chars). What to do or not do.
|
|
47
|
+
- **Why**: What goes wrong without it (min 10 chars). The consequence that makes this worth knowing.
|
|
48
|
+
- **Scope**: Where it applies — crate name, module, or context.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
mcp__unimatrix__context_store(
|
|
52
|
+
title: "{concise what statement}",
|
|
53
|
+
content: "What: {what}\nWhy: {why}\nScope: {scope}",
|
|
54
|
+
topic: "{crate name or module — e.g., 'unimatrix-store'}",
|
|
55
|
+
category: "pattern",
|
|
56
|
+
tags: ["{domain}", "{feature_cycle if known}"],
|
|
57
|
+
agent_id: "{your role name, e.g. uni-rust-dev}"
|
|
58
|
+
)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Step 2b: Supersede EXISTING pattern (prior exists but is incomplete or outdated)
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
mcp__unimatrix__context_correct(
|
|
65
|
+
original_id: {old entry ID},
|
|
66
|
+
content: "What: {updated what}\nWhy: {updated why}\nScope: {updated scope}",
|
|
67
|
+
reason: "Updated: {what changed and why}"
|
|
68
|
+
)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This deprecates the old pattern and creates a corrected version with a supersession chain.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Quality Rules
|
|
76
|
+
|
|
77
|
+
**Reject if:**
|
|
78
|
+
- `why` is missing or under 10 characters — no motivation, no value
|
|
79
|
+
- `what` exceeds 200 characters — not concise enough
|
|
80
|
+
- Content is API documentation, not a gotcha — "Store has a lock_conn() method" is docs, not a pattern
|
|
81
|
+
|
|
82
|
+
**Good patterns:**
|
|
83
|
+
```
|
|
84
|
+
What: Don't hold lock_conn() across await points
|
|
85
|
+
Why: Deadlocks under concurrent MCP requests — the Store mutex is not async-aware
|
|
86
|
+
Scope: unimatrix-store, any async caller
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
What: Use #[serde(default)] on all new EntryRecord fields
|
|
91
|
+
Why: Existing serialized records lack the field; deserialization panics without default
|
|
92
|
+
Scope: unimatrix-core EntryRecord, any schema evolution
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Bad patterns:**
|
|
96
|
+
```
|
|
97
|
+
What: I used Arc::clone for shared ownership
|
|
98
|
+
Why: It works
|
|
99
|
+
```
|
|
100
|
+
(No gotcha. No consequence. This is just Rust basics.)
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Tagging Conventions
|
|
105
|
+
|
|
106
|
+
| Tag type | Examples |
|
|
107
|
+
|----------|----------|
|
|
108
|
+
| Crate | `store`, `server`, `vector`, `core`, `embed`, `engine` |
|
|
109
|
+
| Domain | `async`, `serialization`, `migration`, `mcp`, `confidence` |
|
|
110
|
+
| Feature cycle | `vnc-009`, `crt-005` (for retro traceability) |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Who Stores Patterns
|
|
115
|
+
|
|
116
|
+
| Agent | When |
|
|
117
|
+
|-------|------|
|
|
118
|
+
| uni-rust-dev | Implementation gotchas discovered while coding |
|
|
119
|
+
| uni-tester | Test infrastructure patterns, fixture usage discoveries |
|
|
120
|
+
| uni-risk-strategist | Risk patterns that recur across features |
|
|
121
|
+
| uni-researcher | Technical landscape patterns from problem space exploration |
|
|
122
|
+
| uni-vision-guardian | Recurring alignment variance patterns across features |
|
|
123
|
+
| uni-validator | Quality patterns (cross-feature, not gate-specific) |
|
|
124
|
+
| Retrospective agents | Patterns extracted from shipped feature analysis |
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "uni-store-procedure"
|
|
3
|
+
description: "Store or update a technical procedure (how-to) in Unimatrix. Use during retrospectives when a technique has evolved or been discovered."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Store Procedure — Technical How-To Knowledge
|
|
7
|
+
|
|
8
|
+
## What This Skill Does
|
|
9
|
+
|
|
10
|
+
Stores a step-by-step technical procedure in Unimatrix. Procedures describe HOW to accomplish specific tasks in this project. They evolve as the project evolves.
|
|
11
|
+
|
|
12
|
+
**Use during retrospectives** — not while implementing. Procedures are extracted from evidence, not guessed mid-session.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Procedure vs Convention vs Pattern
|
|
17
|
+
|
|
18
|
+
| Type | What it is | Example |
|
|
19
|
+
|------|-----------|---------|
|
|
20
|
+
| **Procedure** | Ordered steps to accomplish a task | "How to add a new MCP tool: step 1, 2, 3..." |
|
|
21
|
+
| **Convention** | A rule or standard | "No .unwrap() in non-test code" |
|
|
22
|
+
| **Pattern** | A reusable solution to a recurring problem | "Fresh context for unbiased review" |
|
|
23
|
+
|
|
24
|
+
If it has **numbered steps**, it's a procedure. If it's a **rule**, it's a convention. If it's a **when/why/how solution**, it's a pattern.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## How to Store a New Procedure
|
|
29
|
+
|
|
30
|
+
### Step 1: Check for existing procedure
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
mcp__unimatrix__context_search(
|
|
34
|
+
query: "{what the procedure covers}",
|
|
35
|
+
category: "procedure",
|
|
36
|
+
k: 3
|
|
37
|
+
)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If an existing procedure covers the same task, use Step 2 (Update) instead.
|
|
41
|
+
|
|
42
|
+
### Step 2a: Store NEW procedure
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
mcp__unimatrix__context_store(
|
|
46
|
+
title: "How to {task description}",
|
|
47
|
+
content: "{step-by-step content}",
|
|
48
|
+
topic: "{crate or area — e.g., 'unimatrix-server'}",
|
|
49
|
+
category: "procedure",
|
|
50
|
+
tags: ["{domain}", "{consuming-roles}"],
|
|
51
|
+
agent_id: "{your role name, e.g. uni-architect}"
|
|
52
|
+
)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Step 2b: UPDATE existing procedure (supersedes old version)
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
mcp__unimatrix__context_correct(
|
|
59
|
+
original_id: {old entry ID},
|
|
60
|
+
content: "{updated step-by-step content}",
|
|
61
|
+
reason: "Updated: {what changed and why}"
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This deprecates the old entry and creates a new one with a supersession chain. Agents querying later will get the latest version.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Content Format
|
|
70
|
+
|
|
71
|
+
Procedures should be **concise and actionable** (200-500 chars):
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
How to add a new MCP tool:
|
|
75
|
+
1. Add validate_{tool}_params fn in validation.rs (pure, no I/O)
|
|
76
|
+
2. Add format_{tool}_success fn in response.rs (summary + markdown + json)
|
|
77
|
+
3. Add handler block in tools.rs match arm
|
|
78
|
+
4. Add AuditEvent variant in audit.rs
|
|
79
|
+
5. Add tool schema in server registration
|
|
80
|
+
6. Add integration test in product/test/infra-001/
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
NOT:
|
|
84
|
+
```
|
|
85
|
+
When you want to add a new MCP tool to the server, you should first consider
|
|
86
|
+
the validation requirements. The validation module in validation.rs contains
|
|
87
|
+
pure functions that validate input parameters...
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Tagging Conventions
|
|
93
|
+
|
|
94
|
+
| Tag type | Examples |
|
|
95
|
+
|----------|----------|
|
|
96
|
+
| Crate/area | `server`, `store`, `vector`, `core`, `embed` |
|
|
97
|
+
| Consuming roles | `rust-dev`, `pseudocode`, `architect` |
|
|
98
|
+
| Domain | `mcp-tool`, `schema`, `testing`, `integration` |
|
|
99
|
+
|
|
100
|
+
Always include at least one consuming-role tag so `/uni-query-patterns` can filter by who needs it.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## When to Store vs When to Skip
|
|
105
|
+
|
|
106
|
+
**Store when:**
|
|
107
|
+
- A multi-step technique was used across 2+ features
|
|
108
|
+
- An existing procedure was wrong and needed correction
|
|
109
|
+
- A developer had to figure out steps that should have been documented
|
|
110
|
+
|
|
111
|
+
**Skip when:**
|
|
112
|
+
- The technique was used once and may not recur
|
|
113
|
+
- The steps are obvious to any Rust developer (not project-specific)
|
|
114
|
+
- The procedure is workflow choreography (that stays in coordinator agent defs)
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "unimatrix-init"
|
|
3
|
+
description: "Initialize Unimatrix in a repository: append knowledge block to CLAUDE.md and produce agent orientation recommendations."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /unimatrix-init — Repository Initialization
|
|
7
|
+
|
|
8
|
+
## Prerequisites
|
|
9
|
+
|
|
10
|
+
Before running this skill:
|
|
11
|
+
|
|
12
|
+
1. **Skill files installed**: Both `unimatrix-init/SKILL.md` and `unimatrix-seed/SKILL.md` must be present in `.claude/skills/` in the target repository.
|
|
13
|
+
2. **MCP server wired** (for `/unimatrix-seed`): The Unimatrix MCP server (`unimatrix-server`) must be running and configured in your Claude Code `settings.json`. This skill (`/unimatrix-init`) does not require MCP, but `/unimatrix-seed` does.
|
|
14
|
+
|
|
15
|
+
If you need to install the Unimatrix server or wire MCP, consult the installation documentation.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## What This Skill Does
|
|
20
|
+
|
|
21
|
+
Sets up Unimatrix awareness in a repository by:
|
|
22
|
+
1. Checking if Unimatrix is already initialized (idempotency guard)
|
|
23
|
+
2. Scanning agent definitions for orientation gaps (read-only)
|
|
24
|
+
3. Appending a self-contained Unimatrix knowledge block to CLAUDE.md
|
|
25
|
+
|
|
26
|
+
**This is different from the `uni-init` agent** (`.claude/agents/uni/uni-init.md`). The `uni-init` agent performs brownfield bootstrap — it extracts knowledge from existing `.claude/agents/` and `.claude/protocols/` files into Unimatrix entries. Use `/unimatrix-init` for new repository setup (CLAUDE.md + recommendations). Use the `uni-init` agent when you already have agent definitions and want to populate Unimatrix from them.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Arguments
|
|
31
|
+
|
|
32
|
+
- **No arguments**: Run the full initialization (sentinel check, agent scan, CLAUDE.md append).
|
|
33
|
+
- **`--dry-run`**: Print what would happen without modifying any files.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Execution Steps
|
|
38
|
+
|
|
39
|
+
Follow these phases in strict order. Do not skip or reorder.
|
|
40
|
+
|
|
41
|
+
### Phase 1: Pre-flight — Idempotency Check
|
|
42
|
+
|
|
43
|
+
**Check for `--dry-run` argument first.** If the user invoked `/unimatrix-init --dry-run`, set dry-run mode. In dry-run mode, no files will be created or modified — only terminal output.
|
|
44
|
+
|
|
45
|
+
1. Check if `CLAUDE.md` exists in the repository root.
|
|
46
|
+
|
|
47
|
+
2. **If CLAUDE.md exists**, read the entire file and search for this exact sentinel string:
|
|
48
|
+
```
|
|
49
|
+
<!-- unimatrix-init v1: DO NOT REMOVE THIS LINE -->
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
3. **Head-check fallback for large files**: If `CLAUDE.md` has more than 200 lines, also explicitly read the last 30 lines of the file and check for the sentinel there. This catches cases where the sentinel is at the end of a large file.
|
|
53
|
+
|
|
54
|
+
4. **If the sentinel is found** (in either check): Print the following and stop immediately. Do not proceed to Phase 2 or Phase 3.
|
|
55
|
+
```
|
|
56
|
+
Already initialized. Unimatrix block found in CLAUDE.md.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
5. **If CLAUDE.md does not exist**: Note this — CLAUDE.md will be created in Phase 3. Continue to Phase 2.
|
|
60
|
+
|
|
61
|
+
6. **If CLAUDE.md exists but sentinel is not found**: Continue to Phase 2.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### Phase 2: Agent Scan (Read-Only)
|
|
66
|
+
|
|
67
|
+
This phase produces a terminal-only recommendation report. **Do not write any files. Do not modify any agent files.**
|
|
68
|
+
|
|
69
|
+
1. Glob for agent definition files: `.claude/agents/**/*.md`
|
|
70
|
+
|
|
71
|
+
2. **If no agent files are found**: Print the following and continue to Phase 3.
|
|
72
|
+
```
|
|
73
|
+
No agent files found at .claude/agents/. Skipping agent scan.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
3. **For each agent file found**, read its content and check for the presence of these three patterns:
|
|
77
|
+
|
|
78
|
+
- **context_briefing**: Does the file contain `context_briefing`? (This indicates the agent calls the Unimatrix briefing tool at session start.)
|
|
79
|
+
- **Outcome reporting**: Does the file contain `/record-outcome` or reference `context_store` with `category: "outcome"`? (This indicates the agent records session outcomes.)
|
|
80
|
+
- **unimatrix-\* skill reference**: Does the file contain any reference to `unimatrix-` prefixed skills (e.g., `/unimatrix-init`, `/unimatrix-seed`)?
|
|
81
|
+
|
|
82
|
+
4. **Print the Agent Orientation Report** to the terminal:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Agent Orientation Report
|
|
86
|
+
========================
|
|
87
|
+
Agent | Missing | Suggested Addition
|
|
88
|
+
-------------------------------|----------------------------------|------------------------------------------
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For each agent file, print a row:
|
|
92
|
+
- **Agent**: the filename (without path prefix)
|
|
93
|
+
- **Missing**: which of the three patterns are absent
|
|
94
|
+
- **Suggested Addition**: concrete, skill-level recommendation. Examples:
|
|
95
|
+
- Missing context_briefing: "Add orientation section: call context_briefing at session start for relevant knowledge"
|
|
96
|
+
- Missing outcome reporting: "Add session end: invoke /record-outcome to capture what was learned"
|
|
97
|
+
- Missing unimatrix-* skills: "Reference /unimatrix-init and /unimatrix-seed for onboarding new repos"
|
|
98
|
+
- All present: "fully wired" / "none"
|
|
99
|
+
|
|
100
|
+
5. **If all agents have all three patterns**: Print after the table:
|
|
101
|
+
```
|
|
102
|
+
All agents fully wired.
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### Phase 3: CLAUDE.md Append
|
|
108
|
+
|
|
109
|
+
**If in dry-run mode**: Print the following, then print the full Unimatrix block content below, and stop. Do not create or modify any files.
|
|
110
|
+
```
|
|
111
|
+
DRY RUN -- the following block would be appended to CLAUDE.md:
|
|
112
|
+
```
|
|
113
|
+
Print the block, then:
|
|
114
|
+
```
|
|
115
|
+
No files were modified.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**If NOT in dry-run mode**:
|
|
119
|
+
|
|
120
|
+
The exact block to append is:
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
|
|
124
|
+
<!-- unimatrix-init v1: DO NOT REMOVE THIS LINE -->
|
|
125
|
+
## Unimatrix
|
|
126
|
+
|
|
127
|
+
Knowledge engine (MCP server). Makes agent expertise searchable, trustworthy, and self-improving.
|
|
128
|
+
|
|
129
|
+
### Available Skills
|
|
130
|
+
|
|
131
|
+
| Skill | When to Use |
|
|
132
|
+
|-------|-------------|
|
|
133
|
+
| `/unimatrix-init` | First-time setup: wire CLAUDE.md and get agent recommendations |
|
|
134
|
+
| `/unimatrix-seed` | Populate Unimatrix with foundational repo knowledge |
|
|
135
|
+
|
|
136
|
+
### Knowledge Categories
|
|
137
|
+
|
|
138
|
+
| Category | What Goes Here |
|
|
139
|
+
|----------|---------------|
|
|
140
|
+
| `decision` | Architectural decisions (ADRs) — use `/store-adr` |
|
|
141
|
+
| `pattern` | Reusable implementation patterns — use `/store-pattern` |
|
|
142
|
+
| `procedure` | Step-by-step workflows — use `/store-procedure` |
|
|
143
|
+
| `convention` | Project-wide coding/process standards |
|
|
144
|
+
| `lesson-learned` | Post-failure takeaways — use `/store-lesson` |
|
|
145
|
+
|
|
146
|
+
### When to Invoke
|
|
147
|
+
|
|
148
|
+
- Before implementing anything new → search knowledge base
|
|
149
|
+
- After each architectural decision → store ADR
|
|
150
|
+
- After each shipped feature → run retrospective
|
|
151
|
+
- When a technique evolves → update procedure
|
|
152
|
+
<!-- end unimatrix-init v1 -->
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**If CLAUDE.md exists**: Append the block to the end of the existing file. Use Edit/append semantics — do NOT overwrite the file. Preserve all existing content. Add a blank line before the block if the file does not already end with a blank line.
|
|
156
|
+
|
|
157
|
+
**If CLAUDE.md does not exist**: Create CLAUDE.md with the block as its only content (without the leading blank line).
|
|
158
|
+
|
|
159
|
+
After writing, confirm:
|
|
160
|
+
```
|
|
161
|
+
Unimatrix block appended to CLAUDE.md.
|
|
162
|
+
```
|
|
163
|
+
Or if created:
|
|
164
|
+
```
|
|
165
|
+
Created CLAUDE.md with Unimatrix block.
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Finally, print:
|
|
169
|
+
```
|
|
170
|
+
Initialization complete. Run /unimatrix-seed next to populate the knowledge base.
|
|
171
|
+
```
|