thoth-agents 0.3.10 → 0.3.11
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/.claude-plugin/marketplace.json +1 -1
- package/dist/{chunk-TKIDBRM3.js → chunk-CB3EBA7H.js} +4 -1
- package/dist/{chunk-M2WF46BP.js → chunk-GIUU6FNE.js} +305 -194
- package/dist/{chunk-JBG7XMIG.js → chunk-ZEAAWBF2.js} +28 -83
- package/dist/cli/index.js +3 -3
- package/dist/cli/tui/index.js +2 -2
- package/dist/config/constants.d.ts +3 -3
- package/dist/harness/adapters/claude-code.d.ts +8 -0
- package/dist/harness/adapters/codex-surfaces.d.ts +2 -2
- package/dist/harness/core/agent-pack.d.ts +38 -3
- package/dist/harness/core/sdd.d.ts +8 -7
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/plugin/.claude-plugin/.thoth-agents-plugin-assets.json +7 -7
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/agents/deep.md +10 -31
- package/plugin/agents/designer.md +10 -31
- package/plugin/agents/explorer.md +10 -30
- package/plugin/agents/librarian.md +10 -30
- package/plugin/agents/oracle.md +10 -30
- package/plugin/agents/orchestrator.md +22 -14
- package/plugin/agents/quick.md +10 -31
- package/plugin/skills/thoth-archive/scripts/archive.mjs +30 -10
- package/plugin/skills/thoth-sdd/SKILL.md +13 -1
- package/plugin/skills/thoth-sdd/references/phases/implement.md +33 -6
- package/skills/thoth-archive/scripts/archive.mjs +30 -10
- package/skills/thoth-sdd/SKILL.md +13 -1
- package/skills/thoth-sdd/references/phases/implement.md +33 -6
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
{
|
|
10
10
|
"name": "thoth-agents",
|
|
11
11
|
"description": "Adaptive root orchestration, six specialist subagents, and a runtime-autonomous Spec Kit-compatible SDD bundle.",
|
|
12
|
-
"version": "0.3.
|
|
12
|
+
"version": "0.3.11",
|
|
13
13
|
"author": {
|
|
14
14
|
"name": "thoth-agents maintainers"
|
|
15
15
|
},
|
|
@@ -10,11 +10,13 @@ import {
|
|
|
10
10
|
createReadOnlySpecialistPromptSections,
|
|
11
11
|
createWriteCapableSpecialistPromptSections,
|
|
12
12
|
getAgentOverride,
|
|
13
|
+
getAgentRole,
|
|
13
14
|
getModelFamilyPromptSection,
|
|
14
15
|
getStepBudgetPromptSection,
|
|
15
16
|
loadAgentPrompt,
|
|
17
|
+
renderAgentRoutingDescription,
|
|
16
18
|
renderRolePrompt
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-GIUU6FNE.js";
|
|
18
20
|
|
|
19
21
|
// src/agents/deep.ts
|
|
20
22
|
var DEEP_PROMPT = renderRolePrompt(
|
|
@@ -405,6 +407,7 @@ function createAgents(config) {
|
|
|
405
407
|
const prompts = loadAgentPrompt(name, config?.preset);
|
|
406
408
|
const model = getPrimaryModelForPrompt(override?.model) ?? DEFAULT_MODELS[name];
|
|
407
409
|
const agent = factory(model, prompts.prompt, prompts.appendPrompt);
|
|
410
|
+
agent.description = renderAgentRoutingDescription(getAgentRole(name));
|
|
408
411
|
agent.config.variant = CONFIRMED_OPENAI_SUBAGENT_PRESET[name].effort;
|
|
409
412
|
return agent;
|
|
410
413
|
});
|
|
@@ -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: "
|
|
217
|
-
oracle: { model: "gpt-5.6-sol", effort: "
|
|
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: "
|
|
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,269 @@ 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 and implement directly or delegate according to explicit user direction and demonstrated net gain.",
|
|
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: ["Not for independent plan review or final verification."],
|
|
752
|
+
escalateWhen: [
|
|
753
|
+
"Delegate implementation when specialization, context isolation, or independent bounded work creates a demonstrated net gain; then select designer, quick, or deep by task shape."
|
|
754
|
+
],
|
|
755
|
+
toolGovernance: [
|
|
756
|
+
"may inspect and edit the accepted bounded implementation surface in every route, but every verification is delegated to oracle",
|
|
757
|
+
"loads the matching thoth-sdd phase contract on demand instead of carrying every phase protocol in its prompt",
|
|
758
|
+
"owns governed coordination writes under openspec/ and uses append-only tasks.md updates during convergence",
|
|
759
|
+
"delegates independent or specialist work only when it produces a net gain",
|
|
760
|
+
"keeps requirements, decisions, and final synthesis in the root thread"
|
|
761
|
+
],
|
|
762
|
+
verification: [
|
|
763
|
+
"delegates selected plan-review and every verify phase to oracle; plan review stays optional and final verification stays mandatory",
|
|
764
|
+
"consolidates summarized evidence returned by child agents"
|
|
765
|
+
]
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
name: "explorer",
|
|
769
|
+
mode: "read-only",
|
|
770
|
+
dispatch: "task",
|
|
771
|
+
canMutateWorkspace: false,
|
|
772
|
+
scope: "local repository discovery",
|
|
773
|
+
responsibility: "Resolve broad or uncertain repository questions and return distilled evidence.",
|
|
774
|
+
useWhen: ["Repository ownership or behavior is broad or uncertain."],
|
|
775
|
+
doNotUseWhen: ["Not for implementation, edits, or known narrow questions."],
|
|
776
|
+
escalateWhen: [
|
|
777
|
+
"Send external evidence to librarian and mutation scope to root."
|
|
778
|
+
],
|
|
779
|
+
toolGovernance: [
|
|
780
|
+
"uses read, search, and code-navigation tools only",
|
|
781
|
+
"does not mutate files or delegate further"
|
|
782
|
+
],
|
|
783
|
+
verification: ["reports inspected paths, confidence, and remaining gaps"]
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
name: "librarian",
|
|
787
|
+
mode: "read-only",
|
|
788
|
+
dispatch: "task",
|
|
789
|
+
canMutateWorkspace: false,
|
|
790
|
+
scope: "authoritative external research with local confirmation when needed",
|
|
791
|
+
responsibility: "Gather current authoritative evidence and separate documented facts from inference.",
|
|
792
|
+
useWhen: ["Current authoritative external evidence is required."],
|
|
793
|
+
doNotUseWhen: ["Not for implementation, edits, or purely local discovery."],
|
|
794
|
+
escalateWhen: ["Report contradictory or insufficient sources to root."],
|
|
795
|
+
toolGovernance: [
|
|
796
|
+
"uses research and read-only local tools",
|
|
797
|
+
"does not mutate files or delegate further"
|
|
798
|
+
],
|
|
799
|
+
verification: ["provides direct sources for substantive external claims"]
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
name: "oracle",
|
|
803
|
+
mode: "read-only",
|
|
804
|
+
dispatch: "synchronous-task-only",
|
|
805
|
+
canMutateWorkspace: false,
|
|
806
|
+
scope: "diagnosis, architecture, optional plan review, and independent verification",
|
|
807
|
+
responsibility: "Independently review plans when the user requests it and perform every implementation verification, exposing correctness risks and judging whether results satisfy their contracts.",
|
|
808
|
+
useWhen: [
|
|
809
|
+
"Selected plan review, diagnosis, or final verification needs independent judgment."
|
|
810
|
+
],
|
|
811
|
+
doNotUseWhen: [
|
|
812
|
+
"Not for implementation, mutation, persistence, or self-review."
|
|
813
|
+
],
|
|
814
|
+
escalateWhen: ["Return blockers and remediation anchors to root."],
|
|
815
|
+
toolGovernance: [
|
|
816
|
+
"performs read-only analysis and independent review and is never the implementer of the work it judges",
|
|
817
|
+
"does not implement, persist artifacts, or delegate further"
|
|
818
|
+
],
|
|
819
|
+
verification: ["separates observations, risks, and recommendations"]
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
name: "designer",
|
|
823
|
+
mode: "write-capable",
|
|
824
|
+
dispatch: "synchronous-task-only",
|
|
825
|
+
canMutateWorkspace: true,
|
|
826
|
+
scope: "UI/UX decisions, implementation, and visual verification",
|
|
827
|
+
responsibility: "Own user-facing implementation choices and visual quality for UI work.",
|
|
828
|
+
useWhen: [
|
|
829
|
+
"User-facing UI/UX, interaction, accessibility, or visual quality is material."
|
|
830
|
+
],
|
|
831
|
+
doNotUseWhen: [
|
|
832
|
+
"Not for backend-only, non-visual, or correctness-heavy cross-cutting work."
|
|
833
|
+
],
|
|
834
|
+
escalateWhen: [
|
|
835
|
+
"Escalate coupled contracts, migrations, or high risk to deep."
|
|
836
|
+
],
|
|
837
|
+
toolGovernance: [
|
|
838
|
+
"may edit focused UI/UX files",
|
|
839
|
+
"owns screenshots and visual QA",
|
|
840
|
+
"does not delegate further"
|
|
841
|
+
],
|
|
842
|
+
verification: ["includes visual verification when applicable"]
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
name: "quick",
|
|
846
|
+
mode: "write-capable",
|
|
847
|
+
dispatch: "synchronous-task-only",
|
|
848
|
+
canMutateWorkspace: true,
|
|
849
|
+
scope: "fast bounded implementation",
|
|
850
|
+
responsibility: "Implement narrow, clear, low-risk changes within an explicitly bounded surface.",
|
|
851
|
+
useWhen: ["Known narrow mechanical low-risk work has exact targets."],
|
|
852
|
+
doNotUseWhen: [
|
|
853
|
+
"Not for coupled contracts, migrations, broad discovery, concurrency, edge cases, or high risk."
|
|
854
|
+
],
|
|
855
|
+
escalateWhen: [
|
|
856
|
+
"Escalate discovery, coupling, edge cases, or higher risk to deep."
|
|
857
|
+
],
|
|
858
|
+
toolGovernance: [
|
|
859
|
+
"edits only bounded targets",
|
|
860
|
+
"escalates when discovery or correctness risk exceeds the assignment",
|
|
861
|
+
"does not delegate further"
|
|
862
|
+
],
|
|
863
|
+
verification: ["runs the smallest sufficient focused check"]
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
name: "deep",
|
|
867
|
+
mode: "write-capable",
|
|
868
|
+
dispatch: "synchronous-task-only",
|
|
869
|
+
canMutateWorkspace: true,
|
|
870
|
+
scope: "correctness-critical implementation and verification",
|
|
871
|
+
responsibility: "Handle multi-file, edge-case-heavy, or high-risk implementation with full local context.",
|
|
872
|
+
useWhen: [
|
|
873
|
+
"Implementation is multi-file, edge-case-heavy, migration, concurrency, shared-contract, or high-risk."
|
|
874
|
+
],
|
|
875
|
+
doNotUseWhen: ["Not for visual-only work or narrow known low-risk edits."],
|
|
876
|
+
escalateWhen: ["Return product or architecture choices to root."],
|
|
877
|
+
toolGovernance: [
|
|
878
|
+
"may edit implementation and tests within the assigned surface",
|
|
879
|
+
"validates shared behavior against related code and call sites",
|
|
880
|
+
"does not delegate further"
|
|
881
|
+
],
|
|
882
|
+
verification: ["reports focused checks and relevant edge-case evidence"]
|
|
883
|
+
}
|
|
884
|
+
];
|
|
885
|
+
var ORCHESTRATION_POLICY = {
|
|
886
|
+
maxDelegationDepth: 1,
|
|
887
|
+
singleWriter: true,
|
|
888
|
+
implementationOwnership: {
|
|
889
|
+
eligibleOwners: ["orchestrator", "designer", "quick", "deep"],
|
|
890
|
+
routeIndependent: true,
|
|
891
|
+
delegationBenefits: [
|
|
892
|
+
"specialization",
|
|
893
|
+
"context isolation",
|
|
894
|
+
"independent bounded work",
|
|
895
|
+
"safe parallelism",
|
|
896
|
+
"quality, latency, or total-cost gain"
|
|
897
|
+
],
|
|
898
|
+
rootContinuityBenefits: [
|
|
899
|
+
"short work",
|
|
900
|
+
"one ordered reasoning chain",
|
|
901
|
+
"frequent shared-state writes",
|
|
902
|
+
"already-loaded context",
|
|
903
|
+
"rediscovery and coordination cost"
|
|
904
|
+
],
|
|
905
|
+
userDirection: "explicit safe user direction is an ownership input",
|
|
906
|
+
insufficientSignals: [
|
|
907
|
+
"SDD route name",
|
|
908
|
+
"file count alone",
|
|
909
|
+
"cheaper model price without end-to-end evidence"
|
|
910
|
+
]
|
|
911
|
+
},
|
|
912
|
+
rules: [
|
|
913
|
+
"Direct, Accelerated, Full, and no-artifact execution govern artifacts and gates, not implementation ownership.",
|
|
914
|
+
"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.",
|
|
915
|
+
"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.",
|
|
916
|
+
"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.",
|
|
917
|
+
"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.",
|
|
918
|
+
"Use one writer for each mutable surface and never parallelize overlapping writes.",
|
|
919
|
+
"A fresh subagent instance is the default when the objective, SDD phase, mutable surface, or independent judgment changes.",
|
|
920
|
+
"Continue an existing subagent only to steer, complete, or clarify the same bounded assignment; completed agents are not a reusable role pool.",
|
|
921
|
+
"Every Oracle plan review, verification round, and approval or PASS judgment uses a fresh Oracle instance; reuse is limited to clarifying current findings.",
|
|
922
|
+
"Wait and status operations collect only the active nonterminal assignment and do not authorize later reuse.",
|
|
923
|
+
"Child agents return distilled evidence instead of raw logs or file dumps."
|
|
924
|
+
]
|
|
925
|
+
};
|
|
926
|
+
var AGENT_RETURN_CONTRACT = [
|
|
927
|
+
"conclusion",
|
|
928
|
+
"evidence",
|
|
929
|
+
"verification",
|
|
930
|
+
"risks",
|
|
931
|
+
"openQuestions",
|
|
932
|
+
"nextAction"
|
|
933
|
+
];
|
|
934
|
+
var VERIFICATION_PROTOCOL = [
|
|
935
|
+
"Completion reports identify changed files and verification evidence.",
|
|
936
|
+
"Behavior changes receive the smallest sufficient automated check or a declared manual check.",
|
|
937
|
+
"Visual changes receive designer-owned visual QA when applicable."
|
|
938
|
+
];
|
|
939
|
+
var AGENT_PACK_CONTRACT = {
|
|
940
|
+
roles: [...AGENT_ROLES],
|
|
941
|
+
orchestrationPolicy: {
|
|
942
|
+
...ORCHESTRATION_POLICY,
|
|
943
|
+
rules: [...ORCHESTRATION_POLICY.rules]
|
|
944
|
+
},
|
|
945
|
+
returnContract: [...AGENT_RETURN_CONTRACT],
|
|
946
|
+
verificationProtocol: [...VERIFICATION_PROTOCOL]
|
|
947
|
+
};
|
|
948
|
+
function getAgentRole(name) {
|
|
949
|
+
const role = AGENT_ROLES.find((candidate) => candidate.name === name);
|
|
950
|
+
if (!role) {
|
|
951
|
+
throw new Error(`Unknown agent role: ${name}`);
|
|
952
|
+
}
|
|
953
|
+
return role;
|
|
954
|
+
}
|
|
955
|
+
function renderAgentRoutingDescription(role) {
|
|
956
|
+
return [
|
|
957
|
+
role.responsibility,
|
|
958
|
+
`Use when: ${role.useWhen.join(" ")}`,
|
|
959
|
+
`Do not use when: ${role.doNotUseWhen.join(" ")}`,
|
|
960
|
+
`Escalate when: ${role.escalateWhen.join(" ")}`,
|
|
961
|
+
`Mutation: ${role.canMutateWorkspace ? `only the assigned ${role.scope} surface` : "read-only; never mutate the workspace"}.`,
|
|
962
|
+
`Verification: ${role.verification.join(" ")}`,
|
|
963
|
+
`Return: ${AGENT_RETURN_CONTRACT.join(", ")}.`
|
|
964
|
+
].join(" ");
|
|
965
|
+
}
|
|
966
|
+
function getAgentPackContract() {
|
|
967
|
+
return {
|
|
968
|
+
roles: AGENT_PACK_CONTRACT.roles.map((role) => ({
|
|
969
|
+
...role,
|
|
970
|
+
useWhen: [...role.useWhen],
|
|
971
|
+
doNotUseWhen: [...role.doNotUseWhen],
|
|
972
|
+
escalateWhen: [...role.escalateWhen],
|
|
973
|
+
writeScope: role.writeScope ? [...role.writeScope] : void 0,
|
|
974
|
+
toolGovernance: [...role.toolGovernance],
|
|
975
|
+
verification: [...role.verification]
|
|
976
|
+
})),
|
|
977
|
+
orchestrationPolicy: {
|
|
978
|
+
...AGENT_PACK_CONTRACT.orchestrationPolicy,
|
|
979
|
+
implementationOwnership: {
|
|
980
|
+
...AGENT_PACK_CONTRACT.orchestrationPolicy.implementationOwnership,
|
|
981
|
+
eligibleOwners: [
|
|
982
|
+
...AGENT_PACK_CONTRACT.orchestrationPolicy.implementationOwnership.eligibleOwners
|
|
983
|
+
],
|
|
984
|
+
delegationBenefits: [
|
|
985
|
+
...AGENT_PACK_CONTRACT.orchestrationPolicy.implementationOwnership.delegationBenefits
|
|
986
|
+
],
|
|
987
|
+
rootContinuityBenefits: [
|
|
988
|
+
...AGENT_PACK_CONTRACT.orchestrationPolicy.implementationOwnership.rootContinuityBenefits
|
|
989
|
+
],
|
|
990
|
+
insufficientSignals: [
|
|
991
|
+
...AGENT_PACK_CONTRACT.orchestrationPolicy.implementationOwnership.insufficientSignals
|
|
992
|
+
]
|
|
993
|
+
},
|
|
994
|
+
rules: [...AGENT_PACK_CONTRACT.orchestrationPolicy.rules]
|
|
995
|
+
},
|
|
996
|
+
returnContract: [...AGENT_PACK_CONTRACT.returnContract],
|
|
997
|
+
verificationProtocol: [...AGENT_PACK_CONTRACT.verificationProtocol]
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
|
|
738
1001
|
// src/agents/prompt-dialects.ts
|
|
739
1002
|
var OPENCODE_CAPABILITIES = {
|
|
740
1003
|
agentDefinitions: "supported",
|
|
@@ -911,170 +1174,6 @@ var CLAUDE_CODE_PROMPT_DIALECT = {
|
|
|
911
1174
|
}
|
|
912
1175
|
};
|
|
913
1176
|
|
|
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
1177
|
// src/harness/core/sdd.ts
|
|
1079
1178
|
var SDD_PHASES = [
|
|
1080
1179
|
{
|
|
@@ -1172,9 +1271,9 @@ var SDD_PHASES = [
|
|
|
1172
1271
|
activation: "required",
|
|
1173
1272
|
prerequisites: ["tasks"],
|
|
1174
1273
|
producesArtifact: false,
|
|
1175
|
-
defaultAgentRole: "
|
|
1274
|
+
defaultAgentRole: "adaptive-implementation",
|
|
1176
1275
|
eligibleAgentRoles: ["orchestrator", "designer", "quick", "deep"],
|
|
1177
|
-
reason: "
|
|
1276
|
+
reason: "Choose root, designer, quick, or deep from task-shaped net gain independently from the SDD route."
|
|
1178
1277
|
},
|
|
1179
1278
|
{
|
|
1180
1279
|
id: "verify",
|
|
@@ -1260,7 +1359,7 @@ var SDD_WORKFLOW_CONTRACT = {
|
|
|
1260
1359
|
"Spec Kit artifact semantics are preserved inside the governed openspec store.",
|
|
1261
1360
|
"Accelerated and full routes require spec.md, plan.md, tasks.md, verify-report.md, and archive-report.md.",
|
|
1262
1361
|
"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;
|
|
1362
|
+
"The adaptive root writes coordination artifacts after loading the matching bundled phase contract; Accelerated and Full implementation selects designer, quick, or deep, while Direct permits one isolated low-risk root micro-action.",
|
|
1264
1363
|
"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
1364
|
"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
1365
|
],
|
|
@@ -1306,13 +1405,6 @@ function getSddRouteExecutionPolicy(route) {
|
|
|
1306
1405
|
validationGates: [...policy.validationGates]
|
|
1307
1406
|
};
|
|
1308
1407
|
}
|
|
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
1408
|
function renderSddPhaseDispatchTemplate() {
|
|
1317
1409
|
return `## PHASE
|
|
1318
1410
|
phase=<phase-id>
|
|
@@ -1349,9 +1441,6 @@ authorization=<none|recall|observe>
|
|
|
1349
1441
|
context:
|
|
1350
1442
|
<bounded recalled context or - none>`;
|
|
1351
1443
|
}
|
|
1352
|
-
function getSddPhaseOwner(_route, phaseId) {
|
|
1353
|
-
return getSddPhase(phaseId).defaultAgentRole;
|
|
1354
|
-
}
|
|
1355
1444
|
function getRequiredSddPhaseOrder(route) {
|
|
1356
1445
|
return SDD_PHASES.filter(
|
|
1357
1446
|
(phase) => phase.requiredFor.includes(route)
|
|
@@ -1406,12 +1495,25 @@ function roleTemplate(role) {
|
|
|
1406
1495
|
return `{{role.${role}}}`;
|
|
1407
1496
|
}
|
|
1408
1497
|
function renderSddRoute(route) {
|
|
1409
|
-
return getRequiredSddPhaseOrder(route).
|
|
1410
|
-
|
|
1411
|
-
|
|
1498
|
+
return getRequiredSddPhaseOrder(route).join(" -> ");
|
|
1499
|
+
}
|
|
1500
|
+
function renderImplementationOwnershipPolicy(policy) {
|
|
1501
|
+
return `<implementation-ownership>
|
|
1502
|
+
- SDD routes govern artifacts and gates, not implementation ownership.
|
|
1503
|
+
- Eligible owners in every route: ${policy.eligibleOwners.map((owner) => roleTemplate(owner)).join(", ")}.
|
|
1504
|
+
- Delegation benefits: ${policy.delegationBenefits.join("; ")}.
|
|
1505
|
+
- Root continuity benefits: ${policy.rootContinuityBenefits.join("; ")}.
|
|
1506
|
+
- Explicit safe user direction is an ownership input.
|
|
1507
|
+
- Insufficient signals: ${policy.insufficientSignals.join("; ")}.
|
|
1508
|
+
- 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.
|
|
1509
|
+
</implementation-ownership>`;
|
|
1412
1510
|
}
|
|
1413
1511
|
function renderRoleDirectory() {
|
|
1414
|
-
return
|
|
1512
|
+
return [
|
|
1513
|
+
`- ${roleTemplate("explorer")}: uncertain local discovery; read-only.`,
|
|
1514
|
+
`- ${roleTemplate("librarian")}: external evidence; read-only.`,
|
|
1515
|
+
`- ${roleTemplate("oracle")}: review/verify; read-only, never implementer.`
|
|
1516
|
+
].join("\n");
|
|
1415
1517
|
}
|
|
1416
1518
|
function createOrchestratorPromptSections() {
|
|
1417
1519
|
const workflow = getSddWorkflowContract();
|
|
@@ -1420,13 +1522,13 @@ function createOrchestratorPromptSections() {
|
|
|
1420
1522
|
const full = getSddRouteExecutionPolicy("full");
|
|
1421
1523
|
return [
|
|
1422
1524
|
roleText(`<role>
|
|
1423
|
-
You are the adaptive root for thoth-agents. Keep requirements, decisions,
|
|
1525
|
+
You are the adaptive root for thoth-agents. Keep requirements, decisions, ownership, and synthesis here.
|
|
1424
1526
|
</role>
|
|
1425
1527
|
|
|
1426
1528
|
<operating-model>
|
|
1427
|
-
- Handle bounded
|
|
1428
|
-
-
|
|
1429
|
-
-
|
|
1529
|
+
- Handle bounded implementation directly in any route when continuity outweighs delegation overhead; never self-verify.
|
|
1530
|
+
- The maximum delegation depth is ${policy.maxDelegationDepth}; children never delegate.
|
|
1531
|
+
- Keep one writer per mutable surface; parallelize only non-overlapping work.
|
|
1430
1532
|
- Keep prompts bounded; request distilled evidence, not raw logs or full files.
|
|
1431
1533
|
- Preserve unrelated changes; report changed files, evidence, risks, and capability gaps.
|
|
1432
1534
|
- Use \`{{userQuestionTool}}\` only when a material unresolved choice changes the result. Continue all safe non-blocked work first.
|
|
@@ -1445,6 +1547,8 @@ You are the adaptive root for thoth-agents. Keep requirements, decisions, execut
|
|
|
1445
1547
|
${renderRoleDirectory()}
|
|
1446
1548
|
</routing>
|
|
1447
1549
|
|
|
1550
|
+
${renderImplementationOwnershipPolicy(policy.implementationOwnership)}
|
|
1551
|
+
|
|
1448
1552
|
<sdd-routing>
|
|
1449
1553
|
- 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
1554
|
- Direct: clear, bounded, low-risk work. ${renderSddRoute("direct")}.
|
|
@@ -1460,6 +1564,7 @@ ${renderRoleDirectory()}
|
|
|
1460
1564
|
- 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
1565
|
- Load the bundled \`thoth-sdd\` skill only after selecting Accelerated or Full, then read only the reference for the current phase.
|
|
1462
1566
|
- Root owns specify, clarify, plan, checklist, tasks, converge, and archive coordination; these phases are not delegated merely to change prompts.
|
|
1567
|
+
- Record owner, net-gain rationale, surface, requirements, and checks before implement or dispatch.
|
|
1463
1568
|
- Delegate each user-selected plan review and every verify phase to ${roleTemplate("oracle")}. The implementation writer must never review itself.
|
|
1464
1569
|
</sdd-routing>
|
|
1465
1570
|
|
|
@@ -1548,13 +1653,18 @@ You are ${roleName}.
|
|
|
1548
1653
|
|
|
1549
1654
|
<responsibility>
|
|
1550
1655
|
${role.responsibility}
|
|
1551
|
-
</responsibility
|
|
1656
|
+
</responsibility>
|
|
1657
|
+
|
|
1658
|
+
<routing-contract>
|
|
1659
|
+
- Use when: ${role.useWhen.join(" ")}
|
|
1660
|
+
- Do not use when: ${role.doNotUseWhen.join(" ")}
|
|
1661
|
+
- Escalate when: ${role.escalateWhen.join(" ")}
|
|
1662
|
+
- Verification: ${role.verification.join(" ")}
|
|
1663
|
+
</routing-contract>`),
|
|
1552
1664
|
createReasoningDisciplineSection(),
|
|
1553
1665
|
roleText(`<rules>
|
|
1554
|
-
- Do not delegate further or manage root progress.
|
|
1555
1666
|
- ${modeRules.join("\n- ")}
|
|
1556
1667
|
- ${ROLE_SPECIFIC_RULES[roleName].join("\n- ")}
|
|
1557
|
-
- Ask only when a local blocking decision cannot be resolved from the assignment and evidence.
|
|
1558
1668
|
</rules>`),
|
|
1559
1669
|
createSubagentRulesSection(),
|
|
1560
1670
|
createQuestionProtocolSection(),
|
|
@@ -1597,8 +1707,7 @@ Use \`${dialect.tools.userQuestionTool}\` only for a blocking material choice, d
|
|
|
1597
1707
|
}
|
|
1598
1708
|
function renderSubagentRules(section, dialect) {
|
|
1599
1709
|
const rules = [
|
|
1600
|
-
`- Do not delegate further or call \`${dialect.tools.progressTool}
|
|
1601
|
-
`- Use \`${dialect.tools.userQuestionTool}\` only for a local blocking choice.`,
|
|
1710
|
+
`- Do not delegate further or call \`${dialect.tools.progressTool}\`; root owns progress.`,
|
|
1602
1711
|
"- Use terminating checks; avoid watch processes and indefinite waits.",
|
|
1603
1712
|
"- Never discard or overwrite unrelated working-tree changes."
|
|
1604
1713
|
];
|
|
@@ -1822,12 +1931,14 @@ export {
|
|
|
1822
1931
|
loadAgentPrompt,
|
|
1823
1932
|
getAgentOverride,
|
|
1824
1933
|
getPrimaryModelId,
|
|
1934
|
+
getAgentRole,
|
|
1935
|
+
renderAgentRoutingDescription,
|
|
1936
|
+
getAgentPackContract,
|
|
1825
1937
|
OPENCODE_PROMPT_DIALECT,
|
|
1826
1938
|
CODEX_PROMPT_DIALECT,
|
|
1827
1939
|
CLAUDE_CODE_SUBAGENT_NAMESPACE,
|
|
1828
1940
|
claudeCodeSubagentType,
|
|
1829
1941
|
CLAUDE_CODE_PROMPT_DIALECT,
|
|
1830
|
-
getAgentPackContract,
|
|
1831
1942
|
createStepBudgetSection,
|
|
1832
1943
|
createModelFamilySection,
|
|
1833
1944
|
createOrchestratorPromptSections,
|