ultra-builder-pro-cli 0.25.1 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/.ultra-template/changes/abandoned/.gitkeep +0 -0
  2. package/.ultra-template/contexts/TEMPLATE.md +94 -0
  3. package/.ultra-template/decisions/.gitkeep +1 -0
  4. package/.ultra-template/evidence/.gitkeep +1 -0
  5. package/.ultra-template/north-star.md +46 -0
  6. package/.ultra-template/research/.gitkeep +1 -0
  7. package/.ultra-template/specs/discovery.md +2 -2
  8. package/.ultra-template/tasks.json +3 -0
  9. package/.ultra-template/test-report.json +27 -0
  10. package/CHANGELOG.md +107 -1
  11. package/README.md +217 -579
  12. package/adapters/_shared/delegate-profiles/kimi-read-only.md +15 -0
  13. package/adapters/_shared/delegate-profiles/kimi-write.md +17 -0
  14. package/adapters/_shared/file-ops.cjs +76 -2
  15. package/adapters/_shared/host-profile.cjs +97 -0
  16. package/adapters/_shared/plugin-core.cjs +204 -0
  17. package/adapters/_shared/runtime-assets.cjs +31 -96
  18. package/adapters/claude.js +92 -291
  19. package/adapters/codex.js +309 -842
  20. package/adapters/grok.js +143 -1469
  21. package/adapters/kimi.js +124 -1053
  22. package/adapters/opencode.js +230 -742
  23. package/bin/delegate-worker.cjs +328 -0
  24. package/bin/delegate.cjs +463 -0
  25. package/bin/install.js +38 -11
  26. package/docs/ARCHITECTURE.md +125 -216
  27. package/docs/ARTIFACT-AUTHORITY.md +90 -268
  28. package/docs/DECISIONS.md +77 -87
  29. package/docs/PHILOSOPHY.md +208 -0
  30. package/docs/PLUGIN-ISOLATION-CONTRACT.md +65 -39
  31. package/docs/RUNTIME-COMPAT-MATRIX.md +140 -155
  32. package/docs/SKILL-AUTHORING.md +94 -73
  33. package/docs/WORKFLOW-LIFECYCLE.md +97 -189
  34. package/hooks/README.md +19 -37
  35. package/hooks/_common.py +113 -0
  36. package/hooks/adapters/codex.py +9 -16
  37. package/hooks/adapters/grok.py +5 -5
  38. package/hooks/adapters/kimi.py +8 -14
  39. package/hooks/block_dangerous_commands.py +201 -0
  40. package/hooks/compact_context.py +65 -0
  41. package/hooks/mid_workflow_recall.py +25 -0
  42. package/hooks/post_edit_guard.py +105 -0
  43. package/hooks/session_context.py +30 -0
  44. package/package.json +17 -52
  45. package/skills/ultra-change/SKILL.md +115 -50
  46. package/skills/ultra-change/references/change-contract.md +68 -3
  47. package/skills/ultra-delegate/SKILL.md +89 -0
  48. package/skills/ultra-delegate/references/delegation-contract.md +59 -0
  49. package/skills/ultra-delegate/scripts/delegate_wait.py +86 -0
  50. package/skills/ultra-deliver/SKILL.md +98 -42
  51. package/skills/ultra-deliver/references/baseline-reconciliation.md +39 -20
  52. package/skills/ultra-dev/SKILL.md +115 -62
  53. package/skills/ultra-dev/references/debugging.md +22 -0
  54. package/skills/ultra-domain-modeling/SKILL.md +79 -0
  55. package/skills/ultra-grilling/SKILL.md +118 -0
  56. package/skills/ultra-grilling/references/reframing.md +72 -0
  57. package/skills/ultra-init/SKILL.md +102 -37
  58. package/skills/ultra-init/references/brownfield-adoption.md +33 -83
  59. package/skills/ultra-init/scripts/init_project.cjs +84 -0
  60. package/skills/ultra-plan/SKILL.md +101 -68
  61. package/skills/ultra-research/SKILL.md +68 -48
  62. package/skills/ultra-research/references/00-problem-validation.md +5 -5
  63. package/skills/ultra-research/references/01-opportunity-discovery.md +3 -3
  64. package/skills/ultra-research/references/02-market-assessment.md +5 -4
  65. package/skills/ultra-research/references/03-competitive-landscape.md +3 -3
  66. package/skills/ultra-research/references/04-product-strategy.md +3 -3
  67. package/skills/ultra-research/references/05-assumptions-validation.md +5 -5
  68. package/skills/ultra-research/references/10-user-personas.md +3 -2
  69. package/skills/ultra-research/references/11-user-scenarios.md +3 -3
  70. package/skills/ultra-research/references/20-user-stories.md +4 -3
  71. package/skills/ultra-research/references/21-features-scope.md +3 -2
  72. package/skills/ultra-research/references/22-success-metrics.md +3 -3
  73. package/skills/ultra-research/references/30-architecture-context.md +3 -3
  74. package/skills/ultra-research/references/31-solution-strategy.md +3 -3
  75. package/skills/ultra-research/references/32-building-blocks.md +3 -3
  76. package/skills/ultra-research/references/40-deployment.md +3 -3
  77. package/skills/ultra-research/references/41-quality-risks.md +3 -3
  78. package/skills/ultra-research/references/99-synthesis.md +7 -7
  79. package/skills/ultra-review/SKILL.md +84 -32
  80. package/skills/ultra-review/references/code.md +17 -0
  81. package/skills/ultra-review/references/comments.md +12 -0
  82. package/skills/ultra-review/references/design.md +12 -0
  83. package/skills/ultra-review/references/errors.md +13 -0
  84. package/skills/ultra-review/references/spec.md +13 -0
  85. package/skills/ultra-review/references/tests.md +12 -0
  86. package/skills/ultra-review/references/worker-packet.md +40 -0
  87. package/skills/ultra-review/scripts/review_wait.py +26 -15
  88. package/skills/ultra-status/SKILL.md +61 -36
  89. package/skills/ultra-tdd/SKILL.md +81 -0
  90. package/skills/ultra-tdd/references/templates/README.md +20 -0
  91. package/skills/ultra-tdd/references/templates/feature-flag-default-audit.sh +79 -0
  92. package/skills/ultra-tdd/references/templates/persistence-real.ts +78 -0
  93. package/skills/ultra-tdd/references/templates/testcontainer-postgres.py +78 -0
  94. package/skills/ultra-tdd/references/templates/testcontainer-postgres.ts +73 -0
  95. package/skills/ultra-tdd/references/templates/vertical-slice.ts +66 -0
  96. package/skills/ultra-tdd/references/test-execution.md +18 -0
  97. package/skills/ultra-test/SKILL.md +75 -30
  98. package/skills/ultra-test/references/export-syntax.md +18 -0
  99. package/skills/ultra-test/scripts/worktree_digest.cjs +54 -0
  100. package/skills/ultra-think/SKILL.md +49 -27
  101. package/skills/ultra-think/references/autonomy-boundary.md +48 -0
  102. package/skills/ultra-think/references/interaction-boundary.md +18 -33
  103. package/.ultra-template/docs/research/README.md +0 -55
  104. package/.ultra-template/reports/templates/delivery-report.json +0 -17
  105. package/.ultra-template/reports/templates/test-report.json +0 -18
  106. package/.ultra-template/tasks/tasks.json +0 -15
  107. package/.ultra-template/templates/task-context.md +0 -19
  108. package/adapters/_shared/codex-assets.cjs +0 -725
  109. package/adapters/_shared/codex-ultra-tools-entry.cjs +0 -11
  110. package/adapters/_shared/interaction-contract.cjs +0 -129
  111. package/adapters/_shared/path-rewrite.cjs +0 -79
  112. package/adapters/_shared/runtime-native.cjs +0 -132
  113. package/adapters/_shared/settings-merge.cjs +0 -76
  114. package/agents/code-reviewer.md +0 -42
  115. package/agents/debugger.md +0 -40
  116. package/agents/review-code.md +0 -49
  117. package/agents/review-comments.md +0 -38
  118. package/agents/review-coordinator.md +0 -56
  119. package/agents/review-design.md +0 -40
  120. package/agents/review-errors.md +0 -43
  121. package/agents/review-spec.md +0 -39
  122. package/agents/review-tests.md +0 -40
  123. package/agents/tdd-runner.md +0 -38
  124. package/bin/orchestrator.js +0 -383
  125. package/commands/ultra-change.md +0 -10
  126. package/commands/ultra-deliver.md +0 -10
  127. package/commands/ultra-dev.md +0 -10
  128. package/commands/ultra-doctor.md +0 -10
  129. package/commands/ultra-init.md +0 -10
  130. package/commands/ultra-plan.md +0 -10
  131. package/commands/ultra-research.md +0 -10
  132. package/commands/ultra-review.md +0 -10
  133. package/commands/ultra-status.md +0 -10
  134. package/commands/ultra-test.md +0 -10
  135. package/commands/ultra-think.md +0 -10
  136. package/docs/AGENT-CONTEXT.md +0 -191
  137. package/docs/COMMIT-HASH-BACKFILL.md +0 -51
  138. package/docs/LEGACY-CLI-CROSSWALK.md +0 -175
  139. package/docs/ROADMAP.md +0 -101
  140. package/docs/STATE-DB-ACCESS-POLICY.md +0 -161
  141. package/hooks/active_task_context.py +0 -152
  142. package/hooks/context_envelope.py +0 -100
  143. package/hooks/health_check.py +0 -196
  144. package/hooks/pre_stop_check.py +0 -66
  145. package/hooks/runtime_paths.py +0 -396
  146. package/hooks/subagent_tracker.py +0 -88
  147. package/hooks/workflow_checkpoint.py +0 -76
  148. package/hooks/workflow_context.py +0 -48
  149. package/hooks/workflow_resume.py +0 -84
  150. package/mcp-server/hook-context.cjs +0 -38
  151. package/mcp-server/hook-event.cjs +0 -34
  152. package/mcp-server/lib/archive-journal.cjs +0 -1119
  153. package/mcp-server/lib/archive-mutation-worker.py +0 -365
  154. package/mcp-server/lib/artifact-registry.cjs +0 -1232
  155. package/mcp-server/lib/baseline-workflow.cjs +0 -1193
  156. package/mcp-server/lib/canonical-json.cjs +0 -19
  157. package/mcp-server/lib/change-authority.cjs +0 -26
  158. package/mcp-server/lib/change-packet.cjs +0 -790
  159. package/mcp-server/lib/change-workflow.cjs +0 -65
  160. package/mcp-server/lib/context-envelope.cjs +0 -581
  161. package/mcp-server/lib/context-paths.cjs +0 -142
  162. package/mcp-server/lib/decision-records.cjs +0 -423
  163. package/mcp-server/lib/delivery-transaction.cjs +0 -471
  164. package/mcp-server/lib/doctor-backup-worker.cjs +0 -328
  165. package/mcp-server/lib/doctor.cjs +0 -627
  166. package/mcp-server/lib/git-bootstrap.cjs +0 -651
  167. package/mcp-server/lib/init-project.cjs +0 -1021
  168. package/mcp-server/lib/kernel-change-workflow.cjs +0 -2029
  169. package/mcp-server/lib/legacy-change-workflow.cjs +0 -3032
  170. package/mcp-server/lib/managed-file-write.cjs +0 -172
  171. package/mcp-server/lib/plan-checkpoint.cjs +0 -177
  172. package/mcp-server/lib/plan-publication-worker.cjs +0 -830
  173. package/mcp-server/lib/plan-store.cjs +0 -794
  174. package/mcp-server/lib/prd-parser.cjs +0 -83
  175. package/mcp-server/lib/pricing.cjs +0 -44
  176. package/mcp-server/lib/project-context.cjs +0 -178
  177. package/mcp-server/lib/projector.cjs +0 -386
  178. package/mcp-server/lib/provider-refs.cjs +0 -42
  179. package/mcp-server/lib/runtime-paths.cjs +0 -1714
  180. package/mcp-server/lib/runtime-state.cjs +0 -222
  181. package/mcp-server/lib/safe-project-file.cjs +0 -385
  182. package/mcp-server/lib/stage-checkpoints.cjs +0 -463
  183. package/mcp-server/lib/state-authority.cjs +0 -95
  184. package/mcp-server/lib/state-db.cjs +0 -1580
  185. package/mcp-server/lib/state-ops.cjs +0 -1428
  186. package/mcp-server/lib/task-contract.cjs +0 -404
  187. package/mcp-server/lib/task-expander.cjs +0 -105
  188. package/mcp-server/lib/task-ledger.cjs +0 -1964
  189. package/mcp-server/lib/telemetry.cjs +0 -85
  190. package/mcp-server/lib/topo.cjs +0 -131
  191. package/mcp-server/lib/ultra-facade.cjs +0 -2684
  192. package/mcp-server/lib/worker-packet.cjs +0 -358
  193. package/mcp-server/server.cjs +0 -437
  194. package/orchestrator/auto-merge.cjs +0 -128
  195. package/orchestrator/daemon.cjs +0 -264
  196. package/orchestrator/dispatch-rules.cjs +0 -78
  197. package/orchestrator/parallel-orchestrator.cjs +0 -903
  198. package/orchestrator/planner/plan-builder.cjs +0 -125
  199. package/orchestrator/recovery.cjs +0 -188
  200. package/orchestrator/session-close-journal-worker.cjs +0 -5
  201. package/orchestrator/session-close-journal.cjs +0 -1014
  202. package/orchestrator/session-runner.cjs +0 -1153
  203. package/orchestrator/worktree-manager.cjs +0 -282
  204. package/settings.json +0 -7
  205. package/skills/cc-collab/SKILL.md +0 -42
  206. package/skills/code-review-expert/SKILL.md +0 -43
  207. package/skills/code-review-expert/references/correctness-reliability.md +0 -30
  208. package/skills/code-review-expert/references/design-boundaries.md +0 -26
  209. package/skills/code-review-expert/references/removal-plan.md +0 -24
  210. package/skills/codex-collab/SKILL.md +0 -49
  211. package/skills/codex-collab/evals/evals.json +0 -35
  212. package/skills/integration-rules/SKILL.md +0 -32
  213. package/skills/security-rules/SKILL.md +0 -38
  214. package/skills/testing-rules/SKILL.md +0 -32
  215. package/skills/ultra-doctor/SKILL.md +0 -41
  216. package/skills/ultra-plan/references/semantic-preflight.md +0 -20
  217. package/skills/ultra-verify/SKILL.md +0 -46
  218. package/skills/ultra-verify/evals/evals.json +0 -46
  219. package/skills/ultra-verify/references/cross-verify-modes.md +0 -28
  220. package/skills/ultra-verify/references/evidence-status.md +0 -21
  221. package/skills/ultra-verify/scripts/verify_wait.py +0 -94
  222. package/spec/cli-protocol.md +0 -102
  223. package/spec/mcp-tools.yaml +0 -312
  224. package/spec/schemas/baseline-reconciliation.v1.schema.json +0 -73
  225. package/spec/schemas/change-delta.v1.schema.json +0 -153
  226. package/spec/schemas/command-manifest.schema.json +0 -29
  227. package/spec/schemas/context-file.v4.5.schema.json +0 -54
  228. package/spec/schemas/delivery-report.v1.schema.json +0 -66
  229. package/spec/schemas/documentation-reconciliation.v1.schema.json +0 -106
  230. package/spec/schemas/mcp-tools.schema.json +0 -136
  231. package/spec/schemas/skill-manifest.schema.json +0 -24
  232. package/spec/schemas/state-db.sql +0 -641
  233. package/spec/schemas/task-ledger.v2.schema.json +0 -296
  234. package/spec/schemas/tasks.v4.5.schema.json +0 -96
  235. package/spec/schemas/test-report.v1.schema.json +0 -225
  236. package/ultra-tools/cli.cjs +0 -129
  237. package/ultra-tools/commands/db.cjs +0 -226
  238. package/ultra-tools/commands/legacy-memory.cjs +0 -159
  239. package/ultra-tools/commands/migrate.cjs +0 -1386
  240. package/ultra-tools/commands/session.cjs +0 -213
  241. package/ultra-tools/commands/status.cjs +0 -559
  242. package/ultra-tools/commands/system.cjs +0 -498
  243. package/ultra-tools/commands/task.cjs +0 -105
@@ -1,282 +0,0 @@
1
- 'use strict';
2
-
3
- // Phase 8B.3 — N-concurrent git worktree registry.
4
- //
5
- // Wraps session-runner's single-session gitWorktreeAdd/Remove with:
6
- // • allocate({repoRoot, sid, baseRef}) — create .ultra/.runtime/worktrees/<sid>
7
- // • release({repoRoot, worktree_path}) — remove one
8
- // • listActive(repoRoot) — scan git + filter our domain
9
- // • releaseAll(repoRoot) — batch cleanup (crash recovery)
10
- //
11
- // Node single-thread execFileSync naturally serializes git calls, so
12
- // `.git/config.lock` contention is a non-issue within one process. If the
13
- // parallel orchestrator (8B.2) ever switches to async git spawning, an
14
- // async mutex can be layered here without changing the API.
15
-
16
- const fs = require('node:fs');
17
- const path = require('node:path');
18
- const { execFileSync } = require('node:child_process');
19
- const Database = require('better-sqlite3');
20
-
21
- const runtimePaths = require('../mcp-server/lib/runtime-paths.cjs');
22
- const gitBootstrap = require('../mcp-server/lib/git-bootstrap.cjs');
23
- const { SessionRunnerError, _internal } = require('./session-runner.cjs');
24
-
25
- const WORKTREE_DOMAIN = path.join(runtimePaths.RUNTIME_RELATIVE_DIR, 'worktrees');
26
-
27
- function worktreePath(repoRoot, sid) {
28
- _internal.assertSessionId(sid);
29
- return _internal.assertManagedWorktreePath(
30
- repoRoot,
31
- path.join(repoRoot, WORKTREE_DOMAIN, sid),
32
- { sid },
33
- );
34
- }
35
-
36
- function allocate({ repoRoot, sid, baseRef = 'HEAD' }) {
37
- if (!repoRoot) throw new Error('allocate: repoRoot required');
38
- if (!sid) throw new Error('allocate: sid required');
39
- const authority = runtimePaths.ensureRuntimeState(repoRoot, {
40
- admitStorageBoundary: () => gitBootstrap.ensureExistingProjectStorageBoundary(repoRoot),
41
- });
42
- const wt = worktreePath(repoRoot, sid);
43
- _internal.gitWorktreeAdd(repoRoot, wt, baseRef); // throws WORKTREE_FAILED
44
- try {
45
- _internal.linkAuthorityIntoWorktree(repoRoot, wt, { authority });
46
- return { worktree_path: wt, authority_db_path: authority.stateDbPath };
47
- } catch (error) {
48
- try { fs.rmSync(path.join(wt, '.ultra', '.runtime'), { force: true }); }
49
- catch { /* best effort */ }
50
- try { _internal.gitWorktreeRemove(repoRoot, wt); }
51
- catch { /* original authority error is more actionable */ }
52
- throw error;
53
- }
54
- }
55
-
56
- function sessionRemovalBlocker(repoRoot, sid, worktreePath) {
57
- const dbPath = runtimePaths.pathsFor(repoRoot).stateDbPath;
58
- if (!fs.existsSync(dbPath)) return null;
59
- const db = new Database(dbPath, { readonly: true, fileMustExist: true });
60
- try {
61
- const rows = db.prepare(
62
- 'SELECT sid, status, worktree_path FROM sessions WHERE sid = ?',
63
- ).all(sid);
64
- for (const row of rows) {
65
- let recorded;
66
- let requested;
67
- try { recorded = fs.realpathSync(row.worktree_path); }
68
- catch { recorded = path.resolve(row.worktree_path); }
69
- try { requested = fs.realpathSync(worktreePath); }
70
- catch { requested = path.resolve(worktreePath); }
71
- if (recorded !== requested) {
72
- return `session ${sid} is bound to a different worktree`;
73
- }
74
- if (!['completed', 'crashed'].includes(row.status)) {
75
- return `session ${sid} is nonterminal (${row.status})`;
76
- }
77
- }
78
- return null;
79
- } finally {
80
- db.close();
81
- }
82
- }
83
-
84
- function release({ repoRoot, worktree_path, sid = null }) {
85
- if (!repoRoot) throw new Error('release: repoRoot required');
86
- if (!worktree_path) throw new Error('release: worktree_path required');
87
- const expectedSid = sid === null ? path.basename(worktree_path) : sid;
88
- _internal.assertSessionId(expectedSid);
89
- const managedPath = _internal.assertManagedWorktreePath(
90
- repoRoot, worktree_path, { sid: expectedSid },
91
- );
92
- const sessionBlocker = sessionRemovalBlocker(
93
- repoRoot, expectedSid, managedPath,
94
- );
95
- const integrationBlocker = _internal.worktreeRemovalBlocker(repoRoot, managedPath);
96
- const blocker = sessionBlocker || integrationBlocker;
97
- if (blocker) {
98
- throw new SessionRunnerError(
99
- 'WORKTREE_NOT_INTEGRATED',
100
- `refusing to remove ${managedPath}: ${blocker}`,
101
- );
102
- }
103
- _internal.gitWorktreeRemove(repoRoot, managedPath);
104
- }
105
-
106
- function parsePorcelain(text) {
107
- const entries = [];
108
- let current = {};
109
- for (const raw of text.split('\n')) {
110
- const line = raw.trimEnd();
111
- if (line.startsWith('worktree ')) {
112
- if (current.worktree) entries.push(current);
113
- current = { worktree: line.slice('worktree '.length) };
114
- } else if (line.startsWith('HEAD ')) {
115
- current.head = line.slice('HEAD '.length);
116
- } else if (line.startsWith('branch ')) {
117
- current.branch = line.slice('branch '.length);
118
- } else if (line === 'detached') {
119
- current.detached = true;
120
- } else if (line === '' && current.worktree) {
121
- entries.push(current);
122
- current = {};
123
- }
124
- }
125
- if (current.worktree) entries.push(current);
126
- return entries;
127
- }
128
-
129
- function gitDiscoveryError(message, cause) {
130
- return new SessionRunnerError(
131
- 'WORKTREE_DISCOVERY_FAILED',
132
- `cannot inspect Git worktrees safely: ${message}`,
133
- { cause },
134
- );
135
- }
136
-
137
- function hasGitMetadata(repoRoot) {
138
- let current = path.resolve(repoRoot);
139
- while (true) {
140
- if (fs.lstatSync(path.join(current, '.git'), { throwIfNoEntry: false })) return true;
141
- const parent = path.dirname(current);
142
- if (parent === current) return false;
143
- current = parent;
144
- }
145
- }
146
-
147
- function runGitText(repoRoot, args, execGit) {
148
- const value = execGit('git', args, {
149
- cwd: repoRoot, stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf8',
150
- });
151
- if (typeof value !== 'string' && !Buffer.isBuffer(value)) {
152
- throw gitDiscoveryError(`Git returned no output for ${args.join(' ')}`);
153
- }
154
- return String(value);
155
- }
156
-
157
- function listActive(repoRoot, { execGit = execFileSync } = {}) {
158
- const metadataPresent = hasGitMetadata(repoRoot);
159
- let inside;
160
- try {
161
- inside = runGitText(repoRoot, ['rev-parse', '--is-inside-work-tree'], execGit).trim();
162
- } catch (error) {
163
- const detail = String(error?.stderr || error?.message || error);
164
- if (!metadataPresent && /not a git repository/i.test(detail)) return [];
165
- if (error instanceof SessionRunnerError) throw error;
166
- throw gitDiscoveryError(detail.trim(), error);
167
- }
168
- if (inside !== 'true') {
169
- if (!metadataPresent && inside === 'false') return [];
170
- throw gitDiscoveryError(`unexpected repository probe result: ${inside || '(empty)'}`);
171
- }
172
-
173
- let out;
174
- try {
175
- out = runGitText(repoRoot, ['worktree', 'list', '--porcelain'], execGit);
176
- } catch (err) {
177
- if (err instanceof SessionRunnerError) throw err;
178
- throw gitDiscoveryError(String(err?.stderr || err?.message || err).trim(), err);
179
- }
180
- const rawDomainRoot = _internal.assertManagedWorktreeRoot(repoRoot);
181
- // On macOS tmpdir is a symlink (/var → /private/var); git returns realpath.
182
- // Canonicalize both sides so prefix matching is robust.
183
- const domainRoot = (fs.existsSync(rawDomainRoot)
184
- ? fs.realpathSync(rawDomainRoot)
185
- : rawDomainRoot) + path.sep;
186
- const active = [];
187
- for (const entry of parsePorcelain(out)) {
188
- if (!entry.worktree) continue;
189
- const physical = fs.existsSync(entry.worktree)
190
- ? fs.realpathSync(entry.worktree)
191
- : path.resolve(entry.worktree);
192
- if (!(physical + path.sep).startsWith(domainRoot)) continue;
193
- const sid = path.basename(entry.worktree);
194
- const canonical = _internal.assertManagedWorktreePath(
195
- repoRoot, entry.worktree, { sid },
196
- );
197
- active.push({
198
- sid,
199
- worktree_path: canonical,
200
- head: entry.head || null,
201
- branch: entry.branch || null,
202
- detached: !!entry.detached,
203
- });
204
- }
205
- return active;
206
- }
207
-
208
- function releaseAll(repoRoot, options = {}) {
209
- const active = listActive(repoRoot, options);
210
- const releaseWorktree = options.releaseWorktree || release;
211
- let cleaned = 0;
212
- const protectedSids = new Set();
213
- const preserved = [];
214
- const quarantined = [];
215
- for (const entry of active) {
216
- try {
217
- releaseWorktree({
218
- repoRoot,
219
- worktree_path: entry.worktree_path,
220
- sid: entry.sid,
221
- });
222
- cleaned += 1;
223
- } catch (err) {
224
- protectedSids.add(entry.sid);
225
- preserved.push({
226
- sid: entry.sid,
227
- worktree_path: entry.worktree_path,
228
- reason: err.message,
229
- });
230
- // Best-effort: one bad worktree shouldn't stop the sweep.
231
- process.stderr.write(`worktree-manager: release(${entry.sid}) failed: ${err.message}\n`);
232
- }
233
- }
234
- // Filesystem entries Git no longer owns are recovery evidence, not trash.
235
- // Move real managed children atomically into quarantine and report the path.
236
- const domainRoot = path.join(repoRoot, WORKTREE_DOMAIN);
237
- if (fs.existsSync(domainRoot)) {
238
- for (const name of fs.readdirSync(domainRoot)) {
239
- const full = path.join(domainRoot, name);
240
- try {
241
- if (protectedSids.has(name)) continue;
242
- _internal.assertSessionId(name);
243
- const managedPath = _internal.assertManagedWorktreePath(
244
- repoRoot, full, { sid: name },
245
- );
246
- const recoveryRoot = path.join(
247
- runtimePaths.pathsFor(repoRoot).runtimeDir,
248
- 'recovery',
249
- 'worktrees',
250
- );
251
- fs.mkdirSync(recoveryRoot, { recursive: true });
252
- const token = new Date().toISOString().replace(/[:.]/g, '-');
253
- let recoveryPath = path.join(recoveryRoot, `${token}-${name}`);
254
- let attempt = 0;
255
- while (fs.lstatSync(recoveryPath, { throwIfNoEntry: false })) {
256
- attempt += 1;
257
- recoveryPath = path.join(recoveryRoot, `${token}-${name}-${attempt}`);
258
- }
259
- fs.renameSync(managedPath, recoveryPath);
260
- quarantined.push({
261
- sid: name,
262
- source_path: managedPath,
263
- recovery_path: recoveryPath,
264
- });
265
- }
266
- catch (err) {
267
- preserved.push({ sid: name, worktree_path: full, reason: err.message });
268
- process.stderr.write(`worktree-manager: orphan sweep failed for ${full}: ${err.message}\n`);
269
- }
270
- }
271
- }
272
- return { cleaned, preserved, quarantined };
273
- }
274
-
275
- module.exports = {
276
- allocate,
277
- release,
278
- listActive,
279
- releaseAll,
280
- worktreePath,
281
- WORKTREE_DOMAIN,
282
- };
package/settings.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "_comment": "Ultra Builder Pro runtime settings. Host hooks and plugin permissions live in each native plugin manifest.",
3
- "cleanupPeriodDays": 30,
4
- "orchestrator": {
5
- "auto_dispatch": false
6
- }
7
- }
@@ -1,42 +0,0 @@
1
- ---
2
- name: cc-collab
3
- description: Ask Claude Code for an independent read-only analysis of a bounded architecture, diagnosis, or review question. Use only when the user explicitly requests Claude Code or CC collaboration and the current host remains primary.
4
- ---
5
-
6
- # Consult Claude Code read-only
7
-
8
- Treat Claude Code as an untrusted advisor. Keep the current host responsible for
9
- scope, evidence, decisions, edits, and final verification.
10
-
11
- ## Preconditions
12
-
13
- 1. Confirm the `claude` CLI and authentication.
14
- 2. Bound the workspace, files or diff, question, evidence standard, and response shape.
15
- 3. Write the primary host's analysis first when independence matters.
16
- 4. Exclude credentials, unrelated files, and unbounded home-directory access.
17
-
18
- ## Invocation
19
-
20
- Run without mutation or session persistence:
21
-
22
- ```bash
23
- claude --safe-mode -p "<bounded prompt>" \
24
- --permission-mode plan \
25
- --tools "Read,Grep,Glob,Bash" \
26
- --output-format text \
27
- --no-session-persistence
28
- ```
29
-
30
- Store large output under `.ultra/.runtime/collab/<session-id>/claude-output.md`. A missing CLI,
31
- failed authentication, timeout, or empty response degrades to host-only analysis and
32
- never blocks the underlying task.
33
-
34
- Treat `.ultra/.runtime/collab/` as working scratch, not Ultra authority. Promote only verified
35
- conclusions into the invoking DB-bound workflow artifact or report.
36
-
37
- ## Synthesis
38
-
39
- Verify consequential claims against the current checkout, runtime, tests, or primary
40
- documentation. Separate verified agreement, useful dissent, and unsupported claims.
41
- Explain scope or version differences and return one host-owned conclusion rather than
42
- a transcript or model vote.
@@ -1,43 +0,0 @@
1
- ---
2
- name: code-review-expert
3
- description: Review a bounded diff for consequential correctness, security, integration, and maintainability defects with evidence and precise locations. Use only when assigned to an Ultra review worker or an explicitly requested read-only code review.
4
- ---
5
-
6
- # Review a bounded code change
7
-
8
- Prioritize defects that can change behavior, safety, operability, or delivery. Do not
9
- fill the report with style preferences or generic best-practice commentary.
10
-
11
- ## Workflow
12
-
13
- 1. Establish the exact diff, stated intent, acceptance evidence, current checkout, and
14
- relevant repository guidance. If the scope is empty or ambiguous, report that
15
- boundary instead of reviewing unrelated history.
16
- 2. Trace changed behavior from a live entry point through state and side effects to a
17
- consumer. Read callers, contracts, tests, and error paths needed to prove or refute
18
- a finding.
19
- 3. Load focused references only when their scope is present:
20
- - `security-rules` for trust or authorization boundaries;
21
- - `integration-rules` for cross-component behavior;
22
- - `references/correctness-reliability.md` for a concrete behavioral risk;
23
- - `references/design-boundaries.md` for a concrete ownership or coupling problem;
24
- - `references/removal-plan.md` for code proposed for deletion.
25
- 4. For every candidate finding, state the violated contract, triggering condition,
26
- user or system impact, and evidence in the current source. Discard speculative
27
- concerns that lack a plausible execution path.
28
- 5. Assign severity from impact and likelihood:
29
- - P0: exploitable security issue, data loss, or deterministic critical failure;
30
- - P1: material correctness, authorization, reliability, or delivery failure;
31
- - P2: bounded maintainability or edge-case defect with concrete future cost;
32
- - P3: optional improvement that does not block the accepted outcome.
33
- 6. Deduplicate findings by root cause and order them by severity, path, and line.
34
-
35
- ## Finding contract
36
-
37
- Each finding includes a concise title, severity, tight file and line range,
38
- trigger, impact, evidence, and smallest complete remediation. Do not request a broad
39
- rewrite when a local fix satisfies the contract.
40
-
41
- If no actionable defect is supported, say so and name the remaining verification or
42
- coverage gap. Review is read-only unless a separate implementation request explicitly
43
- authorizes changes.
@@ -1,30 +0,0 @@
1
- # Correctness and reliability evidence
2
-
3
- Read this reference only when the diff changes behavior, state transitions, resource
4
- use, concurrency, caching, parsing, or failure handling.
5
-
6
- ## Establish the contract
7
-
8
- Identify the input domain, preconditions, observable result, authoritative state, and
9
- caller-visible failure behavior. Repository code, tests, schemas, runtime configuration,
10
- and accepted specifications outrank generic conventions.
11
-
12
- ## Trace material risks
13
-
14
- Inspect only risks supported by the changed path:
15
-
16
- - boundary values, empty or optional inputs, numeric range, encoding, and ordering;
17
- - partial writes, lost updates, duplicate execution, retry, idempotency, and rollback;
18
- - stale caches, key scope, invalidation, and cross-user or cross-tenant isolation;
19
- - unbounded work, repeated I/O, resource lifetime, timeout, and cancellation;
20
- - swallowed failures, false success, ambiguous fallback, and missing recovery signals;
21
- - deployment-time compatibility between readers, writers, clients, and stored data.
22
-
23
- A surface pattern is not a finding. Confirm the triggering condition, follow it to an
24
- observable impact, and check whether a guard or recovery path exists elsewhere.
25
-
26
- ## Report
27
-
28
- State the violated contract, trigger, impact, current source evidence, and smallest
29
- complete remediation. If scale or concurrency is required to trigger the issue, name
30
- the evidence-backed operating condition instead of inventing a multiplier.
@@ -1,26 +0,0 @@
1
- # Design boundary evidence
2
-
3
- Read this reference only when the diff changes ownership, invariants, public contracts,
4
- module boundaries, or a recurring variation point.
5
-
6
- ## Questions grounded in the live path
7
-
8
- - Which module owns the invariant and can callers bypass it?
9
- - Does one authoritative representation exist, or can state diverge across layers?
10
- - Is the dependency direction compatible with the repository's established boundary?
11
- - Does a public contract expose implementation details that block a required consumer?
12
- - Does the change duplicate a domain rule or scatter one accepted change across
13
- unrelated owners?
14
- - Is an abstraction justified by current callers and variants, or only hypothetical
15
- future work?
16
- - Can the behavior be tested and recovered at its public seam?
17
-
18
- File size, method length, inheritance, primitive values, data-only types, and branch
19
- counts are investigation signals. Report them only when they produce a concrete
20
- correctness, compatibility, testing, recovery, or maintenance cost in this change.
21
-
22
- ## Remediation
23
-
24
- Prefer the smallest boundary correction that restores ownership and the accepted
25
- contract. Do not prescribe a design pattern, framework, or broad rewrite without
26
- showing why the existing repository structure cannot satisfy the requirement.
@@ -1,24 +0,0 @@
1
- # Removal evidence
2
-
3
- Read this reference only when the proposed change deletes or retires code, a contract,
4
- configuration, data, or a dependency.
5
-
6
- ## Prove reachability and ownership
7
-
8
- Search static references, registrations, dynamic loading, reflection, generated code,
9
- configuration, feature flags, scripts, documentation, and external interfaces that may
10
- consume the item. Distinguish no evidence of use from evidence of no use.
11
-
12
- ## Determine the safe action
13
-
14
- Record:
15
-
16
- - exact item and owner;
17
- - current consumers and supporting evidence;
18
- - compatibility, data, deployment, and operator impact;
19
- - prerequisites for removal when a consumer or migration remains;
20
- - focused deletion steps, verification, monitoring, and rollback.
21
-
22
- Do not assign urgency from age, naming, or deprecation text alone. Severity follows the
23
- cost of retaining an actual hazard or deleting a reachable contract. When evidence is
24
- incomplete, report the missing proof instead of declaring the item safe to remove.
@@ -1,49 +0,0 @@
1
- ---
2
- name: codex-collab
3
- description: Ask Codex CLI for an independent read-only analysis of a bounded architecture, diagnosis, or review question. Use only when the user explicitly requests Codex collaboration and the current host remains primary.
4
- ---
5
-
6
- # Consult Codex read-only
7
-
8
- Treat Codex as an untrusted advisor. Keep the current host responsible for scope,
9
- evidence, edits, verification, and the final answer.
10
-
11
- ## Preconditions
12
-
13
- 1. Confirm the `codex` CLI and authentication.
14
- 2. Bound the workspace, files or diff, question, evidence standard, and response shape.
15
- 3. Write the primary analysis first when independence matters.
16
- 4. Exclude secrets, unrelated files, and unbounded home-directory access.
17
-
18
- ## Invocation
19
-
20
- Create a session directory under `.ultra/.runtime/collab/`, then run in a read-only sandbox:
21
-
22
- ```bash
23
- SESSION_PATH=".ultra/.runtime/collab/$(date +%Y%m%d-%H%M%S)-codex"
24
- mkdir -p "${SESSION_PATH}"
25
- codex exec -s read-only \
26
- --ephemeral \
27
- --ignore-user-config \
28
- --ignore-rules \
29
- -o "${SESSION_PATH}/codex-output.md" \
30
- "<bounded prompt>" \
31
- 2> "${SESSION_PATH}/codex-error.log"
32
- ```
33
-
34
- Do not enable write-capable automation or permission bypass. The isolation flags keep
35
- the advisory run independent from the user's Codex runtime configuration and rules;
36
- the normal Codex authentication store remains available.
37
-
38
- Treat `.ultra/.runtime/collab/` as working scratch, not Ultra authority. Promote only verified
39
- conclusions into the invoking DB-bound workflow artifact or report.
40
-
41
- ## Synthesis
42
-
43
- Read output only after the process exits and the file is non-empty. Verify
44
- consequential claims against the current checkout, runtime, tests, or primary
45
- documentation. Separate verified agreement, useful dissent, and unsupported claims,
46
- then return one host-owned conclusion.
47
-
48
- If Codex is unavailable, unauthenticated, times out, or returns empty output, report
49
- the degraded path and continue with primary evidence.
@@ -1,35 +0,0 @@
1
- {
2
- "skill_name": "codex-collab",
3
- "evals": [
4
- {
5
- "id": "explicit-review",
6
- "prompt": "Ask Codex for an independent read-only review of the current diff, then verify its findings yourself.",
7
- "should_trigger": true,
8
- "assertions": [
9
- "Bounds the repository and exact diff before launch",
10
- "Runs codex exec with a read-only sandbox and file output",
11
- "Treats Codex output as untrusted advisory evidence",
12
- "Returns one primary-host conclusion after source verification"
13
- ]
14
- },
15
- {
16
- "id": "explicit-decision",
17
- "prompt": "Have Codex independently assess whether this service should stay in the monorepo. Do not tell it our current preference.",
18
- "should_trigger": true,
19
- "assertions": [
20
- "Writes the primary analysis first when independence matters",
21
- "Does not prime Codex with the primary conclusion",
22
- "Explains evidence or assumption differences before synthesis"
23
- ]
24
- },
25
- {
26
- "id": "ordinary-review-negative",
27
- "prompt": "Review the current diff for correctness and security issues.",
28
- "should_trigger": false,
29
- "assertions": [
30
- "Uses the host's ordinary review workflow",
31
- "Does not launch Codex without an explicit user request"
32
- ]
33
- }
34
- ]
35
- }
@@ -1,32 +0,0 @@
1
- ---
2
- name: integration-rules
3
- description: Verify that changed components are reachable, contract-compatible, and tested across the boundaries required by the accepted behavior. Use only when an assigned review or implementation slice crosses modules, services, persistence, protocols, or UI seams.
4
- ---
5
-
6
- # Verify integration and reachability
7
-
8
- Prove that new behavior is connected to a real consumer and that data and failures
9
- cross each boundary according to one contract.
10
-
11
- ## Procedure
12
-
13
- 1. Start at the declared public seam or entry point and trace the changed path through
14
- domain behavior, state, side effects, and the final consumer.
15
- 2. At each boundary, identify the producer, consumer, data shape, ownership, error
16
- semantics, compatibility expectation, and recovery behavior.
17
- 3. Confirm both sides use the same contract or a deliberate adapter. Inspect runtime
18
- configuration and registration, not only exported types.
19
- 4. Verify the implementation is reachable in the production path. A module, handler,
20
- schema, or component with no caller or registration is incomplete.
21
- 5. Check that tests cross the boundary whose semantics matter and would fail on a
22
- producer-consumer mismatch.
23
- 6. For a larger feature, confirm an executable vertical slice exists before broad
24
- expansion. The slice may be narrow, but it must use real wiring and observable data.
25
- 7. Inspect partial failure, retry, idempotency, ordering, rollback, and observability
26
- when the boundary can leave inconsistent state.
27
-
28
- ## Finding contract
29
-
30
- Report the broken path, mismatched contract, missing consumer, or unverified failure
31
- mode with exact source evidence and observable impact. Do not flag a horizontal task
32
- solely by its name when another completed slice already proves the integration.
@@ -1,38 +0,0 @@
1
- ---
2
- name: security-rules
3
- description: Evaluate changed trust boundaries for exploitable input, authorization, secret, data-exposure, and supply-chain failures. Use only when an assigned review scope contains a security-relevant boundary.
4
- ---
5
-
6
- # Review security-relevant changes
7
-
8
- Follow data from an attacker-controlled or less-trusted source to a protected action,
9
- secret, identity, or output. Report plausible exploit paths, not isolated pattern
10
- matches.
11
-
12
- ## Review procedure
13
-
14
- 1. Identify trust boundaries, protected assets, principals, and state-changing actions
15
- in the diff.
16
- 2. Trace input validation, canonicalization, authorization, and output handling through
17
- the real call path.
18
- 3. Verify authorization is derived from trusted server state and applies to the
19
- requested resource, tenant, or object.
20
- 4. Inspect persistence and command boundaries for injection, unsafe deserialization,
21
- path traversal, and unbounded resource use.
22
- 5. Inspect logs, errors, telemetry, and client responses for secret or sensitive-data
23
- disclosure.
24
- 6. Inspect changed authentication, cryptography, dependency, file-upload, webhook, and
25
- cross-origin behavior when present.
26
- 7. Check the failure path: rate limits, replay or idempotency, partial writes, rollback,
27
- and audit evidence where the risk requires them.
28
-
29
- ## Finding threshold
30
-
31
- Report only when the current code supports a triggering input and a meaningful impact.
32
- Include the source-to-sink path, affected asset, exploit preconditions, and a bounded
33
- fix. Distinguish a missing defense from a defense implemented elsewhere in the live
34
- path.
35
-
36
- Treat confirmed secret exposure, authorization bypass, injection with material impact,
37
- and destructive cross-tenant access as blocking. Calibrate other issues from their
38
- actual reachability and blast radius rather than a fixed pattern-to-severity table.
@@ -1,32 +0,0 @@
1
- ---
2
- name: testing-rules
3
- description: Review whether changed behavior has meaningful, trustworthy, and proportionate test evidence across its real boundaries. Use only when assigned to a test review or delivery verification scope.
4
- ---
5
-
6
- # Review test evidence
7
-
8
- Evaluate what the tests prove about the accepted behavior. Line coverage and the mere
9
- presence of a test file are supporting signals, not the contract.
10
-
11
- ## Procedure
12
-
13
- 1. Map each changed behavior and acceptance claim to a test or other executable check.
14
- 2. Confirm the test can fail for the intended defect and observes a public or stable
15
- contract rather than implementation trivia.
16
- 3. Inspect happy, error, boundary, state-transition, and concurrency cases according to
17
- the risk introduced by the diff.
18
- 4. Verify integration seams with the most realistic practical boundary. Prefer real
19
- persistence and protocol behavior when their semantics matter.
20
- 5. Accept test doubles at costly, unavailable, or nondeterministic external boundaries
21
- when the double preserves the documented contract and the reason is clear.
22
- 6. Flag mocks or fakes only when they bypass the behavior under review, encode a false
23
- contract, or make a passing test unrelated to production behavior.
24
- 7. Detect skipped checks, tautological assertions, swallowed failures, non-determinism,
25
- weakened expectations, and tests that never reach the changed code.
26
-
27
- ## Finding contract
28
-
29
- Name the unproven behavior, why current evidence is insufficient, the failure that can
30
- escape, and the smallest test or boundary check that closes the gap. Calibrate severity
31
- to product risk and reachability; do not impose a universal coverage percentage or a
32
- single test technology on every repository.