@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,296 @@
1
+ ---
2
+ name: "uni-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_retrospective(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
+ - `permission_retries` → settings.json allowlist may need updating
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 /uni-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 /uni-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 /uni-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 /uni-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 (/uni-store-lesson) or procedure (/uni-store-procedure).
193
+
194
+ For each recommendation from the retrospective:
195
+ - Check if a matching procedure already exists (/uni-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 `/uni-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 `/uni-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. |
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: "uni-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 `/uni-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 `/uni-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}.`
@@ -0,0 +1,271 @@
1
+ ---
2
+ name: "uni-seed"
3
+ description: "Populate Unimatrix with foundational repository knowledge through human-directed, gated exploration."
4
+ ---
5
+
6
+ # /uni-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 `/uni-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 /uni-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: "uni-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 /uni-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
+ ```