thoth-agents 0.10.0 → 0.12.0
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 +5 -3
- package/dist/agents/agent-config.d.ts +13 -0
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/orchestrator.d.ts +1 -1
- package/dist/{chunk-VHQMTZ5O.js → chunk-7F33WUSD.js} +1 -1
- package/dist/{chunk-RWQPMWEM.js → chunk-JLU3FSBT.js} +17 -2
- package/dist/chunk-MIDGZE34.js +107 -0
- package/dist/{chunk-RVQ6IIBR.js → chunk-NY2IPJ7V.js} +361 -118
- package/dist/{chunk-RN2ERZLZ.js → chunk-QOA2AETX.js} +2 -228
- package/dist/{chunk-6NZTNWI4.js → chunk-SEF6PFM6.js} +504 -211
- package/dist/cli/config-io.d.ts +2 -2
- package/dist/cli/index.js +92 -39
- package/dist/cli/install.d.ts +1 -0
- package/dist/cli/opencode-skill-consent.d.ts +5 -0
- package/dist/cli/operations/opencode.d.ts +2 -1
- package/dist/cli/operations/types.d.ts +1 -0
- package/dist/cli/owned-skills.d.ts +16 -0
- package/dist/cli/paths.d.ts +1 -1
- package/dist/cli/providers.d.ts +1 -1
- package/dist/cli/system.d.ts +3 -1
- package/dist/cli/thoth-mem-install.d.ts +10 -10
- package/dist/cli/tui/index.js +53 -5
- package/dist/cli/tui/operations.d.ts +2 -0
- package/dist/cli/types.d.ts +2 -4
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/schema.d.ts +0 -31
- package/dist/harness/adapters/opencode.d.ts +1 -1
- package/dist/harness/core/agent-pack.d.ts +1 -0
- package/dist/harness/core/sdd.d.ts +6 -6
- package/dist/hooks/delegate-task-retry/hook.d.ts +8 -8
- package/dist/hooks/foreground-fallback/index.d.ts +14 -69
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/json-error-recovery/hook.d.ts +2 -15
- package/dist/hooks/oracle-gate-verdict/hook.d.ts +4 -11
- package/dist/index.d.ts +7 -4
- package/dist/index.js +822 -1421
- package/dist/opencode/agents.d.ts +3 -0
- package/dist/opencode/command.d.ts +3 -0
- package/dist/opencode/context.d.ts +20 -0
- package/dist/opencode/delegation-hooks.d.ts +3 -0
- package/dist/opencode/mcp.d.ts +3 -0
- package/dist/opencode/permission-rules.d.ts +9 -0
- package/dist/opencode/permissions.d.ts +3 -0
- package/dist/opencode/session-hooks.d.ts +3 -0
- package/dist/opencode/session-state.d.ts +39 -0
- package/dist/opencode/skills.d.ts +3 -0
- package/dist/opencode/tools.d.ts +3 -0
- package/dist/pi.js +3 -3
- package/dist/tools/ast-grep/cli.d.ts +1 -0
- package/dist/tools/ast-grep/index.d.ts +108 -2
- package/dist/tools/ast-grep/tools.d.ts +107 -3
- package/dist/tools/define-tool.d.ts +23 -0
- package/dist/tools/lsp/tools.d.ts +97 -5
- package/dist/utils/index.d.ts +0 -1
- package/package.json +14 -3
- package/pi/.thoth-agents-assets.json +2 -2
- package/pi/agents/thoth-designer.md +1 -1
- package/pi/agents/thoth-worker.md +1 -1
- package/plugin/.claude-plugin/.thoth-agents-plugin-assets.json +3 -3
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/.thoth-agents-plugin-assets.json +3 -3
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/agents/designer.md +1 -1
- package/plugin/agents/orchestrator.md +32 -32
- package/plugin/agents/worker.md +1 -1
- package/plugin/codex-hooks/payloads/designer.md +1 -1
- package/plugin/codex-hooks/payloads/root.md +32 -32
- package/plugin/codex-hooks/payloads/worker.md +1 -1
- package/plugin/skills/plan-reviewer/SKILL.md +5 -5
- package/plugin/skills/thoth-sdd/SKILL.md +33 -9
- package/plugin/skills/thoth-sdd/references/phases/checklist.md +1 -1
- package/plugin/skills/thoth-sdd/references/phases/clarify.md +1 -1
- package/plugin/skills/thoth-sdd/references/phases/converge.md +8 -1
- package/plugin/skills/thoth-sdd/references/phases/implement.md +5 -1
- package/plugin/skills/thoth-sdd/references/phases/plan.md +1 -1
- package/plugin/skills/thoth-sdd/references/phases/specify.md +1 -1
- package/plugin/skills/thoth-sdd/references/phases/tasks.md +1 -1
- package/plugin/skills/thoth-sdd/references/phases/verify.md +10 -3
- package/plugin/skills/thoth-sdd/scripts/validate-result.mjs +28 -2
- package/plugin/skills/thoth-sdd/templates/change.md +2 -1
- package/skills/plan-reviewer/SKILL.md +5 -5
- package/skills/thoth-sdd/SKILL.md +33 -9
- package/skills/thoth-sdd/references/phases/checklist.md +1 -1
- package/skills/thoth-sdd/references/phases/clarify.md +1 -1
- package/skills/thoth-sdd/references/phases/converge.md +8 -1
- package/skills/thoth-sdd/references/phases/implement.md +5 -1
- package/skills/thoth-sdd/references/phases/plan.md +1 -1
- package/skills/thoth-sdd/references/phases/specify.md +1 -1
- package/skills/thoth-sdd/references/phases/tasks.md +1 -1
- package/skills/thoth-sdd/references/phases/verify.md +10 -3
- package/skills/thoth-sdd/scripts/validate-result.mjs +28 -2
- package/skills/thoth-sdd/templates/change.md +2 -1
- package/thoth-agents.schema.json +0 -26
- package/dist/chunk-62L3ORXN.js +0 -30
- package/dist/delegation/project-id.d.ts +0 -10
- package/dist/hooks/auto-update-checker/checker.d.ts +0 -23
- package/dist/hooks/auto-update-checker/constants.d.ts +0 -11
- package/dist/hooks/auto-update-checker/index.d.ts +0 -17
- package/dist/hooks/auto-update-checker/types.d.ts +0 -22
- package/dist/utils/tmux-session-manager.d.ts +0 -63
- package/dist/utils/tmux.d.ts +0 -32
|
@@ -19,20 +19,6 @@ function findPackageRoot(startDir) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
// src/config/loader.ts
|
|
23
|
-
import * as fs from "fs";
|
|
24
|
-
import * as path from "path";
|
|
25
|
-
|
|
26
|
-
// src/cli/config-io.ts
|
|
27
|
-
import {
|
|
28
|
-
copyFileSync,
|
|
29
|
-
existsSync as existsSync3,
|
|
30
|
-
readFileSync as readFileSync2,
|
|
31
|
-
renameSync,
|
|
32
|
-
statSync,
|
|
33
|
-
writeFileSync
|
|
34
|
-
} from "fs";
|
|
35
|
-
|
|
36
22
|
// src/config/constants.ts
|
|
37
23
|
var SUBAGENT_NAMES = [
|
|
38
24
|
"explorer",
|
|
@@ -99,7 +85,6 @@ function getDefaultOpenCodeVariant(name) {
|
|
|
99
85
|
}
|
|
100
86
|
return CONFIRMED_OPENAI_SUBAGENT_PRESET[name].effort;
|
|
101
87
|
}
|
|
102
|
-
var POLL_INTERVAL_BACKGROUND_MS = 2e3;
|
|
103
88
|
var DEFAULT_TIMEOUT_MS = 2 * 60 * 1e3;
|
|
104
89
|
var MAX_POLL_TIME_MS = 5 * 60 * 1e3;
|
|
105
90
|
|
|
@@ -195,27 +180,41 @@ function resolveExecutingPackageVersion(options = {}) {
|
|
|
195
180
|
return { ok: true, version, packageRoot };
|
|
196
181
|
}
|
|
197
182
|
|
|
183
|
+
// src/config/loader.ts
|
|
184
|
+
import * as fs from "fs";
|
|
185
|
+
import * as path from "path";
|
|
186
|
+
|
|
187
|
+
// src/cli/config-io.ts
|
|
188
|
+
import {
|
|
189
|
+
copyFileSync,
|
|
190
|
+
existsSync as existsSync3,
|
|
191
|
+
readFileSync as readFileSync2,
|
|
192
|
+
renameSync,
|
|
193
|
+
statSync,
|
|
194
|
+
writeFileSync
|
|
195
|
+
} from "fs";
|
|
196
|
+
|
|
198
197
|
// src/cli/paths.ts
|
|
199
198
|
import { existsSync as existsSync2, mkdirSync } from "fs";
|
|
200
199
|
import { homedir } from "os";
|
|
201
200
|
import { dirname as dirname3, join as join3 } from "path";
|
|
202
|
-
function getDefaultOpenCodeConfigDir() {
|
|
203
|
-
const userConfigDir = process.env.XDG_CONFIG_HOME ? process.env.XDG_CONFIG_HOME : join3(
|
|
201
|
+
function getDefaultOpenCodeConfigDir(homeDir) {
|
|
202
|
+
const userConfigDir = process.env.XDG_CONFIG_HOME ? process.env.XDG_CONFIG_HOME : join3(homeDir, ".config");
|
|
204
203
|
return join3(userConfigDir, "opencode");
|
|
205
204
|
}
|
|
206
205
|
function getCustomOpenCodeConfigDir() {
|
|
207
206
|
const configDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
208
207
|
return configDir || void 0;
|
|
209
208
|
}
|
|
210
|
-
function getConfigDir() {
|
|
209
|
+
function getConfigDir(homeDir = homedir()) {
|
|
211
210
|
const customConfigDir = getCustomOpenCodeConfigDir();
|
|
212
211
|
if (customConfigDir) {
|
|
213
212
|
return customConfigDir;
|
|
214
213
|
}
|
|
215
|
-
return getDefaultOpenCodeConfigDir();
|
|
214
|
+
return getDefaultOpenCodeConfigDir(homeDir);
|
|
216
215
|
}
|
|
217
216
|
function getOpenCodeConfigPaths() {
|
|
218
|
-
const configDir =
|
|
217
|
+
const configDir = getConfigDir();
|
|
219
218
|
return [join3(configDir, "opencode.json"), join3(configDir, "opencode.jsonc")];
|
|
220
219
|
}
|
|
221
220
|
function getConfigJson() {
|
|
@@ -328,24 +327,6 @@ var AgentOverrideConfigSchema = z.object({
|
|
|
328
327
|
steps: z.number().int().min(1).optional(),
|
|
329
328
|
variant: z.string().optional().catch(void 0)
|
|
330
329
|
});
|
|
331
|
-
var TmuxLayoutSchema = z.enum([
|
|
332
|
-
"main-horizontal",
|
|
333
|
-
// Main pane on top, agents stacked below
|
|
334
|
-
"main-vertical",
|
|
335
|
-
// Main pane on left, agents stacked on right
|
|
336
|
-
"tiled",
|
|
337
|
-
// All panes equal size grid
|
|
338
|
-
"even-horizontal",
|
|
339
|
-
// All panes side by side
|
|
340
|
-
"even-vertical"
|
|
341
|
-
// All panes stacked vertically
|
|
342
|
-
]);
|
|
343
|
-
var TmuxConfigSchema = z.object({
|
|
344
|
-
enabled: z.boolean().default(false),
|
|
345
|
-
layout: TmuxLayoutSchema.default("main-vertical"),
|
|
346
|
-
main_pane_size: z.number().min(20).max(80).default(60)
|
|
347
|
-
// percentage for main pane
|
|
348
|
-
});
|
|
349
330
|
var PresetSchema = z.record(
|
|
350
331
|
SupportedAgentRecordKeySchema,
|
|
351
332
|
AgentOverrideConfigSchema
|
|
@@ -378,7 +359,6 @@ var PluginConfigSchema = z.object({
|
|
|
378
359
|
presets: z.record(z.string(), PresetSchema).optional(),
|
|
379
360
|
agents: z.record(SupportedAgentRecordKeySchema, AgentOverrideConfigSchema).optional(),
|
|
380
361
|
disabled_mcps: z.array(z.string()).optional(),
|
|
381
|
-
tmux: TmuxConfigSchema.optional(),
|
|
382
362
|
fallback: FailoverConfigSchema.optional(),
|
|
383
363
|
codex: CodexGenerationConfigSchema.optional(),
|
|
384
364
|
claudeCode: ClaudeCodeGenerationConfigSchema.optional()
|
|
@@ -418,7 +398,7 @@ function buildOpenAIModelMappings() {
|
|
|
418
398
|
var MODEL_MAPPINGS = {
|
|
419
399
|
openai: buildOpenAIModelMappings()
|
|
420
400
|
};
|
|
421
|
-
function generateLiteConfig(
|
|
401
|
+
function generateLiteConfig(_installConfig) {
|
|
422
402
|
const config = {
|
|
423
403
|
$schema: THOTH_AGENTS_CONFIG_SCHEMA_URL,
|
|
424
404
|
preset: "openai",
|
|
@@ -440,13 +420,6 @@ function generateLiteConfig(installConfig) {
|
|
|
440
420
|
);
|
|
441
421
|
};
|
|
442
422
|
config.presets.openai = buildPreset("openai");
|
|
443
|
-
if (installConfig.hasTmux) {
|
|
444
|
-
config.tmux = {
|
|
445
|
-
enabled: true,
|
|
446
|
-
layout: "main-vertical",
|
|
447
|
-
main_pane_size: 60
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
423
|
return config;
|
|
451
424
|
}
|
|
452
425
|
|
|
@@ -500,24 +473,32 @@ function writeConfig(configPath, config) {
|
|
|
500
473
|
writeFileSync(tmpPath, content);
|
|
501
474
|
renameSync(tmpPath, configPath);
|
|
502
475
|
}
|
|
476
|
+
function pluginEntries(value) {
|
|
477
|
+
return Array.isArray(value) ? value : [];
|
|
478
|
+
}
|
|
479
|
+
function isManagedOpenCodePlugin(entry) {
|
|
480
|
+
const name = typeof entry === "string" ? entry : Array.isArray(entry) ? entry[0] : entry && typeof entry === "object" && "package" in entry ? entry.package : void 0;
|
|
481
|
+
return typeof name === "string" && (name === PACKAGE_NAME || name.startsWith(`${PACKAGE_NAME}@`));
|
|
482
|
+
}
|
|
483
|
+
function hasManagedPluginOptions(entry) {
|
|
484
|
+
if (!isManagedOpenCodePlugin(entry)) return false;
|
|
485
|
+
const options = Array.isArray(entry) ? entry[1] : entry && typeof entry === "object" && "options" in entry ? entry.options : void 0;
|
|
486
|
+
return !!options && typeof options === "object" && Object.keys(options).length > 0;
|
|
487
|
+
}
|
|
503
488
|
function mergeOpenCodeMainConfig(config, update) {
|
|
504
489
|
if (update.ensurePlugin) {
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
490
|
+
const legacy = pluginEntries(config.plugin).filter(
|
|
491
|
+
(entry) => !isManagedOpenCodePlugin(entry)
|
|
492
|
+
);
|
|
493
|
+
if (legacy.length > 0) config.plugin = legacy;
|
|
494
|
+
else delete config.plugin;
|
|
495
|
+
config.plugins = [
|
|
496
|
+
...pluginEntries(config.plugins).filter(
|
|
497
|
+
(entry) => !isManagedOpenCodePlugin(entry)
|
|
509
498
|
),
|
|
510
499
|
`${PACKAGE_NAME}@${update.pluginVersion}`
|
|
511
500
|
];
|
|
512
501
|
}
|
|
513
|
-
if (update.disableDefaults) {
|
|
514
|
-
const agent = config.agent && typeof config.agent === "object" ? { ...config.agent } : {};
|
|
515
|
-
const explore = agent.explore && typeof agent.explore === "object" ? { ...agent.explore } : {};
|
|
516
|
-
const general = agent.general && typeof agent.general === "object" ? { ...agent.general } : {};
|
|
517
|
-
agent.explore = { ...explore, disable: true };
|
|
518
|
-
agent.general = { ...general, disable: true };
|
|
519
|
-
config.agent = agent;
|
|
520
|
-
}
|
|
521
502
|
return config;
|
|
522
503
|
}
|
|
523
504
|
function updateOpenCodeMainConfig(update) {
|
|
@@ -547,10 +528,19 @@ function updateOpenCodeMainConfig(update) {
|
|
|
547
528
|
error: `Failed to parse config: ${error}`
|
|
548
529
|
};
|
|
549
530
|
}
|
|
531
|
+
const removedOptions = update.ensurePlugin && [
|
|
532
|
+
...pluginEntries(parsedConfig?.plugin),
|
|
533
|
+
...pluginEntries(parsedConfig?.plugins)
|
|
534
|
+
].some(hasManagedPluginOptions);
|
|
550
535
|
writeConfig(
|
|
551
536
|
configPath,
|
|
552
537
|
mergeOpenCodeMainConfig(parsedConfig ?? {}, update)
|
|
553
538
|
);
|
|
539
|
+
if (removedOptions) {
|
|
540
|
+
console.warn(
|
|
541
|
+
`[config-manager] Removed non-empty thoth-agents plugin options while pinning the v2 plugin. Original entries are preserved in ${configPath}.bak; configure the plugin via thoth-agents.json instead.`
|
|
542
|
+
);
|
|
543
|
+
}
|
|
554
544
|
return { success: true, configPath };
|
|
555
545
|
} catch (err) {
|
|
556
546
|
return {
|
|
@@ -634,13 +624,14 @@ function writeLiteConfig(installConfig, targetPath) {
|
|
|
634
624
|
function detectCurrentConfig() {
|
|
635
625
|
const result = {
|
|
636
626
|
isInstalled: false,
|
|
637
|
-
hasOpenAI: false
|
|
638
|
-
hasTmux: false
|
|
627
|
+
hasOpenAI: false
|
|
639
628
|
};
|
|
640
629
|
const { config } = parseConfig(getExistingConfigPath());
|
|
641
630
|
if (!config) return result;
|
|
642
|
-
|
|
643
|
-
|
|
631
|
+
result.isInstalled = [
|
|
632
|
+
...pluginEntries(config.plugin),
|
|
633
|
+
...pluginEntries(config.plugins)
|
|
634
|
+
].some(isManagedOpenCodePlugin);
|
|
644
635
|
const { config: liteConfig } = parseConfig(getLiteConfig());
|
|
645
636
|
if (liteConfig && typeof liteConfig === "object") {
|
|
646
637
|
const configObj = liteConfig;
|
|
@@ -651,10 +642,6 @@ function detectCurrentConfig() {
|
|
|
651
642
|
const models = Object.values(agents).map((a) => a?.model).filter(Boolean);
|
|
652
643
|
result.hasOpenAI = models.some((m) => m?.startsWith("openai/"));
|
|
653
644
|
}
|
|
654
|
-
if (configObj.tmux && typeof configObj.tmux === "object") {
|
|
655
|
-
const tmuxConfig = configObj.tmux;
|
|
656
|
-
result.hasTmux = tmuxConfig.enabled === true;
|
|
657
|
-
}
|
|
658
645
|
}
|
|
659
646
|
return result;
|
|
660
647
|
}
|
|
@@ -727,7 +714,6 @@ function loadPluginConfig(directory) {
|
|
|
727
714
|
...config,
|
|
728
715
|
...projectConfig,
|
|
729
716
|
agents: deepMerge(config.agents, projectConfig.agents),
|
|
730
|
-
tmux: deepMerge(config.tmux, projectConfig.tmux),
|
|
731
717
|
fallback: deepMerge(config.fallback, projectConfig.fallback),
|
|
732
718
|
codex: deepMerge(config.codex, projectConfig.codex),
|
|
733
719
|
claudeCode: deepMerge(config.claudeCode, projectConfig.claudeCode)
|
|
@@ -1032,17 +1018,18 @@ var IMPLEMENTATION_OWNERSHIP_POLICY = {
|
|
|
1032
1018
|
eligibleOwners: ["orchestrator", "designer", "worker"],
|
|
1033
1019
|
workflowIndependent: true,
|
|
1034
1020
|
defaultImplementationOwner: "specialist",
|
|
1035
|
-
rootIdentity: "
|
|
1021
|
+
rootIdentity: "Root: specialists default to unlocated-source discovery, external research and substantive implementation; you direct/decide/accept/synthesize.",
|
|
1036
1022
|
defaultRule: "Specialists execute by default for discovery of unlocated source, external research and substantive implementation; root retains goals, decisions, coordination, acceptance, and synthesis.",
|
|
1037
1023
|
rootResponsibilities: [
|
|
1038
1024
|
"retain the goal, constraints, decisions, coordination, semantic acceptance, and synthesis"
|
|
1039
1025
|
],
|
|
1026
|
+
recordAuthorship: "Root alone creates/edits/validates/corrects substantial record: coordination outside specialist-default execution/direct-work allowances/consultation budget; no source discovery/substantive implementation license. Planning specialists: context only within full role scope; never assign SDD creation/modification/correction.",
|
|
1040
1027
|
discovery: [
|
|
1041
|
-
"Unlocated local source/flow/responsibility: Explorer before root read/search/shell/git/CodeGraph;
|
|
1042
|
-
"Before first read/search/shell each turn: bounded known
|
|
1028
|
+
"Unlocated local source/flow/responsibility: Explorer before root read/search/shell/git/CodeGraph; assign unknown location, no pre-read. Navigation/fallbacks govern investigators, not root.",
|
|
1029
|
+
"Before first read/search/shell each turn: bounded known-source direct-work exception or dispatch. Memory recall precedes dispatch; exempt, not source discovery."
|
|
1043
1030
|
],
|
|
1044
1031
|
directConsultation: [
|
|
1045
|
-
"Direct consultation: one known source, bounded question;
|
|
1032
|
+
"Direct consultation: one known source, bounded question; two fragments/~200 code lines max per user request across tools/files/subtasks; exclude instructions/coordination artifacts, no source/log dumps. New path/unlocated dependency/exhausted allowance: delegate missing evidence."
|
|
1046
1033
|
],
|
|
1047
1034
|
directException: [
|
|
1048
1035
|
"Direct-work exceptions: known low-risk mechanical work (reviewed commits included), no rediscovery; minimal authorized low-risk edits with known scope/verification, no discovery/independent judgment."
|
|
@@ -1051,7 +1038,7 @@ var IMPLEMENTATION_OWNERSHIP_POLICY = {
|
|
|
1051
1038
|
"Known bounded implementation: directly to designer/worker, no mandatory Explorer; librarian: external evidence; Oracle: independent judgment; no fixed all-role pipeline."
|
|
1052
1039
|
],
|
|
1053
1040
|
evidenceHandling: [
|
|
1054
|
-
"Conclusions
|
|
1041
|
+
"Conclusions/localized evidence/uncertainty, not files/source/log dumps; next action only from Oracle/Worker/Designer. Never repeat delegated discovery; fill gaps via targeted requests or bounded identified-evidence inspection. Independent verification stays mandatory."
|
|
1055
1042
|
],
|
|
1056
1043
|
delegationFailure: [
|
|
1057
1044
|
"Report delegation failure truthfully; no unrestricted root execution. Prompt guidance, not runtime enforcement."
|
|
@@ -1380,25 +1367,30 @@ function piCapabilityDisclosure(capability) {
|
|
|
1380
1367
|
}
|
|
1381
1368
|
var OPENCODE_PROMPT_DIALECT = {
|
|
1382
1369
|
harness: "opencode",
|
|
1383
|
-
gateDeliveryInstruction: "
|
|
1370
|
+
gateDeliveryInstruction: "Foreground Oracle `subagent` gates get one `thoth-gate-verdict` line; background completions have none: use the explicit compact validator fallback.",
|
|
1384
1371
|
tools: {
|
|
1385
|
-
delegationTool: "
|
|
1386
|
-
backgroundDelegationTool: "
|
|
1387
|
-
|
|
1372
|
+
delegationTool: "subagent",
|
|
1373
|
+
backgroundDelegationTool: "subagent(background:true)",
|
|
1374
|
+
backgroundWaitInstruction: 'Native `<subagent sessionID=... state="completed">` completion wakes root. No status polling tool exists; never poll/sleep.',
|
|
1388
1375
|
userQuestionTool: "question",
|
|
1389
1376
|
progressTool: "todowrite",
|
|
1390
|
-
hostStatusSurface: "
|
|
1377
|
+
hostStatusSurface: "native subagent completion messages",
|
|
1391
1378
|
lifecycle: {
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1379
|
+
rootInstructions: [
|
|
1380
|
+
"- New objectives, phases, work units, mutable surfaces or independent judgments require fresh specialist sessions via `subagent` (agent, description, prompt; omit sessionID). These are fresh-session boundaries, not permission for root execution; never pool completed agents.",
|
|
1381
|
+
"- Use sessionID only to continue/clarify the same assignment, including while running. Optional model; background:true for independent work. Default nesting depth is 1.",
|
|
1382
|
+
"- Every Oracle plan review, verification round, and PASS judgment uses a fresh Oracle instance. Existing ones only clarify their findings."
|
|
1383
|
+
].join("\n"),
|
|
1384
|
+
freshDelegation: "`subagent` with agent, description and prompt, omitting sessionID",
|
|
1385
|
+
sameAssignmentContinuation: "`subagent` with the prior sessionID, including while running",
|
|
1386
|
+
independentContext: "omitting sessionID creates an isolated child session",
|
|
1387
|
+
statusAction: "receive native completion automatically; never poll",
|
|
1388
|
+
terminalState: "a completed subagent result/message",
|
|
1389
|
+
nonterminalState: "a running placeholder",
|
|
1390
|
+
sameSessionProbe: "continue or clarify with subagent and the same sessionID; never ask for status",
|
|
1399
1391
|
enforcement: "runtime-supported"
|
|
1400
1392
|
},
|
|
1401
|
-
roleReference: (role) =>
|
|
1393
|
+
roleReference: (role) => `subagent agent:"${role}"`
|
|
1402
1394
|
},
|
|
1403
1395
|
capabilities: supportedCapabilityProfile(OPENCODE_CAPABILITIES),
|
|
1404
1396
|
dispatchLabel(method) {
|
|
@@ -1406,11 +1398,11 @@ var OPENCODE_PROMPT_DIALECT = {
|
|
|
1406
1398
|
case "root-coordinator":
|
|
1407
1399
|
return "root coordinator";
|
|
1408
1400
|
case "task":
|
|
1409
|
-
return "
|
|
1401
|
+
return "subagent";
|
|
1410
1402
|
}
|
|
1411
1403
|
},
|
|
1412
1404
|
renderRoleInvocation(role) {
|
|
1413
|
-
return
|
|
1405
|
+
return `subagent agent:"${role}"`;
|
|
1414
1406
|
}
|
|
1415
1407
|
};
|
|
1416
1408
|
var CODEX_PROMPT_DIALECT = {
|
|
@@ -1658,6 +1650,255 @@ var SDD_PHASES = [
|
|
|
1658
1650
|
reason: "Fail closed on incomplete work or verification, then transactionally archive."
|
|
1659
1651
|
}
|
|
1660
1652
|
];
|
|
1653
|
+
var FAILURE_CONVERGENCE_RULES = [
|
|
1654
|
+
"Plan review OKAY/REJECT judges the record; root repairs REJECT. Final verification PASS/FAIL judges the implementation.",
|
|
1655
|
+
"Root records remaining acceptance-linked work in the substantial record when one exists, otherwise in the brief in-session small plan; the owning Worker or Designer repairs each affected surface; root coordinates and does not repair implementation unless the user explicitly instructs direct work; even then, never self-approve and report unavailable independent review.",
|
|
1656
|
+
"Repeat independent verification as the change's verification level requires; substantial or materially risky work uses a fresh Oracle. Material changes in intent, scope or risk reopen understanding and planning before further implementation."
|
|
1657
|
+
];
|
|
1658
|
+
var SDD_PHASE_PROTOCOLS = [
|
|
1659
|
+
{
|
|
1660
|
+
id: "explore",
|
|
1661
|
+
objective: "Understand current behavior and constraints in proportion to the request.",
|
|
1662
|
+
requiredInputs: ["User intent and known repository context"],
|
|
1663
|
+
instructions: [
|
|
1664
|
+
"Inspect repository evidence in proportion to the request to identify behavior, constraints, risks, and safe assumptions.",
|
|
1665
|
+
"Root owns completing understanding and acceptance; specific discovery ownership determines who gathers evidence, even when generic guidance permits direct exploration.",
|
|
1666
|
+
"During planning, specialists supply only context within their full role scope; never assign them to create, modify or correct SDD files.",
|
|
1667
|
+
"Give each evidence assignment one precise question and result. Independent questions may run in parallel within native capacity; dependent questions wait until the upstream output is accepted by root. Do not duplicate discovery.",
|
|
1668
|
+
"Complete this phase before specifying. No document, agent, or interview is forced in this phase."
|
|
1669
|
+
],
|
|
1670
|
+
outputSchema: [
|
|
1671
|
+
"confirmed facts",
|
|
1672
|
+
"constraints",
|
|
1673
|
+
"safe assumptions",
|
|
1674
|
+
"material uncertainty"
|
|
1675
|
+
],
|
|
1676
|
+
doneWhen: [
|
|
1677
|
+
"The next step can state intended outcomes without repeating discovery."
|
|
1678
|
+
],
|
|
1679
|
+
blockingConditions: [
|
|
1680
|
+
"A material human-owned decision cannot safely be inferred."
|
|
1681
|
+
]
|
|
1682
|
+
},
|
|
1683
|
+
{
|
|
1684
|
+
id: "specify",
|
|
1685
|
+
objective: "State the intended outcome and observable acceptance proportionally.",
|
|
1686
|
+
requiredInputs: ["User intent", "Explore findings and constraints"],
|
|
1687
|
+
instructions: [
|
|
1688
|
+
"Define outcomes, non-goals, and meaningful edge cases in concise working notes.",
|
|
1689
|
+
"Do not persist a document before classification; only substantial work creates the one ID-named record.",
|
|
1690
|
+
"No document, agent, or interview is forced in this phase."
|
|
1691
|
+
],
|
|
1692
|
+
outputSchema: ["intent", "non-goals", "observable acceptance"],
|
|
1693
|
+
doneWhen: [
|
|
1694
|
+
"Acceptance expresses the requested outcome without material ambiguity."
|
|
1695
|
+
],
|
|
1696
|
+
blockingConditions: [
|
|
1697
|
+
"Acceptance depends on an unresolved material human decision."
|
|
1698
|
+
]
|
|
1699
|
+
},
|
|
1700
|
+
{
|
|
1701
|
+
id: "clarify",
|
|
1702
|
+
objective: "Resolve material ambiguity without imposing routine interviews.",
|
|
1703
|
+
requiredInputs: [
|
|
1704
|
+
"Explore evidence",
|
|
1705
|
+
"Specified outcome",
|
|
1706
|
+
"Any material uncertainty"
|
|
1707
|
+
],
|
|
1708
|
+
instructions: [
|
|
1709
|
+
"Use evidence or a safe bounded assumption when it preserves user intent.",
|
|
1710
|
+
"Ask only for a material human-owned decision that cannot safely be inferred; no interview is forced.",
|
|
1711
|
+
"An unresolved material clarification blocks classification.",
|
|
1712
|
+
"No document, agent, or interview is forced in this phase."
|
|
1713
|
+
],
|
|
1714
|
+
outputSchema: [
|
|
1715
|
+
"resolved decision or none-needed disposition",
|
|
1716
|
+
"remaining material blockers"
|
|
1717
|
+
],
|
|
1718
|
+
doneWhen: ["No material intent remains unresolved."],
|
|
1719
|
+
blockingConditions: [
|
|
1720
|
+
"The required human clarification has not been provided."
|
|
1721
|
+
]
|
|
1722
|
+
},
|
|
1723
|
+
{
|
|
1724
|
+
id: "plan",
|
|
1725
|
+
objective: "Plan substantial work in its one persistent record.",
|
|
1726
|
+
requiredInputs: [
|
|
1727
|
+
"Settled understanding",
|
|
1728
|
+
"Substantial classification",
|
|
1729
|
+
"Accepted outcomes"
|
|
1730
|
+
],
|
|
1731
|
+
instructions: [
|
|
1732
|
+
"Root alone creates, edits, validates and corrects the substantial change record: coordination outside specialist-default execution, direct-work allowances and consultation budget; no source discovery or substantive implementation permission.",
|
|
1733
|
+
"Substantial classification only creates the `.thoth/changes/<id>/<id>.md` record.",
|
|
1734
|
+
"Capture interfaces, mutable surfaces, durable deltas, dependencies, risks, and verification seams.",
|
|
1735
|
+
"Plan each useful work unit with concrete inputs, outputs, and dependencies.",
|
|
1736
|
+
"Record each unit's owner, owned writes, interface boundaries, focused checks with PASS evidence, and return milestone and stop condition.",
|
|
1737
|
+
"Validate the plan before tasks exist; tasks are checked later for acceptance coverage."
|
|
1738
|
+
],
|
|
1739
|
+
outputSchema: [
|
|
1740
|
+
"technical approach",
|
|
1741
|
+
"affected interfaces",
|
|
1742
|
+
"risks",
|
|
1743
|
+
"verification seams"
|
|
1744
|
+
],
|
|
1745
|
+
doneWhen: [
|
|
1746
|
+
"A competent implementer can proceed without guessing at critical constraints."
|
|
1747
|
+
],
|
|
1748
|
+
blockingConditions: [
|
|
1749
|
+
"The approach contradicts accepted intent or unresolved material choices remain."
|
|
1750
|
+
]
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
id: "checklist",
|
|
1754
|
+
objective: "Audit acceptance only when risk warrants a focused review.",
|
|
1755
|
+
requiredInputs: ["Substantial record", "Risk or ambiguity rationale"],
|
|
1756
|
+
instructions: [
|
|
1757
|
+
"Assess completeness, consistency, measurability, and relevant domain coverage in the same record.",
|
|
1758
|
+
"Correct material gaps without creating a second checklist artifact."
|
|
1759
|
+
],
|
|
1760
|
+
outputSchema: [
|
|
1761
|
+
"activation rationale",
|
|
1762
|
+
"resolved or remaining acceptance gaps"
|
|
1763
|
+
],
|
|
1764
|
+
doneWhen: ["Material acceptance gaps have an evidence-backed disposition."],
|
|
1765
|
+
blockingConditions: [
|
|
1766
|
+
"A material high-risk acceptance gap remains unresolved."
|
|
1767
|
+
]
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
id: "tasks",
|
|
1771
|
+
objective: "Record useful implementation slices and acceptance coverage.",
|
|
1772
|
+
requiredInputs: [
|
|
1773
|
+
"Accepted outcomes",
|
|
1774
|
+
"Validated plan",
|
|
1775
|
+
"Known dependencies"
|
|
1776
|
+
],
|
|
1777
|
+
instructions: [
|
|
1778
|
+
"Record one task row per outcome in the same ID-named record; each row names one independently acceptable outcome.",
|
|
1779
|
+
"Use the validator-compatible `- [ ] AC-n: ...` row with indented details and name concrete inputs, outputs, dependencies, owner, owned writes, interface boundaries, focused checks with PASS evidence, a meaningful return milestone, and a stop condition for each unit.",
|
|
1780
|
+
"Write `none` for owned writes on read-only work.",
|
|
1781
|
+
"Split phases with separately acceptable outcomes before dispatch; keep tiny cohesive mechanical work together and do not split mechanically by file or test step.",
|
|
1782
|
+
"Independent, precise Explorer questions may run in parallel within native capacity. Dependent questions wait for accepted evidence; root accepts producer outputs before consumers start, and discovery is not duplicated.",
|
|
1783
|
+
"Cover every accepted outcome with concrete work; test-first for behavior changes.",
|
|
1784
|
+
"Tasks and ready gates enforce coverage; the plan gate does not depend on tasks."
|
|
1785
|
+
],
|
|
1786
|
+
outputSchema: ["pending work", "acceptance coverage", "dependency order"],
|
|
1787
|
+
doneWhen: [
|
|
1788
|
+
"Each outcome has an executable task or bounded implementation seam."
|
|
1789
|
+
],
|
|
1790
|
+
blockingConditions: [
|
|
1791
|
+
"A task depends on unresolved material intent or hidden prerequisites."
|
|
1792
|
+
]
|
|
1793
|
+
},
|
|
1794
|
+
{
|
|
1795
|
+
id: "plan-review",
|
|
1796
|
+
objective: "Offer optional independent blocker review after the ready plan.",
|
|
1797
|
+
requiredInputs: ["Ready substantial record", "Selected review disposition"],
|
|
1798
|
+
instructions: [
|
|
1799
|
+
"At ready, first show the user a concise plan summary (goal, acceptance, units, risks), then always offer \u201CReview plan with Oracle (Recommended)\u201D or \u201CProceed without review\u201D; record the plan-review choice as EXPLICIT_REVIEW for an explicit review answer, EXPLICIT_SKIP for an explicit direct answer, or DEFAULT_REVIEW_AFTER_3 only when the third confirmed empty return selects review. Keep selection provenance separate from implementation authorization; silence never means EXPLICIT_SKIP.",
|
|
1800
|
+
"For every orchestrator choice with a meaningful safe recommendation, after its first and second confirmed empty native returns repeat the same question and do no dependent work; after the third confirmed empty native return choose the recommendation. Explicit answers and Stop win. Pending, unavailable, failed, interrupted or host-prohibited questions do not count. If higher-priority host or tool rules prevent asking or repeating, obey them and report the limitation rather than claiming three returns or an explicit selection.",
|
|
1801
|
+
"Never fabricate facts or secrets; recommend safe deferral when needed information or material intent is unresolved, and keep dependent work blocked.",
|
|
1802
|
+
"Review scope, approach, risks, and acceptance coverage without redesigning settled intent.",
|
|
1803
|
+
"Return actionable blockers and cautions; a pass is not implementation authorization or final verification.",
|
|
1804
|
+
"After [OKAY], preserve the separate Implement (Recommended) / Stop authorization decision; honor applicable prior explicit authorization, and let explicit Stop supersede it.",
|
|
1805
|
+
"REJECT: root repairs the same record, reruns affected gates and sends it to a fresh Oracle; repeat until OKAY or a human-owned material blocker stops the round.",
|
|
1806
|
+
"A plan review does not substitute for fresh final verification."
|
|
1807
|
+
],
|
|
1808
|
+
outputSchema: ["status", "blockers", "cautions"],
|
|
1809
|
+
doneWhen: [
|
|
1810
|
+
"The selected review has a current, evidence-backed disposition."
|
|
1811
|
+
],
|
|
1812
|
+
blockingConditions: ["A blocking finding remains unresolved."]
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
id: "implement",
|
|
1816
|
+
objective: "Implement the accepted small request or authorized substantial slice.",
|
|
1817
|
+
requiredInputs: [
|
|
1818
|
+
"Settled user intent or authorized record",
|
|
1819
|
+
"Exact mutable boundaries",
|
|
1820
|
+
"Focused checks"
|
|
1821
|
+
],
|
|
1822
|
+
instructions: [
|
|
1823
|
+
"For small work, root states a brief in-session plan (scope, owner, focused verification) before delegation or implementation; no record or planning phases.",
|
|
1824
|
+
"Implementation writers start only after authorization; never write .thoth/changes/ records.",
|
|
1825
|
+
"Use one writer per mutable surface and choose an owner from task shape.",
|
|
1826
|
+
"Work only from accepted inputs and named dependencies within the assigned outcome and interface boundaries.",
|
|
1827
|
+
"Return bounded progress for root acceptance before dependent work starts.",
|
|
1828
|
+
"Use test-first (TDD); observe red before green for behavior changes, then verify call sites, shared contracts, and edge cases.",
|
|
1829
|
+
"Stop on a missing interface, ownership conflict, or new independent outcome.",
|
|
1830
|
+
"Return completed bounded progress and the smallest blocker for root reassessment before expansion.",
|
|
1831
|
+
"Do not create process tooling, reports, evidence generators, or temporary artifacts."
|
|
1832
|
+
],
|
|
1833
|
+
outputSchema: ["outcome", "changed files", "checks", "residual risks"],
|
|
1834
|
+
doneWhen: [
|
|
1835
|
+
"The assigned outcome is implemented and focused checks have run."
|
|
1836
|
+
],
|
|
1837
|
+
blockingConditions: [
|
|
1838
|
+
"Scope, risk, or material intent changes before safe completion."
|
|
1839
|
+
]
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
id: "verify",
|
|
1843
|
+
objective: "Verify actual outcomes with independence proportional to risk.",
|
|
1844
|
+
requiredInputs: ["Accepted outcomes", "Actual change and executed checks"],
|
|
1845
|
+
instructions: [
|
|
1846
|
+
"Judge the actual diff, executed checks, and residual risks; verify completeness, correctness, coherence, and behavior.",
|
|
1847
|
+
"Substantial or materially risky work requires a fresh independent Oracle; no writer self-approves.",
|
|
1848
|
+
"For substantial work, record acceptance evidence, checks, source digests, and reviewed-record digest in the same record.",
|
|
1849
|
+
...FAILURE_CONVERGENCE_RULES
|
|
1850
|
+
],
|
|
1851
|
+
outputSchema: [
|
|
1852
|
+
"verdict",
|
|
1853
|
+
"acceptance evidence",
|
|
1854
|
+
"checks",
|
|
1855
|
+
"residual risks"
|
|
1856
|
+
],
|
|
1857
|
+
doneWhen: [
|
|
1858
|
+
"Every accepted outcome has evidence or an explicit residual risk."
|
|
1859
|
+
],
|
|
1860
|
+
blockingConditions: [
|
|
1861
|
+
"A failed check, missing evidence, or critical issue remains."
|
|
1862
|
+
]
|
|
1863
|
+
},
|
|
1864
|
+
{
|
|
1865
|
+
id: "converge",
|
|
1866
|
+
objective: "Turn actionable verification gaps into bounded corrective work.",
|
|
1867
|
+
requiredInputs: ["Failed verification", "Settled intent"],
|
|
1868
|
+
instructions: [
|
|
1869
|
+
...FAILURE_CONVERGENCE_RULES,
|
|
1870
|
+
"Do not create a separate convergence report."
|
|
1871
|
+
],
|
|
1872
|
+
outputSchema: ["bounded follow-up", "verification seam"],
|
|
1873
|
+
doneWhen: [
|
|
1874
|
+
"Each actionable gap has a safe next action or the work is confirmed converged."
|
|
1875
|
+
],
|
|
1876
|
+
blockingConditions: [
|
|
1877
|
+
"Findings lack evidence or require material new intent."
|
|
1878
|
+
]
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
id: "archive",
|
|
1882
|
+
objective: "Transactionally apply declared deltas and archive a verified record.",
|
|
1883
|
+
requiredInputs: [
|
|
1884
|
+
"Complete substantial record",
|
|
1885
|
+
"Fresh independent pass",
|
|
1886
|
+
"Current archive date"
|
|
1887
|
+
],
|
|
1888
|
+
instructions: [
|
|
1889
|
+
"Fail-closed behavior blocks incomplete tasks, acceptance evidence, authorization, or independent verification.",
|
|
1890
|
+
"Apply only declared durable deltas transactionally and preserve unaffected specifications.",
|
|
1891
|
+
"Move `.thoth/changes/<id>/<id>.md` to `.thoth/changes/archive/YYYY-MM-DD-<id>/<id>.md`; keep the filename stable."
|
|
1892
|
+
],
|
|
1893
|
+
outputSchema: ["archive path", "updated specifications", "residual risks"],
|
|
1894
|
+
doneWhen: [
|
|
1895
|
+
"Declared deltas and verified record are archived without collisions or history loss."
|
|
1896
|
+
],
|
|
1897
|
+
blockingConditions: [
|
|
1898
|
+
"A closeout gate fails, destination collides, or a symlinked ancestor exists."
|
|
1899
|
+
]
|
|
1900
|
+
}
|
|
1901
|
+
];
|
|
1661
1902
|
var workflow = {
|
|
1662
1903
|
recordRoot: ".thoth/changes/<id>/",
|
|
1663
1904
|
recordPath: ".thoth/changes/<id>/<id>.md",
|
|
@@ -1673,7 +1914,8 @@ var workflow = {
|
|
|
1673
1914
|
"Scope or risk increases reopen understanding and classification before more work."
|
|
1674
1915
|
],
|
|
1675
1916
|
artifactRules: [
|
|
1676
|
-
"
|
|
1917
|
+
"For small work, root states a brief in-session plan (scope, owner, focused verification) before delegation or implementation; no record or planning phases. Test-first implementation and focused verification remain required.",
|
|
1918
|
+
"Root alone creates, edits, validates and corrects the substantial change record: coordination outside specialist-default execution, root execution allowances and consultation budget; no source discovery or substantive implementation permission. During planning, specialists supply only context within their entire role scope; never assign them to create, modify or correct SDD files.",
|
|
1677
1919
|
"Substantial work creates one `.thoth/changes/<id>/<id>.md` record after classification; the record contains exploration, intent, acceptance, clarification, decisions, plan, tasks, verification, and closeout.",
|
|
1678
1920
|
"Archive to `.thoth/changes/archive/YYYY-MM-DD-<id>/<id>.md`; the date prefixes only the directory, and the ID filename remains stable.",
|
|
1679
1921
|
"No aliases, extra per-change files, reports, evidence directories, process tools, wrappers, or temporary generators are created.",
|
|
@@ -1685,7 +1927,8 @@ var workflow = {
|
|
|
1685
1927
|
"Substantial or materially risky work requires a fresh independent Oracle; no implementation writer self-approves.",
|
|
1686
1928
|
"Plan review is optional and separate from the Implement or Stop authorization decision and final verification.",
|
|
1687
1929
|
"A substantial record cannot close out without complete tasks, independent PASS, acceptance evidence, current digests, and Archive READY.",
|
|
1688
|
-
"A verification failure blocks archive; actionable fixes must be reimplemented and reverified."
|
|
1930
|
+
"A verification failure blocks archive; actionable fixes must be reimplemented and reverified.",
|
|
1931
|
+
...FAILURE_CONVERGENCE_RULES
|
|
1689
1932
|
]
|
|
1690
1933
|
};
|
|
1691
1934
|
function clonePhase(phase) {
|
|
@@ -1763,7 +2006,7 @@ function renderImplementationOwnershipPolicy(policy) {
|
|
|
1763
2006
|
}
|
|
1764
2007
|
function renderRoleDirectory(directory) {
|
|
1765
2008
|
return directory.map(
|
|
1766
|
-
({ role, selectWhen, rejectWhen }) => `- ${roleTemplate(role)}:
|
|
2009
|
+
({ role, selectWhen, rejectWhen }) => `- ${roleTemplate(role)}: ${selectWhen} Not: ${rejectWhen}`
|
|
1767
2010
|
).join("\n");
|
|
1768
2011
|
}
|
|
1769
2012
|
function renderTaskShapingPolicy(policy) {
|
|
@@ -1776,10 +2019,10 @@ function renderTaskShapingPolicy(policy) {
|
|
|
1776
2019
|
- ${policy.decisions.dependency}.
|
|
1777
2020
|
- ${policy.decisions.readyDispatch} through \`{{backgroundDelegationTool}}\`{{backgroundWaitInstruction}}
|
|
1778
2021
|
- ${policy.decisions.refill}; no global wave barrier.
|
|
1779
|
-
- Accept only {{lifecycleTerminalState}} after
|
|
2022
|
+
- Accept only {{lifecycleTerminalState}} after intent/checks/freshness reconciliation. {{lifecycleNonterminalState}}, ${policy.decisions.terminalEvidence}.
|
|
1780
2023
|
- Native execution and terminal results are the sole authority: native waits/notifications, never polling, timers or an invented executor, queue, scheduler, wait API or lifecycle mirror; ${policy.decisions.degradation}.
|
|
1781
|
-
- On native attention
|
|
1782
|
-
- After two consecutive attempts without new evidence
|
|
2024
|
+
- On native attention/missed milestone: inspect/steer/narrow/stop safely; timeout is a safety ceiling, not a progress plan. No attention delivery: return at agreed milestone; reconcile termination before replacing writer.
|
|
2025
|
+
- After two consecutive attempts without new evidence/progress: return partial evidence/smallest blocker; duration alone does not invalidate useful work.
|
|
1783
2026
|
</task-shaping>`;
|
|
1784
2027
|
}
|
|
1785
2028
|
function createOrchestratorPromptSections() {
|
|
@@ -1791,9 +2034,9 @@ ${policy.implementationOwnership.rootIdentity}
|
|
|
1791
2034
|
</role>
|
|
1792
2035
|
|
|
1793
2036
|
<operating-model>
|
|
1794
|
-
-
|
|
2037
|
+
- Max delegation depth ${policy.maxDelegationDepth}; children never delegate.
|
|
1795
2038
|
- One writer per mutable surface; parallelize only non-overlapping work.
|
|
1796
|
-
- Preserve unrelated changes; report risks
|
|
2039
|
+
- Preserve unrelated changes; report risks/capability gaps.
|
|
1797
2040
|
- {{progressInstruction}}
|
|
1798
2041
|
</operating-model>
|
|
1799
2042
|
|
|
@@ -1810,24 +2053,24 @@ ${renderImplementationOwnershipPolicy(policy.implementationOwnership)}
|
|
|
1810
2053
|
${renderTaskShapingPolicy(policy.taskShaping)}
|
|
1811
2054
|
|
|
1812
2055
|
<sdd-workflow>
|
|
1813
|
-
- Before planning: explore -> specify -> clarify
|
|
1814
|
-
- Classify by scope,
|
|
1815
|
-
- Small
|
|
1816
|
-
- At ready
|
|
1817
|
-
-
|
|
1818
|
-
-
|
|
1819
|
-
- Subagent notifications
|
|
1820
|
-
- No auxiliary process tools
|
|
1821
|
-
-
|
|
1822
|
-
- Close substantial
|
|
1823
|
-
- Recover
|
|
2056
|
+
- Before planning: explore -> specify -> clarify; proportionally classify questions/research/changes. Investigate facts/reuse decisions before asking; no forced documents/agents/interviews.
|
|
2057
|
+
- Classify by scope/uncertainty/risk, not file count. Substantial: coordinated/cross-cutting or material uncertainty/risk; risk may force small-patch planning. Material intent/uncertainty/scope/risk changes: reopen understanding/planning; reclassify. Bounded technical unknowns: resolution strategy/stop; material human-owned uncertainty blocks classification/readiness.
|
|
2058
|
+
- Small: before delegation/implementation root states brief in-session scope/owner/focused-verification plan; no record/planning phases. Test-first; clear low-risk work: known owner may implement. Substantial: one ${workflow2.recordPath}: intent/acceptance/decisions/deltas/plan/tasks/authorization/verification; no extra discovery/specification docs; persistence ignores unit count/staffing.
|
|
2059
|
+
- At ready show user plan summary (goal/units/risks), then always offer \u201CReview plan with Oracle (Recommended)\u201D or \u201CProceed without review\u201D. Optional; silence never skips; [OKAY] alone never authorizes implementation. After [OKAY]: separate Implement (Recommended) / Stop; honor prior authorization. Separate review disposition/implementation authorization per installed \`thoth-sdd\`. Plan OKAY/REJECT judges record. REJECT: root repairs same record/reruns affected gates/fresh Oracle; repeat until OKAY or human-owned material blocker.
|
|
2060
|
+
- Orchestrator choices with meaningful safe recommendations: own three-return budgets; first two confirmed empty native returns: repeat same question, no dependent work; third: choose recommendation. Explicit answers/Stop win. Pending/unavailable/failed/interrupted/host-prohibited questions do not count; obey/report host limits; never invent three returns/explicit selection. Never fabricate facts/secrets; safe deferral recommendation blocks dependent work.
|
|
2061
|
+
- Replies/questions/options: use the last real human message language (including question-tool answers); explicit language requests persist until human switches. Delegation/records/code/artifacts may stay English.
|
|
2062
|
+
- Subagent notifications/tool output/reminders/injected context\u2014even user-role/English\u2014are not human messages: never set/switch reply language or count as instructions/answers/choices.
|
|
2063
|
+
- No auxiliary process tools/scripts/reports/execution wrappers/evidence generators; use shipped validators/native/project commands.
|
|
2064
|
+
- Mandatory final verification: focused root checks for trivial deterministic low-risk work; fresh read-only ${roleTemplate("oracle")} for substantial/material risk. No implementation writer may approve its own work; plan review never replaces final verification.
|
|
2065
|
+
- Close substantial only after independent PASS; record acceptance/checks/source digests/risks. Final PASS/FAIL judges implementation. FAIL: root records acceptance-linked work in record or small in-session plan; surface-owning Worker/Designer repairs, not root unless user explicitly directs; repeat required independent verification. Archive only fresh PASS; sync declared ADDED/MODIFIED/REMOVED/RENAMED deltas to .thoth/specs/.
|
|
2066
|
+
- Recover: record, relevant diff/dirty files, native liveness; preserve history. Unknown liveness blocks only conflicts; inspect interrupted archives before retry.
|
|
1824
2067
|
</sdd-workflow>
|
|
1825
2068
|
|
|
1826
2069
|
<external-skills>
|
|
1827
|
-
-
|
|
1828
|
-
- Behavior changes need installed \`tdd\`;
|
|
1829
|
-
- SDD
|
|
1830
|
-
-
|
|
2070
|
+
- Bundled \`thoth-sdd\` skill: phase, \`templates/change.md\`, record validator; \`thoth-constitution\` only for explicit constitution lifecycle.
|
|
2071
|
+
- Behavior changes need installed \`tdd\`; post-implementation: behavior-preserving \`simplify\`.
|
|
2072
|
+
- SDD: never use thoth-agents CLI, \`npx skills add\` or network for missing contracts; report installation drift.
|
|
2073
|
+
- progressive-context-router: only repository instruction/context-router work.
|
|
1831
2074
|
- Use grill-me when material human-owned decisions remain unresolved.
|
|
1832
2075
|
</external-skills>
|
|
1833
2076
|
|
|
@@ -1840,8 +2083,8 @@ ${renderTaskShapingPolicy(policy.taskShaping)}
|
|
|
1840
2083
|
</memory>
|
|
1841
2084
|
|
|
1842
2085
|
<artifacts>
|
|
1843
|
-
-
|
|
1844
|
-
- Worktree automation
|
|
2086
|
+
- ${policy.implementationOwnership.recordAuthorship} native execution state stays with the harness.
|
|
2087
|
+
- Worktree automation deferred.
|
|
1845
2088
|
</artifacts>
|
|
1846
2089
|
|
|
1847
2090
|
<delegation>
|
|
@@ -1889,7 +2132,7 @@ function childSections(roleName) {
|
|
|
1889
2132
|
"Do not mutate the workspace.",
|
|
1890
2133
|
"Do not create coordination artifacts."
|
|
1891
2134
|
] : [
|
|
1892
|
-
"Edit only the assigned work-unit surface.",
|
|
2135
|
+
"Edit only the assigned work-unit surface. Never write .thoth/changes/ records; implementation starts only after authorization.",
|
|
1893
2136
|
"Preserve unrelated working-tree changes and never use destructive Git cleanup."
|
|
1894
2137
|
];
|
|
1895
2138
|
const assignedOutcomeRules = role.mode === "write-capable" ? [
|
|
@@ -1979,7 +2222,7 @@ Use \`${dialect.tools.userQuestionTool}\` only for a blocking material choice, d
|
|
|
1979
2222
|
}
|
|
1980
2223
|
function renderSubagentRules(section, dialect) {
|
|
1981
2224
|
const rules = [
|
|
1982
|
-
dialect.tools.progressTool ? `- Do not delegate further or call \`${dialect.tools.progressTool}\`; root owns progress.` : "- Do not delegate further; root owns progress.",
|
|
2225
|
+
dialect.harness === "opencode" ? "- Do not delegate further; no `todowrite` (root-owned)." : dialect.tools.progressTool ? `- Do not delegate further or call \`${dialect.tools.progressTool}\`; root owns progress.` : "- Do not delegate further; root owns progress.",
|
|
1983
2226
|
"- Use terminating checks; avoid watch processes and indefinite waits.",
|
|
1984
2227
|
"- Preserve operator-selected model/effort. Stop after the assigned outcome and checks; never expand scope to fill a timeout.",
|
|
1985
2228
|
"- After two consecutive attempts without new evidence or progress, return partial evidence and the smallest blocker; do not repeat searches or unchanged failing commands.",
|
|
@@ -2176,19 +2419,19 @@ export {
|
|
|
2176
2419
|
DEFAULT_MODELS,
|
|
2177
2420
|
getDefaultOpenCodeModel,
|
|
2178
2421
|
getDefaultOpenCodeVariant,
|
|
2179
|
-
POLL_INTERVAL_BACKGROUND_MS,
|
|
2180
2422
|
findPackageRoot,
|
|
2181
2423
|
isValidPackageVersion,
|
|
2182
2424
|
resolveExecutingPackageVersion,
|
|
2183
|
-
|
|
2425
|
+
getConfigDir,
|
|
2184
2426
|
getOpenCodeManagedModelStatePath,
|
|
2185
2427
|
getExistingLiteConfigPath,
|
|
2186
2428
|
getExistingConfigPath,
|
|
2187
2429
|
ensureConfigDir,
|
|
2188
2430
|
generateLiteConfig,
|
|
2189
|
-
stripJsonComments,
|
|
2190
2431
|
parseConfig,
|
|
2191
2432
|
writeConfig,
|
|
2433
|
+
pluginEntries,
|
|
2434
|
+
isManagedOpenCodePlugin,
|
|
2192
2435
|
updateOpenCodeMainConfig,
|
|
2193
2436
|
writeLiteConfig,
|
|
2194
2437
|
detectCurrentConfig,
|