@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.
@@ -0,0 +1,271 @@
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
+ ```