thoth-agents 0.3.10 → 0.3.12

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 (52) hide show
  1. package/README.md +119 -33
  2. package/dist/{chunk-TKIDBRM3.js → chunk-5UBJB5QO.js} +4 -1
  3. package/dist/{chunk-M2WF46BP.js → chunk-DX4U3AD3.js} +387 -231
  4. package/dist/{chunk-JBG7XMIG.js → chunk-VPVBYBPU.js} +602 -180
  5. package/dist/cli/codex-plugin-install.d.ts +16 -2
  6. package/dist/cli/index.js +7 -5
  7. package/dist/cli/tui/index.js +2 -2
  8. package/dist/config/constants.d.ts +3 -3
  9. package/dist/harness/adapters/claude-code.d.ts +8 -0
  10. package/dist/harness/adapters/codex-surfaces.d.ts +2 -2
  11. package/dist/harness/core/agent-pack.d.ts +60 -5
  12. package/dist/harness/core/sdd.d.ts +32 -19
  13. package/dist/harness/writers/codex-plugin-package.d.ts +1 -0
  14. package/dist/index.js +2 -2
  15. package/package.json +4 -4
  16. package/plugin/.claude-plugin/.thoth-agents-plugin-assets.json +7 -7
  17. package/plugin/.claude-plugin/plugin.json +1 -1
  18. package/plugin/.codex-plugin/plugin.json +1 -1
  19. package/plugin/agents/deep.md +10 -31
  20. package/plugin/agents/designer.md +10 -31
  21. package/plugin/agents/explorer.md +10 -30
  22. package/plugin/agents/librarian.md +10 -30
  23. package/plugin/agents/oracle.md +11 -31
  24. package/plugin/agents/orchestrator.md +48 -35
  25. package/plugin/agents/quick.md +10 -31
  26. package/plugin/skills/plan-reviewer/SKILL.md +54 -15
  27. package/plugin/skills/thoth-archive/SKILL.md +5 -0
  28. package/plugin/skills/thoth-archive/scripts/archive.mjs +30 -10
  29. package/plugin/skills/thoth-constitution/SKILL.md +5 -0
  30. package/plugin/skills/thoth-constitution/templates/constitution.md +19 -2
  31. package/plugin/skills/thoth-init/SKILL.md +5 -0
  32. package/plugin/skills/thoth-sdd/SKILL.md +48 -11
  33. package/plugin/skills/thoth-sdd/references/phases/implement.md +44 -6
  34. package/plugin/skills/thoth-sdd/references/phases/tasks.md +23 -2
  35. package/plugin/skills/thoth-sdd/references/phases/verify.md +7 -5
  36. package/plugin/skills/thoth-sdd/scripts/validate.mjs +263 -30
  37. package/plugin/skills/thoth-sdd/templates/tasks.md +18 -2
  38. package/skills/README.md +2 -1
  39. package/skills/plan-reviewer/SKILL.md +54 -15
  40. package/skills/thoth-archive/SKILL.md +5 -0
  41. package/skills/thoth-archive/scripts/archive.mjs +30 -10
  42. package/skills/thoth-constitution/SKILL.md +5 -0
  43. package/skills/thoth-constitution/templates/constitution.md +19 -2
  44. package/skills/thoth-init/SKILL.md +5 -0
  45. package/skills/thoth-sdd/SKILL.md +48 -11
  46. package/skills/thoth-sdd/references/phases/implement.md +44 -6
  47. package/skills/thoth-sdd/references/phases/tasks.md +23 -2
  48. package/skills/thoth-sdd/references/phases/verify.md +7 -5
  49. package/skills/thoth-sdd/scripts/validate.mjs +263 -30
  50. package/skills/thoth-sdd/templates/tasks.md +18 -2
  51. package/.agents/plugins/marketplace.json +0 -20
  52. package/.claude-plugin/marketplace.json +0 -21
@@ -213,10 +213,10 @@ var ALL_AGENT_NAMES = [
213
213
  ];
214
214
  var CONFIRMED_OPENAI_SUBAGENT_PRESET = {
215
215
  explorer: { model: "gpt-5.6-luna", effort: "low" },
216
- librarian: { model: "gpt-5.6-luna", effort: "xhigh" },
217
- oracle: { model: "gpt-5.6-sol", effort: "xhigh" },
216
+ librarian: { model: "gpt-5.6-luna", effort: "high" },
217
+ oracle: { model: "gpt-5.6-sol", effort: "high" },
218
218
  designer: { model: "gpt-5.6-sol", effort: "medium" },
219
- quick: { model: "gpt-5.6-luna", effort: "xhigh" },
219
+ quick: { model: "gpt-5.6-luna", effort: "low" },
220
220
  deep: { model: "gpt-5.6-sol", effort: "medium" }
221
221
  };
222
222
  var OPENCODE_OPENAI_ORCHESTRATOR_PRESET = {
@@ -735,6 +735,311 @@ function loadAgentPrompt(agentName, preset) {
735
735
  return result;
736
736
  }
737
737
 
738
+ // src/harness/core/agent-pack.ts
739
+ var AGENT_ROLES = [
740
+ {
741
+ name: "orchestrator",
742
+ mode: "adaptive-root",
743
+ dispatch: "root-coordinator",
744
+ canMutateWorkspace: true,
745
+ scope: "requirements, SDD coordination, routing, bounded implementation, decisions, and synthesis",
746
+ responsibility: "Keep requirements, decisions, sequential SDD coordination, and final synthesis in the root thread; evaluate implementation ownership independently in every route, implement directly or delegate by demonstrated net gain, and run focused verification for trivial deterministic Direct work.",
747
+ useWhen: [
748
+ "Coordinate requirements, governed artifacts, routing, and synthesis.",
749
+ "Implement an accepted mutable surface in any route when accumulated context and continuity outweigh delegation overhead."
750
+ ],
751
+ doNotUseWhen: [
752
+ "Not for independent plan review or Oracle-required final verification."
753
+ ],
754
+ escalateWhen: [
755
+ "Delegate implementation when specialization, context isolation, or independent bounded work creates a demonstrated net gain; then select designer, quick, or deep by task shape."
756
+ ],
757
+ toolGovernance: [
758
+ "may inspect and edit the accepted bounded implementation surface in every route and may verify trivial deterministic Direct work without self-approval",
759
+ "loads the matching thoth-sdd phase contract on demand instead of carrying every phase protocol in its prompt",
760
+ "owns governed coordination writes under openspec/ and uses append-only tasks.md updates during convergence",
761
+ "delegates independent or specialist work only when it produces a net gain",
762
+ "keeps requirements, decisions, and final synthesis in the root thread"
763
+ ],
764
+ verification: [
765
+ "runs focused checks for trivial deterministic Direct work while final verification remains mandatory",
766
+ "delegates selected plan review plus Accelerated, Full, and material-risk Direct final verification to a fresh oracle",
767
+ "consolidates summarized evidence returned by child agents"
768
+ ]
769
+ },
770
+ {
771
+ name: "explorer",
772
+ mode: "read-only",
773
+ dispatch: "task",
774
+ canMutateWorkspace: false,
775
+ scope: "local repository discovery",
776
+ responsibility: "Resolve broad or uncertain repository questions and return distilled evidence.",
777
+ useWhen: ["Repository ownership or behavior is broad or uncertain."],
778
+ doNotUseWhen: ["Not for implementation, edits, or known narrow questions."],
779
+ escalateWhen: [
780
+ "Send external evidence to librarian and mutation scope to root."
781
+ ],
782
+ toolGovernance: [
783
+ "uses read, search, and code-navigation tools only",
784
+ "does not mutate files or delegate further"
785
+ ],
786
+ verification: ["reports inspected paths, confidence, and remaining gaps"]
787
+ },
788
+ {
789
+ name: "librarian",
790
+ mode: "read-only",
791
+ dispatch: "task",
792
+ canMutateWorkspace: false,
793
+ scope: "authoritative external research with local confirmation when needed",
794
+ responsibility: "Gather current authoritative evidence and separate documented facts from inference.",
795
+ useWhen: ["Current authoritative external evidence is required."],
796
+ doNotUseWhen: ["Not for implementation, edits, or purely local discovery."],
797
+ escalateWhen: ["Report contradictory or insufficient sources to root."],
798
+ toolGovernance: [
799
+ "uses research and read-only local tools",
800
+ "does not mutate files or delegate further"
801
+ ],
802
+ verification: ["provides direct sources for substantive external claims"]
803
+ },
804
+ {
805
+ name: "oracle",
806
+ mode: "read-only",
807
+ dispatch: "synchronous-task-only",
808
+ canMutateWorkspace: false,
809
+ scope: "diagnosis, architecture, optional plan review, and independent verification",
810
+ responsibility: "Independently review plans when the user requests it and provide independent judgment for artifact-backed or material-risk final verification, exposing correctness risks and judging whether results satisfy their contracts.",
811
+ useWhen: [
812
+ "Selected plan review, persistent diagnosis, material architecture or security risk, contradictory evidence, high failure cost, or artifact-backed final verification needs independent judgment."
813
+ ],
814
+ doNotUseWhen: [
815
+ "Not for implementation, mutation, persistence, or self-review."
816
+ ],
817
+ escalateWhen: ["Return blockers and remediation anchors to root."],
818
+ toolGovernance: [
819
+ "performs read-only analysis and independent review and is never the implementer of the work it judges",
820
+ "does not implement, persist artifacts, or delegate further"
821
+ ],
822
+ verification: ["separates observations, risks, and recommendations"]
823
+ },
824
+ {
825
+ name: "designer",
826
+ mode: "write-capable",
827
+ dispatch: "synchronous-task-only",
828
+ canMutateWorkspace: true,
829
+ scope: "UI/UX decisions, implementation, and visual verification",
830
+ responsibility: "Own user-facing implementation choices and visual quality for UI work.",
831
+ useWhen: [
832
+ "User-facing UI/UX, interaction, accessibility, or visual quality is material."
833
+ ],
834
+ doNotUseWhen: [
835
+ "Not for backend-only, non-visual, or correctness-heavy cross-cutting work."
836
+ ],
837
+ escalateWhen: [
838
+ "Escalate coupled contracts, migrations, or high risk to deep."
839
+ ],
840
+ toolGovernance: [
841
+ "may edit focused UI/UX files",
842
+ "owns screenshots and visual QA",
843
+ "does not delegate further"
844
+ ],
845
+ verification: ["includes visual verification when applicable"]
846
+ },
847
+ {
848
+ name: "quick",
849
+ mode: "write-capable",
850
+ dispatch: "synchronous-task-only",
851
+ canMutateWorkspace: true,
852
+ scope: "fast bounded implementation",
853
+ responsibility: "Implement narrow, clear, low-risk changes within an explicitly bounded surface.",
854
+ useWhen: ["Known narrow mechanical low-risk work has exact targets."],
855
+ doNotUseWhen: [
856
+ "Not for coupled contracts, migrations, broad discovery, concurrency, edge cases, or high risk."
857
+ ],
858
+ escalateWhen: [
859
+ "Escalate discovery, coupling, edge cases, or higher risk to deep."
860
+ ],
861
+ toolGovernance: [
862
+ "edits only bounded targets",
863
+ "escalates when discovery or correctness risk exceeds the assignment",
864
+ "does not delegate further"
865
+ ],
866
+ verification: ["runs the smallest sufficient focused check"]
867
+ },
868
+ {
869
+ name: "deep",
870
+ mode: "write-capable",
871
+ dispatch: "synchronous-task-only",
872
+ canMutateWorkspace: true,
873
+ scope: "correctness-critical implementation and verification",
874
+ responsibility: "Handle multi-file, edge-case-heavy, or high-risk implementation with full local context.",
875
+ useWhen: [
876
+ "Implementation is multi-file, edge-case-heavy, migration, concurrency, shared-contract, or high-risk."
877
+ ],
878
+ doNotUseWhen: ["Not for visual-only work or narrow known low-risk edits."],
879
+ escalateWhen: ["Return product or architecture choices to root."],
880
+ toolGovernance: [
881
+ "may edit implementation and tests within the assigned surface",
882
+ "validates shared behavior against related code and call sites",
883
+ "does not delegate further"
884
+ ],
885
+ verification: ["reports focused checks and relevant edge-case evidence"]
886
+ }
887
+ ];
888
+ var ORCHESTRATION_POLICY = {
889
+ maxDelegationDepth: 1,
890
+ singleWriter: true,
891
+ implementationOwnership: {
892
+ eligibleOwners: ["orchestrator", "designer", "quick", "deep"],
893
+ routeIndependent: true,
894
+ delegationBenefits: [
895
+ "specialization",
896
+ "context isolation",
897
+ "independent bounded work",
898
+ "safe parallelism",
899
+ "quality, latency, or total-cost gain"
900
+ ],
901
+ rootContinuityBenefits: [
902
+ "short work",
903
+ "one ordered reasoning chain",
904
+ "frequent shared-state writes",
905
+ "already-loaded context",
906
+ "rediscovery and coordination cost"
907
+ ],
908
+ userDirection: "explicit safe user direction is an ownership input",
909
+ insufficientSignals: [
910
+ "SDD route name",
911
+ "file count alone",
912
+ "cheaper model price without end-to-end evidence"
913
+ ]
914
+ },
915
+ taskShaping: {
916
+ steps: [
917
+ "bound-work",
918
+ "map-dependencies",
919
+ "assign-ownership",
920
+ "select-specialists",
921
+ "mark-ready-and-blocked",
922
+ "dispatch-ready-wave",
923
+ "wait-for-terminal-evidence",
924
+ "reconcile-and-verify"
925
+ ],
926
+ nativeAuthority: true,
927
+ boundedWidth: true,
928
+ decisions: {
929
+ dependency: "block a lane until every concrete upstream output exists",
930
+ ownershipConflict: "serialize overlapping mutable surfaces or assign one writer",
931
+ readyWave: "dispatch all independent conflict-free ready lanes before waiting",
932
+ terminalEvidence: "silence, timeout, and malformed status remain nonterminal",
933
+ degradation: "report an unavailable native primitive and use a truthful sequential fallback"
934
+ }
935
+ },
936
+ specialistDirectory: AGENT_ROLES.filter(
937
+ (role) => role.name !== "orchestrator"
938
+ ).map((role) => ({
939
+ role: role.name,
940
+ selectWhen: role.useWhen.join(" "),
941
+ rejectWhen: role.doNotUseWhen.join(" ")
942
+ })),
943
+ rules: [
944
+ "Direct, Accelerated, Full, and no-artifact execution govern artifacts and gates, not implementation ownership.",
945
+ "Root or a specialist may implement in every route; delegate only when specialization, context isolation, independent bounded work, or safe parallelism creates a demonstrated quality, latency, or total-cost net gain.",
946
+ "Keep implementation in root when short work, one ordered reasoning chain, frequent shared-state writes, already-loaded context, rediscovery, or coordination cost outweigh delegation benefit.",
947
+ "Treat explicit safe user direction as an ownership input; route name, file count alone, or cheaper model price without end-to-end evidence cannot choose an owner.",
948
+ "After deciding to delegate implementation, select designer for UI/UX, quick for known narrow low-risk work, and deep for coupled or high-risk work.",
949
+ "Use one writer for each mutable surface and never parallelize overlapping writes.",
950
+ "A fresh subagent instance is the default when the objective, SDD phase, mutable surface, or independent judgment changes.",
951
+ "Continue an existing subagent only to steer, complete, or clarify the same bounded assignment; completed agents are not a reusable role pool.",
952
+ "Every Oracle plan review, verification round, and approval or PASS judgment uses a fresh Oracle instance; reuse is limited to clarifying current findings.",
953
+ "Final verification is mandatory: root owns trivial deterministic Direct checks; a fresh Oracle owns Accelerated, Full, and material-risk Direct judgment.",
954
+ "Wait and status operations collect only the active nonterminal assignment and do not authorize later reuse.",
955
+ "Child agents return distilled evidence instead of raw logs or file dumps."
956
+ ]
957
+ };
958
+ var AGENT_RETURN_CONTRACT = [
959
+ "conclusion",
960
+ "evidence",
961
+ "verification",
962
+ "risks",
963
+ "openQuestions",
964
+ "nextAction"
965
+ ];
966
+ var VERIFICATION_PROTOCOL = [
967
+ "Completion reports identify changed files and verification evidence.",
968
+ "Behavior changes receive the smallest sufficient automated check or a declared manual check.",
969
+ "Visual changes receive designer-owned visual QA when applicable."
970
+ ];
971
+ var AGENT_PACK_CONTRACT = {
972
+ roles: [...AGENT_ROLES],
973
+ orchestrationPolicy: {
974
+ ...ORCHESTRATION_POLICY,
975
+ rules: [...ORCHESTRATION_POLICY.rules]
976
+ },
977
+ returnContract: [...AGENT_RETURN_CONTRACT],
978
+ verificationProtocol: [...VERIFICATION_PROTOCOL]
979
+ };
980
+ function getAgentRole(name) {
981
+ const role = AGENT_ROLES.find((candidate) => candidate.name === name);
982
+ if (!role) {
983
+ throw new Error(`Unknown agent role: ${name}`);
984
+ }
985
+ return role;
986
+ }
987
+ function renderAgentRoutingDescription(role) {
988
+ return [
989
+ role.responsibility,
990
+ `Use when: ${role.useWhen.join(" ")}`,
991
+ `Do not use when: ${role.doNotUseWhen.join(" ")}`,
992
+ `Escalate when: ${role.escalateWhen.join(" ")}`,
993
+ `Mutation: ${role.canMutateWorkspace ? `only the assigned ${role.scope} surface` : "read-only; never mutate the workspace"}.`,
994
+ `Verification: ${role.verification.join(" ")}`,
995
+ `Return: ${AGENT_RETURN_CONTRACT.join(", ")}.`
996
+ ].join(" ");
997
+ }
998
+ function getAgentPackContract() {
999
+ return {
1000
+ roles: AGENT_PACK_CONTRACT.roles.map((role) => ({
1001
+ ...role,
1002
+ useWhen: [...role.useWhen],
1003
+ doNotUseWhen: [...role.doNotUseWhen],
1004
+ escalateWhen: [...role.escalateWhen],
1005
+ writeScope: role.writeScope ? [...role.writeScope] : void 0,
1006
+ toolGovernance: [...role.toolGovernance],
1007
+ verification: [...role.verification]
1008
+ })),
1009
+ orchestrationPolicy: {
1010
+ ...AGENT_PACK_CONTRACT.orchestrationPolicy,
1011
+ implementationOwnership: {
1012
+ ...AGENT_PACK_CONTRACT.orchestrationPolicy.implementationOwnership,
1013
+ eligibleOwners: [
1014
+ ...AGENT_PACK_CONTRACT.orchestrationPolicy.implementationOwnership.eligibleOwners
1015
+ ],
1016
+ delegationBenefits: [
1017
+ ...AGENT_PACK_CONTRACT.orchestrationPolicy.implementationOwnership.delegationBenefits
1018
+ ],
1019
+ rootContinuityBenefits: [
1020
+ ...AGENT_PACK_CONTRACT.orchestrationPolicy.implementationOwnership.rootContinuityBenefits
1021
+ ],
1022
+ insufficientSignals: [
1023
+ ...AGENT_PACK_CONTRACT.orchestrationPolicy.implementationOwnership.insufficientSignals
1024
+ ]
1025
+ },
1026
+ taskShaping: {
1027
+ ...AGENT_PACK_CONTRACT.orchestrationPolicy.taskShaping,
1028
+ steps: [...AGENT_PACK_CONTRACT.orchestrationPolicy.taskShaping.steps],
1029
+ decisions: {
1030
+ ...AGENT_PACK_CONTRACT.orchestrationPolicy.taskShaping.decisions
1031
+ }
1032
+ },
1033
+ specialistDirectory: AGENT_PACK_CONTRACT.orchestrationPolicy.specialistDirectory.map(
1034
+ (decision) => ({ ...decision })
1035
+ ),
1036
+ rules: [...AGENT_PACK_CONTRACT.orchestrationPolicy.rules]
1037
+ },
1038
+ returnContract: [...AGENT_PACK_CONTRACT.returnContract],
1039
+ verificationProtocol: [...AGENT_PACK_CONTRACT.verificationProtocol]
1040
+ };
1041
+ }
1042
+
738
1043
  // src/agents/prompt-dialects.ts
739
1044
  var OPENCODE_CAPABILITIES = {
740
1045
  agentDefinitions: "supported",
@@ -911,170 +1216,6 @@ var CLAUDE_CODE_PROMPT_DIALECT = {
911
1216
  }
912
1217
  };
913
1218
 
914
- // src/harness/core/agent-pack.ts
915
- var AGENT_ROLES = [
916
- {
917
- name: "orchestrator",
918
- mode: "adaptive-root",
919
- dispatch: "root-coordinator",
920
- canMutateWorkspace: true,
921
- scope: "requirements, SDD coordination, routing, bounded direct work, decisions, and synthesis",
922
- responsibility: "Keep the task coherent, own sequential specification, planning, task, convergence, and archive coordination, act directly when work is clear and bounded, and delegate only for net gain.",
923
- toolGovernance: [
924
- "may inspect and edit bounded direct work, but every verification is delegated to oracle",
925
- "loads the matching thoth-sdd phase contract on demand instead of carrying every phase protocol in its prompt",
926
- "owns governed coordination writes under openspec/ and uses append-only tasks.md updates during convergence",
927
- "delegates independent or specialist work only when it produces a net gain",
928
- "keeps requirements, decisions, and final synthesis in the root thread"
929
- ],
930
- verification: [
931
- "delegates selected plan-review and every verify phase to oracle; plan review stays optional and final verification stays mandatory",
932
- "consolidates summarized evidence returned by child agents"
933
- ]
934
- },
935
- {
936
- name: "explorer",
937
- mode: "read-only",
938
- dispatch: "task",
939
- canMutateWorkspace: false,
940
- scope: "local repository discovery",
941
- responsibility: "Resolve broad or uncertain repository questions and return distilled evidence.",
942
- toolGovernance: [
943
- "uses read, search, and code-navigation tools only",
944
- "does not mutate files or delegate further"
945
- ],
946
- verification: ["reports inspected paths, confidence, and remaining gaps"]
947
- },
948
- {
949
- name: "librarian",
950
- mode: "read-only",
951
- dispatch: "task",
952
- canMutateWorkspace: false,
953
- scope: "authoritative external research with local confirmation when needed",
954
- responsibility: "Gather current authoritative evidence and separate documented facts from inference.",
955
- toolGovernance: [
956
- "uses research and read-only local tools",
957
- "does not mutate files or delegate further"
958
- ],
959
- verification: ["provides direct sources for substantive external claims"]
960
- },
961
- {
962
- name: "oracle",
963
- mode: "read-only",
964
- dispatch: "synchronous-task-only",
965
- canMutateWorkspace: false,
966
- scope: "diagnosis, architecture, optional plan review, and independent verification",
967
- responsibility: "Independently review plans when the user requests it and perform every implementation verification, exposing correctness risks and judging whether results satisfy their contracts.",
968
- toolGovernance: [
969
- "performs read-only analysis and independent review and is never the implementer of the work it judges",
970
- "does not implement, persist artifacts, or delegate further"
971
- ],
972
- verification: ["separates observations, risks, and recommendations"]
973
- },
974
- {
975
- name: "designer",
976
- mode: "write-capable",
977
- dispatch: "synchronous-task-only",
978
- canMutateWorkspace: true,
979
- scope: "UI/UX decisions, implementation, and visual verification",
980
- responsibility: "Own user-facing implementation choices and visual quality for UI work.",
981
- toolGovernance: [
982
- "may edit focused UI/UX files",
983
- "owns screenshots and visual QA",
984
- "does not delegate further"
985
- ],
986
- verification: ["includes visual verification when applicable"]
987
- },
988
- {
989
- name: "quick",
990
- mode: "write-capable",
991
- dispatch: "synchronous-task-only",
992
- canMutateWorkspace: true,
993
- scope: "fast bounded implementation",
994
- responsibility: "Implement narrow, clear, low-risk changes within an explicitly bounded surface.",
995
- toolGovernance: [
996
- "edits only bounded targets",
997
- "escalates when discovery or correctness risk exceeds the assignment",
998
- "does not delegate further"
999
- ],
1000
- verification: ["runs the smallest sufficient focused check"]
1001
- },
1002
- {
1003
- name: "deep",
1004
- mode: "write-capable",
1005
- dispatch: "synchronous-task-only",
1006
- canMutateWorkspace: true,
1007
- scope: "correctness-critical implementation and verification",
1008
- responsibility: "Handle multi-file, edge-case-heavy, or high-risk implementation with full local context.",
1009
- toolGovernance: [
1010
- "may edit implementation and tests within the assigned surface",
1011
- "validates shared behavior against related code and call sites",
1012
- "does not delegate further"
1013
- ],
1014
- verification: ["reports focused checks and relevant edge-case evidence"]
1015
- }
1016
- ];
1017
- var ORCHESTRATION_POLICY = {
1018
- maxDelegationDepth: 1,
1019
- singleWriter: true,
1020
- rules: [
1021
- "The root performs bounded direct work when scope and intent are clear.",
1022
- "Delegate only when specialization, context isolation, or independent parallel work creates a net gain.",
1023
- "Prefer child agents for read-heavy exploration, research, analysis, and verification.",
1024
- "Use one writer for each mutable surface and never parallelize overlapping writes.",
1025
- "A fresh subagent instance is the default when the objective, SDD phase, mutable surface, or independent judgment changes.",
1026
- "Continue an existing subagent only to steer, complete, or clarify the same bounded assignment; completed agents are not a reusable role pool.",
1027
- "Every Oracle plan review, verification round, and approval or PASS judgment uses a fresh Oracle instance; reuse is limited to clarifying current findings.",
1028
- "Wait and status operations collect only the active nonterminal assignment and do not authorize later reuse.",
1029
- "Child agents return distilled evidence instead of raw logs or file dumps."
1030
- ]
1031
- };
1032
- var AGENT_RETURN_CONTRACT = [
1033
- "conclusion",
1034
- "evidence",
1035
- "verification",
1036
- "risks",
1037
- "openQuestions",
1038
- "nextAction"
1039
- ];
1040
- var VERIFICATION_PROTOCOL = [
1041
- "Completion reports identify changed files and verification evidence.",
1042
- "Behavior changes receive the smallest sufficient automated check or a declared manual check.",
1043
- "Visual changes receive designer-owned visual QA when applicable."
1044
- ];
1045
- var AGENT_PACK_CONTRACT = {
1046
- roles: [...AGENT_ROLES],
1047
- orchestrationPolicy: {
1048
- ...ORCHESTRATION_POLICY,
1049
- rules: [...ORCHESTRATION_POLICY.rules]
1050
- },
1051
- returnContract: [...AGENT_RETURN_CONTRACT],
1052
- verificationProtocol: [...VERIFICATION_PROTOCOL]
1053
- };
1054
- function getAgentRole(name) {
1055
- const role = AGENT_ROLES.find((candidate) => candidate.name === name);
1056
- if (!role) {
1057
- throw new Error(`Unknown agent role: ${name}`);
1058
- }
1059
- return role;
1060
- }
1061
- function getAgentPackContract() {
1062
- return {
1063
- roles: AGENT_PACK_CONTRACT.roles.map((role) => ({
1064
- ...role,
1065
- writeScope: role.writeScope ? [...role.writeScope] : void 0,
1066
- toolGovernance: [...role.toolGovernance],
1067
- verification: [...role.verification]
1068
- })),
1069
- orchestrationPolicy: {
1070
- ...AGENT_PACK_CONTRACT.orchestrationPolicy,
1071
- rules: [...AGENT_PACK_CONTRACT.orchestrationPolicy.rules]
1072
- },
1073
- returnContract: [...AGENT_PACK_CONTRACT.returnContract],
1074
- verificationProtocol: [...AGENT_PACK_CONTRACT.verificationProtocol]
1075
- };
1076
- }
1077
-
1078
1219
  // src/harness/core/sdd.ts
1079
1220
  var SDD_PHASES = [
1080
1221
  {
@@ -1161,8 +1302,8 @@ var SDD_PHASES = [
1161
1302
  producesArtifact: true,
1162
1303
  defaultAgentRole: "oracle",
1163
1304
  eligibleAgentRoles: ["oracle"],
1164
- reason: "Offer independent blocker-only plan review when the user selects it after planning passes ready.",
1165
- condition: "Activate only after ready when the user chooses Review plan with Oracle (Recommended)."
1305
+ reason: "Offer independent blocker-only plan review after explicit or bounded recommended-default selection once planning passes ready.",
1306
+ condition: "Activate after ready when review is selected explicitly or by the bounded recommended default after three answerless attempts."
1166
1307
  },
1167
1308
  {
1168
1309
  id: "implement",
@@ -1172,9 +1313,9 @@ var SDD_PHASES = [
1172
1313
  activation: "required",
1173
1314
  prerequisites: ["tasks"],
1174
1315
  producesArtifact: false,
1175
- defaultAgentRole: "orchestrator",
1316
+ defaultAgentRole: "adaptive-implementation",
1176
1317
  eligibleAgentRoles: ["orchestrator", "designer", "quick", "deep"],
1177
- reason: "Let the adaptive root act directly or route the settled work to one writer."
1318
+ reason: "Choose root, designer, quick, or deep from task-shaped net gain independently from the SDD route."
1178
1319
  },
1179
1320
  {
1180
1321
  id: "verify",
@@ -1184,9 +1325,9 @@ var SDD_PHASES = [
1184
1325
  activation: "required",
1185
1326
  prerequisites: ["implement"],
1186
1327
  producesArtifact: true,
1187
- defaultAgentRole: "oracle",
1188
- eligibleAgentRoles: ["oracle"],
1189
- reason: "Independently judge the result against requirements, contracts, and focused checks."
1328
+ defaultAgentRole: "adaptive-verification",
1329
+ eligibleAgentRoles: ["orchestrator", "oracle"],
1330
+ reason: "Keep verification mandatory while selecting root for trivial deterministic Direct checks and a fresh Oracle for material-risk Direct or artifact-backed judgment."
1190
1331
  },
1191
1332
  {
1192
1333
  id: "converge",
@@ -1248,25 +1389,25 @@ var SDD_WORKFLOW_CONTRACT = {
1248
1389
  validationGates: [...policy.validationGates]
1249
1390
  })),
1250
1391
  routingRules: [
1251
- "The root recommends direct, accelerated, or full from risk evidence, but the user selects the route; an explicitly requested route already counts as selection.",
1392
+ "The root summarizes context and recommends direct, accelerated, or full from risk evidence; an explicit answer wins, while the third answerless route question selects the displayed recommendation, and an explicitly requested route already counts as selection.",
1252
1393
  "Direct work is the default for clear, bounded, low-risk changes; documentation and mechanical work may remain direct across multiple files.",
1253
1394
  "Accelerated SDD is used for multi-surface behavior, architecture, partial clarity, moderate risk, or broad non-behavioral coordination.",
1254
- "Accelerated planning fast-forwards specify, plan, and tasks without pauses between those artifacts, then offers the user optional oracle plan review after ready.",
1395
+ "Accelerated planning fast-forwards specify, plan, and tasks without pauses between those artifacts, then offers optional oracle plan review after ready; an explicit answer wins and the third answerless review question selects Review plan with Oracle (Recommended).",
1255
1396
  "Full SDD is used for unresolved scope, cross-cutting behavior or architecture, high contract risk, or high failure cost.",
1256
1397
  "Use architectural-grilling before specification only when the user explicitly requests it or material product or architecture decisions remain human-owned and unresolved; never require it merely because the route is Full.",
1257
- "Route selection and the post-ready plan-review choice are explicit user decisions; other input is requested only when a material unresolved decision changes the result."
1398
+ "Route selection and the post-ready plan-review choice resolve through an explicit answer or their bounded recommended fallback; other input is requested only when a material unresolved decision changes the result."
1258
1399
  ],
1259
1400
  artifactRules: [
1260
1401
  "Spec Kit artifact semantics are preserved inside the governed openspec store.",
1261
1402
  "Accelerated and full routes require spec.md, plan.md, tasks.md, verify-report.md, and archive-report.md.",
1262
1403
  "Research, data model, contracts, quickstart, requirements checklist, and plan-review.md are optional and created only when useful or selected.",
1263
- "The adaptive root writes coordination artifacts after loading the matching bundled phase contract; implementation ownership stays with the root or one writer role.",
1404
+ "The adaptive root writes coordination artifacts after loading the matching bundled phase contract; every route selects root, designer, quick, or deep from task shape, explicit direction, and demonstrated net gain.",
1264
1405
  "After oracle PASS, archive transactionally synchronizes only explicitly declared durable ADDED, MODIFIED, REMOVED, and RENAMED requirement deltas into openspec/specs; INTERNAL requirements and undeclared prose never update permanent specifications.",
1265
1406
  "Archive stages and backs up writes so handled failures roll back within the active process; forced process or operating-system termination is not crash-atomic."
1266
1407
  ],
1267
1408
  verificationRules: [
1268
- "Every route delegates focused verification to read-only oracle; the implementation writer never verifies its own work.",
1269
- "Accelerated and Full offer read-only oracle plan review after ready; it runs only when the user selects it and never replaces final verification.",
1409
+ "Every route requires final verification; trivial deterministic Direct checks are root-owned, while materially risky Direct and every Accelerated or Full final verification use a fresh read-only oracle, and no implementation writer self-approves.",
1410
+ "Accelerated and Full offer read-only oracle plan review after ready; it runs when selected explicitly or by the bounded recommended fallback and never replaces final verification.",
1270
1411
  "Accelerated and full verification persists verify-report.md with a pass or fail verdict and requirement compliance matrix.",
1271
1412
  "An artifact-backed fail verdict routes through append-only convergence, implementation, and verification again; direct work returns straight to implementation.",
1272
1413
  "A pass verdict is required before accelerated or full work can archive."
@@ -1306,13 +1447,6 @@ function getSddRouteExecutionPolicy(route) {
1306
1447
  validationGates: [...policy.validationGates]
1307
1448
  };
1308
1449
  }
1309
- function getSddPhase(id) {
1310
- const phase = SDD_PHASES.find((candidate) => candidate.id === id);
1311
- if (!phase) {
1312
- throw new Error(`Unknown SDD phase: ${id}`);
1313
- }
1314
- return clonePhase(phase);
1315
- }
1316
1450
  function renderSddPhaseDispatchTemplate() {
1317
1451
  return `## PHASE
1318
1452
  phase=<phase-id>
@@ -1349,9 +1483,6 @@ authorization=<none|recall|observe>
1349
1483
  context:
1350
1484
  <bounded recalled context or - none>`;
1351
1485
  }
1352
- function getSddPhaseOwner(_route, phaseId) {
1353
- return getSddPhase(phaseId).defaultAgentRole;
1354
- }
1355
1486
  function getRequiredSddPhaseOrder(route) {
1356
1487
  return SDD_PHASES.filter(
1357
1488
  (phase) => phase.requiredFor.includes(route)
@@ -1406,12 +1537,33 @@ function roleTemplate(role) {
1406
1537
  return `{{role.${role}}}`;
1407
1538
  }
1408
1539
  function renderSddRoute(route) {
1409
- return getRequiredSddPhaseOrder(route).map(
1410
- (phase) => `${phase} (${roleTemplate(getSddPhaseOwner(route, phase))})`
1411
- ).join(" -> ");
1412
- }
1413
- function renderRoleDirectory() {
1414
- return getAgentPackContract().roles.filter((role) => role.name !== "orchestrator").map((role) => `- ${roleTemplate(role.name)}: ${role.responsibility}`).join("\n");
1540
+ return getRequiredSddPhaseOrder(route).join(" -> ");
1541
+ }
1542
+ function renderImplementationOwnershipPolicy(policy) {
1543
+ return `<implementation-ownership>
1544
+ - SDD routes govern artifacts and gates, not implementation ownership.
1545
+ - Eligible owners in every route: ${policy.eligibleOwners.map((owner) => roleTemplate(owner)).join(", ")}.
1546
+ - Delegation benefits: ${policy.delegationBenefits.join("; ")}.
1547
+ - Root continuity benefits: ${policy.rootContinuityBenefits.join("; ")}.
1548
+ - Explicit safe user direction is an ownership input.
1549
+ - Insufficient signals: ${policy.insufficientSignals.join("; ")}.
1550
+ - Only after deciding delegation creates net gain: use ${roleTemplate("designer")} for UI/UX, ${roleTemplate("quick")} for known narrow low-risk work, and ${roleTemplate("deep")} for coupled or high-risk work.
1551
+ </implementation-ownership>`;
1552
+ }
1553
+ function renderRoleDirectory(directory) {
1554
+ return directory.map(
1555
+ ({ role, selectWhen, rejectWhen }) => `- ${roleTemplate(role)}: Select when ${selectWhen} Reject when ${rejectWhen}`
1556
+ ).join("\n");
1557
+ }
1558
+ function renderTaskShapingPolicy(policy) {
1559
+ return `<task-shaping>
1560
+ ${policy.steps.join(" -> ")}
1561
+ - ${policy.decisions.dependency}; bind each lane to output, mutable ownership, specialist fit, and verification input.
1562
+ - ${policy.decisions.ownershipConflict}; avoid duplicate evidence work.
1563
+ - ${policy.decisions.readyWave} through \`{{backgroundDelegationTool}}\` within native capacity, then use \`{{backgroundStatusTool}}\`.
1564
+ - Fan in only from {{lifecycleTerminalState}}; {{lifecycleNonterminalState}}, ${policy.decisions.terminalEvidence}.
1565
+ - Reconcile against intent, dependencies, ownership, conflicts, and verification before synthesis; native execution remains authoritative; ${policy.decisions.degradation}.
1566
+ </task-shaping>`;
1415
1567
  }
1416
1568
  function createOrchestratorPromptSections() {
1417
1569
  const workflow = getSddWorkflowContract();
@@ -1420,13 +1572,13 @@ function createOrchestratorPromptSections() {
1420
1572
  const full = getSddRouteExecutionPolicy("full");
1421
1573
  return [
1422
1574
  roleText(`<role>
1423
- You are the adaptive root for thoth-agents. Keep requirements, decisions, execution ownership, and final synthesis in this thread.
1575
+ You are the adaptive root for thoth-agents. Keep requirements, decisions, ownership, and synthesis here.
1424
1576
  </role>
1425
1577
 
1426
1578
  <operating-model>
1427
- - Handle bounded direct work when intent and risk are clear; never verify your own implementation.
1428
- - Delegate only for net gain from specialization, context isolation, review, or safe parallelism. The maximum delegation depth is ${policy.maxDelegationDepth}; children never delegate.
1429
- - Maintain one writer for each mutable surface. Parallelize only independent work with no overlapping writes.
1579
+ - Handle bounded implementation directly in any route when continuity outweighs delegation overhead; never self-approve.
1580
+ - The maximum delegation depth is ${policy.maxDelegationDepth}; children never delegate.
1581
+ - Keep one writer per mutable surface; parallelize only non-overlapping work.
1430
1582
  - Keep prompts bounded; request distilled evidence, not raw logs or full files.
1431
1583
  - Preserve unrelated changes; report changed files, evidence, risks, and capability gaps.
1432
1584
  - Use \`{{userQuestionTool}}\` only when a material unresolved choice changes the result. Continue all safe non-blocked work first.
@@ -1442,48 +1594,46 @@ You are the adaptive root for thoth-agents. Keep requirements, decisions, execut
1442
1594
  </delegation-lifecycle>
1443
1595
 
1444
1596
  <routing>
1445
- ${renderRoleDirectory()}
1597
+ ${renderRoleDirectory(policy.specialistDirectory)}
1446
1598
  </routing>
1447
1599
 
1600
+ ${renderImplementationOwnershipPolicy(policy.implementationOwnership)}
1601
+
1602
+ ${renderTaskShapingPolicy(policy.taskShaping)}
1603
+
1448
1604
  <sdd-routing>
1449
- - An explicitly requested route wins: no duplicate route-selection prompt. Otherwise assess and recommend one route, ask with \`{{userQuestionTool}}\`, and wait for the user to select Direct, Accelerated, or Full. The recommendation is not the decision. The user's selected route wins; explain risk without overriding it. A generic SDD request sets Accelerated as the minimum unless Full risk applies.
1450
- - Direct: clear, bounded, low-risk work. ${renderSddRoute("direct")}.
1451
- - Documentation or mechanical work may remain Direct across multiple files when it is clear and low risk.
1452
- - Accelerated SDD: multi-surface behavior, architecture, partial clarity, or moderate risk. ${renderSddRoute("accelerated")}.
1453
- - For Accelerated, run specify -> plan -> tasks in one uninterrupted root pass. Do not pause between those planning artifacts; ask only for a material unresolved decision.
1454
- - Its thoth-sdd validator gates are ${accelerated.validationGates.join(" -> ")}; optional artifacts are off by default.
1455
- - Full SDD: uncertain scope, cross-cutting behavior or architecture, high contract risk, or high failure cost. ${renderSddRoute("full")}.
1456
- - Full gates are ${full.validationGates.join(" -> ")}; checklist remains conditional.
1457
- - After \`ready\` on Accelerated/Full, ask with \`{{userQuestionTool}}\`: \`Review plan with Oracle (Recommended)\` or \`Proceed without review\`. Skipping plan review means no pre-implementation Oracle review. If selected, load \`plan-reviewer\`, delegate read-only review, and accept only \`[OKAY]\` or \`[REJECT]\` with at most 3 actionable blockers. After \`[OKAY]\`, summarize and ask whether to implement or stop. Plan review never replaces mandatory final Oracle verify.
1605
+ - An explicitly requested route wins: no duplicate route-selection prompt. Otherwise assess and recommend one route; summarize the relevant request context, assessed scope, clarity, risk, and why the recommendation fits before asking with \`{{userQuestionTool}}\` for Direct, Accelerated, or Full. On an answerless result, make at most three total attempts. After the third answerless result, treat the recommended route as selected. Any explicit user answer wins. A generic SDD request sets Accelerated as the minimum unless Full risk applies.
1606
+ - Direct is clear, bounded, low-risk: ${renderSddRoute("direct")}. Documentation or mechanical work may remain Direct across multiple files when clear and low risk.
1607
+ - Accelerated SDD covers multi-surface behavior, architecture, partial clarity, or moderate risk: ${renderSddRoute("accelerated")}; run specify -> plan -> tasks in one uninterrupted root pass. Do not pause between those planning artifacts except for a material unresolved decision. Gates: ${accelerated.validationGates.join(" -> ")}.
1608
+ - Full SDD covers uncertainty, cross-cutting behavior/architecture, high contract risk, or high failure cost: ${renderSddRoute("full")}. Gates: ${full.validationGates.join(" -> ")}; checklist conditional.
1609
+ - After \`ready\` on Accelerated/Full, ask with \`{{userQuestionTool}}\`: \`Review plan with Oracle (Recommended)\` or \`Proceed without review\`. Any explicit \`Proceed without review\` answer wins. If the review question returns answerless, retry to that limit. After the third answerless result, treat \`Review plan with Oracle (Recommended)\` as selected. For review, load \`plan-reviewer\`; accept only \`[OKAY]\`/\`[REJECT]\` with at most 3 actionable blockers. On \`[REJECT]\`, repair same-intent planning artifacts, revalidate affected gates, and use fresh Oracle rounds until \`[OKAY]\` or a human-owned blocker. On \`[OKAY]\`, summarize the approved scope, approach, ownership, verification, and material risks before asking with \`{{userQuestionTool}}\`: \`Implement (Recommended)\` or \`Stop\`. Reuse the answerless limit. After the third answerless result, treat implementation as selected. Any explicit \`Stop\` answer wins; \`[OKAY]\` alone does not authorize implementation. Plan review never replaces mandatory final Oracle verify.
1610
+ - Bounded fallbacks are only for route, plan-review, and implementation questions; never for secrets, destructive/security-sensitive actions, or material human-owned decisions.
1458
1611
  - Happy path: verify -> archive. Artifact-backed failure loop: verify fail -> converge -> implement -> verify. Direct failure loop: verify fail -> implement -> verify.
1459
- - Conditional phases: clarify for material ambiguity; checklist for requirement risk; plan-review by user choice; converge for verification defects.
1460
- - When implementation discoveries refine the same intent, update the canonical artifact and revalidate only affected downstream artifacts. Split a new change when the intent changes.
1461
- - Load the bundled \`thoth-sdd\` skill only after selecting Accelerated or Full, then read only the reference for the current phase.
1462
- - Root owns specify, clarify, plan, checklist, tasks, converge, and archive coordination; these phases are not delegated merely to change prompts.
1463
- - Delegate each user-selected plan review and every verify phase to ${roleTemplate("oracle")}. The implementation writer must never review itself.
1612
+ - Same-intent discoveries update the artifact and revalidate only affected downstream artifacts; new intent starts a change.
1613
+ - After Accelerated/Full selection, load the bundled \`thoth-sdd\` skill and read only the reference for the current phase. Run thoth-sdd validator. Root owns specify, clarify, plan, checklist, tasks, converge, and archive; do not delegate just to change prompts. Record owner, rationale, surface, requirements, and checks before implementation.
1614
+ - Final verification is mandatory. Use a fresh ${roleTemplate("oracle")} for Accelerated/Full and materially risky Direct work. Root may run focused verification only for trivial deterministic Direct work; no implementation writer may approve its own work.
1464
1615
  </sdd-routing>
1465
1616
 
1466
1617
  <external-skills>
1467
1618
  - Use bundled \`thoth-constitution\` for constitution lifecycle and \`thoth-archive\` for verified artifact-backed closeout.
1468
1619
  - Use the installed mandatory \`tdd\` skill for behavior changes and \`simplify\` after implementation without changing behavior.
1469
- - During an SDD, never invoke the thoth-agents CLI, \`npx skills add\`, or a network fetch. A missing local contract means incomplete installation.
1620
+ - During SDD, never invoke the thoth-agents CLI, \`npx skills add\`, or network; a missing contract means incomplete installation.
1470
1621
  - Use progressive-context-router only for repository instruction or context-router work.
1471
1622
  - Use architectural-grilling before specification only when the user explicitly asks to be grilled or material human-owned product or architecture decisions remain unresolved.
1472
- - Do not invoke it merely because the route is Full. While grilling, ask one material question per turn and await explicit closure.
1473
- - Feed accepted decisions forward; spec.md and plan.md remain canonical instead of creating a duplicate blueprint artifact by default.
1623
+ - Do not invoke it merely because the route is Full; while grilling, ask one material question per turn.
1624
+ - Feed decisions forward; spec.md and plan.md remain canonical, without a duplicate blueprint by default.
1474
1625
  </external-skills>
1475
1626
 
1476
1627
  <memory>
1477
- - Load the installed \`thoth-mem\` skill for resume or prior work; never invent its protocol.
1478
- - Preserve a durable decision, root cause, convention, or discovery only when reusable. Root owns the stable root session ID, project, lifecycle, real-user intent, and authorization.
1479
- - Follow the skill at verified compaction or a meaningful semantic boundary; children receive only bounded MEMORY and never own root lifecycle.
1480
- - \`openspec/\` remains canonical; do not mirror SDD phase artifacts. A memory failure does not block unrelated work.
1628
+ - For resume/prior work, load the installed \`thoth-mem\` skill; never invent its protocol.
1629
+ - Preserve only a reusable decision, root cause, convention, or discovery. Root owns the stable root session ID, project, lifecycle, real-user intent, and authorization.
1630
+ - Follow it at verified compaction or a meaningful semantic boundary; children get bounded MEMORY, never root lifecycle.
1631
+ - \`openspec/\` remains canonical; do not mirror SDD artifacts. A memory failure does not block unrelated work.
1481
1632
  </memory>
1482
1633
 
1483
1634
  <artifacts>
1484
- - In ${workflow.artifactRoot}, Accelerated and Full require spec.md, plan.md, tasks.md, verify-report.md, and archive-report.md.
1485
- - Root owns openspec/ gates and task state, moves [~] -> [x] after evidence, and keeps one product writer.
1486
- - ${roleTemplate("oracle")} returns read-only findings; root persists verification and archives declared durable deltas after PASS.
1635
+ - Accelerated/Full require ${workflow.artifactRoot}{spec.md,plan.md,tasks.md,verify-report.md,archive-report.md}.
1636
+ - Root owns gates/task state, moves [~] -> [x] on evidence, and keeps one product writer. ${roleTemplate("oracle")} returns read-only findings; root persists verification and archives declared deltas after PASS.
1487
1637
  </artifacts>
1488
1638
 
1489
1639
  <delegation>
@@ -1548,13 +1698,18 @@ You are ${roleName}.
1548
1698
 
1549
1699
  <responsibility>
1550
1700
  ${role.responsibility}
1551
- </responsibility>`),
1701
+ </responsibility>
1702
+
1703
+ <routing-contract>
1704
+ - Use when: ${role.useWhen.join(" ")}
1705
+ - Do not use when: ${role.doNotUseWhen.join(" ")}
1706
+ - Escalate when: ${role.escalateWhen.join(" ")}
1707
+ - Verification: ${role.verification.join(" ")}
1708
+ </routing-contract>`),
1552
1709
  createReasoningDisciplineSection(),
1553
1710
  roleText(`<rules>
1554
- - Do not delegate further or manage root progress.
1555
1711
  - ${modeRules.join("\n- ")}
1556
1712
  - ${ROLE_SPECIFIC_RULES[roleName].join("\n- ")}
1557
- - Ask only when a local blocking decision cannot be resolved from the assignment and evidence.
1558
1713
  </rules>`),
1559
1714
  createSubagentRulesSection(),
1560
1715
  createQuestionProtocolSection(),
@@ -1597,8 +1752,7 @@ Use \`${dialect.tools.userQuestionTool}\` only for a blocking material choice, d
1597
1752
  }
1598
1753
  function renderSubagentRules(section, dialect) {
1599
1754
  const rules = [
1600
- `- Do not delegate further or call \`${dialect.tools.progressTool}\`.`,
1601
- `- Use \`${dialect.tools.userQuestionTool}\` only for a local blocking choice.`,
1755
+ `- Do not delegate further or call \`${dialect.tools.progressTool}\`; root owns progress.`,
1602
1756
  "- Use terminating checks; avoid watch processes and indefinite waits.",
1603
1757
  "- Never discard or overwrite unrelated working-tree changes."
1604
1758
  ];
@@ -1822,12 +1976,14 @@ export {
1822
1976
  loadAgentPrompt,
1823
1977
  getAgentOverride,
1824
1978
  getPrimaryModelId,
1979
+ getAgentRole,
1980
+ renderAgentRoutingDescription,
1981
+ getAgentPackContract,
1825
1982
  OPENCODE_PROMPT_DIALECT,
1826
1983
  CODEX_PROMPT_DIALECT,
1827
1984
  CLAUDE_CODE_SUBAGENT_NAMESPACE,
1828
1985
  claudeCodeSubagentType,
1829
1986
  CLAUDE_CODE_PROMPT_DIALECT,
1830
- getAgentPackContract,
1831
1987
  createStepBudgetSection,
1832
1988
  createModelFamilySection,
1833
1989
  createOrchestratorPromptSections,