thoth-agents 0.2.2 → 0.2.4

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.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  <div align="center">
2
- <img src="img/team.png" alt="thoth-agents agents" width="420">
3
- <p><i>Seven specialized agents, one delegate-first workflow across supported harnesses.</i></p>
2
+ <img src="img/team.png" alt="thoth-agents agents" width="420">
3
+
4
+ <p><i>Seven specialized agents, one delegate-first workflow across supported harnesses.</i></p>
4
5
  <p><b>thoth-agents</b> - Multi-harness orchestration - Thoth-mem persistence - Bundled SDD pipeline</p>
5
6
  <p>
6
7
  <a href="https://github.com/EremesNG/thoth-agents/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/EremesNG/thoth-agents/ci.yml?branch=master&label=CI" alt="CI status"></a>
@@ -50,11 +51,12 @@ hooks, MCP, skills, and per-agent tool permissions.
50
51
 
51
52
  ## Harness Support
52
53
 
53
- | Harness | Status | Setup path | Notes |
54
- | --- | --- | --- | --- |
55
- | OpenCode | Stable default | `npx thoth-agents@latest install` or `npx thoth-agents@latest install --agent=opencode` | Native plugin config, native `task` delegation, optional tmux panes, OpenCode provider auth. |
56
- | Codex | Supported explicit path | `npx thoth-agents@latest install --agent=codex` | Installs ambient/root guidance, six role subagents, and a Personal plugin source. Requires `/plugins` and `/hooks` trust review. Some governance remains instruction-level. |
57
- | Claude Code | Supported first-class path | `npx thoth-agents@latest install --agent=claude` | Installs one Claude Code plugin: six specialist subagents (`Task(subagent_type: ...)`), an `orchestrator` agent activated as the main thread via `settings.json`, `.mcp.json`, and bundled skills. Role permissions are enforced by subagent `tools`. |
54
+
55
+ | Harness | Status | Setup path | Notes |
56
+ | ----------- | -------------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
57
+ | OpenCode | Stable default | `npx thoth-agents@latest install` or `npx thoth-agents@latest install --agent=opencode` | Native plugin config, native`task` delegation, optional tmux panes, OpenCode provider auth. |
58
+ | Codex | Supported explicit path | `npx thoth-agents@latest install --agent=codex` | Installs ambient/root guidance, six role subagents, and a Personal plugin source. Requires`/plugins` and `/hooks` trust review. Some governance remains instruction-level. |
59
+ | Claude Code | Supported first-class path | `npx thoth-agents@latest install --agent=claude` | Installs one Claude Code plugin: six specialist subagents (`Task(subagent_type: ...)`), an `orchestrator` agent activated as the main thread via `settings.json`, `.mcp.json`, and bundled skills. Role permissions are enforced by subagent `tools`. |
58
60
 
59
61
  OpenCode can load the plugin with:
60
62
 
@@ -314,7 +316,7 @@ clarifies intent, assesses scope, asks for user approval when needed, and routes
314
316
  work into direct implementation, accelerated SDD, or full SDD.
315
317
 
316
318
  ```text
317
- propose -> [spec || design] -> tasks -> apply -> verify -> archive
319
+ propose -> spec -> clarify -> design -> tasks -> apply -> verify -> archive
318
320
  ```
319
321
 
320
322
  For moderate work, the accelerated path usually runs `propose -> tasks`. For
@@ -323,14 +325,15 @@ artifacts before task execution.
323
325
 
324
326
  Artifacts can be persisted in four modes:
325
327
 
326
- | Mode | Writes to | Cost | Use when |
327
- | --- | --- | --- | --- |
328
- | `thoth-mem` | Memory only | Low | Fast iteration without repo planning files |
329
- | `openspec` | `openspec/` files only | Medium | Reviewable planning artifacts in the repo |
330
- | `hybrid` | Both | High | Maximum durability; default |
331
- | `none` | Neither | Lowest | Ephemeral iterations, no persistence |
332
328
 
333
- Thoth-mem is the local memory MCP used for durable observations, architectural
329
+ | Mode | Writes to | Cost | Use when |
330
+ | ----------- | ---------------------- | ------ | ------------------------------------------ |
331
+ | `thoth-mem` | Memory only | Low | Fast iteration without repo planning files |
332
+ | `openspec` | `openspec/` files only | Medium | Reviewable planning artifacts in the repo |
333
+ | `hybrid` | Both | High | Maximum durability; default |
334
+ | `none` | Neither | Lowest | Ephemeral iterations, no persistence |
335
+
336
+ [Thoth-mem](https://github.com/EremesNG/thoth-mem) is the local memory MCP used for durable observations, architectural
334
337
  decisions, SDD artifacts, and session summaries. The core retrieval pattern is:
335
338
 
336
339
  1. `mem_recall(mode="compact")` for compact candidate records
@@ -355,12 +358,13 @@ planning/execution, verification, and archiving. It also registers MCP servers
355
358
  for docs research, public code search, and local memory where the harness
356
359
  supports that delivery surface.
357
360
 
358
- | Surface | Shared concept | OpenCode binding | Codex binding | Claude Code binding |
359
- | --- | --- | --- | --- | --- |
360
- | Skills | Requirements, SDD, review, execution workflows | Copied into the OpenCode skills directory when `--skills=yes` | Packaged as plugin-bundled skills for the Personal plugin source | Bundled in the plugin `skills/` directory |
361
- | MCPs | `exa`, `context7`, `grep_app`, `thoth_mem` | Registered by generated OpenCode plugin config | Packaged/configured only on validated Codex surfaces | Bundled in the plugin `.mcp.json` (`type: "http"` for URL servers) |
362
- | Delegation | Seven-role specialist workflow | Native `task` tool | Custom agents plus prompt/plugin guidance | Native `Task(subagent_type: ...)` over auto-discovered subagents |
363
- | Blocking choices | Use a structured question surface | OpenCode `question` tool | `request_user_input` when enabled and available | `AskUserQuestion` tool |
361
+
362
+ | Surface | Shared concept | OpenCode binding | Codex binding | Claude Code binding |
363
+ | ---------------- | ---------------------------------------------- | ------------------------------------------------------------ | ---------------------------------------------------------------- | ----------------------------------------------------------------- |
364
+ | Skills | Requirements, SDD, review, execution workflows | Copied into the OpenCode skills directory when`--skills=yes` | Packaged as plugin-bundled skills for the Personal plugin source | Bundled in the plugin`skills/` directory |
365
+ | MCPs | `exa`, `context7`, `grep_app`, `thoth_mem` | Registered by generated OpenCode plugin config | Packaged/configured only on validated Codex surfaces | Bundled in the plugin`.mcp.json` (`type: "http"` for URL servers) |
366
+ | Delegation | Seven-role specialist workflow | Native`task` tool | Custom agents plus prompt/plugin guidance | Native`Task(subagent_type: ...)` over auto-discovered subagents |
367
+ | Blocking choices | Use a structured question surface | OpenCode`question` tool | `request_user_input` when enabled and available | `AskUserQuestion` tool |
364
368
 
365
369
  See [docs/skills-and-mcps.md](docs/skills-and-mcps.md) for the detailed matrix.
366
370
 
@@ -400,16 +404,17 @@ corepack prepare pnpm@11.2.2 --activate
400
404
  pnpm install
401
405
  ```
402
406
 
403
- | Command | Purpose |
404
- | --- | --- |
405
- | `pnpm run build` | Build TypeScript into `dist/` and generate declarations/schema |
406
- | `pnpm run typecheck` | Run TypeScript type checking without emit |
407
- | `pnpm test` | Run the Vitest suite |
408
- | `pnpm run lint` | Run Biome linter |
409
- | `pnpm run format` | Run Biome formatter |
410
- | `pnpm run check` | Run Biome check with auto-fix |
411
- | `pnpm run check:ci` | Run Biome check without writes |
412
- | `pnpm run dev` | Build and launch the OpenCode plugin in local dev mode |
407
+
408
+ | Command | Purpose |
409
+ | -------------------- | ------------------------------------------------------------- |
410
+ | `pnpm run build` | Build TypeScript into`dist/` and generate declarations/schema |
411
+ | `pnpm run typecheck` | Run TypeScript type checking without emit |
412
+ | `pnpm test` | Run the Vitest suite |
413
+ | `pnpm run lint` | Run Biome linter |
414
+ | `pnpm run format` | Run Biome formatter |
415
+ | `pnpm run check` | Run Biome check with auto-fix |
416
+ | `pnpm run check:ci` | Run Biome check without writes |
417
+ | `pnpm run dev` | Build and launch the OpenCode plugin in local dev mode |
413
418
 
414
419
  ## License
415
420
 
@@ -804,6 +804,7 @@ var CLAUDE_CODE_PROMPT_DIALECT = {
804
804
  };
805
805
 
806
806
  // src/harness/core/sdd.ts
807
+ var SDD_VERIFY_MAX_ROUNDS = 3;
807
808
  var SDD_PHASES = [
808
809
  {
809
810
  id: "requirements-interview",
@@ -822,7 +823,7 @@ var SDD_PHASES = [
822
823
  producesArtifact: true,
823
824
  owner: "write-capable-agent",
824
825
  artifactSkill: "sdd-init",
825
- condition: "Only when OpenSpec persistence is selected and openspec/ is missing.",
826
+ condition: "Only when OpenSpec persistence is selected and openspec/ is missing or stale (partial structure or missing mechanism sections).",
826
827
  defaultAgentRole: "quick",
827
828
  supportingAgentRoles: ["explorer"],
828
829
  delegationReason: "Fast mechanical bootstrap, with explorer supplying repository facts when needed."
@@ -848,7 +849,11 @@ var SDD_PHASES = [
848
849
  artifactSkill: "sdd-propose",
849
850
  defaultAgentRole: "deep",
850
851
  supportingAgentRoles: ["oracle"],
851
- delegationReason: "Structured technical reasoning and trade-off synthesis before implementation."
852
+ delegationReason: "Structured technical reasoning and trade-off synthesis before implementation.",
853
+ handoffHints: [
854
+ "Preserve accepted scope and explicit non-goals downstream.",
855
+ "Carry deferred or discovery affected areas forward as follow-up."
856
+ ]
852
857
  },
853
858
  {
854
859
  id: "spec",
@@ -860,24 +865,48 @@ var SDD_PHASES = [
860
865
  artifactSkill: "sdd-spec",
861
866
  defaultAgentRole: "deep",
862
867
  supportingAgentRoles: ["oracle"],
863
- delegationReason: "High-quality requirement contract work where ambiguity propagates downstream."
868
+ delegationReason: "High-quality requirement contract work where ambiguity propagates downstream.",
869
+ handoffHints: [
870
+ "Preserve recorded Assumptions and any [NEEDS CLARIFICATION] resolutions.",
871
+ "Keep the requirements-quality checklist resolved before tasks."
872
+ ]
864
873
  },
865
874
  {
866
- id: "design",
875
+ id: "clarify",
867
876
  order: 5,
868
877
  requiredFor: ["full"],
869
- prerequisites: ["proposal", "spec"],
878
+ prerequisites: ["spec"],
879
+ producesArtifact: false,
880
+ owner: "write-capable-agent",
881
+ artifactSkill: "sdd-clarify",
882
+ defaultAgentRole: "deep",
883
+ supportingAgentRoles: ["oracle"],
884
+ delegationReason: "Resolve residual spec ambiguity in place before design consumes it.",
885
+ handoffHints: [
886
+ "Preserve clarified resolutions written back into the spec.",
887
+ "Keep the requirements-quality checklist re-validated before design."
888
+ ]
889
+ },
890
+ {
891
+ id: "design",
892
+ order: 6,
893
+ requiredFor: ["full"],
894
+ prerequisites: ["proposal", "clarify"],
870
895
  producesArtifact: true,
871
896
  owner: "write-capable-agent",
872
897
  artifactSkill: "sdd-design",
873
898
  artifactMeaning: "technical-solution-design",
874
899
  defaultAgentRole: "deep",
875
900
  supportingAgentRoles: ["designer"],
876
- delegationReason: "Technical architecture and file-change design; designer only supports UI/UX concerns."
901
+ delegationReason: "Technical architecture and file-change design; designer only supports UI/UX concerns.",
902
+ handoffHints: [
903
+ "Preserve coverage decisions and architecture constraints in tasks.",
904
+ "Honor the Constitution Check outcome recorded during design."
905
+ ]
877
906
  },
878
907
  {
879
908
  id: "tasks",
880
- order: 6,
909
+ order: 7,
881
910
  requiredFor: ["accelerated", "full"],
882
911
  prerequisites: ["proposal", "spec", "design"],
883
912
  producesArtifact: true,
@@ -889,7 +918,7 @@ var SDD_PHASES = [
889
918
  },
890
919
  {
891
920
  id: "plan-review",
892
- order: 7,
921
+ order: 8,
893
922
  requiredFor: ["accelerated", "full"],
894
923
  prerequisites: ["tasks"],
895
924
  producesArtifact: false,
@@ -900,7 +929,7 @@ var SDD_PHASES = [
900
929
  },
901
930
  {
902
931
  id: "implementation-confirmation",
903
- order: 8,
932
+ order: 9,
904
933
  requiredFor: ["accelerated", "full"],
905
934
  prerequisites: ["plan-review"],
906
935
  producesArtifact: false,
@@ -910,7 +939,7 @@ var SDD_PHASES = [
910
939
  },
911
940
  {
912
941
  id: "apply",
913
- order: 9,
942
+ order: 10,
914
943
  requiredFor: ["direct", "accelerated", "full"],
915
944
  prerequisites: ["implementation-confirmation"],
916
945
  producesArtifact: false,
@@ -921,10 +950,12 @@ var SDD_PHASES = [
921
950
  },
922
951
  {
923
952
  id: "verify",
924
- order: 10,
953
+ order: 11,
925
954
  requiredFor: ["accelerated", "full"],
926
955
  prerequisites: ["apply"],
927
956
  producesArtifact: true,
957
+ gate: "iterative-verify",
958
+ maxRounds: SDD_VERIFY_MAX_ROUNDS,
928
959
  owner: "oracle",
929
960
  artifactSkill: "sdd-verify",
930
961
  defaultAgentRole: "oracle",
@@ -933,7 +964,7 @@ var SDD_PHASES = [
933
964
  },
934
965
  {
935
966
  id: "archive",
936
- order: 11,
967
+ order: 12,
937
968
  requiredFor: ["accelerated", "full"],
938
969
  prerequisites: ["verify"],
939
970
  producesArtifact: true,
@@ -950,7 +981,7 @@ var SDD_WORKFLOW_CONTRACT = {
950
981
  "Scope-faithful invariant: accepted user intent/scope is preserved; unresolved affected areas remain explicit as deferred/discovery follow-up.",
951
982
  "Direct implementation is reserved for low-complexity work.",
952
983
  "Accelerated SDD follows explore -> proposal -> tasks before execution.",
953
- "Full SDD follows explore -> proposal -> spec -> design -> tasks before execution."
984
+ "Full SDD follows explore -> proposal -> spec -> clarify -> design -> tasks before execution."
954
985
  ],
955
986
  artifactRules: [
956
987
  "SDD delegation defaults are phase-specific: sdd-propose, sdd-spec, and sdd-design default to deep.",
@@ -965,7 +996,8 @@ var SDD_WORKFLOW_CONTRACT = {
965
996
  verificationRules: [
966
997
  "Plan review must complete before implementation confirmation.",
967
998
  "User confirmation is required after plan-review approval and before apply.",
968
- "Apply is followed by verify and archive for SDD pipelines."
999
+ "Apply is followed by verify and archive for SDD pipelines.",
1000
+ "Verify runs as a bounded iterative gate of at most SDD_VERIFY_MAX_ROUNDS rounds; on exhausted failure escalate to the user."
969
1001
  ]
970
1002
  };
971
1003
  function getSddWorkflowContract() {
@@ -975,7 +1007,8 @@ function getSddWorkflowContract() {
975
1007
  requiredFor: [...phase.requiredFor],
976
1008
  prerequisites: [...phase.prerequisites],
977
1009
  alternateAgentRoles: phase.alternateAgentRoles ? [...phase.alternateAgentRoles] : void 0,
978
- supportingAgentRoles: phase.supportingAgentRoles ? [...phase.supportingAgentRoles] : void 0
1010
+ supportingAgentRoles: phase.supportingAgentRoles ? [...phase.supportingAgentRoles] : void 0,
1011
+ handoffHints: phase.handoffHints ? [...phase.handoffHints] : void 0
979
1012
  })),
980
1013
  routingRules: [...SDD_WORKFLOW_CONTRACT.routingRules],
981
1014
  artifactRules: [...SDD_WORKFLOW_CONTRACT.artifactRules],
@@ -1072,7 +1105,7 @@ function persistenceSddRole(id) {
1072
1105
  function renderSddDelegationMatrix() {
1073
1106
  return `<sdd-delegation-matrix>
1074
1107
  - sdd-init -> ${primarySddRole("init")} (+${supportSddRoles("init")}, if openspec/ missing); sdd-explore -> ${primarySddRole("explore")} (+${supportSddRoles("explore")})
1075
- - sdd-propose/sdd-spec/sdd-design -> ${primarySddRole("proposal")}; sdd-tasks -> ${primarySddRole("tasks")} (fallback: ${alternateSddRoles("tasks")})
1108
+ - sdd-propose/sdd-spec/sdd-design -> ${primarySddRole("proposal")}; sdd-clarify -> ${primarySddRole("clarify")}; sdd-tasks -> ${primarySddRole("tasks")} (fallback: ${alternateSddRoles("tasks")})
1076
1109
  - plan-reviewer -> ${primarySddRole("plan-review")}; sdd-apply -> ${primarySddRole("apply")} (fallback: ${alternateSddRoles("apply")}); sdd-verify -> ${primarySddRole("verify")} (persistence: ${persistenceSddRole("verify")}); sdd-archive -> ${primarySddRole("archive")}
1077
1110
  </sdd-delegation-matrix>`;
1078
1111
  }
@@ -1221,7 +1254,7 @@ Scope-faithful invariant: accepted user intent and scope must not be silently na
1221
1254
  Routes:
1222
1255
  - Direct implementation for low-complexity work.
1223
1256
  - Accelerated SDD: explore -> propose -> tasks.
1224
- - Full SDD: explore -> propose -> spec -> design -> tasks.
1257
+ - Full SDD: explore -> propose -> spec -> clarify -> design -> tasks.
1225
1258
 
1226
1259
  ${renderSddDelegationMatrix()}
1227
1260
 
@@ -1231,7 +1264,7 @@ Hard gates:
1231
1264
  - {{role.oracle}} is read-only for plan-reviewer and sdd-verify review; {{role.quick}} persists verify reports when writes are required.
1232
1265
  - Never skip artifacts or jump from requirements-interview to implementation when SDD is selected.
1233
1266
  - Before SDD execution, load \`executing-plans\`; then track progress in {{progressTool}} plus the persistent artifact.
1234
- - If openspec persistence is selected and openspec/ is missing, dispatch sdd-init first.
1267
+ - If openspec persistence is selected and openspec/ is missing or stale (partial structure or missing mechanism sections), dispatch sdd-init first.
1235
1268
  - During SDD execution, batch compatible implementation work.
1236
1269
  - Group consecutive ready SDD tasks for the same execution agent into one dispatch when dependencies, scope, and verification can be handled together. Keep per-task tracking and evidence; do not split a compatible {{role.designer}}/{{role.quick}}/{{role.deep}} run into one delegation per checkbox.
1237
1270
 
@@ -1247,7 +1280,12 @@ Plan gate: after tasks, ask with \`{{userQuestionTool}}\`: "Review plan with {{r
1247
1280
  If reviewed, the review loop is complete only after [OKAY].
1248
1281
  If {{role.oracle}} returns [OKAY], give a deep approved-plan overview, then ask with \`{{userQuestionTool}}\` whether to implement or stop. Cover goals, scope, sequence, key decisions, verification, risks/trade-offs, and uncertainty so the user has full context.
1249
1282
  Do not dispatch \`sdd-apply\` after oracle approval until the user confirms implementation.
1250
- Post-execution: delegate sdd-verify, then sdd-archive when verification passes.
1283
+ Post-execution verify-loop (mirrors the plan-review loop's discipline; bounded to 3 rounds = initial apply->verify plus up to 2 fix->re-verify):
1284
+ - Dispatch \`sdd-verify\` as an iterative gate, not a single shot; round 1 is the first verify after apply. Treat the \`round N\` marker in the verify report as the source of truth for the round counter and surface it in {{progressTool}}.
1285
+ - On clean \`pass\`: proceed through the existing pre-archive user gate above, then delegate \`sdd-archive\`. Do not auto-advance to archive merely because a verify report exists.
1286
+ - On \`fail\` with rounds remaining (round < 3): dispatch a TARGETED \`sdd-apply\` re-run scoped by the verify report's Critical Issue remediation anchors (file and/or scenario), then re-dispatch \`sdd-verify\` as round N+1. Do not expand a scoped fix into a full unscoped re-apply when anchors are present, and do not advance to archive while the verdict is \`fail\`.
1287
+ - On \`fail\` at the bound (round 3 still failing): escalate the unresolved failure to the user with \`{{userQuestionTool}}\`. Do not run another apply/verify round and do not silently abandon or auto-archive. If the harness lacks a blocking user-input primitive, report this as an unsupported-capability limitation instead of auto-advancing or looping.
1288
+ - On \`pass with warnings\`: escalate with \`{{userQuestionTool}}\` an advance-vs-iterate choice (advance to \`sdd-archive\` vs re-iterate to clear warnings). Never auto-advance and never auto-loop. If the user chooses re-iterate, dispatch a targeted \`sdd-apply\` scoped by the warning remediation anchors and re-verify, subject to the 3-round bound.
1251
1289
  </sdd>
1252
1290
 
1253
1291
  <progress-memory>
@@ -1711,6 +1749,14 @@ var BUNDLED_SKILL_REGISTRY = [
1711
1749
  kind: "skill",
1712
1750
  purpose: "sdd"
1713
1751
  },
1752
+ {
1753
+ name: "sdd-clarify",
1754
+ description: "Resolve residual spec ambiguity in place before design, with a bounded taxonomy-driven clarification pass.",
1755
+ allowedRoles: ORCHESTRATOR_ONLY,
1756
+ sourcePath: "src/skills/sdd-clarify",
1757
+ kind: "skill",
1758
+ purpose: "sdd"
1759
+ },
1714
1760
  {
1715
1761
  name: "sdd-design",
1716
1762
  description: "Create technical solution design artifacts for changes",
@@ -1758,6 +1804,14 @@ var BUNDLED_SKILL_REGISTRY = [
1758
1804
  sourcePath: "src/skills/sdd-archive",
1759
1805
  kind: "skill",
1760
1806
  purpose: "sdd"
1807
+ },
1808
+ {
1809
+ name: "sdd-constitution",
1810
+ description: "Guide a semver constitution amendment and Sync-Impact Report entry.",
1811
+ allowedRoles: ORCHESTRATOR_ONLY,
1812
+ sourcePath: "src/skills/sdd-constitution",
1813
+ kind: "skill",
1814
+ purpose: "sdd"
1761
1815
  }
1762
1816
  ];
1763
1817
  var SKILL_REGISTRY = [
@@ -35,7 +35,7 @@ import {
35
35
  renderRolePrompt,
36
36
  writeConfig,
37
37
  writeLiteConfig
38
- } from "./chunk-3NOVCFN7.js";
38
+ } from "./chunk-HFZAL6NE.js";
39
39
 
40
40
  // src/cli/codex-paths.ts
41
41
  import { homedir } from "os";
@@ -13,7 +13,7 @@ import {
13
13
  getStepBudgetPromptSection,
14
14
  loadAgentPrompt,
15
15
  renderRolePrompt
16
- } from "./chunk-3NOVCFN7.js";
16
+ } from "./chunk-HFZAL6NE.js";
17
17
 
18
18
  // src/agents/deep.ts
19
19
  var DEEP_PROMPT = renderRolePrompt(
@@ -587,6 +587,7 @@ function spawnSync(command, options = {}) {
587
587
  // src/cli/system.ts
588
588
  import { statSync } from "fs";
589
589
  var cachedOpenCodePath = null;
590
+ var OPENCODE_PROBE_TIMEOUT_MS = 1500;
590
591
  function quoteWindowsShellCommand(command) {
591
592
  if (!/[\s&()^<>"|]/.test(command)) {
592
593
  return command;
@@ -674,10 +675,30 @@ async function isOpenCodeInstalled() {
674
675
  try {
675
676
  const invocation = getOpenCodeVersionInvocation(opencodePath);
676
677
  const proc = spawn(invocation.command, invocation.options);
677
- await proc.exited;
678
- if (proc.exitCode === 0) {
679
- cachedOpenCodePath = opencodePath;
680
- return true;
678
+ let timer;
679
+ const timedOut = /* @__PURE__ */ Symbol("timeout");
680
+ try {
681
+ const outcome = await Promise.race([
682
+ proc.exited.then(() => proc.exitCode),
683
+ new Promise((resolve) => {
684
+ timer = setTimeout(
685
+ () => resolve(timedOut),
686
+ OPENCODE_PROBE_TIMEOUT_MS
687
+ );
688
+ })
689
+ ]);
690
+ if (outcome === timedOut) {
691
+ proc.kill();
692
+ continue;
693
+ }
694
+ if (outcome === 0) {
695
+ cachedOpenCodePath = opencodePath;
696
+ return true;
697
+ }
698
+ } finally {
699
+ if (timer) {
700
+ clearTimeout(timer);
701
+ }
681
702
  }
682
703
  } catch {
683
704
  }
package/dist/cli/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  getOpenCodeVersion,
5
5
  isOpenCodeInstalled,
6
6
  opencodeAdapter
7
- } from "../chunk-3SQ4ZQ57.js";
7
+ } from "../chunk-YZNH23HZ.js";
8
8
  import {
9
9
  CODEX_ROLE_NAMES,
10
10
  RECOMMENDED_SKILLS,
@@ -36,7 +36,7 @@ import {
36
36
  getOperationHarness,
37
37
  installRecommendedSkill,
38
38
  listOperationHarnesses
39
- } from "../chunk-FRZZ25ND.js";
39
+ } from "../chunk-PDKLWORW.js";
40
40
  import {
41
41
  ALL_AGENT_NAMES,
42
42
  CUSTOM_SKILLS,
@@ -48,7 +48,7 @@ import {
48
48
  getExistingLiteConfigPath,
49
49
  installCustomSkills,
50
50
  writeLiteConfig
51
- } from "../chunk-3NOVCFN7.js";
51
+ } from "../chunk-HFZAL6NE.js";
52
52
 
53
53
  // src/cli/index.ts
54
54
  import { pathToFileURL } from "url";
@@ -25,13 +25,13 @@ import {
25
25
  listOperationHarnesses,
26
26
  parseRoleTomlModel,
27
27
  parseSubagentModel
28
- } from "../../chunk-FRZZ25ND.js";
28
+ } from "../../chunk-PDKLWORW.js";
29
29
  import {
30
30
  ALL_AGENT_NAMES,
31
31
  DEFAULT_MODELS,
32
32
  getExistingLiteConfigPath,
33
33
  parseConfig
34
- } from "../../chunk-3NOVCFN7.js";
34
+ } from "../../chunk-HFZAL6NE.js";
35
35
 
36
36
  // src/cli/tui/index.tsx
37
37
  import { render } from "ink";
@@ -1,13 +1,14 @@
1
1
  import type { AgentRoleName } from './agent-pack';
2
2
  export type SddPipelineType = 'direct' | 'accelerated' | 'full';
3
- export type SddPhaseId = 'requirements-interview' | 'init' | 'explore' | 'proposal' | 'spec' | 'design' | 'tasks' | 'plan-review' | 'implementation-confirmation' | 'apply' | 'verify' | 'archive';
3
+ export type SddPhaseId = 'requirements-interview' | 'init' | 'explore' | 'proposal' | 'spec' | 'clarify' | 'design' | 'tasks' | 'plan-review' | 'implementation-confirmation' | 'apply' | 'verify' | 'archive';
4
4
  export interface SddPhaseContract {
5
5
  id: SddPhaseId;
6
6
  order: number;
7
7
  requiredFor: SddPipelineType[];
8
8
  prerequisites: SddPhaseId[];
9
9
  producesArtifact: boolean;
10
- gate?: 'oracle-review' | 'user-confirmation';
10
+ gate?: 'oracle-review' | 'user-confirmation' | 'iterative-verify';
11
+ maxRounds?: number;
11
12
  owner: 'orchestrator' | 'read-only-agent' | 'write-capable-agent' | 'oracle' | 'user';
12
13
  artifactSkill?: string;
13
14
  artifactMeaning?: string;
@@ -17,6 +18,7 @@ export interface SddPhaseContract {
17
18
  supportingAgentRoles?: AgentRoleName[];
18
19
  persistenceAgentRole?: AgentRoleName;
19
20
  delegationReason?: string;
21
+ handoffHints?: string[];
20
22
  }
21
23
  export interface SddWorkflowContract {
22
24
  phases: SddPhaseContract[];
@@ -24,7 +26,8 @@ export interface SddWorkflowContract {
24
26
  artifactRules: string[];
25
27
  verificationRules: string[];
26
28
  }
27
- export declare const FULL_SDD_PHASE_ORDER: readonly ["requirements-interview", "explore", "proposal", "spec", "design", "tasks", "plan-review", "implementation-confirmation", "apply", "verify", "archive"];
29
+ export declare const FULL_SDD_PHASE_ORDER: readonly ["requirements-interview", "explore", "proposal", "spec", "clarify", "design", "tasks", "plan-review", "implementation-confirmation", "apply", "verify", "archive"];
30
+ export declare const SDD_VERIFY_MAX_ROUNDS = 3;
28
31
  export declare const SDD_PHASES: readonly [{
29
32
  readonly id: "requirements-interview";
30
33
  readonly order: 0;
@@ -41,7 +44,7 @@ export declare const SDD_PHASES: readonly [{
41
44
  readonly producesArtifact: true;
42
45
  readonly owner: "write-capable-agent";
43
46
  readonly artifactSkill: "sdd-init";
44
- readonly condition: "Only when OpenSpec persistence is selected and openspec/ is missing.";
47
+ readonly condition: "Only when OpenSpec persistence is selected and openspec/ is missing or stale (partial structure or missing mechanism sections).";
45
48
  readonly defaultAgentRole: "quick";
46
49
  readonly supportingAgentRoles: ["explorer"];
47
50
  readonly delegationReason: "Fast mechanical bootstrap, with explorer supplying repository facts when needed.";
@@ -66,6 +69,7 @@ export declare const SDD_PHASES: readonly [{
66
69
  readonly defaultAgentRole: "deep";
67
70
  readonly supportingAgentRoles: ["oracle"];
68
71
  readonly delegationReason: "Structured technical reasoning and trade-off synthesis before implementation.";
72
+ readonly handoffHints: ["Preserve accepted scope and explicit non-goals downstream.", "Carry deferred or discovery affected areas forward as follow-up."];
69
73
  }, {
70
74
  readonly id: "spec";
71
75
  readonly order: 4;
@@ -77,11 +81,24 @@ export declare const SDD_PHASES: readonly [{
77
81
  readonly defaultAgentRole: "deep";
78
82
  readonly supportingAgentRoles: ["oracle"];
79
83
  readonly delegationReason: "High-quality requirement contract work where ambiguity propagates downstream.";
84
+ readonly handoffHints: ["Preserve recorded Assumptions and any [NEEDS CLARIFICATION] resolutions.", "Keep the requirements-quality checklist resolved before tasks."];
80
85
  }, {
81
- readonly id: "design";
86
+ readonly id: "clarify";
82
87
  readonly order: 5;
83
88
  readonly requiredFor: ["full"];
84
- readonly prerequisites: ["proposal", "spec"];
89
+ readonly prerequisites: ["spec"];
90
+ readonly producesArtifact: false;
91
+ readonly owner: "write-capable-agent";
92
+ readonly artifactSkill: "sdd-clarify";
93
+ readonly defaultAgentRole: "deep";
94
+ readonly supportingAgentRoles: ["oracle"];
95
+ readonly delegationReason: "Resolve residual spec ambiguity in place before design consumes it.";
96
+ readonly handoffHints: ["Preserve clarified resolutions written back into the spec.", "Keep the requirements-quality checklist re-validated before design."];
97
+ }, {
98
+ readonly id: "design";
99
+ readonly order: 6;
100
+ readonly requiredFor: ["full"];
101
+ readonly prerequisites: ["proposal", "clarify"];
85
102
  readonly producesArtifact: true;
86
103
  readonly owner: "write-capable-agent";
87
104
  readonly artifactSkill: "sdd-design";
@@ -89,9 +106,10 @@ export declare const SDD_PHASES: readonly [{
89
106
  readonly defaultAgentRole: "deep";
90
107
  readonly supportingAgentRoles: ["designer"];
91
108
  readonly delegationReason: "Technical architecture and file-change design; designer only supports UI/UX concerns.";
109
+ readonly handoffHints: ["Preserve coverage decisions and architecture constraints in tasks.", "Honor the Constitution Check outcome recorded during design."];
92
110
  }, {
93
111
  readonly id: "tasks";
94
- readonly order: 6;
112
+ readonly order: 7;
95
113
  readonly requiredFor: ["accelerated", "full"];
96
114
  readonly prerequisites: ["proposal", "spec", "design"];
97
115
  readonly producesArtifact: true;
@@ -102,7 +120,7 @@ export declare const SDD_PHASES: readonly [{
102
120
  readonly delegationReason: "Mechanical conversion of settled design into dependency-ordered execution tasks.";
103
121
  }, {
104
122
  readonly id: "plan-review";
105
- readonly order: 7;
123
+ readonly order: 8;
106
124
  readonly requiredFor: ["accelerated", "full"];
107
125
  readonly prerequisites: ["tasks"];
108
126
  readonly producesArtifact: false;
@@ -112,7 +130,7 @@ export declare const SDD_PHASES: readonly [{
112
130
  readonly delegationReason: "Independent read-only executability review of tasks before implementation.";
113
131
  }, {
114
132
  readonly id: "implementation-confirmation";
115
- readonly order: 8;
133
+ readonly order: 9;
116
134
  readonly requiredFor: ["accelerated", "full"];
117
135
  readonly prerequisites: ["plan-review"];
118
136
  readonly producesArtifact: false;
@@ -121,7 +139,7 @@ export declare const SDD_PHASES: readonly [{
121
139
  readonly delegationReason: "Human approval gate after reviewed tasks and before workspace implementation.";
122
140
  }, {
123
141
  readonly id: "apply";
124
- readonly order: 9;
142
+ readonly order: 10;
125
143
  readonly requiredFor: ["direct", "accelerated", "full"];
126
144
  readonly prerequisites: ["implementation-confirmation"];
127
145
  readonly producesArtifact: false;
@@ -131,10 +149,12 @@ export declare const SDD_PHASES: readonly [{
131
149
  readonly delegationReason: "Correctness-heavy implementation by default; quick handles mechanical batches and designer owns UI/visual work.";
132
150
  }, {
133
151
  readonly id: "verify";
134
- readonly order: 10;
152
+ readonly order: 11;
135
153
  readonly requiredFor: ["accelerated", "full"];
136
154
  readonly prerequisites: ["apply"];
137
155
  readonly producesArtifact: true;
156
+ readonly gate: "iterative-verify";
157
+ readonly maxRounds: 3;
138
158
  readonly owner: "oracle";
139
159
  readonly artifactSkill: "sdd-verify";
140
160
  readonly defaultAgentRole: "oracle";
@@ -142,7 +162,7 @@ export declare const SDD_PHASES: readonly [{
142
162
  readonly delegationReason: "Independent verification review; quick persists the report when the selected store requires writes.";
143
163
  }, {
144
164
  readonly id: "archive";
145
- readonly order: 11;
165
+ readonly order: 12;
146
166
  readonly requiredFor: ["accelerated", "full"];
147
167
  readonly prerequisites: ["verify"];
148
168
  readonly producesArtifact: true;
@@ -51,6 +51,13 @@ export declare const BUNDLED_SKILL_REGISTRY: readonly [{
51
51
  readonly sourcePath: "src/skills/sdd-spec";
52
52
  readonly kind: "skill";
53
53
  readonly purpose: "sdd";
54
+ }, {
55
+ readonly name: "sdd-clarify";
56
+ readonly description: "Resolve residual spec ambiguity in place before design, with a bounded taxonomy-driven clarification pass.";
57
+ readonly allowedRoles: AgentRoleName[];
58
+ readonly sourcePath: "src/skills/sdd-clarify";
59
+ readonly kind: "skill";
60
+ readonly purpose: "sdd";
54
61
  }, {
55
62
  readonly name: "sdd-design";
56
63
  readonly description: "Create technical solution design artifacts for changes";
@@ -93,6 +100,13 @@ export declare const BUNDLED_SKILL_REGISTRY: readonly [{
93
100
  readonly sourcePath: "src/skills/sdd-archive";
94
101
  readonly kind: "skill";
95
102
  readonly purpose: "sdd";
103
+ }, {
104
+ readonly name: "sdd-constitution";
105
+ readonly description: "Guide a semver constitution amendment and Sync-Impact Report entry.";
106
+ readonly allowedRoles: AgentRoleName[];
107
+ readonly sourcePath: "src/skills/sdd-constitution";
108
+ readonly kind: "skill";
109
+ readonly purpose: "sdd";
96
110
  }];
97
111
  export declare const SKILL_REGISTRY: readonly [{
98
112
  readonly name: "requirements-interview";
@@ -136,6 +150,13 @@ export declare const SKILL_REGISTRY: readonly [{
136
150
  readonly sourcePath: "src/skills/sdd-spec";
137
151
  readonly kind: "skill";
138
152
  readonly purpose: "sdd";
153
+ }, {
154
+ readonly name: "sdd-clarify";
155
+ readonly description: "Resolve residual spec ambiguity in place before design, with a bounded taxonomy-driven clarification pass.";
156
+ readonly allowedRoles: AgentRoleName[];
157
+ readonly sourcePath: "src/skills/sdd-clarify";
158
+ readonly kind: "skill";
159
+ readonly purpose: "sdd";
139
160
  }, {
140
161
  readonly name: "sdd-design";
141
162
  readonly description: "Create technical solution design artifacts for changes";
@@ -178,6 +199,13 @@ export declare const SKILL_REGISTRY: readonly [{
178
199
  readonly sourcePath: "src/skills/sdd-archive";
179
200
  readonly kind: "skill";
180
201
  readonly purpose: "sdd";
202
+ }, {
203
+ readonly name: "sdd-constitution";
204
+ readonly description: "Guide a semver constitution amendment and Sync-Impact Report entry.";
205
+ readonly allowedRoles: AgentRoleName[];
206
+ readonly sourcePath: "src/skills/sdd-constitution";
207
+ readonly kind: "skill";
208
+ readonly purpose: "sdd";
181
209
  }, SkillRegistryEntry];
182
210
  export declare function getSkillRegistry(): SkillRegistryEntry[];
183
211
  export declare function getBundledSkillRegistry(): SkillRegistryEntry[];