ultra-builder-pro-cli 0.5.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 (206) hide show
  1. package/.ultra-template/delivery-report.json +9 -0
  2. package/.ultra-template/docs/research/README.md +53 -0
  3. package/.ultra-template/specs/architecture.md +250 -0
  4. package/.ultra-template/specs/discovery.md +248 -0
  5. package/.ultra-template/specs/product.md +223 -0
  6. package/.ultra-template/tasks/contexts/TEMPLATE.md +57 -0
  7. package/.ultra-template/tasks/tasks.json +33 -0
  8. package/.ultra-template/test-report.json +8 -0
  9. package/CHANGELOG.md +194 -0
  10. package/LICENSE +21 -0
  11. package/README.md +187 -0
  12. package/adapters/_shared/codex-assets.cjs +1128 -0
  13. package/adapters/_shared/codex-ultra-tools-entry.cjs +11 -0
  14. package/adapters/_shared/file-ops.cjs +115 -0
  15. package/adapters/_shared/frontmatter.cjs +52 -0
  16. package/adapters/_shared/handbook.cjs +144 -0
  17. package/adapters/_shared/md-to-toml.cjs +54 -0
  18. package/adapters/_shared/path-rewrite.cjs +79 -0
  19. package/adapters/_shared/rtk-detect.cjs +86 -0
  20. package/adapters/_shared/runtime-assets.cjs +70 -0
  21. package/adapters/_shared/settings-merge.cjs +76 -0
  22. package/adapters/_shared/tests/file-ops.test.cjs +54 -0
  23. package/adapters/_shared/tests/frontmatter.test.cjs +47 -0
  24. package/adapters/_shared/tests/handbook.test.cjs +86 -0
  25. package/adapters/_shared/tests/md-to-toml.test.cjs +48 -0
  26. package/adapters/_shared/tests/path-rewrite.test.cjs +60 -0
  27. package/adapters/_shared/tests/resolve-target.test.cjs +85 -0
  28. package/adapters/_shared/tests/rtk-detect.test.cjs +116 -0
  29. package/adapters/_shared/tests/runtime-assets.test.cjs +107 -0
  30. package/adapters/_shared/tests/settings-merge.test.cjs +85 -0
  31. package/adapters/_shared/tests/validate.test.cjs +30 -0
  32. package/adapters/_shared/validate.cjs +24 -0
  33. package/adapters/claude.js +182 -0
  34. package/adapters/codex.js +385 -0
  35. package/adapters/gemini.js +204 -0
  36. package/adapters/opencode.js +506 -0
  37. package/adapters/tests/claude.test.cjs +117 -0
  38. package/adapters/tests/codex-hook.test.cjs +90 -0
  39. package/adapters/tests/codex.test.cjs +356 -0
  40. package/adapters/tests/gemini.test.cjs +112 -0
  41. package/adapters/tests/opencode.test.cjs +246 -0
  42. package/agents/code-reviewer.md +102 -0
  43. package/agents/debugger.md +127 -0
  44. package/agents/review-code.md +125 -0
  45. package/agents/review-comments.md +98 -0
  46. package/agents/review-coordinator.md +146 -0
  47. package/agents/review-design.md +133 -0
  48. package/agents/review-errors.md +87 -0
  49. package/agents/review-tests.md +93 -0
  50. package/agents/tdd-runner.md +92 -0
  51. package/bin/handbook.js +54 -0
  52. package/bin/install.js +254 -0
  53. package/bin/orchestrator.js +214 -0
  54. package/commands/learn.md +41 -0
  55. package/commands/ultra-deliver.md +45 -0
  56. package/commands/ultra-dev.md +50 -0
  57. package/commands/ultra-init.md +51 -0
  58. package/commands/ultra-plan.md +49 -0
  59. package/commands/ultra-research.md +59 -0
  60. package/commands/ultra-status.md +46 -0
  61. package/commands/ultra-test.md +48 -0
  62. package/commands/ultra-think.md +45 -0
  63. package/docs/AGENT-CONTEXT.md +143 -0
  64. package/docs/ARCHITECTURE.md +197 -0
  65. package/docs/COMMIT-HASH-BACKFILL.md +101 -0
  66. package/docs/LEGACY-HERMES.md +1175 -0
  67. package/docs/PLAN.zh-CN.md +1683 -0
  68. package/docs/ROADMAP.md +102 -0
  69. package/docs/RUNTIME-COMPAT-MATRIX.md +98 -0
  70. package/docs/STATE-DB-ACCESS-POLICY.md +109 -0
  71. package/docs/USER-HANDBOOK-CONTRACT.md +61 -0
  72. package/hooks/README.md +24 -0
  73. package/hooks/active_task_context.py +44 -0
  74. package/hooks/adapters/codex.py +302 -0
  75. package/hooks/health_check.py +61 -0
  76. package/hooks/pre_stop_check.py +56 -0
  77. package/hooks/subagent_tracker.py +116 -0
  78. package/hooks/workflow_checkpoint.py +56 -0
  79. package/hooks/workflow_context.py +63 -0
  80. package/hooks/workflow_resume.py +50 -0
  81. package/mcp-server/lib/init-project.cjs +162 -0
  82. package/mcp-server/lib/llm-client.cjs +157 -0
  83. package/mcp-server/lib/llm-client.test.cjs +156 -0
  84. package/mcp-server/lib/plan-store.cjs +96 -0
  85. package/mcp-server/lib/plan-store.test.cjs +132 -0
  86. package/mcp-server/lib/prd-parser.cjs +110 -0
  87. package/mcp-server/lib/prd-parser.test.cjs +171 -0
  88. package/mcp-server/lib/pricing.cjs +53 -0
  89. package/mcp-server/lib/projector.cjs +158 -0
  90. package/mcp-server/lib/state-db.cjs +113 -0
  91. package/mcp-server/lib/state-db.test.cjs +116 -0
  92. package/mcp-server/lib/state-ops.cjs +725 -0
  93. package/mcp-server/lib/task-expander.cjs +123 -0
  94. package/mcp-server/lib/task-expander.test.cjs +253 -0
  95. package/mcp-server/lib/telemetry.cjs +72 -0
  96. package/mcp-server/lib/topo.cjs +131 -0
  97. package/mcp-server/lib/topo.test.cjs +158 -0
  98. package/mcp-server/server.cjs +482 -0
  99. package/mcp-server/tests/circuit-breaker.test.cjs +125 -0
  100. package/mcp-server/tests/commit-hash-flow.test.cjs +117 -0
  101. package/mcp-server/tests/concurrency-update.test.cjs +96 -0
  102. package/mcp-server/tests/concurrency.test.cjs +112 -0
  103. package/mcp-server/tests/db-ops.test.cjs +117 -0
  104. package/mcp-server/tests/init-project.test.cjs +141 -0
  105. package/mcp-server/tests/migrate.test.cjs +144 -0
  106. package/mcp-server/tests/projector.test.cjs +130 -0
  107. package/mcp-server/tests/server-contract.test.cjs +750 -0
  108. package/mcp-server/tests/staleness.test.cjs +190 -0
  109. package/mcp-server/tests/state-ops.test.cjs +286 -0
  110. package/mcp-server/tests/tagged-tasks.test.cjs +163 -0
  111. package/mcp-server/tests/telemetry.test.cjs +205 -0
  112. package/orchestrator/auto-merge.cjs +109 -0
  113. package/orchestrator/code-graph-watcher.cjs +121 -0
  114. package/orchestrator/daemon.cjs +112 -0
  115. package/orchestrator/dispatch-rules.cjs +93 -0
  116. package/orchestrator/parallel-orchestrator.cjs +195 -0
  117. package/orchestrator/planner/expand-prompt.cjs +62 -0
  118. package/orchestrator/planner/expand-prompt.test.cjs +52 -0
  119. package/orchestrator/planner/plan-builder.cjs +116 -0
  120. package/orchestrator/planner/plan-builder.test.cjs +165 -0
  121. package/orchestrator/planner/prd-prompt.cjs +44 -0
  122. package/orchestrator/planner/prd-prompt.test.cjs +30 -0
  123. package/orchestrator/recovery.cjs +70 -0
  124. package/orchestrator/session-runner.cjs +224 -0
  125. package/orchestrator/skill-miner.cjs +133 -0
  126. package/orchestrator/tests/auto-merge.test.cjs +216 -0
  127. package/orchestrator/tests/code-graph-watcher.test.cjs +183 -0
  128. package/orchestrator/tests/daemon.test.cjs +260 -0
  129. package/orchestrator/tests/dispatch-rules.test.cjs +122 -0
  130. package/orchestrator/tests/parallel-orchestrator.test.cjs +233 -0
  131. package/orchestrator/tests/phase-8b-gate.test.cjs +183 -0
  132. package/orchestrator/tests/recovery.test.cjs +190 -0
  133. package/orchestrator/tests/session-runner.test.cjs +314 -0
  134. package/orchestrator/tests/skill-miner.test.cjs +147 -0
  135. package/orchestrator/tests/worktree-manager.test.cjs +148 -0
  136. package/orchestrator/worktree-manager.cjs +131 -0
  137. package/output-styles/coding-vibes.md +67 -0
  138. package/output-styles/structural-thinking.md +61 -0
  139. package/package.json +109 -0
  140. package/settings.json +8 -0
  141. package/skills/cc-collab/SKILL.md +41 -0
  142. package/skills/code-review-expert/SKILL.md +118 -0
  143. package/skills/code-review-expert/references/code-quality-checklist.md +112 -0
  144. package/skills/code-review-expert/references/integration-checklist.md +46 -0
  145. package/skills/code-review-expert/references/removal-plan.md +52 -0
  146. package/skills/code-review-expert/references/security-checklist.md +100 -0
  147. package/skills/code-review-expert/references/solid-checklist.md +65 -0
  148. package/skills/codex-collab/SKILL.md +52 -0
  149. package/skills/codex-collab/evals/evals.json +40 -0
  150. package/skills/gemini-collab/SKILL.md +51 -0
  151. package/skills/gemini-collab/evals/evals.json +42 -0
  152. package/skills/integration-rules/SKILL.md +71 -0
  153. package/skills/learn/SKILL.md +117 -0
  154. package/skills/security-rules/SKILL.md +60 -0
  155. package/skills/testing-rules/SKILL.md +56 -0
  156. package/skills/ultra-deliver/SKILL.md +171 -0
  157. package/skills/ultra-dev/SKILL.md +324 -0
  158. package/skills/ultra-init/SKILL.md +148 -0
  159. package/skills/ultra-plan/SKILL.md +314 -0
  160. package/skills/ultra-research/SKILL.md +156 -0
  161. package/skills/ultra-research/steps/step-00-problem-validation.md +154 -0
  162. package/skills/ultra-research/steps/step-01-opportunity-discovery.md +172 -0
  163. package/skills/ultra-research/steps/step-02-market-assessment.md +195 -0
  164. package/skills/ultra-research/steps/step-03-competitive-landscape.md +197 -0
  165. package/skills/ultra-research/steps/step-04-product-strategy.md +196 -0
  166. package/skills/ultra-research/steps/step-05-assumptions-validation.md +234 -0
  167. package/skills/ultra-research/steps/step-10-user-personas.md +169 -0
  168. package/skills/ultra-research/steps/step-11-user-scenarios.md +181 -0
  169. package/skills/ultra-research/steps/step-20-user-stories.md +156 -0
  170. package/skills/ultra-research/steps/step-21-features-scope.md +157 -0
  171. package/skills/ultra-research/steps/step-22-success-metrics.md +195 -0
  172. package/skills/ultra-research/steps/step-30-architecture-context.md +154 -0
  173. package/skills/ultra-research/steps/step-31-solution-strategy.md +172 -0
  174. package/skills/ultra-research/steps/step-32-building-blocks.md +188 -0
  175. package/skills/ultra-research/steps/step-40-deployment.md +123 -0
  176. package/skills/ultra-research/steps/step-41-quality-risks.md +135 -0
  177. package/skills/ultra-research/steps/step-99-synthesis.md +188 -0
  178. package/skills/ultra-review/SKILL.md +437 -0
  179. package/skills/ultra-review/references/unified-schema.md +127 -0
  180. package/skills/ultra-review/scripts/review_verdict_update.py +99 -0
  181. package/skills/ultra-review/scripts/review_wait.py +120 -0
  182. package/skills/ultra-status/SKILL.md +162 -0
  183. package/skills/ultra-test/SKILL.md +195 -0
  184. package/skills/ultra-think/SKILL.md +109 -0
  185. package/skills/ultra-verify/SKILL.md +111 -0
  186. package/skills/ultra-verify/evals/evals.json +51 -0
  187. package/skills/ultra-verify/references/confidence-system.md +38 -0
  188. package/skills/ultra-verify/references/cross-verify-modes.md +73 -0
  189. package/skills/ultra-verify/scripts/verify_wait.py +131 -0
  190. package/spec/cli-protocol.md +118 -0
  191. package/spec/mcp-tools.yaml +658 -0
  192. package/spec/schemas/command-manifest.schema.json +47 -0
  193. package/spec/schemas/context-file.v4.5.schema.json +54 -0
  194. package/spec/schemas/mcp-tools.schema.json +136 -0
  195. package/spec/schemas/skill-manifest.schema.json +94 -0
  196. package/spec/schemas/state-db.sql +154 -0
  197. package/spec/schemas/tasks.v4.5.schema.json +66 -0
  198. package/ultra-tools/cli.cjs +121 -0
  199. package/ultra-tools/commands/db.cjs +175 -0
  200. package/ultra-tools/commands/legacy-memory.cjs +159 -0
  201. package/ultra-tools/commands/migrate.cjs +354 -0
  202. package/ultra-tools/commands/session.cjs +180 -0
  203. package/ultra-tools/commands/status.cjs +158 -0
  204. package/ultra-tools/commands/task.cjs +95 -0
  205. package/ultra-tools/legacy-memory.test.cjs +80 -0
  206. package/ultra-tools/status-command.test.cjs +132 -0
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env python3
2
+ """Review Wait - File-based completion waiter for /ultra-review pipeline.
3
+
4
+ Polls the session directory for expected review JSON files and/or SUMMARY.json.
5
+ Returns a one-line verdict on stdout. Blocks until complete or timeout.
6
+
7
+ Usage:
8
+ python3 review_wait.py <session_path> agents <count> # Wait for N review-*.json files
9
+ python3 review_wait.py <session_path> summary # Wait for SUMMARY.json only
10
+
11
+ Exit codes:
12
+ 0 - All expected files found
13
+ 1 - Timeout (default 5 minutes)
14
+ 2 - Invalid arguments
15
+ """
16
+
17
+ import glob
18
+ import json
19
+ import sys
20
+ import time
21
+ from pathlib import Path
22
+
23
+ POLL_INTERVAL = 2 # seconds
24
+ DEFAULT_TIMEOUT = 300 # 5 minutes
25
+
26
+
27
+ def wait_for_agents(session_path: Path, expected_count: int, timeout: int) -> bool:
28
+ """Wait for expected_count review-*.json files to appear.
29
+
30
+ Returns structured JSON on stdout:
31
+ - status: "complete" (all agents) or "partial" (>=1 agent on timeout)
32
+ - agents_done / agents_missing: lists of agent names
33
+ - count: number of completed agents
34
+
35
+ Exit code: 0 if all complete OR partial (>=1), 1 if 0 agents.
36
+ """
37
+ all_agents = ["review-code", "review-tests", "review-errors",
38
+ "review-design", "review-comments"]
39
+ deadline = time.monotonic() + timeout
40
+ while time.monotonic() < deadline:
41
+ found = glob.glob(str(session_path / "review-*.json"))
42
+ if len(found) >= expected_count:
43
+ names = [Path(f).stem for f in sorted(found)]
44
+ result = {"status": "complete", "agents_done": names, "agents_missing": [], "count": len(found)}
45
+ print(json.dumps(result))
46
+ return True
47
+ remaining = int(deadline - time.monotonic())
48
+ sys.stderr.write(f"\r Waiting: {len(found)}/{expected_count} ({remaining}s remaining)")
49
+ sys.stderr.flush()
50
+ time.sleep(POLL_INTERVAL)
51
+
52
+ # Timeout — report partial results as structured JSON
53
+ found = glob.glob(str(session_path / "review-*.json"))
54
+ found_names = [Path(f).stem for f in sorted(found)]
55
+ missing = [a for a in all_agents if a not in found_names]
56
+ result = {"status": "partial", "agents_done": found_names, "agents_missing": missing, "count": len(found)}
57
+ print(json.dumps(result))
58
+ return len(found) >= 1 # At least 1 agent = partial success
59
+
60
+
61
+ def wait_for_summary(session_path: Path, timeout: int) -> bool:
62
+ """Wait for SUMMARY.json to appear."""
63
+ summary_path = session_path / "SUMMARY.json"
64
+ deadline = time.monotonic() + timeout
65
+ while time.monotonic() < deadline:
66
+ if summary_path.exists() and summary_path.stat().st_size > 0:
67
+ try:
68
+ data = json.loads(summary_path.read_text(encoding="utf-8"))
69
+ verdict = data.get("verdict", "UNKNOWN")
70
+ p0 = data.get("p0", 0)
71
+ p1 = data.get("p1", 0)
72
+ total = data.get("total", 0)
73
+ print(f"Review complete: {verdict} (P0:{p0} P1:{p1} total:{total})")
74
+ return True
75
+ except (json.JSONDecodeError, KeyError):
76
+ pass # File still being written
77
+ remaining = int(deadline - time.monotonic())
78
+ print(
79
+ f"\r Waiting for coordinator ({remaining}s remaining)",
80
+ end="", flush=True
81
+ )
82
+ time.sleep(POLL_INTERVAL)
83
+
84
+ print("\nTimeout: coordinator did not produce SUMMARY.json")
85
+ return False
86
+
87
+
88
+ def main():
89
+ if len(sys.argv) < 3:
90
+ print(__doc__, file=sys.stderr)
91
+ sys.exit(2)
92
+
93
+ session_path = Path(sys.argv[1])
94
+ mode = sys.argv[2]
95
+
96
+ if not session_path.is_dir():
97
+ print(f"Error: session directory not found: {session_path}", file=sys.stderr)
98
+ sys.exit(2)
99
+
100
+ timeout = DEFAULT_TIMEOUT
101
+
102
+ if mode == "agents":
103
+ if len(sys.argv) < 4:
104
+ print("Error: agents mode requires <count> argument", file=sys.stderr)
105
+ sys.exit(2)
106
+ expected = int(sys.argv[3])
107
+ ok = wait_for_agents(session_path, expected, timeout)
108
+ sys.exit(0 if ok else 1)
109
+
110
+ elif mode == "summary":
111
+ ok = wait_for_summary(session_path, timeout)
112
+ sys.exit(0 if ok else 1)
113
+
114
+ else:
115
+ print(f"Error: unknown mode '{mode}'. Use 'agents' or 'summary'.", file=sys.stderr)
116
+ sys.exit(2)
117
+
118
+
119
+ if __name__ == "__main__":
120
+ main()
@@ -0,0 +1,162 @@
1
+ ---
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
+ cli_fallback: "status --cost --json"
11
+ ---
12
+
13
+ # ultra-status — Phase 3.6
14
+
15
+ Single-call dashboard. Pulls task state from state.db (authoritative), layers
16
+ in `.ultra/test-report.json` + `.ultra/delivery-report.json` (file artifacts),
17
+ reports progress + risks + workflow routing.
18
+
19
+ ## Workflow
20
+
21
+ ### Phase 0 — Environment validation
22
+
23
+ | Check | If missing |
24
+ |-------|-----------|
25
+ | `.ultra/tasks/tasks.json` projection present (or state.db reachable) | suggest `/ultra-init` |
26
+ | At least one task visible via `task.list` | suggest `/ultra-plan` |
27
+ | `task.list` returns valid rows | surface error |
28
+
29
+ ### Phase 1 — Load data
30
+
31
+ ```jsonc
32
+ // MCP: task.list (no filter — get all tasks)
33
+ {}
34
+ // → { tasks: [...], count: N }
35
+
36
+ // MCP: session.list (active sessions; Phase 4.5.4)
37
+ { "status": "running" }
38
+ // → { sessions: [...], count: N }
39
+
40
+ // MCP: session.subscribe_events (recent events for the "last event" panel)
41
+ { "since_id": 0, "limit": 20 }
42
+ // → { events: [...], next_since_id: M }
43
+ ```
44
+
45
+ **CLI fallback**: `ultra-tools task list` + `ultra-tools session list`.
46
+
47
+ Also read:
48
+ - `.ultra/test-report.json` — if present
49
+ - `.ultra/delivery-report.json` — if present
50
+
51
+ Extract:
52
+ - Task stats: by status (`pending`/`in_progress`/`completed`/`blocked`), by priority (P0-P3)
53
+ - Current `in_progress` task, next `pending` task (topological order)
54
+ - Active sessions: count, per-runtime breakdown, orphan warnings
55
+ - Most recent 20 events (by `events.id` DESC) — "last event" panel
56
+ - Test passed / failed / stale (compare `git_commit` to HEAD)
57
+ - Delivery readiness (tag + pushed)
58
+
59
+ ### Phase 2 — Progress report
60
+
61
+ Compact multi-section output:
62
+ - **Overview**: progress bar `[████░░░░] 50%`, completion %, velocity (completed tasks / elapsed days)
63
+ - **Tasks**: counts per status + per priority
64
+ - **Test**: pass/fail, `run_count`, `blocking_issues` if any
65
+ - **Delivery**: `version` + `pushed` + last tag
66
+ - **Risks**: auto-detected list (see Phase 3)
67
+ - **Next**: recommended next task (see Phase 4)
68
+
69
+ ### Phase 3 — Risk detection
70
+
71
+ Auto-detect:
72
+ - **Blockers**: tasks with unsatisfied dependencies
73
+ - **Stalled**: `in_progress` for >3 days (check `updated_at`)
74
+ - **Overdue**: past `estimated_days` from when moved to `in_progress`
75
+ - **Complexity spike**: 3+ consecutive `pending` tasks with complexity ≥7
76
+ - **Test stale**: `test-report.json.git_commit ≠ HEAD`
77
+ - **Orphan sessions**: any session with `lease_expires_at < now()` still status=running
78
+ (uninitialized by orphan-reaper; escalate)
79
+
80
+ | Icon | Meaning | Action |
81
+ |------|---------|--------|
82
+ | 🟢 | on track | continue |
83
+ | 🟡 | minor issues | review stalled |
84
+ | 🟠 | significant risks | address blockers |
85
+ | 🔴 | critical | stop and resolve |
86
+
87
+ ### Phase 4 — Next-task recommendation
88
+
89
+ Select next optimal task by:
90
+ 1. Priority (P0 > P1 > P2 > P3)
91
+ 2. Dependencies resolved (only `pending` with all deps `completed`)
92
+ 3. Complexity sweet spot (prefer 3-5, avoid clustering 7+)
93
+ 4. Context continuity (favor same component as recent completed task)
94
+
95
+ ### Phase 5 — Workflow routing (▶ Next Up)
96
+
97
+ Detect position from artifacts:
98
+
99
+ | Condition | Route |
100
+ |-----------|-------|
101
+ | No `.ultra/` | `/ultra-init` |
102
+ | Specs have `[NEEDS CLARIFICATION]` or missing | `/ultra-research` |
103
+ | No tasks | `/ultra-plan` |
104
+ | Any `pending` | `/ultra-dev` (show which) |
105
+ | All `completed` | `/ultra-test` |
106
+ | `test-report.json.passed === true` | `/ultra-deliver` |
107
+ | `test-report.json.passed === false` | `/ultra-dev` (show blocking issues) |
108
+ | `delivery-report.json` exists + fresh | Done; suggest next milestone |
109
+
110
+ **Safety checks before routing**:
111
+ - Routing to deliver but `test-report.git_commit ≠ HEAD` → warn "Tests stale"
112
+ - `git status --porcelain` non-empty → warn "Uncommitted changes"
113
+
114
+ **Output block**:
115
+ ```markdown
116
+ ---
117
+ ## ▶ Next Up
118
+ **{command}** — {description}
119
+ `/clear` then `/{command}`
120
+ ---
121
+ **Also available**: `/{alt}` — {description}
122
+ ---
123
+ ```
124
+
125
+ ## Single-task mode (`$1` supplied)
126
+
127
+ When `task-id` provided:
128
+ ```jsonc
129
+ // MCP: task.get
130
+ { "id": "<id>" }
131
+ ```
132
+ Display: title, status, priority, complexity, deps, files_modified (if set),
133
+ session_id (if active), `context_file`, `trace_to`, stale flag, update history.
134
+
135
+ ## MCP → CLI fallback matrix
136
+
137
+ | Purpose | MCP tool | CLI fallback |
138
+ |---------|----------|--------------|
139
+ | List tasks | `task.list` | `ultra-tools task list` |
140
+ | Single task detail | `task.get` | `ultra-tools task get <id>` |
141
+ | Cost panel (Phase 6.3) | — | `ultra-tools status --cost --json --since 7d` |
142
+
143
+ ## Cost panel (Phase 6.3)
144
+
145
+ `ultra-tools status --cost --json` returns `{period, by_runtime, top_tasks,
146
+ total_cost_usd}`. Render under the progress section when the user asks
147
+ "how much did we spend?" or `/ultra-status --cost` is invoked. `--since 7d`
148
+ is the conventional weekly window; override with ISO-8601 for custom ranges.
149
+
150
+ ## What this skill DOES NOT do
151
+
152
+ - Does NOT modify state
153
+ - Does NOT run tests / build / deploy
154
+ - Does NOT require all artifacts (partial reports are tolerated)
155
+
156
+ ## Integration
157
+
158
+ | | |
159
+ |---|---|
160
+ | **Input** | state.db (via `task.list`/`task.get`), `test-report.json`, `delivery-report.json`, git HEAD |
161
+ | **Output** | console report (Chinese per project rule) |
162
+ | **When** | anytime — idempotent read-only |
@@ -0,0 +1,195 @@
1
+ ---
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
+ cli_fallback: "task list"
8
+ ---
9
+
10
+ # ultra-test — Phase 3.5
11
+
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.
16
+
17
+ ## Prerequisites
18
+
19
+ - `task.list` returns ≥1 task with `status=completed`
20
+ - Repo has test files (Step 0 pre-check)
21
+
22
+ ## Workflow
23
+
24
+ ### Step 0 — Pre-Execution
25
+
26
+ 1. Detect project type from config (`package.json` / `Cargo.toml` / `go.mod` / `pyproject.toml` / …)
27
+ 2. `task.list { status: "completed" }` → confirm ≥1 task delivered
28
+ 3. Find test files (suffix `.test.*`, `.spec.*`, `test_*.py`, `*_test.go`)
29
+
30
+ Block with instructive error if any precheck fails.
31
+
32
+ ### Step 1 — Anti-Pattern Detection
33
+
34
+ Detect fake / meaningless tests that waste CI time.
35
+
36
+ | Pattern | Example | Severity |
37
+ |---------|---------|----------|
38
+ | Tautology | `assert True`, `expect(true).toBe(true)` | CRITICAL |
39
+ | Empty test | function body is just `pass` / `{}` | CRITICAL |
40
+ | Core-logic mock | `jest.mock()` on domain/service/state files | CRITICAL |
41
+
42
+ Use Grep with language-appropriate regex; count matches per file.
43
+
44
+ **Gate**: any CRITICAL match → fail.
45
+
46
+ ### Step 2 — Coverage Gap Analysis
47
+
48
+ Find exported functions / classes with **zero** test references.
49
+
50
+ 1. Enumerate exports in `src/` (or language equivalent)
51
+ 2. For each symbol, grep test files for its name
52
+ 3. Bucket:
53
+ - HIGH: core business logic untested
54
+ - MEDIUM: utility untested
55
+ - LOW: config/constant untested
56
+
57
+ **Output**: `.ultra/docs/test-coverage-gaps.md`
58
+ **Gate**: any HIGH → fail.
59
+
60
+ ### Step 2.5 — Wiring Verification
61
+
62
+ Detect orphan code — files that exist and pass tests but are not reachable.
63
+
64
+ 1. Enumerate exported symbols in source files
65
+ 2. For each export, grep **non-test** source for imports
66
+ 3. Report exports with 0 non-test imports as orphaned
67
+
68
+ Also check boundary wiring:
69
+ - Component → API (fetch/axios targets a real route)
70
+ - API → DB (handler imports a real client)
71
+ - Form → handler (onSubmit is not `() => {}`)
72
+ - State → render (state appears in JSX/template)
73
+
74
+ Stub detection (Level-2 substantive):
75
+ - Functions returning empty `[]` / `{}` without real work
76
+ - `console.log`-only bodies
77
+ - Handlers calling only `e.preventDefault()`
78
+ - Components returning only `<div>Placeholder</div>`
79
+
80
+ **Output**: append to `test-coverage-gaps.md` under `## Wiring Gaps`.
81
+ **Gate**: any HIGH orphan or stub → fail.
82
+
83
+ ### Step 3 — E2E Testing (conditional)
84
+
85
+ **Trigger**: project has web UI or API endpoints.
86
+
87
+ 1. Start dev server (detect `scripts.dev` / `scripts.start`)
88
+ 2. Navigate key pages/endpoints
89
+ 3. Verify elements render; check console errors
90
+ 4. Exercise primary user flows
91
+
92
+ **Method per runtime**:
93
+ - Claude: `mcp__claude-in-chrome__*` or Playwright via Bash
94
+ - Others: Playwright via `npx playwright` (CLI portable)
95
+
96
+ **Gate**: critical pages fail / major errors → fail.
97
+
98
+ ### Step 4 — Performance (conditional, frontend only)
99
+
100
+ Lighthouse on dev server. Core Web Vitals gates:
101
+ - LCP < 2.5s
102
+ - INP < 200ms
103
+ - CLS < 0.1
104
+
105
+ **Gate**: any metric above threshold → fail.
106
+
107
+ ### Step 5 — Security Audit
108
+
109
+ Dependency vulnerability scan via project's native tool:
110
+ - `npm audit --json` / `pnpm audit --json` / `yarn audit --json`
111
+ - `cargo audit --json`
112
+ - `pip-audit --format=json`
113
+ - `govulncheck ./...`
114
+
115
+ **Severity**:
116
+ - Critical/High → fail
117
+ - Medium → warn
118
+ - Low → info
119
+
120
+ ### Step 6 — Auto-Fix Loop
121
+
122
+ If any gate failed, loop (max 5 attempts):
123
+
124
+ 1. Read `blocking_issues`
125
+ 2. Fix what is fixable without user input:
126
+ - Coverage Gap → write missing tests
127
+ - Anti-Pattern → rewrite fake tests
128
+ - E2E error → fix the code
129
+ - Performance → code-level optimizations (lazy, splitting, memoization)
130
+ 3. External blockers (upstream CVE, breaking dep bump) → break, report, ask user
131
+ 4. If all gates pass → exit loop
132
+
133
+ If max reached → surface remaining issues; `passed=false`.
134
+
135
+ ### Step 7 — Persist `.ultra/test-report.json`
136
+
137
+ ```jsonc
138
+ {
139
+ "timestamp": "<ISO8601>",
140
+ "git_commit": "<HEAD>",
141
+ "passed": true,
142
+ "run_count": 1,
143
+ "gates": {
144
+ "anti_pattern": { "passed": true, "critical": 0, "warning": 1 },
145
+ "coverage_gaps": { "passed": true, "high": 0, "medium": 3, "low": 5 },
146
+ "wiring": { "passed": true, "orphans": 0, "stubs": 0 },
147
+ "e2e": { "passed": true, "skipped": false },
148
+ "performance": { "passed": true, "lcp": 1.8, "inp": 150, "cls": 0.05 },
149
+ "security": { "passed": true, "critical": 0, "high": 0, "medium": 2 }
150
+ },
151
+ "blocking_issues": []
152
+ }
153
+ ```
154
+
155
+ Rules:
156
+ - File exists → increment `run_count`
157
+ - `passed = true` iff all gates `.passed === true`
158
+ - `blocking_issues` lists human-readable strings for any fail
159
+
160
+ ### Step 8 — Report
161
+
162
+ Print a compact summary (emoji-free, ≤20 lines). Suggest `/ultra-deliver` only
163
+ when `passed=true`.
164
+
165
+ ## Quality Gates — summary
166
+
167
+ | Gate | Requirement |
168
+ |------|-------------|
169
+ | Anti-Pattern | 0 critical |
170
+ | Coverage Gaps | 0 HIGH |
171
+ | Wiring | 0 HIGH orphan, 0 HIGH stub |
172
+ | E2E | all flows pass (if applicable) |
173
+ | Performance | all Core Web Vitals (if frontend) |
174
+ | Security | 0 critical/high |
175
+
176
+ ## MCP → CLI fallback matrix
177
+
178
+ | Purpose | MCP tool | CLI fallback |
179
+ |---------|----------|--------------|
180
+ | Confirm ≥1 completed task | `task.list { status: "completed" }` | `ultra-tools task list --status completed` |
181
+ | Confirm risky auto-fix | none | current Host's native user-interaction surface |
182
+
183
+ ## What this skill DOES NOT do
184
+
185
+ - Does NOT run unit tests (that is `/ultra-dev`)
186
+ - Does NOT mutate state.db (auditing is read-only against state)
187
+ - Does NOT release or tag (that is `/ultra-deliver`)
188
+
189
+ ## Integration
190
+
191
+ | | |
192
+ |---|---|
193
+ | **Input** | Source + test files, state.db (read-only) |
194
+ | **Output** | `.ultra/test-report.json`, `.ultra/docs/test-coverage-gaps.md` |
195
+ | **Next** | `/ultra-deliver` (only when `passed=true`) |
@@ -0,0 +1,109 @@
1
+ ---
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"
6
+ ---
7
+
8
+ # ultra-think — Phase 3.6
9
+
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.
13
+
14
+ ## Workflow
15
+
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` |
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: ultra-verify
3
+ description: Run three-way verification with the current host as primary and read-only Gemini and Codex advisors, then verify and synthesize the evidence.
4
+ ---
5
+
6
+ # Ultra Verify — Three-Way Verification
7
+
8
+ Claude Code remains primary. It writes the first independent analysis, verifies consequential
9
+ claims, and owns the final answer. Gemini and Codex are untrusted read-only advisors. Use this
10
+ workflow only when the user explicitly asks for cross-model or three-way verification.
11
+
12
+ ## Modes
13
+
14
+ - `decision <question>`: architecture or product decision.
15
+ - `diagnose <symptoms>`: independent root-cause hypotheses.
16
+ - `audit <scope>`: evidence-backed findings.
17
+ - `estimate <task>`: estimates with explicit assumptions.
18
+
19
+ ## Preconditions
20
+
21
+ 1. Confirm `gemini --version` and `codex --version` plus authentication.
22
+ 2. Define the exact workspace, question, evidence standard, and response shape.
23
+ 3. Do not send secrets, unrelated files, or an unbounded home directory.
24
+ 4. Track the four workflow steps in the current host plan: primary analysis, advisor launch,
25
+ completion wait, and verified synthesis.
26
+
27
+ ## 1. Create the session and write the primary view
28
+
29
+ ```bash
30
+ SESSION_ID="$(date +%Y%m%d-%H%M%S)-verify-<mode>"
31
+ SESSION_PATH=".ultra/collab/${SESSION_ID}"
32
+ mkdir -p "${SESSION_PATH}"
33
+ ```
34
+
35
+ Write Claude Code's evidence-backed analysis to `${SESSION_PATH}/claude-analysis.md` before
36
+ reading either advisor. Record the mode, checkout, scope, and evidence boundary.
37
+
38
+ ## 2. Launch both advisors read-only
39
+
40
+ Give both advisors the same bounded raw question and evidence, without the primary conclusion.
41
+ Launch them concurrently when the host supports independent shell sessions; otherwise start both
42
+ before collecting either result.
43
+
44
+ Gemini:
45
+
46
+ ```bash
47
+ gemini --approval-mode plan \
48
+ --output-format text \
49
+ -p "<bounded prompt>" \
50
+ > "${SESSION_PATH}/gemini-output.md" \
51
+ 2> "${SESSION_PATH}/gemini-error.log"
52
+ ```
53
+
54
+ Codex:
55
+
56
+ ```bash
57
+ codex exec -s read-only \
58
+ -o "${SESSION_PATH}/codex-output.md" \
59
+ "<bounded prompt>" \
60
+ 2> "${SESSION_PATH}/codex-error.log"
61
+ ```
62
+
63
+ Never enable auto-edit, write-capable automation, danger-full-access, or permission bypass for
64
+ either advisor.
65
+
66
+ ## 3. Wait for completed outputs
67
+
68
+ Run the bundled waiter in an asynchronous or yielded shell session and poll it at bounded
69
+ intervals; never hold one blocking tool call longer than 60 seconds.
70
+
71
+ ```bash
72
+ python3 "$CLAUDE_PLUGIN_ROOT/skills/ultra-verify/scripts/verify_wait.py" \
73
+ "${SESSION_PATH}" --timeout 1200
74
+ ```
75
+
76
+ The waiter reports each advisor as `complete`, `failed`, `empty`, or `pending`. Read an advisor
77
+ output only after the corresponding status is `complete` and the file is non-empty. Preserve its
78
+ error log when it fails.
79
+
80
+ ## 4. Verify and synthesize
81
+
82
+ Compare `claude-analysis.md` with each completed advisor output:
83
+
84
+ 1. Verify claims against the current checkout, tests, runtime, or primary documentation.
85
+ 2. Separate consensus, majority views, useful dissent, and unsupported assertions.
86
+ 3. Explain scope, version, and assumption differences before scoring agreement.
87
+ 4. Write `synthesis.md` and `metadata.json`, then return one Claude Code-owned conclusion.
88
+
89
+ Use `references/confidence-system.md` for scoring and
90
+ `references/cross-verify-modes.md` for mode-specific evidence expectations. Model agreement never
91
+ overrides failing tests or authoritative runtime evidence.
92
+
93
+ ## Degraded operation
94
+
95
+ - One advisor fails: continue with the primary view plus the available advisor and name the gap.
96
+ - Both advisors fail: return primary-only analysis with an explicit single-source warning.
97
+ - Never block the underlying user task solely because an advisor is absent, unauthenticated, or
98
+ slow.
99
+
100
+ ## Session files
101
+
102
+ ```text
103
+ .ultra/collab/<SESSION_ID>/
104
+ claude-analysis.md
105
+ gemini-output.md
106
+ gemini-error.log
107
+ codex-output.md
108
+ codex-error.log
109
+ metadata.json
110
+ synthesis.md
111
+ ```