@dug-21/unimatrix 0.6.3 → 0.7.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dug-21/unimatrix",
3
- "version": "0.6.3",
3
+ "version": "0.7.1",
4
4
  "description": "Unimatrix knowledge engine for multi-agent development",
5
5
  "bin": {
6
6
  "unimatrix": "bin/unimatrix.js"
@@ -9,8 +9,8 @@
9
9
  "postinstall": "node postinstall.js"
10
10
  },
11
11
  "optionalDependencies": {
12
- "@dug-21/unimatrix-linux-x64": "0.6.3",
13
- "@dug-21/unimatrix-linux-arm64": "0.6.3"
12
+ "@dug-21/unimatrix-linux-x64": "0.7.1",
13
+ "@dug-21/unimatrix-linux-arm64": "0.7.1"
14
14
  },
15
15
  "files": [
16
16
  "bin/",
@@ -311,7 +311,13 @@ Task(subagent_type: "uni-validator",
311
311
  - Integration smoke tests passed
312
312
  - Any xfail markers added have corresponding GH Issues
313
313
  - If bug was discovered by integration test, that test's xfail marker was removed
314
- - Knowledge stewardship: investigator and rust-dev reports contain ## Knowledge Stewardship block with Queried/Stored/Declined entries
314
+ - Knowledge stewardship: investigator, architect, and rust-dev phase comments each contain
315
+ a ## Knowledge Stewardship block with Queried/Stored/Declined entries
316
+
317
+ To verify Knowledge Stewardship:
318
+ Run: gh issue view {issue-number} --comments
319
+ Read all phase comments. Verify each of the three agents has a ## Knowledge Stewardship
320
+ block. Missing block = REWORKABLE FAIL. Present with no reason after "nothing novel" = WARN.
315
321
 
316
322
  Bug report: {bug description}
317
323
  Root cause diagnosis: {from approved diagnosis}
@@ -406,7 +412,7 @@ Human action required: Review PR and approve merge.
406
412
  ```
407
413
 
408
414
  On human approval to merge, the Bugfix Manager:
409
- 1. Merges the PR with `gh pr merge --rebase` (if human requests it)
415
+ 1. Merges the PR with `gh pr merge --squash --delete-branch` (if human requests it) — squash preferred: one commit = one revert target if backout is needed
410
416
  2. Closes the GH Issue with reference to the PR (if applicable)
411
417
 
412
418
  ---
@@ -539,9 +545,10 @@ Then use Unimatrix skills as applicable:
539
545
 
540
546
  ### Stewardship Compliance
541
547
 
542
- The bugfix gate validator checks stewardship compliance for investigator and rust-dev agents:
543
- - Investigator report must include `## Knowledge Stewardship` with `Queried:` and `Stored:`/`Declined:` entries
544
- - Rust-dev report must include `## Knowledge Stewardship` with `Queried:` and `Stored:`/`Declined:` entries
548
+ The bugfix gate validator checks stewardship compliance for all three agents via `gh issue view --comments`:
549
+ - Investigator phase comment must include `## Knowledge Stewardship` with `Queried:` and `Stored:`/`Declined:` entries
550
+ - Architect phase comment must include `## Knowledge Stewardship` with `Queried:` and `Stored:`/`Declined:` entries
551
+ - Rust-dev phase comment must include `## Knowledge Stewardship` with `Queried:` and `Stored:`/`Declined:` entries
545
552
  - Missing stewardship block = REWORKABLE FAIL
546
553
 
547
554
  All phase outputs (diagnosis, fix summary, gate results, security review) are posted as **GH Issue comments** — never written to the filesystem.
@@ -42,6 +42,7 @@ Phase 4: Delivery
42
42
  - Max 2 rework iterations per gate — protects context window
43
43
  - Cargo output truncated to first error + summary line
44
44
  - The three source documents (Architecture, Specification, Risk Strategy) are sacred — all work traces back to them
45
+ - **Artifact hierarchy**: Architecture, Specification, and Risk Strategy are the technical ground truth. The Implementation Brief is a coordination artifact — it routes and summarizes but does not override source documents. If the brief and a source document conflict, the source document is authoritative; resolve before Stage 3a begins.
45
46
 
46
47
  ---
47
48
 
@@ -281,11 +282,13 @@ Task(subagent_type: "uni-validator",
281
282
  - Does implementation align with approved Architecture?
282
283
  - Are component interfaces implemented as specified?
283
284
  - Do test cases match component test plans?
285
+ - Do test cases cover risks from the Risk-Based Test Strategy?
284
286
  - Does code compile? Are there stubs or placeholders?
285
287
 
286
288
  Source documents:
287
289
  - product/features/{id}/architecture/ARCHITECTURE.md
288
290
  - product/features/{id}/specification/SPECIFICATION.md
291
+ - product/features/{id}/RISK-TEST-STRATEGY.md
289
292
  - product/features/{id}/pseudocode/ (all files)
290
293
  - product/features/{id}/test-plan/ (all files)
291
294
 
@@ -44,6 +44,7 @@ Each message batches ALL related operations of the same type:
44
44
  - NO code changes. NO file edits outside `product/features/`
45
45
  - NO launching delivery agents (uni-rust-dev, uni-pseudocode, uni-tester)
46
46
  - Agents return: artifact paths + key decisions + open questions (NOT full file contents)
47
+ - **Artifact hierarchy**: Architecture, Specification, and Risk Strategy are the technical ground truth. The Implementation Brief is a coordination artifact derived from them — technical decisions live in source documents, the brief routes and summarizes.
47
48
 
48
49
  ### No Git Operations in Design
49
50
 
@@ -322,6 +323,10 @@ Open questions: {list or "none"}
322
323
  Human action required: Review design artifacts. Then start Session 2 to deliver.
323
324
  ```
324
325
 
326
+ **Handling human-requested changes**: If the human requests changes after reviewing artifacts:
327
+ - **Technical changes** (architecture decisions, requirements, risk coverage) → update the relevant source document(s) first, then re-run the synthesizer to regenerate the Implementation Brief and Acceptance Map from the updated sources.
328
+ - **Coordination changes only** (wave ordering, component naming, delivery notes) → update the Implementation Brief directly.
329
+
325
330
  **Session 1 ends here.** No branch, no commit, no PR — artifacts sit untracked in `product/features/{feature-id}/` until Session 2 picks them up.
326
331
 
327
332
  ---
@@ -31,18 +31,20 @@ On invocation, orient yourself before engaging. Do all of this in parallel:
31
31
  ```bash
32
32
  gh issue list --state open --limit 30 --json number,title,labels
33
33
  ```
34
- 5. **Load active vision entries from Unimatrix**:
34
+ 5. **Load the goal and feature graph from Unimatrix** — two lookups in parallel:
35
35
  ```
36
36
  mcp__unimatrix__context_lookup({
37
- "topic": "product-vision",
38
- "status": "active",
39
- "agent_id": "uni-zero",
40
- "limit": 10
37
+ "category": "goal", "status": "active", "agent_id": "uni-zero", "limit": 20
38
+ })
39
+ mcp__unimatrix__context_lookup({
40
+ "category": "feature", "status": "active", "agent_id": "uni-zero", "limit": 20
41
41
  })
42
42
  ```
43
- Note the entry IDs. These are the entries you are responsible for keeping current.
44
- Compare key claims in each entry against `PRODUCT-VISION.md` as you read them — note
45
- any significant discrepancies to surface during the session if relevant.
43
+ Note the IDs. The vision root is the single `goal` entry tagged `["vision", "root"]`.
44
+ Strategic goals are `goal` entries tagged `["goal", ...]`. Feature entries carry status
45
+ tags (`planned`, `in-flight`, `delivered`). These are the entries you are responsible
46
+ for keeping current. Compare goal content against `PRODUCT-VISION.md` — note material
47
+ discrepancies to surface during the session.
46
48
 
47
49
  After orientation, present a concise **situation summary** (not a dump — synthesize):
48
50
 
@@ -52,6 +54,10 @@ UNIMATRIX ZERO — Orientation Complete
52
54
 
53
55
  Vision: {one-sentence summary of core purpose}
54
56
 
57
+ Goals: {N strategic goals} — {e.g. "2 achieved, 4 in-progress, 2 planned"}
58
+ Active features: {in-flight feature titles}
59
+ Planned features: {planned feature titles}
60
+
55
61
  Roadmap position:
56
62
  Completed: {wave/feature summary}
57
63
  Active: {what's in flight}
@@ -134,56 +140,103 @@ EOF
134
140
  - Labels: use `enhancement`, `bug`, `research`, or `question` as appropriate.
135
141
  - Do not create issues for work already tracked. Check open issues first.
136
142
 
137
- ### Curate Unimatrix Vision Entries
138
-
139
- You are the official curator of the product vision entries in Unimatrix the entries
140
- with `topic: product-vision` loaded at orientation. These are the agent-facing summary
141
- layer: what agents across all session types receive when briefed. Keep them accurate.
142
-
143
- **What triggers an update:**
144
- - The vision statement, core purpose, or domain scope changes
145
- - A strategic direction shift that isn't yet captured in either surface
146
- - A conversation reveals an inaccuracy in an existing Unimatrix vision entry
143
+ ### Curate Goals and Features
144
+
145
+ You are the official curator of the goal and feature graph in Unimatrix. This is the
146
+ agent-facing product roadmap what agents receive when briefed and what makes features
147
+ traceable to strategic intent.
148
+
149
+ **Category definitions:**
150
+
151
+ - **`goal`** an outcome-oriented statement of *why* the product is moving in a direction. Durable — survives individual feature completions. Use for: strategic capabilities, domain support commitments, cross-cutting product properties. Never use for: individual deliverables, implementation milestones, or wave labels.
152
+ - **`feature`** a delivery-oriented description of *what is being built*. Has a clear done state. Maps to one or more GitHub Issues. Use for: bounded work items with a shipped outcome. Never use for: abstract capabilities, architectural principles, or ongoing operational concerns.
153
+
154
+ **Vision root:** one `goal` entry tagged `["vision", "root"]` — the north star. Discovered at orientation via `context_lookup(category="goal", tags=["root"])`. All other goals `Advances` this entry.
155
+
156
+ **Edge type conventions:**
157
+
158
+ | Relationship | Edge type | Direction | Notes |
159
+ |---|---|---|---|
160
+ | Feature advances a goal | `Advances` | feature → goal | Required on every feature entry — no orphan features |
161
+ | Goal advances the vision | `Advances` | goal → vision root | Required on every goal entry |
162
+ | Goal advances a parent goal | `Advances` | sub-goal → goal | Use when a goal is more specific than an existing one |
163
+ | Feature depends on another feature | `DependsOn` | feature → prerequisite | Hard prerequisite — B cannot ship without A |
164
+ | Goals are thematically adjacent | `RelatedTo` | goal ↔ goal | Signals discovery overlap, not hierarchy |
165
+ | Research spike motivates a feature | `Motivates` | research → feature | Rationale chain from spike to delivery |
166
+ | ADR motivates a feature's design | `Motivates` | decision → feature | Why the feature is designed this way |
167
+
168
+ **Rules:**
169
+ - Every `feature` MUST have at least one `Advances` edge to a `goal` — a feature with no goal link is scope creep
170
+ - Every `goal` (except vision root) MUST have an `Advances` edge to the vision root or a parent goal
171
+ - Use `DependsOn` only for hard prerequisites — if A not shipped, B cannot start
172
+ - Use `RelatedTo` between goals to express adjacency, never between feature and goal
173
+ - Do NOT use `Supports` for the goal/feature graph — that edge type is for knowledge entry relationships
174
+ - Do NOT manually call `context_deprecate` when correcting goal/feature entries — always use `context_correct`, which creates the supersession chain atomically
175
+
176
+ **Feature delivery tags** (carried on feature entries):
177
+ - `planned` — scoped, not yet started; roadmap label as topic is sufficient
178
+ - `in-flight` — active delivery underway
179
+ - `delivered` — shipped (content includes PR number and merge date)
180
+ - `cancelled` — dropped
181
+
182
+ **Adding a new goal:**
183
+ 1. Discuss and agree in conversation first.
184
+ 2. `context_store(category="goal", topic="product-vision", tags=["goal", "{tag}"], edges=[{Advances → #4544}])`
185
+ 3. If it represents a new strategic direction, update `PRODUCT-VISION.md` in the same turn.
186
+
187
+ **Adding a new feature:**
188
+ 1. Propose in conversation, confirm scope and which goal(s) it advances.
189
+ 2. `context_store(category="feature", topic="{roadmap-label}", tags=["planned", ...], edges=[{Advances → goal_id}])`
190
+ 3. No feature ID required at planning time — roadmap label (e.g. W2-6) is sufficient as topic.
191
+
192
+ **Updating feature state** — use `context_correct` to preserve the evolution chain:
193
+ - When delivery starts: tag `planned` → `in-flight`, add assigned feature ID to content
194
+ - When delivered: tag `in-flight` → `delivered`, add PR number and merge date to content
195
+ - When scope changes: update content body; correction chain records the evolution
196
+
197
+ **Gap detection queries:**
198
+ - `context_lookup(category="feature", tags=["in-flight"])` — active work
199
+ - `context_lookup(category="feature", tags=["planned"])` — backlog
200
+ - `context_lookup(category="goal", tags=["delivered"])` — achieved goals
201
+ - `context_graph(mode="subgraph", seed={goal_id}, edge_types=["Advances"])` — all features for a goal
202
+ - `context_graph(mode="inverse", category="feature", missing_edge_types=["Advances"])` — features without a goal link (scope creep signal)
203
+
204
+ **What triggers a goal entry update:**
205
+ - A strategic direction changes — a goal is no longer relevant or a new one emerges
206
+ - A goal's overall delivery posture changes materially
207
+ - A conversation reveals an inaccuracy in a goal's description
147
208
  - The human explicitly requests an update
148
209
 
149
- Wave and group completions do NOT automatically trigger updates — implementation
150
- milestones are status changes, not vision changes. The entries describe what Unimatrix
151
- is and where it is going, not a delivery changelog.
210
+ Individual feature completions do NOT trigger goal updates — update the feature entry tag, not the goal.
152
211
 
153
212
  **Drift detection:**
154
- During orientation and throughout the conversation, compare what the active vision entries
155
- claim against `PRODUCT-VISION.md`. When a discrepancy is significant — an entry says
156
- something the document no longer supports, or the document has moved ahead of what any
157
- entry captures — surface it explicitly to the human:
213
+ Compare goal entry content against `PRODUCT-VISION.md` during orientation. When a
214
+ discrepancy is material — an entry says something the document no longer supports, or
215
+ vice versa surface it explicitly:
158
216
 
159
- > "Entry #NNNN says [X]. PRODUCT-VISION.md now says [Y]. These have drifted — want me
160
- > to bring them into sync?"
217
+ > "Goal #NNNN says [X]. PRODUCT-VISION.md says [Y]. These have drifted — want me to sync them?"
161
218
 
162
- The human decides what to do: update the entry, update the document, or both. Do not
163
- silently correct drift without confirmation. Minor wording differences are not worth
164
- surfacing; material factual divergences are.
219
+ Do not silently correct drift. Minor wording differences are not worth surfacing; factual
220
+ divergences are.
165
221
 
166
- This is also the mechanism for `PRODUCT-VISION.md` updates that originate from the
167
- conversation if the discussion reveals that the document no longer reflects the real
168
- strategic direction, flag it as drift and propose coordinated edits to both surfaces.
222
+ **The sync rule (short-term dual maintenance):**
223
+ `PRODUCT-VISION.md` remains the human-readable prose reference for contributors. The
224
+ goal/feature graph is the agent-facing structured layer. When either changes, check
225
+ whether the other needs updating — they must not contradict each other.
169
226
 
170
- **Process when updating:**
171
- 1. Identify which entry covers the changed area (from the IDs loaded at orientation).
172
- 2. Propose the updated content in conversation. Quote what is changing and why.
173
- 3. Confirm with the human before writing.
174
- 4. Apply via `context_correct` — deprecates the old entry, creates a new one with a
175
- correction chain link.
176
- 5. If the same change warrants updating `PRODUCT-VISION.md`, do both in the same turn.
227
+ Long-term direction: the goal/feature graph becomes the source of truth; `PRODUCT-VISION.md`
228
+ becomes derived output. Until then, maintain both.
177
229
 
178
- **The sync rule:** `PRODUCT-VISION.md` is the authoritative detailed prose document.
179
- Unimatrix vision entries are the agent-facing summary. Drift flows both ways — entries
180
- can lag the document (staleness), and the document can lag reality that emerged in
181
- conversation (vision evolution not yet committed). When one changes, check whether the
182
- other needs to change too. They must not contradict each other.
230
+ **Process when updating a goal or feature entry:**
231
+ 1. Identify the entry ID from the taxonomy table above.
232
+ 2. Propose the change in conversation. Quote what is changing and why.
233
+ 3. Confirm with the human before writing.
234
+ 4. Apply via `context_correct` (atomic deprecate + new entry with correction chain).
235
+ 5. If the change warrants updating `PRODUCT-VISION.md`, do both in the same turn.
183
236
 
184
- **Scope boundary:** Vision entries only. Do not use this session to store ADRs, patterns,
185
- lessons, or procedures — those belong to delivery and retro sessions where they are
186
- generated from actual implementation work with proper attribution.
237
+ **Scope boundary:** Goal and feature entries are within scope for this session.
238
+ Do not store ADRs, patterns, lessons, conventions, or procedures — those belong in
239
+ delivery and retro sessions with proper implementation attribution.
187
240
 
188
241
  ---
189
242
 
@@ -213,7 +266,7 @@ For contained questions that need deeper exploration than conversation allows:
213
266
  | Create feature implementation artifacts (IMPLEMENTATION-BRIEF, ARCHITECTURE.md, etc.) | These belong to design/delivery |
214
267
  | Commit or push code | No code authority |
215
268
  | Execute a research spike | Scope it; hand off |
216
- | Store non-vision knowledge in Unimatrix | ADRs, patterns, lessons, and procedures belong in delivery and retro sessions — not here |
269
+ | Store non-goal knowledge in Unimatrix | ADRs, patterns, lessons, conventions, and procedures belong in delivery and retro sessions — not here |
217
270
 
218
271
  If the human asks for something in the forbidden list, explain that it belongs in a different session type and offer to scope it or create an issue for it.
219
272
 
@@ -232,4 +285,4 @@ If the human asks for something in the forbidden list, explain that it belongs i
232
285
 
233
286
  ## Session End
234
287
 
235
- There is no formal close. When the human is done, they will end the session. If you have updated the vision doc, corrected Unimatrix vision entries, or created issues during the session, give a brief summary of what changed before the human leaves. Flag any vision drift you noticed but did not yet act on — name the specific entry or document section and what is stale, so the human can decide whether to address it now or later.
288
+ There is no formal close. When the human is done, they will end the session. If you have updated the vision doc, added or corrected goal/feature entries, or created issues during the session, give a brief summary of what changed before the human leaves. Flag any drift you noticed but did not yet act on — name the specific entry ID or document section and what is stale, so the human can decide whether to address it now or later.
@@ -1,171 +0,0 @@
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
- ```
@@ -1,271 +0,0 @@
1
- ---
2
- name: "unimatrix-seed"
3
- description: "Populate Unimatrix with foundational repository knowledge through human-directed, gated exploration."
4
- ---
5
-
6
- # /unimatrix-seed — Knowledge Base Seeding
7
-
8
- ## Prerequisites
9
-
10
- Before running this skill:
11
-
12
- 1. **MCP server running**: The Unimatrix MCP server (`unimatrix-server`) must be running and wired in your Claude Code `settings.json`. This skill calls `context_status`, `context_search`, and `context_store` — all require an operational MCP server.
13
- 2. **Recommended**: Run `/unimatrix-init` first to set up the CLAUDE.md knowledge block. Seeding works without it, but the CLAUDE.md block provides ongoing awareness.
14
-
15
- If `context_status` fails at startup, the MCP server is not available. Consult the installation documentation for wiring setup.
16
-
17
- ---
18
-
19
- ## What This Skill Does
20
-
21
- Guides you through populating Unimatrix with foundational knowledge about your repository. The skill explores your repo structure in bounded levels, proposes knowledge entries, and stores only what you approve.
22
-
23
- **Depth limit**: Level 0 (automatic) + up to 2 opt-in levels. No deeper. You control how far to go.
24
-
25
- **Categories used**: Only `convention`, `pattern`, and `procedure`. Categories like `decision`, `outcome`, and `lesson-learned` are excluded from seeding — they emerge from real feature work, not initial exploration.
26
-
27
- ---
28
-
29
- ## Entry Quality Rules
30
-
31
- Every proposed entry must pass this quality gate before being shown to you. Entries that fail are silently discarded — you only see quality entries.
32
-
33
- | Field | Rule |
34
- |-------|------|
35
- | **What** | One sentence, max 200 characters. Describes the knowledge. |
36
- | **Why** | Min 10 characters. Explains the consequence or motivation — what goes wrong without this knowledge. Must not be tautological (restating "what" without adding value). |
37
- | **Scope** | Where this applies — component, module, or workflow context. Must be present. |
38
-
39
- ---
40
-
41
- ## Execution Steps
42
-
43
- Follow these steps in strict order. At every gate marked with **STOP**, halt and wait for the human to respond before proceeding. Do not auto-advance.
44
-
45
- ### Step 1: Pre-flight — MCP Availability Check
46
-
47
- **This must be the very first action. Do not read any files before this step.**
48
-
49
- Call `context_status()`.
50
-
51
- - **If the call fails or returns an error**: Print the following and halt immediately. Do not proceed to any further steps.
52
- ```
53
- Unimatrix MCP is not available.
54
- Ensure unimatrix-server is running and wired in your Claude settings.json.
55
- See installation documentation for setup instructions.
56
- ```
57
-
58
- - **If the response is healthy** (no error indicators, returns system status): Continue to Step 2.
59
-
60
- ---
61
-
62
- ### Step 2: Existing-Entries Check
63
-
64
- Check whether seed entries already exist to avoid near-duplicates.
65
-
66
- Call `context_search` for each seeding category:
67
- - `context_search(query: "repository", category: "convention", k: 5)`
68
- - `context_search(query: "repository", category: "pattern", k: 5)`
69
- - `context_search(query: "repository", category: "procedure", k: 5)`
70
-
71
- Count the total results across all three searches.
72
-
73
- **If 3 or more entries found**:
74
-
75
- Print:
76
- ```
77
- Found {count} existing entries in seeding categories (convention/pattern/procedure).
78
- Re-seeding may create near-duplicates. You can save tokens by skipping if the knowledge base already has a good foundation.
79
-
80
- Options:
81
- supplement — continue and add new knowledge alongside existing entries
82
- skip — exit without changes
83
- ```
84
-
85
- **STOP. Wait for human response before proceeding.**
86
-
87
- - If the human says **skip**: Print "No changes made." and halt.
88
- - If the human says **supplement**: Continue to Step 3.
89
-
90
- **If fewer than 3 entries found**: Continue to Step 3 (clean first run).
91
-
92
- ---
93
-
94
- ### Step 3: Level 0 — Automatic Foundational Exploration
95
-
96
- Read the following files without requiring human confirmation. Skip any that do not exist:
97
-
98
- - `README.md`
99
- - `CLAUDE.md`
100
- - `Cargo.toml` (Rust)
101
- - `package.json` (Node.js)
102
- - `pyproject.toml` (Python)
103
- - `go.mod` (Go)
104
- - List the `.claude/` directory structure (if present) — directory listing only, not deep file reads
105
-
106
- From what you read, generate 2 to 4 high-level foundational entries. Typical entries cover:
107
-
108
- - **Repository purpose**: What this project does and why it exists
109
- - **Technology stack**: Primary language, framework, key dependencies
110
- - **Project structure**: How the codebase is organized (monorepo, workspace, key directories)
111
- - **Key conventions**: Any obvious conventions visible in top-level config (naming, formatting, etc.)
112
-
113
- Apply the quality gate (What/Why/Scope) to each candidate. Silently discard any that fail. If fewer than 2 entries pass the gate, include only what passes — do not pad with low-quality entries.
114
-
115
- If 0 entries pass the quality gate:
116
- ```
117
- Could not generate quality entries from available files. Consider adding a README.md with project context, then re-run /unimatrix-seed.
118
- ```
119
- Skip to the Done summary.
120
-
121
- ---
122
-
123
- ### Step 4: Gate 0 — Batch Approval
124
-
125
- Present all Level 0 entries as a batch:
126
-
127
- ```
128
- Level 0 — Foundational Knowledge
129
- =================================
130
- Proposed entries (approve or reject as a batch):
131
-
132
- 1. [convention] {what}
133
- Why: {why}
134
- Scope: {scope}
135
-
136
- 2. [pattern] {what}
137
- Why: {why}
138
- Scope: {scope}
139
-
140
- ...
141
-
142
- Approve all entries? (approve / reject)
143
- ```
144
-
145
- **STOP. Wait for human response before proceeding.**
146
-
147
- - **If approved**: Store each entry via `context_store`:
148
- ```
149
- context_store(
150
- title: "{what}",
151
- content: "What: {what}\nWhy: {why}\nScope: {scope}",
152
- topic: "{repo name or top-level context}",
153
- category: "{convention|pattern|procedure}",
154
- tags: ["seed", "level-0"],
155
- agent_id: "unimatrix-seed"
156
- )
157
- ```
158
- Report success or failure for each entry individually. If a `context_store` call fails, report which entry failed and continue storing the remaining entries.
159
-
160
- Print: "Stored {count} entries."
161
-
162
- - **If rejected**: Print "0 entries stored. Re-invoke /unimatrix-seed with more specific guidance if needed." and skip to the Done summary.
163
-
164
- After storing (or rejecting), present the Level 1 exploration menu:
165
-
166
- ```
167
- Would you like to explore deeper? Options:
168
- a) Module structure — explore source directories and key modules
169
- b) Conventions — look for coding standards, linting, formatting config
170
- c) Build & test — explore build system, test framework, CI config
171
- d) Done — stop here
172
- ```
173
-
174
- **STOP. Wait for human response before proceeding.**
175
-
176
- - If the human selects one or more options (a, b, c, or combinations): Continue to Step 5 with those selections.
177
- - If the human selects **d (Done)**: Skip to the Done summary.
178
-
179
- ---
180
-
181
- ### Step 5: Level 1 — Category Exploration (Opt-in)
182
-
183
- For each category the human selected, explore relevant files:
184
-
185
- - **Module structure**: Read `src/` or `lib/` directory listings, key module entry points, workspace member crates
186
- - **Conventions**: Read `.editorconfig`, `.eslintrc`, `rustfmt.toml`, `.clippy.toml`, `.prettierrc`, similar config files
187
- - **Build & test**: Read CI config (`.github/workflows/`, `Makefile`, `justfile`), test directory structure, build scripts
188
-
189
- For each entry generated from exploration, apply the quality gate. For entries that pass, present them **individually** (not as a batch):
190
-
191
- ```
192
- Proposed entry:
193
- [{category}] {what}
194
- Why: {why}
195
- Scope: {scope}
196
-
197
- Store this entry? (yes / no)
198
- ```
199
-
200
- **STOP. Wait for human response before proceeding.**
201
-
202
- - **yes**: Store via `context_store` with tags `["seed", "level-1"]`. Report success or failure.
203
- - **no**: Skip this entry.
204
-
205
- Continue until all Level 1 entries have been presented.
206
-
207
- ---
208
-
209
- ### Step 6: Gate 1 — Level 2 Decision
210
-
211
- ```
212
- Level 1 complete. Stored {count} new entries.
213
-
214
- Level 2 is the final exploration level. Would you like to go deeper into any area?
215
- a) {list deeper explorations based on Level 1 selections — e.g., "specific module internals", "test patterns", "CI pipeline details"}
216
- b) Done — stop here
217
- ```
218
-
219
- **STOP. Wait for human response before proceeding.**
220
-
221
- - If the human selects a deeper exploration: Continue to Step 7.
222
- - If the human selects **Done**: Skip to the Done summary.
223
-
224
- ---
225
-
226
- ### Step 7: Level 2 — Deep Exploration (Final Level)
227
-
228
- Explore the selected areas in greater depth. Read specific files within the directories explored at Level 1.
229
-
230
- For each entry generated, apply the quality gate and present individually (same as Level 1):
231
-
232
- ```
233
- Proposed entry:
234
- [{category}] {what}
235
- Why: {why}
236
- Scope: {scope}
237
-
238
- Store this entry? (yes / no)
239
- ```
240
-
241
- **STOP. Wait for human response before proceeding.**
242
-
243
- Store approved entries with tags `["seed", "level-2"]`.
244
-
245
- ---
246
-
247
- ### Step 8: Gate 2 — Terminal
248
-
249
- After Level 2 entries are processed:
250
-
251
- ```
252
- Level 2 complete. This is the final exploration level. No further levels are available.
253
- ```
254
-
255
- Proceed directly to the Done summary. **Do not offer a Level 3 option. Level 2 is the terminal level.**
256
-
257
- ---
258
-
259
- ### Done Summary
260
-
261
- ```
262
- Seed Summary
263
- ============
264
- Total entries stored: {total}
265
- Level 0: {l0_count}
266
- Level 1: {l1_count}
267
- Level 2: {l2_count}
268
-
269
- Knowledge base is ready. Future context_briefing calls will return these entries
270
- to agents working in this repository.
271
- ```