thoth-agents 0.1.11 → 0.1.16
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 +7 -0
- package/dist/{chunk-A753XXHX.js → chunk-HFKZF2ZB.js} +29 -10
- package/dist/{chunk-R2AP6O5Q.js → chunk-XTLXC2CM.js} +249 -11
- package/dist/cli/index.js +2 -2
- package/dist/cli/tui/index.js +2 -2
- package/dist/harness/core/agent-pack.d.ts +1 -1
- package/dist/harness/core/memory-governance.d.ts +1 -1
- package/dist/harness/core/sdd.d.ts +58 -16
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/skills/_shared/openspec-convention.md +5 -0
- package/src/skills/_shared/persistence-contract.md +71 -76
- package/src/skills/_shared/thoth-mem-convention.md +41 -44
- package/src/skills/executing-plans/SKILL.md +9 -3
- package/src/skills/plan-reviewer/SKILL.md +8 -0
- package/src/skills/requirements-interview/SKILL.md +21 -8
- package/src/skills/sdd-propose/SKILL.md +16 -4
- package/src/skills/sdd-tasks/SKILL.md +6 -0
- package/src/skills/thoth-mem-agents/SKILL.md +112 -260
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
<img src="img/team.png" alt="thoth-agents agents" width="420">
|
|
3
3
|
<p><i>Seven specialized agents, one delegate-first workflow across supported harnesses.</i></p>
|
|
4
4
|
<p><b>thoth-agents</b> - Multi-harness orchestration - Thoth-mem persistence - Bundled SDD pipeline</p>
|
|
5
|
+
<p>
|
|
6
|
+
<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>
|
|
7
|
+
<a href="https://www.npmjs.com/package/thoth-agents"><img src="https://img.shields.io/npm/v/thoth-agents?label=npm" alt="npm version"></a>
|
|
8
|
+
<a href="https://github.com/EremesNG/thoth-agents/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/thoth-agents" alt="MIT license"></a>
|
|
9
|
+
<img src="https://img.shields.io/node/v/thoth-agents" alt="Node.js version">
|
|
10
|
+
<img src="https://img.shields.io/badge/pnpm-11.2.2-F69220?logo=pnpm&logoColor=white" alt="pnpm 11.2.2">
|
|
11
|
+
</p>
|
|
5
12
|
</div>
|
|
6
13
|
|
|
7
14
|
---
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
renderRolePrompt,
|
|
32
32
|
writeConfig,
|
|
33
33
|
writeLiteConfig
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-XTLXC2CM.js";
|
|
35
35
|
|
|
36
36
|
// src/harness/adapters/codex.ts
|
|
37
37
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
@@ -94,7 +94,7 @@ var AGENT_ROLES = [
|
|
|
94
94
|
responsibility: "Provide strategic technical guidance anchored to evidence and review SDD plans.",
|
|
95
95
|
toolGovernance: [
|
|
96
96
|
"read-only analysis and review",
|
|
97
|
-
"no implementation
|
|
97
|
+
"no implementation; may perform read-only SDD plan review and verification review, but does not persist artifacts",
|
|
98
98
|
"no task delegation"
|
|
99
99
|
],
|
|
100
100
|
verification: ["separates observations, risks, and recommendations"]
|
|
@@ -182,16 +182,24 @@ var READ_RECALL_CHAIN = [
|
|
|
182
182
|
"mem_timeline",
|
|
183
183
|
"mem_get_observation"
|
|
184
184
|
];
|
|
185
|
+
var BOUNDED_CONTEXT_TOOLS = [
|
|
186
|
+
"mem_context",
|
|
187
|
+
"mem_project_summary",
|
|
188
|
+
"mem_project_graph",
|
|
189
|
+
"mem_topic_keys"
|
|
190
|
+
];
|
|
185
191
|
var WRITE_CAPABLE_DELEGATED_TOOLS = [
|
|
186
192
|
"mem_save",
|
|
187
193
|
"mem_search",
|
|
188
194
|
"mem_get_observation",
|
|
189
195
|
"mem_timeline",
|
|
196
|
+
...BOUNDED_CONTEXT_TOOLS,
|
|
190
197
|
"mem_suggest_topic_key"
|
|
191
198
|
];
|
|
192
199
|
var ALL_MEMORY_TOOLS = [
|
|
193
200
|
...ROOT_OWNED_TOOLS,
|
|
194
201
|
...READ_RECALL_CHAIN,
|
|
202
|
+
...BOUNDED_CONTEXT_TOOLS,
|
|
195
203
|
"mem_suggest_topic_key",
|
|
196
204
|
"mem_save"
|
|
197
205
|
];
|
|
@@ -203,20 +211,25 @@ function roleAllowedTools(role) {
|
|
|
203
211
|
return uniqueTools([...ROOT_OWNED_TOOLS, ...WRITE_CAPABLE_DELEGATED_TOOLS]);
|
|
204
212
|
}
|
|
205
213
|
if (role.mode === "read-only") {
|
|
206
|
-
return [...READ_RECALL_CHAIN];
|
|
214
|
+
return [...READ_RECALL_CHAIN, ...BOUNDED_CONTEXT_TOOLS];
|
|
207
215
|
}
|
|
208
216
|
return [...WRITE_CAPABLE_DELEGATED_TOOLS];
|
|
209
217
|
}
|
|
210
218
|
function roleRules(role) {
|
|
211
219
|
const sharedSubagentRules = [
|
|
212
220
|
"Every subagent memory call requires the parent session_id and project from dispatch; if either is missing, do not call thoth-mem.",
|
|
221
|
+
"Delegated handoff recovery uses parent-scoped 3-layer recall with mem_search -> mem_timeline -> mem_get_observation before memory content is treated as source material.",
|
|
222
|
+
"Report missing, stale, contradictory, or insufficient recalled context instead of guessing through it.",
|
|
213
223
|
"Never call mem_session_start, mem_session_summary, or mem_save_prompt; those tools are root/orchestrator-owned.",
|
|
224
|
+
"Never save generated subagent prompts as user intent.",
|
|
214
225
|
"Protect the sdd/* topic namespace; SDD artifacts may use deterministic sdd/{change}/{artifact} topic keys only in persistence modes that include thoth-mem."
|
|
215
226
|
];
|
|
216
227
|
if (role.name === "orchestrator") {
|
|
217
228
|
return [
|
|
218
229
|
"mem_session_start, mem_session_summary, and mem_save_prompt are root/main orchestrator-owned tools and responsibilities.",
|
|
219
230
|
"In harnesses without an orchestrator-named agent, root/main orchestrator-owned means the initial/root agent when the harness does not expose an orchestrator-named agent.",
|
|
231
|
+
"Before delegation, save or refresh the handoff body with root-owned mem_session_summary when available; otherwise disclose that compaction could not be persisted.",
|
|
232
|
+
"Dispatch task instructions plus recovery instructions, not the handoff body, raw transcripts, or generated subagent prompts.",
|
|
220
233
|
"Dispatch parent session_id and project when authorizing subagent memory use.",
|
|
221
234
|
"Protect the sdd/* topic namespace and write SDD memory artifacts only in thoth-mem or hybrid persistence modes."
|
|
222
235
|
];
|
|
@@ -225,13 +238,17 @@ function roleRules(role) {
|
|
|
225
238
|
return [
|
|
226
239
|
...sharedSubagentRules,
|
|
227
240
|
"Read-only agents may only perform bounded, project-scoped recall with mem_search -> mem_timeline -> mem_get_observation when authorized.",
|
|
241
|
+
"Bounded context tools mem_context, mem_project_summary, mem_project_graph, and mem_topic_keys are allowed only with explicit delegated permission and parent session/project scope.",
|
|
242
|
+
"Project-scoped read tools require explicit delegated permission.",
|
|
228
243
|
"Read-only agents must never write durable memory."
|
|
229
244
|
];
|
|
230
245
|
}
|
|
231
246
|
return [
|
|
232
247
|
...sharedSubagentRules,
|
|
233
|
-
"Write-capable agents may call mem_save only for delegated durable observations under the parent session/project.",
|
|
234
|
-
"For reads, use only mem_search -> mem_timeline -> mem_get_observation."
|
|
248
|
+
"Write-capable agents may call mem_save only for delegated durable observations or assigned deterministic SDD artifacts/apply-progress under the parent session/project.",
|
|
249
|
+
"For reads, use only mem_search -> mem_timeline -> mem_get_observation.",
|
|
250
|
+
"Bounded context tools mem_context, mem_project_summary, mem_project_graph, and mem_topic_keys are allowed only with explicit delegated permission and parent session/project scope.",
|
|
251
|
+
"Project-scoped read tools require explicit delegated permission."
|
|
235
252
|
];
|
|
236
253
|
}
|
|
237
254
|
function getRoleMemoryGovernance(role) {
|
|
@@ -279,7 +296,7 @@ function memoryGovernanceDiagnostics(input) {
|
|
|
279
296
|
diagnostics.push({
|
|
280
297
|
severity: input.parentContextInjection === "unknown" ? "error" : "warning",
|
|
281
298
|
code: `${input.harness}.context.parent_injection.unvalidated`,
|
|
282
|
-
message: "Parent session_id/project injection is not runtime-enforced; subagents must be instructed not to use memory without explicit dispatch context.",
|
|
299
|
+
message: "Parent session_id/project injection is not runtime-enforced; subagents must be instructed not to use memory without explicit dispatch context and handoff recovery instructions.",
|
|
283
300
|
harness: input.harness,
|
|
284
301
|
capability: "parentContextInjection",
|
|
285
302
|
fallback: "instruction-only"
|
|
@@ -289,7 +306,7 @@ function memoryGovernanceDiagnostics(input) {
|
|
|
289
306
|
diagnostics.push({
|
|
290
307
|
severity: "warning",
|
|
291
308
|
code: `${input.harness}.permission.memory_write.enforcement_gap`,
|
|
292
|
-
message: "Runtime controls for delegated memory writes are unavailable; write-capable agents receive instruction-level mem_save limits only.",
|
|
309
|
+
message: "Runtime controls for delegated memory writes are unavailable; write-capable agents receive instruction-level mem_save limits for durable observations and deterministic SDD artifacts only.",
|
|
293
310
|
harness: input.harness,
|
|
294
311
|
capability: "memoryGovernanceEnforcement",
|
|
295
312
|
fallback: "instruction-only"
|
|
@@ -1358,11 +1375,12 @@ function codexInternalHandoffGuidance() {
|
|
|
1358
1375
|
"<codex-delegation-guidance>",
|
|
1359
1376
|
"- The user has explicitly authorized this generated Codex orchestrator to use `multi_agent_v1.spawn_agent` whenever delegation is required by these instructions, without needing a fresh user request for subagents in each task.",
|
|
1360
1377
|
"- Delegate by calling `multi_agent_v1.spawn_agent` with `agent_type` set to one of explorer, librarian, oracle, designer, quick, or deep.",
|
|
1361
|
-
"- Pass the self-contained delegated
|
|
1362
|
-
"-
|
|
1363
|
-
"-
|
|
1378
|
+
"- Pass the self-contained delegated task instructions plus handoff retrieval instructions in `message`; do not embed the root-owned handoff summary body in `message`.",
|
|
1379
|
+
"- Do not include the handoff body in `message` or `items`, and do not pass both `message` and `items` for the same handoff.",
|
|
1380
|
+
"- Use `items` only for structured attachments or mentions when they are truly required; do not use `items` as a handoff-summary payload.",
|
|
1364
1381
|
"- Leave `fork_context` omitted or false by default; set `fork_context: true` only when the exact current thread history is required.",
|
|
1365
1382
|
"- Use `multi_agent_v1.wait_agent` only when the root needs the result, `multi_agent_v1.send_input` for follow-up or redirect, `multi_agent_v1.resume_agent` only for a closed agent that must continue, and `multi_agent_v1.close_agent` after completion.",
|
|
1383
|
+
"- Memory ownership, handoff recovery, permissions, and prompt-body exclusion are instruction-level unless the active Codex runtime documents stronger enforcement.",
|
|
1366
1384
|
"</codex-delegation-guidance>"
|
|
1367
1385
|
].join("\n");
|
|
1368
1386
|
}
|
|
@@ -1404,6 +1422,7 @@ function renderCodexRootInstructions(config) {
|
|
|
1404
1422
|
"- The ambient Codex root session is the root/main orchestrator; orchestrator-only and root-owned instructions apply to it because Codex does not generate a selectable orchestrator agent TOML.",
|
|
1405
1423
|
"- On each new root session, when thoth-mem tools are installed and session/project identity is known, call mem_session_start with the active project and session identity, then save the real user prompt with mem_save_prompt before later delegation.",
|
|
1406
1424
|
"- If thoth-mem tools or identity values are unavailable, disclose that memory bootstrap could not run and continue without claiming memory was saved.",
|
|
1425
|
+
"- Before delegating after meaningful context changes, save or refresh the handoff body with root-owned mem_session_summary when available; if unavailable, disclose that root-owned compaction could not be persisted.",
|
|
1407
1426
|
"- Use the ambient Codex root session as the delegate-first root coordinator; do not generate or select an orchestrator TOML.",
|
|
1408
1427
|
"- Delegate by invoking `multi_agent_v1.spawn_agent` for the installed Codex role agents: explorer, librarian, oracle, designer, quick, and deep.",
|
|
1409
1428
|
"- After receiving a delegated subagent response, close that subagent session unless you will retry or intentionally keep using that exact same session; explorer and librarian sessions must always be closed immediately after their response, and retry sessions must be closed after the retry result unless explicit same-session reuse is still required.",
|
|
@@ -746,6 +746,186 @@ var CODEX_PROMPT_DIALECT = {
|
|
|
746
746
|
}
|
|
747
747
|
};
|
|
748
748
|
|
|
749
|
+
// src/harness/core/sdd.ts
|
|
750
|
+
var SDD_PHASES = [
|
|
751
|
+
{
|
|
752
|
+
id: "requirements-interview",
|
|
753
|
+
order: 0,
|
|
754
|
+
requiredFor: ["direct", "accelerated", "full"],
|
|
755
|
+
prerequisites: [],
|
|
756
|
+
producesArtifact: false,
|
|
757
|
+
owner: "orchestrator",
|
|
758
|
+
delegationReason: "Root-owned requirements discovery, scope calibration, and route approval."
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
id: "init",
|
|
762
|
+
order: 1,
|
|
763
|
+
requiredFor: [],
|
|
764
|
+
prerequisites: ["requirements-interview"],
|
|
765
|
+
producesArtifact: true,
|
|
766
|
+
owner: "write-capable-agent",
|
|
767
|
+
artifactSkill: "sdd-init",
|
|
768
|
+
condition: "Only when OpenSpec persistence is selected and openspec/ is missing.",
|
|
769
|
+
defaultAgentRole: "quick",
|
|
770
|
+
supportingAgentRoles: ["explorer"],
|
|
771
|
+
delegationReason: "Fast mechanical bootstrap, with explorer supplying repository facts when needed."
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
id: "explore",
|
|
775
|
+
order: 2,
|
|
776
|
+
requiredFor: ["accelerated", "full"],
|
|
777
|
+
prerequisites: ["requirements-interview"],
|
|
778
|
+
producesArtifact: false,
|
|
779
|
+
owner: "read-only-agent",
|
|
780
|
+
defaultAgentRole: "explorer",
|
|
781
|
+
supportingAgentRoles: ["librarian"],
|
|
782
|
+
delegationReason: "Read-only repository discovery before artifact-producing SDD phases."
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
id: "proposal",
|
|
786
|
+
order: 3,
|
|
787
|
+
requiredFor: ["accelerated", "full"],
|
|
788
|
+
prerequisites: ["requirements-interview", "explore"],
|
|
789
|
+
producesArtifact: true,
|
|
790
|
+
owner: "write-capable-agent",
|
|
791
|
+
artifactSkill: "sdd-propose",
|
|
792
|
+
defaultAgentRole: "deep",
|
|
793
|
+
supportingAgentRoles: ["oracle"],
|
|
794
|
+
delegationReason: "Structured technical reasoning and trade-off synthesis before implementation."
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
id: "spec",
|
|
798
|
+
order: 4,
|
|
799
|
+
requiredFor: ["full"],
|
|
800
|
+
prerequisites: ["proposal"],
|
|
801
|
+
producesArtifact: true,
|
|
802
|
+
owner: "write-capable-agent",
|
|
803
|
+
artifactSkill: "sdd-spec",
|
|
804
|
+
defaultAgentRole: "deep",
|
|
805
|
+
supportingAgentRoles: ["oracle"],
|
|
806
|
+
delegationReason: "High-quality requirement contract work where ambiguity propagates downstream."
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
id: "design",
|
|
810
|
+
order: 5,
|
|
811
|
+
requiredFor: ["full"],
|
|
812
|
+
prerequisites: ["proposal", "spec"],
|
|
813
|
+
producesArtifact: true,
|
|
814
|
+
owner: "write-capable-agent",
|
|
815
|
+
artifactSkill: "sdd-design",
|
|
816
|
+
artifactMeaning: "technical-solution-design",
|
|
817
|
+
defaultAgentRole: "deep",
|
|
818
|
+
supportingAgentRoles: ["designer"],
|
|
819
|
+
delegationReason: "Technical architecture and file-change design; designer only supports UI/UX concerns."
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
id: "tasks",
|
|
823
|
+
order: 6,
|
|
824
|
+
requiredFor: ["accelerated", "full"],
|
|
825
|
+
prerequisites: ["proposal", "spec", "design"],
|
|
826
|
+
producesArtifact: true,
|
|
827
|
+
owner: "write-capable-agent",
|
|
828
|
+
artifactSkill: "sdd-tasks",
|
|
829
|
+
defaultAgentRole: "quick",
|
|
830
|
+
alternateAgentRoles: ["deep"],
|
|
831
|
+
delegationReason: "Mechanical conversion of settled design into dependency-ordered execution tasks."
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
id: "plan-review",
|
|
835
|
+
order: 7,
|
|
836
|
+
requiredFor: ["accelerated", "full"],
|
|
837
|
+
prerequisites: ["tasks"],
|
|
838
|
+
producesArtifact: false,
|
|
839
|
+
gate: "oracle-review",
|
|
840
|
+
owner: "oracle",
|
|
841
|
+
defaultAgentRole: "oracle",
|
|
842
|
+
delegationReason: "Independent read-only executability review of tasks before implementation."
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
id: "implementation-confirmation",
|
|
846
|
+
order: 8,
|
|
847
|
+
requiredFor: ["accelerated", "full"],
|
|
848
|
+
prerequisites: ["plan-review"],
|
|
849
|
+
producesArtifact: false,
|
|
850
|
+
gate: "user-confirmation",
|
|
851
|
+
owner: "user",
|
|
852
|
+
delegationReason: "Human approval gate after reviewed tasks and before workspace implementation."
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
id: "apply",
|
|
856
|
+
order: 9,
|
|
857
|
+
requiredFor: ["direct", "accelerated", "full"],
|
|
858
|
+
prerequisites: ["implementation-confirmation"],
|
|
859
|
+
producesArtifact: false,
|
|
860
|
+
owner: "write-capable-agent",
|
|
861
|
+
defaultAgentRole: "deep",
|
|
862
|
+
alternateAgentRoles: ["quick", "designer"],
|
|
863
|
+
delegationReason: "Correctness-heavy implementation by default; quick handles mechanical batches and designer owns UI/visual work."
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
id: "verify",
|
|
867
|
+
order: 10,
|
|
868
|
+
requiredFor: ["accelerated", "full"],
|
|
869
|
+
prerequisites: ["apply"],
|
|
870
|
+
producesArtifact: true,
|
|
871
|
+
owner: "oracle",
|
|
872
|
+
artifactSkill: "sdd-verify",
|
|
873
|
+
defaultAgentRole: "oracle",
|
|
874
|
+
persistenceAgentRole: "quick",
|
|
875
|
+
delegationReason: "Independent verification review; quick persists the report when the selected store requires writes."
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
id: "archive",
|
|
879
|
+
order: 11,
|
|
880
|
+
requiredFor: ["accelerated", "full"],
|
|
881
|
+
prerequisites: ["verify"],
|
|
882
|
+
producesArtifact: true,
|
|
883
|
+
owner: "write-capable-agent",
|
|
884
|
+
artifactSkill: "sdd-archive",
|
|
885
|
+
defaultAgentRole: "quick",
|
|
886
|
+
delegationReason: "Mechanical closeout, summary, and archive movement after verification passes."
|
|
887
|
+
}
|
|
888
|
+
];
|
|
889
|
+
var SDD_WORKFLOW_CONTRACT = {
|
|
890
|
+
phases: [...SDD_PHASES],
|
|
891
|
+
routingRules: [
|
|
892
|
+
"Requirements interview is step zero for all non-trivial work.",
|
|
893
|
+
"Scope-faithful invariant: accepted user intent/scope is preserved; unresolved affected areas remain explicit as deferred/discovery follow-up.",
|
|
894
|
+
"Direct implementation is reserved for low-complexity work.",
|
|
895
|
+
"Accelerated SDD follows explore -> proposal -> tasks before execution.",
|
|
896
|
+
"Full SDD follows explore -> proposal -> spec -> design -> tasks before execution."
|
|
897
|
+
],
|
|
898
|
+
artifactRules: [
|
|
899
|
+
"SDD delegation defaults are phase-specific: sdd-propose, sdd-spec, and sdd-design default to deep.",
|
|
900
|
+
"sdd-tasks defaults to quick with deep as fallback when the task plan is complex.",
|
|
901
|
+
"sdd-verify defaults to oracle for independent review; quick persists the report when repository or memory writes are required.",
|
|
902
|
+
"sdd-archive defaults to quick for mechanical closeout.",
|
|
903
|
+
"OpenSpec design.md is technical solution design, not UI/UX design; sdd-design itself never routes to designer.",
|
|
904
|
+
"Designer participates during apply only for user-facing UI, visual work, screenshots, or visual QA.",
|
|
905
|
+
"Full-pipeline tasks require proposal, spec, and design artifacts.",
|
|
906
|
+
"Oracle is read-only and performs plan review plus independent verification review; it does not persist artifacts."
|
|
907
|
+
],
|
|
908
|
+
verificationRules: [
|
|
909
|
+
"Plan review must complete before implementation confirmation.",
|
|
910
|
+
"User confirmation is required after plan-review approval and before apply.",
|
|
911
|
+
"Apply is followed by verify and archive for SDD pipelines."
|
|
912
|
+
]
|
|
913
|
+
};
|
|
914
|
+
function getSddWorkflowContract() {
|
|
915
|
+
return {
|
|
916
|
+
phases: SDD_WORKFLOW_CONTRACT.phases.map((phase) => ({
|
|
917
|
+
...phase,
|
|
918
|
+
requiredFor: [...phase.requiredFor],
|
|
919
|
+
prerequisites: [...phase.prerequisites],
|
|
920
|
+
alternateAgentRoles: phase.alternateAgentRoles ? [...phase.alternateAgentRoles] : void 0,
|
|
921
|
+
supportingAgentRoles: phase.supportingAgentRoles ? [...phase.supportingAgentRoles] : void 0
|
|
922
|
+
})),
|
|
923
|
+
routingRules: [...SDD_WORKFLOW_CONTRACT.routingRules],
|
|
924
|
+
artifactRules: [...SDD_WORKFLOW_CONTRACT.artifactRules],
|
|
925
|
+
verificationRules: [...SDD_WORKFLOW_CONTRACT.verificationRules]
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
|
|
749
929
|
// src/agents/prompt-sections.ts
|
|
750
930
|
function createQuestionProtocolSection() {
|
|
751
931
|
return {
|
|
@@ -802,6 +982,43 @@ function createModelFamilySection(role, model) {
|
|
|
802
982
|
function roleText(template) {
|
|
803
983
|
return { kind: "role-text", template };
|
|
804
984
|
}
|
|
985
|
+
function roleTemplate(role) {
|
|
986
|
+
return `{{role.${role}}}`;
|
|
987
|
+
}
|
|
988
|
+
function renderRoleList(roles) {
|
|
989
|
+
return roles.map(roleTemplate).join(", ");
|
|
990
|
+
}
|
|
991
|
+
function getDelegatedSddPhase(id) {
|
|
992
|
+
const phase = getSddWorkflowContract().phases.find(
|
|
993
|
+
(candidate) => candidate.id === id
|
|
994
|
+
);
|
|
995
|
+
if (!phase?.defaultAgentRole) {
|
|
996
|
+
throw new Error(`Missing SDD delegation role for ${id}`);
|
|
997
|
+
}
|
|
998
|
+
return phase;
|
|
999
|
+
}
|
|
1000
|
+
function primarySddRole(id) {
|
|
1001
|
+
return roleTemplate(getDelegatedSddPhase(id).defaultAgentRole);
|
|
1002
|
+
}
|
|
1003
|
+
function alternateSddRoles(id) {
|
|
1004
|
+
const phase = getDelegatedSddPhase(id);
|
|
1005
|
+
return phase.alternateAgentRoles?.length ? renderRoleList(phase.alternateAgentRoles) : "";
|
|
1006
|
+
}
|
|
1007
|
+
function supportSddRoles(id) {
|
|
1008
|
+
const phase = getDelegatedSddPhase(id);
|
|
1009
|
+
return phase.supportingAgentRoles?.length ? renderRoleList(phase.supportingAgentRoles) : "";
|
|
1010
|
+
}
|
|
1011
|
+
function persistenceSddRole(id) {
|
|
1012
|
+
const phase = getDelegatedSddPhase(id);
|
|
1013
|
+
return phase.persistenceAgentRole ? roleTemplate(phase.persistenceAgentRole) : "";
|
|
1014
|
+
}
|
|
1015
|
+
function renderSddDelegationMatrix() {
|
|
1016
|
+
return `<sdd-delegation-matrix>
|
|
1017
|
+
- sdd-init -> ${primarySddRole("init")} (+${supportSddRoles("init")}, if openspec/ missing); sdd-explore -> ${primarySddRole("explore")} (+${supportSddRoles("explore")})
|
|
1018
|
+
- sdd-propose/sdd-spec/sdd-design -> ${primarySddRole("proposal")}; sdd-tasks -> ${primarySddRole("tasks")} (fallback: ${alternateSddRoles("tasks")})
|
|
1019
|
+
- plan-reviewer -> ${primarySddRole("plan-review")}; sdd-apply -> ${primarySddRole("apply")} (fallback: ${alternateSddRoles("apply")}); sdd-verify -> ${primarySddRole("verify")} (persistence: ${persistenceSddRole("verify")}); sdd-archive -> ${primarySddRole("archive")}
|
|
1020
|
+
</sdd-delegation-matrix>`;
|
|
1021
|
+
}
|
|
805
1022
|
function specialistSections({
|
|
806
1023
|
role,
|
|
807
1024
|
mode,
|
|
@@ -912,11 +1129,15 @@ Tiebreakers:
|
|
|
912
1129
|
</subagent-prompts>
|
|
913
1130
|
|
|
914
1131
|
<internal-handoff>
|
|
915
|
-
Before dispatching {{role.designer}}, {{role.quick}}, or {{role.deep}} after discovery, synthesize a compact internal handoff for
|
|
1132
|
+
Before dispatching {{role.designer}}, {{role.quick}}, or {{role.deep}} after discovery, synthesize a compact internal handoff body for root-owned session context; it is not user-facing and must not be embedded in the initial sub-agent prompt.
|
|
1133
|
+
|
|
1134
|
+
Internal handoff fields: Goal, Decision, Evidence, Scope, Steps, Verification, Uncertainty, relevant files or symbols, suggested skills when applicable, constraints, non-goals, escalation conditions, and next focus.
|
|
916
1135
|
|
|
917
|
-
|
|
1136
|
+
When thoth-mem session-summary tooling and parent session/project identity are available, save or refresh that handoff body with root-owned \`mem_session_summary\` before dispatch. If the tooling or identity is unavailable, disclose that root-owned compaction could not be persisted and continue with explicit task instructions and local context; do not invent a fallback session or ask a sub-agent to create one.
|
|
918
1137
|
|
|
919
|
-
|
|
1138
|
+
The delegated prompt carries task instructions plus handoff recovery instructions only: parent \`session_id\`, project, persistence mode, memory permissions, bounded 3-layer recall steps, non-goals, escalation conditions, and redaction requirements. It must not include the handoff body, raw transcripts, file dumps, secrets, credentials, irrelevant context, or generated sub-agent prompts as memory source material.
|
|
1139
|
+
|
|
1140
|
+
Never mention internal handoff preparation to the user, ask the user to prepare it, or present handoff preparation as the recommended next step. Describe the actual work instead.
|
|
920
1141
|
|
|
921
1142
|
For {{role.explorer}}/{{role.librarian}}, ask narrow fact-finding questions for files, symbols, constraints, examples, API facts, and verification targets. Require decision-ready findings, not raw context.
|
|
922
1143
|
</internal-handoff>
|
|
@@ -932,21 +1153,25 @@ For {{role.explorer}}/{{role.librarian}}, ask narrow fact-finding questions for
|
|
|
932
1153
|
- If a named subagent hits capacity, retry that same role up to 3 attempts.
|
|
933
1154
|
- Never switch to \`default\`, \`worker\`, or any other role.
|
|
934
1155
|
- After 3 failures, stay on the same role; if a same-role model override exists, use it. Otherwise report a capacity blocker.
|
|
935
|
-
- Write-capable dispatches must include
|
|
1156
|
+
- Write-capable dispatches must include task instructions and handoff retrieval instructions when a root-owned handoff summary exists, so implementers can recover context without rediscovering settled scope.
|
|
936
1157
|
- Never tell sub-agents to discard working-tree changes.
|
|
937
1158
|
</dispatch>
|
|
938
1159
|
|
|
939
1160
|
<sdd>
|
|
940
1161
|
All work always starts with requirements-interview skill.
|
|
1162
|
+
Scope-faithful invariant: accepted user intent and scope must not be silently narrowed; unresolved affected areas stay visible as deferred/discovery follow-up, not hidden as out-of-scope.
|
|
941
1163
|
|
|
942
1164
|
Routes:
|
|
943
1165
|
- Direct implementation for low-complexity work.
|
|
944
|
-
- Accelerated SDD: propose -> tasks.
|
|
945
|
-
- Full SDD: propose -> spec -> design -> tasks.
|
|
1166
|
+
- Accelerated SDD: explore -> propose -> tasks.
|
|
1167
|
+
- Full SDD: explore -> propose -> spec -> design -> tasks.
|
|
1168
|
+
|
|
1169
|
+
${renderSddDelegationMatrix()}
|
|
946
1170
|
|
|
947
1171
|
Hard gates:
|
|
948
|
-
-
|
|
949
|
-
-
|
|
1172
|
+
- Use the SDD delegation matrix as canonical phase routing.
|
|
1173
|
+
- Load the matching skill when a phase has one.
|
|
1174
|
+
- {{role.oracle}} is read-only for plan-reviewer and sdd-verify review; {{role.quick}} persists verify reports when writes are required.
|
|
950
1175
|
- Never skip artifacts or jump from requirements-interview to implementation when SDD is selected.
|
|
951
1176
|
- Before SDD execution, load \`executing-plans\`; then track progress in {{progressTool}} plus the persistent artifact.
|
|
952
1177
|
- If openspec persistence is selected and openspec/ is missing, dispatch sdd-init first.
|
|
@@ -1148,18 +1373,31 @@ function renderSubagentRules(section, dialect) {
|
|
|
1148
1373
|
];
|
|
1149
1374
|
if (section.memoryAccess === "readonly") {
|
|
1150
1375
|
rules.push(
|
|
1151
|
-
"- Use read-only thoth-mem only when dispatch gives session_id/project: `mem_search` -> `mem_timeline` -> `mem_get_observation`.",
|
|
1376
|
+
"- Use read-only thoth-mem only when dispatch gives parent session_id/project and handoff recovery instructions: `mem_search` -> `mem_timeline` -> `mem_get_observation`.",
|
|
1377
|
+
"- The canonical recall path remains `mem_search` -> `mem_timeline` -> `mem_get_observation`; use bounded context tools only as supplemental context when explicitly allowed.",
|
|
1378
|
+
"- If either parent session_id or project is missing, do NOT call thoth-mem; rely on explicit task instructions and local evidence.",
|
|
1379
|
+
"- Recover the parent-session handoff summary through bounded 3-layer recall before treating memory as source material.",
|
|
1380
|
+
"- Report when recalled context is missing, stale, contradictory, or insufficient.",
|
|
1381
|
+
"- Use project-scoped read tools (`mem_context`, `mem_project_summary`, `mem_project_graph`, `mem_topic_keys`) only when explicitly allowed by the delegated task instructions and bounded to the parent session/project scope.",
|
|
1152
1382
|
"- Never call `mem_session_start`, `mem_session_summary`, or `mem_save_prompt`; those tools are orchestrator-owned.",
|
|
1383
|
+
"- Never save generated subagent prompts as user intent.",
|
|
1153
1384
|
"- Never write memory; memory writes are orchestrator-owned."
|
|
1154
1385
|
);
|
|
1155
1386
|
}
|
|
1156
1387
|
if (section.memoryAccess === "writable") {
|
|
1157
1388
|
rules.push(
|
|
1158
|
-
"- Use delegated thoth-mem tools only (mem_save, mem_search, mem_get_observation, mem_timeline, mem_suggest_topic_key).",
|
|
1389
|
+
"- Use delegated thoth-mem tools only (mem_save, mem_search, mem_get_observation, mem_timeline, mem_context, mem_project_summary, mem_project_graph, mem_topic_keys, mem_suggest_topic_key).",
|
|
1159
1390
|
"- Never call `mem_session_start`, `mem_session_summary`, or `mem_save_prompt`; those tools are orchestrator-owned.",
|
|
1160
1391
|
"- Always use the parent session_id/project from dispatch for every thoth-mem call.",
|
|
1161
1392
|
"- If either is missing, do NOT call thoth-mem.",
|
|
1162
|
-
"-
|
|
1393
|
+
"- Follow handoff recovery instructions from the delegated task before using persisted memory.",
|
|
1394
|
+
"- For reads, use only `mem_search` -> `mem_timeline` -> `mem_get_observation` and recover the parent-session handoff summary before treating memory as source material.",
|
|
1395
|
+
"- Keep 3-layer recall canonical; use `mem_context`, `mem_project_summary`, `mem_project_graph`, and `mem_topic_keys` only as bounded supplemental context when the dispatch explicitly permits project-scoped reads.",
|
|
1396
|
+
"- Report when recalled context is missing, stale, contradictory, or insufficient.",
|
|
1397
|
+
"- Use project-scoped read tools only when explicitly allowed by the delegated task instructions and bounded to the parent session/project scope.",
|
|
1398
|
+
"- `mem_save` is allowed only for delegated durable implementation observations or assigned SDD artifacts/apply-progress under the parent session/project.",
|
|
1399
|
+
"- Protect the `sdd/*` namespace: deterministic SDD artifacts use `sdd/{change}/{artifact}`; general durable observations must stay outside `sdd/*`.",
|
|
1400
|
+
"- Never save generated subagent prompts as user intent.",
|
|
1163
1401
|
"- You do not own durable memory of your own; `mem_save` writes under the orchestrator's session/project only."
|
|
1164
1402
|
);
|
|
1165
1403
|
}
|
package/dist/cli/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
getOperationHarness,
|
|
26
26
|
installRecommendedSkill,
|
|
27
27
|
listOperationHarnesses
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-HFKZF2ZB.js";
|
|
29
29
|
import {
|
|
30
30
|
ALL_AGENT_NAMES,
|
|
31
31
|
CUSTOM_SKILLS,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
getExistingLiteConfigPath,
|
|
38
38
|
installCustomSkills,
|
|
39
39
|
writeLiteConfig
|
|
40
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-XTLXC2CM.js";
|
|
41
41
|
|
|
42
42
|
// src/cli/index.ts
|
|
43
43
|
import { pathToFileURL } from "url";
|
package/dist/cli/tui/index.js
CHANGED
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
getOpenCodeStatus,
|
|
16
16
|
listOperationHarnesses,
|
|
17
17
|
parseRoleTomlModel
|
|
18
|
-
} from "../../chunk-
|
|
18
|
+
} from "../../chunk-HFKZF2ZB.js";
|
|
19
19
|
import {
|
|
20
20
|
ALL_AGENT_NAMES,
|
|
21
21
|
DEFAULT_MODELS,
|
|
22
22
|
getExistingLiteConfigPath,
|
|
23
23
|
parseConfig
|
|
24
|
-
} from "../../chunk-
|
|
24
|
+
} from "../../chunk-XTLXC2CM.js";
|
|
25
25
|
|
|
26
26
|
// src/cli/tui/index.tsx
|
|
27
27
|
import { render } from "ink";
|
|
@@ -51,7 +51,7 @@ export declare const AGENT_ROLES: readonly [{
|
|
|
51
51
|
readonly canMutateWorkspace: false;
|
|
52
52
|
readonly scope: "advice, diagnosis, architecture, code review, and plan review";
|
|
53
53
|
readonly responsibility: "Provide strategic technical guidance anchored to evidence and review SDD plans.";
|
|
54
|
-
readonly toolGovernance: ["read-only analysis and review", "no implementation
|
|
54
|
+
readonly toolGovernance: ["read-only analysis and review", "no implementation; may perform read-only SDD plan review and verification review, but does not persist artifacts", "no task delegation"];
|
|
55
55
|
readonly verification: ["separates observations, risks, and recommendations"];
|
|
56
56
|
}, {
|
|
57
57
|
readonly name: "designer";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HarnessPromptDialect } from '../../agents/prompt-dialects';
|
|
2
2
|
import type { HarnessCapabilityStatus, HarnessDiagnostic } from '../types';
|
|
3
3
|
import type { AgentRoleContract, AgentRoleName } from './agent-pack';
|
|
4
|
-
export type MemoryToolName = 'mem_session_start' | 'mem_session_summary' | 'mem_save_prompt' | 'mem_search' | 'mem_timeline' | 'mem_get_observation' | 'mem_suggest_topic_key' | 'mem_save';
|
|
4
|
+
export type MemoryToolName = 'mem_session_start' | 'mem_session_summary' | 'mem_save_prompt' | 'mem_search' | 'mem_timeline' | 'mem_get_observation' | 'mem_context' | 'mem_project_summary' | 'mem_project_graph' | 'mem_topic_keys' | 'mem_suggest_topic_key' | 'mem_save';
|
|
5
5
|
export type MemoryRuntimeEnforcement = 'runtime' | 'instruction-only';
|
|
6
6
|
export interface RoleMemoryGovernance {
|
|
7
7
|
role: AgentRoleName;
|