ultra-builder-pro-cli 0.9.0 → 0.11.0

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.
Files changed (119) hide show
  1. package/CHANGELOG.md +92 -1
  2. package/README.md +11 -6
  3. package/adapters/_shared/codex-assets.cjs +23 -331
  4. package/adapters/_shared/handbook.cjs +2 -0
  5. package/adapters/_shared/runtime-assets.cjs +25 -0
  6. package/adapters/_shared/tests/handbook.test.cjs +3 -0
  7. package/adapters/_shared/tests/runtime-assets.test.cjs +12 -4
  8. package/adapters/claude.js +28 -5
  9. package/adapters/kimi.js +15 -138
  10. package/adapters/opencode.js +59 -63
  11. package/adapters/tests/claude.test.cjs +26 -9
  12. package/adapters/tests/codex.test.cjs +23 -9
  13. package/adapters/tests/kimi.test.cjs +15 -11
  14. package/adapters/tests/opencode.test.cjs +57 -10
  15. package/agents/code-reviewer.md +24 -85
  16. package/agents/debugger.md +30 -132
  17. package/agents/review-code.md +24 -104
  18. package/agents/review-comments.md +20 -83
  19. package/agents/review-coordinator.md +40 -137
  20. package/agents/review-design.md +21 -118
  21. package/agents/review-errors.md +22 -70
  22. package/agents/review-spec.md +36 -0
  23. package/agents/review-tests.md +20 -76
  24. package/agents/tdd-runner.md +26 -84
  25. package/commands/learn.md +5 -36
  26. package/commands/ultra-change.md +5 -43
  27. package/commands/ultra-deliver.md +4 -46
  28. package/commands/ultra-dev.md +4 -48
  29. package/commands/ultra-doctor.md +4 -30
  30. package/commands/ultra-init.md +5 -47
  31. package/commands/ultra-plan.md +5 -48
  32. package/commands/ultra-research.md +5 -54
  33. package/commands/ultra-status.md +5 -44
  34. package/commands/ultra-test.md +5 -45
  35. package/commands/ultra-think.md +5 -40
  36. package/docs/AGENT-CONTEXT.md +34 -12
  37. package/docs/ARCHITECTURE.md +31 -5
  38. package/docs/PLAN.zh-CN.md +3 -2
  39. package/docs/ROADMAP.md +5 -4
  40. package/docs/RUNTIME-COMPAT-MATRIX.md +7 -5
  41. package/docs/SKILL-AUTHORING.md +75 -0
  42. package/docs/USER-HANDBOOK-CONTRACT.md +9 -2
  43. package/hooks/README.md +6 -4
  44. package/hooks/active_task_context.py +14 -0
  45. package/hooks/context_spine.py +218 -0
  46. package/hooks/health_check.py +1 -1
  47. package/hooks/workflow_context.py +16 -123
  48. package/hooks/workflow_resume.py +21 -0
  49. package/mcp-server/lib/change-workflow.cjs +89 -11
  50. package/mcp-server/lib/change-workflow.test.cjs +202 -7
  51. package/mcp-server/lib/context-spine.cjs +331 -0
  52. package/mcp-server/lib/context-spine.test.cjs +73 -0
  53. package/mcp-server/lib/spec-learning.cjs +191 -0
  54. package/mcp-server/lib/spec-learning.test.cjs +62 -0
  55. package/mcp-server/lib/state-db.cjs +72 -10
  56. package/mcp-server/lib/state-db.test.cjs +7 -2
  57. package/mcp-server/server.cjs +31 -1
  58. package/mcp-server/tests/db-ops.test.cjs +3 -3
  59. package/mcp-server/tests/server-contract.test.cjs +74 -0
  60. package/mcp-server/tests/state-db.test.cjs +20 -3
  61. package/package.json +3 -2
  62. package/skills/cc-collab/SKILL.md +16 -18
  63. package/skills/code-review-expert/SKILL.md +39 -114
  64. package/skills/code-review-expert/references/correctness-reliability.md +30 -0
  65. package/skills/code-review-expert/references/design-boundaries.md +26 -0
  66. package/skills/code-review-expert/references/removal-plan.md +17 -45
  67. package/skills/codex-collab/SKILL.md +23 -28
  68. package/skills/codex-collab/evals/evals.json +18 -23
  69. package/skills/integration-rules/SKILL.md +28 -67
  70. package/skills/learn/SKILL.md +46 -105
  71. package/skills/security-rules/SKILL.md +34 -56
  72. package/skills/testing-rules/SKILL.md +28 -52
  73. package/skills/ultra-change/SKILL.md +61 -145
  74. package/skills/ultra-deliver/SKILL.md +63 -229
  75. package/skills/ultra-dev/SKILL.md +46 -338
  76. package/skills/ultra-doctor/SKILL.md +39 -71
  77. package/skills/ultra-init/SKILL.md +59 -139
  78. package/skills/ultra-plan/SKILL.md +50 -310
  79. package/skills/ultra-research/SKILL.md +59 -152
  80. package/skills/ultra-research/references/architecture.md +38 -0
  81. package/skills/ultra-research/references/problem-product.md +39 -0
  82. package/skills/ultra-research/references/quality-delivery.md +34 -0
  83. package/skills/ultra-research/references/synthesis.md +38 -0
  84. package/skills/ultra-research/references/users-scope.md +40 -0
  85. package/skills/ultra-review/SKILL.md +55 -427
  86. package/skills/ultra-review/references/unified-schema.md +76 -101
  87. package/skills/ultra-review/scripts/review_wait.py +242 -77
  88. package/skills/ultra-status/SKILL.md +38 -173
  89. package/skills/ultra-test/SKILL.md +41 -195
  90. package/skills/ultra-think/SKILL.md +43 -101
  91. package/skills/ultra-verify/SKILL.md +44 -84
  92. package/skills/ultra-verify/evals/evals.json +24 -27
  93. package/spec/cli-protocol.md +3 -0
  94. package/spec/mcp-tools.yaml +133 -4
  95. package/spec/schemas/command-manifest.schema.json +7 -25
  96. package/spec/schemas/skill-manifest.schema.json +9 -79
  97. package/spec/schemas/state-db.sql +31 -0
  98. package/skills/code-review-expert/references/code-quality-checklist.md +0 -112
  99. package/skills/code-review-expert/references/integration-checklist.md +0 -46
  100. package/skills/code-review-expert/references/security-checklist.md +0 -100
  101. package/skills/code-review-expert/references/solid-checklist.md +0 -65
  102. package/skills/ultra-research/steps/step-00-problem-validation.md +0 -154
  103. package/skills/ultra-research/steps/step-01-opportunity-discovery.md +0 -172
  104. package/skills/ultra-research/steps/step-02-market-assessment.md +0 -195
  105. package/skills/ultra-research/steps/step-03-competitive-landscape.md +0 -197
  106. package/skills/ultra-research/steps/step-04-product-strategy.md +0 -196
  107. package/skills/ultra-research/steps/step-05-assumptions-validation.md +0 -234
  108. package/skills/ultra-research/steps/step-10-user-personas.md +0 -169
  109. package/skills/ultra-research/steps/step-11-user-scenarios.md +0 -181
  110. package/skills/ultra-research/steps/step-20-user-stories.md +0 -156
  111. package/skills/ultra-research/steps/step-21-features-scope.md +0 -157
  112. package/skills/ultra-research/steps/step-22-success-metrics.md +0 -195
  113. package/skills/ultra-research/steps/step-30-architecture-context.md +0 -154
  114. package/skills/ultra-research/steps/step-31-solution-strategy.md +0 -172
  115. package/skills/ultra-research/steps/step-32-building-blocks.md +0 -188
  116. package/skills/ultra-research/steps/step-40-deployment.md +0 -123
  117. package/skills/ultra-research/steps/step-41-quality-risks.md +0 -135
  118. package/skills/ultra-research/steps/step-99-synthesis.md +0 -188
  119. package/skills/ultra-review/scripts/review_verdict_update.py +0 -99
@@ -1,190 +1,55 @@
1
1
  ---
2
2
  name: ultra-status
3
- description: "Real-time project status — progress, risk analysis, workflow routing. Reads task.list + session.list from state.db; reads test/delivery reports from files."
4
- runtime: all
5
- mcp_tools_required:
6
- - task.list
7
- - task.get
8
- - session.list
9
- - session.subscribe_events
10
- - change.list
11
- - system.doctor
12
- cli_fallback: "status --cost --json"
3
+ description: Report authoritative Ultra health, position, readiness, evidence freshness, and one deterministic next action. Use when the user asks where an Ultra project stands or what should happen next.
13
4
  ---
14
5
 
15
- # ultra-status — Phase 3.6
6
+ # Route from authoritative status
16
7
 
17
- Single-call dashboard. Pulls task state from state.db (authoritative), layers
18
- in `.ultra/test-report.json` + `.ultra/delivery-report.json` (file artifacts),
19
- reports progress + risks + workflow routing.
20
- It never treats a completed initial delivery as a terminal state: a healthy
21
- baseline routes the next daily request through `/ultra-change`.
8
+ Answer status questions without reconstructing state from prose. `.ultra/state.db` is
9
+ authoritative; reports and Markdown are evidence or projections.
22
10
 
23
- ## Authority failure boundary
11
+ ## Read order
24
12
 
25
- `task.list` and `task.get` are the only task-state inputs. If either is
26
- unavailable or returns an authority error, surface it and stop. Never fall back to `.ultra/tasks/tasks.json`.
27
- On `LEGACY_STATE_MIGRATION_REQUIRED`, instruct the
28
- user to run `ultra-tools migrate --from=4.4 --to=4.5 --source-dir <project-root>`.
13
+ 1. Call `system.doctor` in read-only mode. If authority is unhealthy, route only to
14
+ `ultra-doctor` and include the blocking diagnostic.
15
+ 2. Call `change.breadcrumb` for the active change, task, role, gate, readiness,
16
+ blockers, staleness, and next action.
17
+ 3. Call `task.list` and `session.list` for progress and active execution details.
18
+ 4. Read test and delivery reports only when present, and mark a report stale when its
19
+ HEAD differs from the current checkout.
20
+ 5. Read Git branch, HEAD, and worktree status without mutation.
29
21
 
30
- ## Workflow
22
+ If MCP task or change state is unavailable, label that panel unavailable. Never fall
23
+ back to generated task JSON, context frontmatter, or raw SQLite.
31
24
 
32
- ### Phase 0 — Environment validation
25
+ ## Routing
33
26
 
34
- | Check | If missing |
35
- |-------|-----------|
36
- | state.db reachable through `task.list` | suggest `/ultra-init` only when `.ultra/` is absent; otherwise surface the MCP error |
37
- | At least one task visible via `task.list` | suggest `/ultra-plan` |
38
- | `task.list` returns valid rows | surface error |
27
+ Follow the breadcrumb's primary route and return one action, not a menu:
39
28
 
40
- ### Phase 1 — Load data
29
+ - unhealthy authority: `ultra-doctor`;
30
+ - missing Ultra project: `ultra-init`;
31
+ - missing baseline evidence: `ultra-research` or `ultra-plan`, matching the gap;
32
+ - blocked or stale context: the workflow named by the breadcrumb;
33
+ - ready implementation task: `ultra-dev <task-id>`;
34
+ - completed tasks with missing or stale test evidence: `ultra-test`;
35
+ - incomplete review or convergence: `ultra-review` or `ultra-deliver`;
36
+ - ready change: `ultra-deliver`;
37
+ - archived change with fresh evidence: report completion without inventing more work.
41
38
 
42
- ```jsonc
43
- // MCP: task.list (no filter — get all tasks)
44
- {}
45
- // → { tasks: [...], count: N }
39
+ Require an explicit change id when several active changes make the route ambiguous.
46
40
 
47
- // MCP: session.list (active sessions; Phase 4.5.4)
48
- { "status": "running" }
49
- // → { sessions: [...], count: N }
41
+ ## Output
50
42
 
51
- // MCP: session.subscribe_events (recent events for the "last event" panel)
52
- { "since_id": 0, "limit": 20 }
53
- // → { events: [...], next_since_id: M }
43
+ Use a compact shape:
54
44
 
55
- // MCP: change.list (continuous-change lane)
56
- { "limit": 20 }
57
-
58
- // MCP: system.doctor (read-only runtime health)
59
- { "repair": false }
45
+ ```text
46
+ Ultra: <healthy|degraded> · <branch>@<head> · worktree <clean|dirty>
47
+ Position: change=<id|none> task=<id|none> role=<role> gate=<gate>
48
+ Readiness: <ready|blocked|stale> — <blockers or none>
49
+ Progress: <completed>/<total>; sessions=<active count>
50
+ Evidence: tests=<fresh|stale|missing>; delivery=<fresh|stale|missing>
51
+ Next: <one exact action>
60
52
  ```
61
53
 
62
- Also read:
63
- - `.ultra/test-report.json` — if present
64
- - `.ultra/delivery-report.json` — if present
65
-
66
- Extract:
67
- - Task stats: by status (`pending`/`in_progress`/`completed`/`blocked`), by priority (P0-P3)
68
- - Current `in_progress` task, next `pending` task (topological order)
69
- - Active sessions: count, per-runtime breakdown, orphan warnings
70
- - Most recent 20 events (by `events.id` DESC) — "last event" panel
71
- - Test passed / failed / stale (compare `git_commit` to HEAD)
72
- - Delivery readiness (tag + pushed)
73
- - Active/blocked/ready change, linked task counts, docs impact, and context freshness
74
- - Runtime health: open incidents, projection lag/failure, orphan sessions, missing change artifacts
75
-
76
- ### Phase 2 — Progress report
77
-
78
- Compact multi-section output:
79
- - **Overview**: progress bar `[████░░░░] 50%`, completion %, velocity (completed tasks / elapsed days)
80
- - **Tasks**: counts per status + per priority
81
- - **Test**: pass/fail, `run_count`, `blocking_issues` if any
82
- - **Delivery**: `version` + `pushed` + last tag
83
- - **Change**: active id/kind/status, docs impact, task completion, context/provider freshness
84
- - **Runtime**: healthy/degraded with failing doctor checks only
85
- - **Risks**: auto-detected list (see Phase 3)
86
- - **Next**: recommended next task (see Phase 4)
87
-
88
- ### Phase 3 — Risk detection
89
-
90
- Auto-detect:
91
- - **Blockers**: tasks with unsatisfied dependencies
92
- - **Stalled**: `in_progress` for >3 days (check `updated_at`)
93
- - **Overdue**: past `estimated_days` from when moved to `in_progress`
94
- - **Complexity spike**: 3+ consecutive `pending` tasks with complexity ≥7
95
- - **Test stale**: `test-report.json.git_commit ≠ HEAD`
96
- - **Orphan sessions**: any session with `lease_expires_at < now()` still status=running
97
- (uninitialized by orphan-reaper; escalate)
98
- - **Projection/incident failure**: read-only doctor is degraded → route to
99
- `/ultra-doctor`; never infer recovery from a generated JSON file
100
- - **Context stale**: active change manifest head or task set differs from current state
101
- - **Docs drift**: change has `docs_impact.status=unknown` or declared required file is missing
102
-
103
- | Icon | Meaning | Action |
104
- |------|---------|--------|
105
- | 🟢 | on track | continue |
106
- | 🟡 | minor issues | review stalled |
107
- | 🟠 | significant risks | address blockers |
108
- | 🔴 | critical | stop and resolve |
109
-
110
- ### Phase 4 — Next-task recommendation
111
-
112
- Select next optimal task by:
113
- 1. Priority (P0 > P1 > P2 > P3)
114
- 2. Dependencies resolved (only `pending` with all deps `completed`)
115
- 3. Complexity sweet spot (prefer 3-5, avoid clustering 7+)
116
- 4. Context continuity (favor same component as recent completed task)
117
-
118
- ### Phase 5 — Workflow routing (▶ Next Up)
119
-
120
- Detect position from artifacts:
121
-
122
- | Condition | Route |
123
- |-----------|-------|
124
- | No `.ultra/` | `/ultra-init` |
125
- | Specs have `[NEEDS CLARIFICATION]` or missing | `/ultra-research` |
126
- | No tasks and no delivered baseline | `/ultra-plan` |
127
- | Doctor degraded because of Ultra runtime state | `/ultra-doctor` |
128
- | No active/blocked/ready change and fresh delivery exists | `/ultra-change` for the next daily change |
129
- | Active change has any `pending` linked task | `/ultra-dev` (show which) |
130
- | Active change linked tasks all `completed` | `/ultra-test` |
131
- | Matching fresh `test-report.json.passed === true` | `/ultra-deliver` |
132
- | `test-report.json.passed === false` | `/ultra-dev` (show blocking issues) |
133
- | Change is `ready` | `/ultra-deliver` to reconcile/archive before release completion |
134
- | Latest change archived and delivery fresh | Baseline healthy; next work starts with `/ultra-change` |
135
-
136
- **Safety checks before routing**:
137
- - Routing to deliver but `test-report.git_commit ≠ HEAD` → warn "Tests stale"
138
- - `git status --porcelain` non-empty → warn "Uncommitted changes"
139
-
140
- **Output block**:
141
- ```markdown
142
- ---
143
- ## ▶ Next Up
144
- **{command}** — {description}
145
- `/clear` then `/{command}`
146
- ---
147
- **Also available**: `/{alt}` — {description}
148
- ---
149
- ```
150
-
151
- ## Single-task mode (`$1` supplied)
152
-
153
- When `task-id` provided:
154
- ```jsonc
155
- // MCP: task.get
156
- { "id": "<id>" }
157
- ```
158
- Display: title, status, priority, complexity, deps, files_modified (if set),
159
- session_id (if active), `context_file`, `trace_to`, stale flag, update history.
160
-
161
- ## MCP and CLI matrix
162
-
163
- | Purpose | MCP tool | CLI fallback |
164
- |---------|----------|--------------|
165
- | List tasks | `task.list` | none; fail closed |
166
- | Single task detail | `task.get` | none; fail closed |
167
- | Change lane | `change.list` | none; fail closed |
168
- | Runtime health | `system.doctor { repair:false }` | `ultra-tools system doctor` |
169
- | Cost panel (Phase 6.3) | — | `ultra-tools status --cost --json --since 7d` |
170
-
171
- ## Cost panel (Phase 6.3)
172
-
173
- `ultra-tools status --cost --json` returns `{period, by_runtime, top_tasks,
174
- total_cost_usd}`. Render under the progress section when the user asks
175
- "how much did we spend?" or `/ultra-status --cost` is invoked. `--since 7d`
176
- is the conventional weekly window; override with ISO-8601 for custom ranges.
177
-
178
- ## What this skill DOES NOT do
179
-
180
- - Does NOT modify or repair state
181
- - Does NOT run tests / build / deploy
182
- - Does NOT require all artifacts (partial reports are tolerated)
183
-
184
- ## Integration
185
-
186
- | | |
187
- |---|---|
188
- | **Input** | state.db via task/change/session/system reads, test/delivery reports, git HEAD |
189
- | **Output** | console report (Chinese per project rule) |
190
- | **When** | anytime — idempotent read-only |
54
+ This workflow is read-only. It does not repair state, compile context, update tasks, or
55
+ release software.
@@ -1,213 +1,59 @@
1
1
  ---
2
2
  name: ultra-test
3
- description: "Pre-delivery quality audit — Anti-Pattern + Coverage Gap + Wiring + E2E + Performance + Security. Writes .ultra/test-report.json; no state.db writes."
4
- runtime: all
5
- mcp_tools_required:
6
- - task.list
7
- - change.list
3
+ description: Run an independent pre-delivery verification gate and record exact feedback-loop, reachability, recovery, and acceptance evidence. Use when scoped implementation tasks are complete and delivery readiness must be established.
8
4
  ---
9
5
 
10
- # ultra-test — Phase 3.5
6
+ # Verify delivery readiness
11
7
 
12
- Project-level quality audit before `/ultra-deliver`. Auditors are orthogonal;
13
- each writes a JSON gate result; the skill aggregates into `.ultra/test-report.json`.
14
- This is **not** for running unit tests (that is `/ultra-dev`). This is the
15
- pre-ship gate.
8
+ Run this gate from a fresh checking context. It complements task-level development
9
+ tests and writes `.ultra/test-report.json`; it does not replace authoritative task or
10
+ change state.
16
11
 
17
- ## Authority failure boundary
12
+ ## Entry gate
18
13
 
19
- The completed-task precheck requires MCP `task.list`. If it is unavailable or
20
- returns an authority error, stop the audit. Never fall back to
21
- `.ultra/tasks/tasks.json`. For `LEGACY_STATE_MIGRATION_REQUIRED`, instruct
22
- `ultra-tools migrate --from=4.4 --to=4.5 --source-dir <project-root>`.
14
+ 1. Call `task.list` and require at least one completed task in scope.
15
+ 2. Call `change.list` and bind exactly one relevant change, or record a null change id
16
+ for an initial baseline.
17
+ 3. For a change, compile `change.context` for the checking role and verification gate
18
+ with only the specifications, tests, and source seams needed for acceptance.
19
+ 4. Call `change.breadcrumb`; stop when context is stale or readiness is blocked.
23
20
 
24
- ## Prerequisites
21
+ Never use generated task JSON as authority or reuse the implementer's full
22
+ conversation as test context.
25
23
 
26
- - `task.list` returns ≥1 task with `status=completed`
27
- - Repo has test files (Step 0 pre-check)
24
+ ## Evidence matrix
28
25
 
29
- ## Workflow
26
+ Map each acceptance claim to observable evidence:
30
27
 
31
- ### Step 0 — Pre-Execution
28
+ | Check | Evidence | Blocking result |
29
+ |---|---|---|
30
+ | Feedback loop | exact command and observed result | failure or missing baseline signal for a fix |
31
+ | Public seam | reachable entry-to-consumer path | orphan, stub, or unwired behavior |
32
+ | Regression | focused and adjacent suites | failure or weakened assertion |
33
+ | Static/build | applicable type, lint, and build commands | non-zero result |
34
+ | Error/recovery | exercised failure and recovery path | silent or unrecoverable critical path |
35
+ | Security | relevant input, authorization, secret, and dependency checks | high-impact exploitable issue |
36
+ | Docs/spec | delivered behavior matches the declared baseline or delta | drift or unknown impact |
32
37
 
33
- 1. Detect project type from config (`package.json` / `Cargo.toml` / `go.mod` / `pyproject.toml` / …)
34
- 2. `task.list { status: "completed" }` → confirm ≥1 task delivered
35
- 3. `change.list` → identify the active/blocked change, if any; filter linked
36
- tasks locally by `change_id`
37
- 4. Find test files (suffix `.test.*`, `.spec.*`, `test_*.py`, `*_test.go`)
38
+ Use repository-native commands and real boundaries when practical. Use test doubles
39
+ only at costly or nondeterministic external boundaries, and state why they preserve
40
+ the contract being tested.
38
41
 
39
- Block with instructive error if any precheck fails.
42
+ Inspect tests for tautologies, empty assertions, hidden skips, excessive boundary
43
+ mocking, changed exports without behavioral coverage, and code with no non-test
44
+ consumer. Apply checks by risk and scope rather than forcing every category.
40
45
 
41
- ### Step 1 — Anti-Pattern Detection
46
+ ## Report contract
42
47
 
43
- Detect fake / meaningless tests that waste CI time.
48
+ Write the report atomically with the current full HEAD, change id, context manifest
49
+ hash, exact commands, baseline and final signals, verified public seams, checks, and
50
+ blocking issues. Preserve concise failure excerpts instead of full logs.
44
51
 
45
- | Pattern | Example | Severity |
46
- |---------|---------|----------|
47
- | Tautology | `assert True`, `expect(true).toBe(true)` | CRITICAL |
48
- | Empty test | function body is just `pass` / `{}` | CRITICAL |
49
- | Core-logic mock | `jest.mock()` on domain/service/state files | CRITICAL |
52
+ Set `passed: true` only when every required check passes, the report HEAD is current,
53
+ and at least one declared public seam is verified. A not-applicable check needs a
54
+ specific scope reason.
50
55
 
51
- Use Grep with language-appropriate regex; count matches per file.
56
+ ## Exit
52
57
 
53
- **Gate**: any CRITICAL match → fail.
54
-
55
- ### Step 2 — Coverage Gap Analysis
56
-
57
- Find exported functions / classes with **zero** test references.
58
-
59
- 1. Enumerate exports in `src/` (or language equivalent)
60
- 2. For each symbol, grep test files for its name
61
- 3. Bucket:
62
- - HIGH: core business logic untested
63
- - MEDIUM: utility untested
64
- - LOW: config/constant untested
65
-
66
- **Output**: `.ultra/docs/test-coverage-gaps.md`
67
- **Gate**: any HIGH → fail.
68
-
69
- ### Step 2.5 — Wiring Verification
70
-
71
- Detect orphan code — files that exist and pass tests but are not reachable.
72
-
73
- 1. Enumerate exported symbols in source files
74
- 2. For each export, grep **non-test** source for imports
75
- 3. Report exports with 0 non-test imports as orphaned
76
-
77
- Also check boundary wiring:
78
- - Component → API (fetch/axios targets a real route)
79
- - API → DB (handler imports a real client)
80
- - Form → handler (onSubmit is not `() => {}`)
81
- - State → render (state appears in JSX/template)
82
-
83
- Stub detection (Level-2 substantive):
84
- - Functions returning empty `[]` / `{}` without real work
85
- - `console.log`-only bodies
86
- - Handlers calling only `e.preventDefault()`
87
- - Components returning only `<div>Placeholder</div>`
88
-
89
- **Output**: append to `test-coverage-gaps.md` under `## Wiring Gaps`.
90
- **Gate**: any HIGH orphan or stub → fail.
91
-
92
- ### Step 3 — E2E Testing (conditional)
93
-
94
- **Trigger**: project has web UI or API endpoints.
95
-
96
- 1. Start dev server (detect `scripts.dev` / `scripts.start`)
97
- 2. Navigate key pages/endpoints
98
- 3. Verify elements render; check console errors
99
- 4. Exercise primary user flows
100
-
101
- **Method per runtime**:
102
- - Claude: `mcp__claude-in-chrome__*` or Playwright via Bash
103
- - Others: Playwright via `npx playwright` (CLI portable)
104
-
105
- **Gate**: critical pages fail / major errors → fail.
106
-
107
- ### Step 4 — Performance (conditional, frontend only)
108
-
109
- Lighthouse on dev server. Core Web Vitals gates:
110
- - LCP < 2.5s
111
- - INP < 200ms
112
- - CLS < 0.1
113
-
114
- **Gate**: any metric above threshold → fail.
115
-
116
- ### Step 5 — Security Audit
117
-
118
- Dependency vulnerability scan via project's native tool:
119
- - `npm audit --json` / `pnpm audit --json` / `yarn audit --json`
120
- - `cargo audit --json`
121
- - `pip-audit --format=json`
122
- - `govulncheck ./...`
123
-
124
- **Severity**:
125
- - Critical/High → fail
126
- - Medium → warn
127
- - Low → info
128
-
129
- ### Step 6 — Auto-Fix Loop
130
-
131
- If any gate failed, loop (max 5 attempts):
132
-
133
- 1. Read `blocking_issues`
134
- 2. Fix what is fixable without user input:
135
- - Coverage Gap → write missing tests
136
- - Anti-Pattern → rewrite fake tests
137
- - E2E error → fix the code
138
- - Performance → code-level optimizations (lazy, splitting, memoization)
139
- 3. External blockers (upstream CVE, breaking dep bump) → break, report, ask user
140
- 4. If all gates pass → exit loop
141
-
142
- If max reached → surface remaining issues; `passed=false`.
143
-
144
- ### Step 7 — Persist `.ultra/test-report.json`
145
-
146
- ```jsonc
147
- {
148
- "timestamp": "<ISO8601>",
149
- "git_commit": "<HEAD>",
150
- "change_id": "<active-change-id-or-null>",
151
- "passed": true,
152
- "run_count": 1,
153
- "commands": [
154
- { "command": "<exact command>", "exit_code": 0, "scope": "unit/integration/e2e/build" }
155
- ],
156
- "gates": {
157
- "anti_pattern": { "passed": true, "critical": 0, "warning": 1 },
158
- "coverage_gaps": { "passed": true, "high": 0, "medium": 3, "low": 5 },
159
- "wiring": { "passed": true, "orphans": 0, "stubs": 0 },
160
- "e2e": { "passed": true, "skipped": false },
161
- "performance": { "passed": true, "lcp": 1.8, "inp": 150, "cls": 0.05 },
162
- "security": { "passed": true, "critical": 0, "high": 0, "medium": 2 }
163
- },
164
- "blocking_issues": []
165
- }
166
- ```
167
-
168
- Rules:
169
- - File exists → increment `run_count`
170
- - `passed = true` iff all gates `.passed === true`
171
- - `blocking_issues` lists human-readable strings for any fail
172
- - `commands` records exact executable evidence; prose such as “tests look good”
173
- is not convergence evidence
174
- - when a continuous change is active, `change_id` must match it; never reuse a
175
- report from another change
176
-
177
- ### Step 8 — Report
178
-
179
- Print a compact summary (emoji-free, ≤20 lines). Suggest `/ultra-deliver` only
180
- when `passed=true`.
181
-
182
- ## Quality Gates — summary
183
-
184
- | Gate | Requirement |
185
- |------|-------------|
186
- | Anti-Pattern | 0 critical |
187
- | Coverage Gaps | 0 HIGH |
188
- | Wiring | 0 HIGH orphan, 0 HIGH stub |
189
- | E2E | all flows pass (if applicable) |
190
- | Performance | all Core Web Vitals (if frontend) |
191
- | Security | 0 critical/high |
192
-
193
- ## MCP failure matrix
194
-
195
- | Purpose | MCP tool | CLI fallback |
196
- |---------|----------|--------------|
197
- | Confirm ≥1 completed task | `task.list { status: "completed" }` | none; fail closed |
198
- | Identify active change | `change.list` | none; omit only for initial baseline delivery |
199
- | Confirm risky auto-fix | none | current Host's native user-interaction surface |
200
-
201
- ## What this skill DOES NOT do
202
-
203
- - Does NOT run unit tests (that is `/ultra-dev`)
204
- - Does NOT mutate state.db (auditing is read-only against state)
205
- - Does NOT release or tag (that is `/ultra-deliver`)
206
-
207
- ## Integration
208
-
209
- | | |
210
- |---|---|
211
- | **Input** | Source + test files, state.db (read-only) |
212
- | **Output** | `.ultra/test-report.json` with exact commands/change id, `.ultra/docs/test-coverage-gaps.md` |
213
- | **Next** | `/ultra-deliver` (only when `passed=true`) |
58
+ Call `change.breadcrumb` and return one next action: fix a named blocker, run
59
+ `ultra-review`, or run `ultra-deliver`. A stale report never routes to delivery.
@@ -1,109 +1,51 @@
1
1
  ---
2
2
  name: ultra-think
3
- description: "Deep analysis with adversarial reasoning — Evidence-First + Multi-Perspective + Steel-Man + Pre-Mortem + Sensitivity. Produces a recommendation with confidence bounds."
4
- runtime: all
5
- cli_fallback: "direct user interaction"
3
+ description: Produce an evidence-bounded recommendation or diagnosis for a consequential technical or product question. Use when the decision has material tradeoffs, uncertainty, or failure risk that benefits from explicit stress testing.
6
4
  ---
7
5
 
8
- # ultra-think — Phase 3.6
6
+ # Analyze a consequential question
9
7
 
10
- Reasoning harness for complex decisions / diagnostics / architecture calls.
11
- Enforces Evidence-First labelling and adversarial stress-tests before issuing
12
- a recommendation with explicit confidence.
8
+ Use the smallest reasoning structure that resolves the user's actual decision. Answer
9
+ simple questions directly; do not turn every request into a framework exercise.
13
10
 
14
11
  ## Workflow
15
12
 
16
- ### Step 1 — Scope Check
17
-
18
- If the problem is ambiguous / underspecified, ask up to **3** clarifying
19
- questions through the current Host's native user-interaction surface.
20
- If the problem is simple, **skip the framework**, answer concisely, and mark
21
- downstream steps `completed` with note `"skipped: simple answer path"`.
22
-
23
- ### Step 2 — Evidence Gathering
24
-
25
- Every factual claim about tech/API/best-practices must be verified via:
26
- - Repo source (Read/Grep)
27
- - Official docs (Context7 MCP: `mcp__context7__query-docs`)
28
- - Community (Exa MCP: `mcp__exa__web_search_exa`)
29
- - Web search (fallback)
30
-
31
- Label each assertion:
32
- - **Fact** — verified, cite source (URL / file path)
33
- - **Inference** — deduced from facts (show the derivation chain)
34
- - **Speculation** — unverified; list verification steps the user can run
35
-
36
- **Iron law**: never trade accuracy for speed. Wrong-with-confidence > "I don't know + here's how to check".
37
-
38
- ### Step 3 — Multi-Perspective Analysis
39
-
40
- Generate **≥3 distinct approaches**. For each, apply whichever lenses are relevant:
41
- - **Technical** — feasibility, scalability, security, maintainability
42
- - **Business** — value, cost, time-to-market, competitive advantage
43
- - **User** — needs, experience, edge cases, accessibility
44
- - **System** — integration, dependencies, emergent behaviors
45
-
46
- ### Step 4 — Adversarial Stress-Testing
47
-
48
- Apply all four techniques:
49
-
50
- | Technique | Question |
51
- |-----------|----------|
52
- | **Steel Man** | For the option you're inclined to REJECT, build its strongest possible case. What do you discover? |
53
- | **Pre-Mortem** | Assume the recommended option has failed in 6 months. List the 3 most likely causes. |
54
- | **Sensitivity** | Which single assumption, if wrong, would reverse your recommendation? |
55
- | **Second-Order** | What new problems does the recommendation create 6-12 months out? |
56
-
57
- ### Step 5 — Synthesis
58
-
59
- Recommendation with quantified confidence (0-100%) and explicit uncertainty bounds.
60
-
61
- ## Output Structure (adapt to problem type)
62
-
63
- ### Problem Statement
64
- 1-2 sentences: core decision + key constraints.
65
-
66
- ### Analysis
67
- Deep analysis using relevant lenses from Step 3.
68
-
69
- ### Options Comparison (skip for diagnostic/investigative problems)
70
- | Criterion | Weight | Option A | Option B | Option C |
71
- |-----------|-------:|----------|----------|----------|
72
- Quantified where possible.
73
-
74
- ### Adversarial Findings
75
- - **Strongest counter-argument** (steel man for rejected option)
76
- - **Pre-mortem top risk** (most likely failure + mitigation)
77
- - **Assumption sensitivity** (load-bearing assumption)
78
-
79
- ### Recommendation
80
- - **Choice**: <option>
81
- - **Confidence**: <X>% because <rationale>
82
- - **Key Assumptions**: what must be true
83
- - **What would change my mind**: specific evidence / outcome
84
-
85
- ### Verification Plan
86
- Concrete steps to validate the decision — metrics, tests, time-boxed experiments.
87
-
88
- ### Next Steps
89
- Ordered, actionable items.
90
-
91
- ## MCP → CLI fallback matrix
92
-
93
- | Purpose | MCP tool | CLI fallback |
94
- |---------|----------|--------------|
95
- | Clarifying questions | none | current Host's native user-interaction surface |
96
-
97
- ## What this skill DOES NOT do
98
-
99
- - Does NOT modify state.db or project files
100
- - Does NOT implement the recommendation (that's `/ultra-dev` after `/ultra-plan`)
101
- - Does NOT replace independent review — output is one model's analysis
102
-
103
- ## Integration
104
-
105
- | | |
106
- |---|---|
107
- | **Input** | the problem statement in `$ARGUMENTS`, optional repo context via Read/Grep, docs via Context7/Exa |
108
- | **Output** | structured Markdown report (Chinese per project rule) |
109
- | **Feeds** | decisions captured in `.ultra/specs/architecture.md` via Dual-Write Mode of `/ultra-dev` |
13
+ 1. State the decision, observed symptom, or disputed claim and the constraints that
14
+ could change the answer. Ask only for missing information that materially affects
15
+ the result.
16
+ 2. Gather evidence from the most authoritative available source:
17
+ - current checkout and runtime for repository claims;
18
+ - official primary documentation for product or API behavior;
19
+ - current web sources for unstable external facts.
20
+ 3. Separate verified facts, evidence-backed inferences, and unresolved assumptions.
21
+ Cite the supporting file, command, runtime result, or source near each consequential
22
+ claim.
23
+ 4. For a decision, compare only credible alternatives. Do not invent a fixed number of
24
+ options or assign arbitrary numeric scores. Name the criteria that actually drive
25
+ the choice and explain the tradeoffs.
26
+ 5. For a diagnosis, form falsifiable hypotheses and identify the smallest observation
27
+ that distinguishes them. Do not recommend implementation before the earliest
28
+ incorrect state is supported by evidence.
29
+ 6. Stress-test the leading conclusion with the techniques that fit the problem:
30
+ - strongest counterargument;
31
+ - likely failure scenario and recovery;
32
+ - load-bearing assumption;
33
+ - meaningful second-order effect.
34
+ 7. Return the recommendation or diagnosis, evidence, uncertainty, what would change
35
+ the conclusion, and the smallest verification step.
36
+
37
+ ## Output
38
+
39
+ Adapt the response to the question. Include:
40
+
41
+ - the conclusion first;
42
+ - the decisive evidence and tradeoffs;
43
+ - unresolved uncertainty without false precision;
44
+ - one concrete verification or follow-up action.
45
+
46
+ Use a comparison table only when several alternatives share the same decision
47
+ criteria. Comparisons are an analysis tool, not a required output section.
48
+
49
+ This skill is read-only unless the user separately authorizes writing an analysis
50
+ artifact. It does not update Ultra state, implement the recommendation, or replace an
51
+ independent review.