pantheon-opencode 1.6.2-beta.1 → 1.6.2-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/README.md +236 -60
  3. package/README.pt-BR.md +19 -1
  4. package/bin/pantheon-init.mjs +195 -13
  5. package/package.json +11 -3
  6. package/plugin.json +1 -1
  7. package/prompts/README.md +58 -0
  8. package/prompts/debug-issue.prompt.md +46 -0
  9. package/prompts/dynamic/agora-generated.txt +38 -0
  10. package/prompts/dynamic/orchestrate-generated.txt +51 -0
  11. package/prompts/focus.prompt.md +42 -0
  12. package/prompts/implement-feature.prompt.md +39 -0
  13. package/prompts/optimize-database.prompt.md +58 -0
  14. package/prompts/orchestrate-with-zeus.prompt.md +441 -0
  15. package/prompts/plan-architecture.prompt.md +59 -0
  16. package/prompts/quick-discovery-large-codebase.prompt.md +294 -0
  17. package/prompts/quick-plan-large-feature.prompt.md +197 -0
  18. package/prompts/semantic-summarize.md +50 -0
  19. package/prompts/sketch.prompt.md +91 -0
  20. package/prompts/subtask.prompt.md +131 -0
  21. package/pyproject.toml +1 -1
  22. package/scripts/decision-router-budget.mjs +780 -0
  23. package/scripts/decision-router-v2-budget.mjs +218 -0
  24. package/scripts/decision-router-v2-egress.mjs +272 -0
  25. package/scripts/decision-router.mjs +758 -0
  26. package/scripts/docs-check-changelog.mjs +5 -3
  27. package/scripts/install/component-selection.mjs +9 -4
  28. package/scripts/install/decision-layer-preview.mjs +376 -0
  29. package/scripts/install/decision-router-config.mjs +560 -0
  30. package/scripts/install/health-check.mjs +20 -11
  31. package/scripts/install/interactive.mjs +103 -14
  32. package/scripts/install/interrupt.mjs +4 -3
  33. package/scripts/install/migrate.mjs +123 -72
  34. package/scripts/install/opencode.mjs +178 -122
  35. package/scripts/install/plan.mjs +8 -1
  36. package/scripts/install/plugin.mjs +4 -3
  37. package/scripts/install/state.mjs +12 -0
  38. package/scripts/install/strings.mjs +22 -0
  39. package/scripts/install/venv.mjs +34 -17
  40. package/scripts/mcp_resources.py +11 -9
  41. package/scripts/release-notes.mjs +30 -7
  42. package/scripts/restore.mjs +22 -10
  43. package/scripts/sync-tui.mjs +3 -3
  44. package/scripts/test-opencode-v2-sandbox.sh +10 -6
  45. package/scripts/versioning.mjs +41 -5
  46. package/src/agents/aphrodite.md +6 -1
  47. package/src/agents/apollo.md +1 -0
  48. package/src/agents/athena.md +1 -0
  49. package/src/agents/demeter.md +1 -1
  50. package/src/agents/gaia.md +1 -0
  51. package/src/agents/hephaestus.md +1 -1
  52. package/src/agents/hermes.md +8 -10
  53. package/src/agents/iris.md +1 -1
  54. package/src/agents/mnemosyne.md +1 -0
  55. package/src/agents/nyx.md +1 -1
  56. package/src/agents/prometheus.md +1 -1
  57. package/src/agents/talos.md +6 -1
  58. package/src/agents/themis.md +1 -1
  59. package/src/agents/zeus.md +52 -62
  60. package/src/mcp/eval_store.py +11 -4
  61. package/src/mcp/mcp_resources.py +11 -9
  62. package/src/mcp/memory_mcp.py +293 -150
  63. package/src/pantheon/cost-command.ts +30 -133
  64. package/src/pantheon/jev-decision-tool.ts +347 -0
  65. package/src/pantheon/jev-decisions.ts +625 -0
  66. package/src/pantheon/local-decision-agents.ts +170 -0
  67. package/src/pantheon/local-decision-budget.ts +1046 -0
  68. package/src/pantheon/local-decision-egress-gate.ts +144 -0
  69. package/src/pantheon/local-decision-prompt.ts +256 -0
  70. package/src/pantheon/local-decision-provider-matrix.ts +44 -0
  71. package/src/pantheon/local-decision-router.ts +225 -0
  72. package/src/pantheon/local-decision-skills.ts +281 -0
  73. package/src/pantheon/local-decision-tool.ts +160 -0
  74. package/src/pantheon/local-decision-turn.ts +101 -0
  75. package/src/pantheon/local-decision-usage-evidence.internal.ts +168 -0
  76. package/src/pantheon/local-orchestration.ts +322 -0
  77. package/src/pantheon/model-pricing.ts +1 -536
  78. package/src/pantheon/pantheon-decision-catalog.ts +101 -0
  79. package/src/pantheon/v2-decision-budget.ts +456 -0
  80. package/src/pantheon/v2-decision-contracts.ts +300 -0
  81. package/src/pantheon/v2-decision-egress.ts +203 -0
  82. package/src/pantheon/v2-decision-events.ts +180 -0
  83. package/src/pantheon/v2-decision-heuristic.ts +121 -0
  84. package/src/pantheon/v2-decision-points/p1-agent.ts +91 -0
  85. package/src/pantheon/v2-decision-points/p10-claims.ts +243 -0
  86. package/src/pantheon/v2-decision-points/p11-catalog.ts +220 -0
  87. package/src/pantheon/v2-decision-points/p2-skill.ts +83 -0
  88. package/src/pantheon/v2-decision-points/p3-complexity.ts +108 -0
  89. package/src/pantheon/v2-decision-points/p4-memory.ts +137 -0
  90. package/src/pantheon/v2-decision-points/p5-themis-verify.ts +190 -0
  91. package/src/pantheon/v2-decision-points/p6-council.ts +161 -0
  92. package/src/pantheon/v2-decision-points/p7-loop.ts +263 -0
  93. package/src/pantheon/v2-decision-points/p8-guardrail.ts +367 -0
  94. package/src/pantheon/v2-decision-points/p9-memory-compaction.ts +304 -0
  95. package/src/pantheon/v2-decision-points.ts +242 -0
  96. package/src/pantheon/v2-decision-policy.ts +166 -0
  97. package/src/pantheon/v2-decision-premises.ts +146 -0
  98. package/src/pantheon/v2-decision-prompt-surface.ts +115 -0
  99. package/src/pantheon/v2-decision-rank.ts +91 -0
  100. package/src/pantheon/v2-decision-registry.ts +391 -0
  101. package/src/pantheon/v2-decision-resource-ids.ts +127 -0
  102. package/src/pantheon/v2-decision-shadow.ts +123 -0
  103. package/src/pantheon/v2-decision-telemetry.ts +214 -0
  104. package/src/pantheon/v2-decision-verify.ts +51 -0
  105. package/src/pantheon/v2-hook-engine.ts +307 -0
  106. package/src/pantheon/v2-native-decisions.ts +365 -0
  107. package/src/pantheon/v2-shell-hooks.ts +66 -2
  108. package/src/pantheon/v2-tools.ts +38 -15
  109. package/src/plugin-v2.ts +419 -26
  110. package/src/plugin.ts +4 -0
  111. package/src/plugins/tui/THIRD_PARTY_NOTICES.md +24 -0
  112. package/src/plugins/tui/dist/server-v2.d.ts +19 -11
  113. package/src/plugins/tui/dist/server-v2.d.ts.map +1 -1
  114. package/src/plugins/tui/dist/server-v2.js +19 -666
  115. package/src/plugins/tui/dist/server-v2.js.map +1 -1
  116. package/src/plugins/tui/dist/tui-v2.d.ts +11 -203
  117. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  118. package/src/plugins/tui/dist/tui-v2.js +187 -1917
  119. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  120. package/src/plugins/tui/dist/tui.js +1 -1
  121. package/src/plugins/tui/package-lock.json +17 -2
  122. package/src/plugins/tui/package.json +4 -2
  123. package/src/plugins/tui/src/cost-data.ts +607 -0
  124. package/src/plugins/tui/src/index-v2.tsx +213 -54
  125. package/src/plugins/tui/src/model-pricing.ts +536 -0
  126. package/src/plugins/tui/src/server-v2.ts +18 -838
  127. package/src/plugins/tui/tsdown.config.ts +28 -6
  128. package/src/plugins/tui/dist/quota-adapters.d.ts +0 -89
  129. package/src/plugins/tui/dist/quota-adapters.d.ts.map +0 -1
  130. package/src/plugins/tui/dist/quota-adapters.js +0 -1142
  131. package/src/plugins/tui/dist/quota-adapters.js.map +0 -1
  132. package/src/plugins/tui/dist/quota-cli.d.ts +0 -17
  133. package/src/plugins/tui/dist/quota-cli.d.ts.map +0 -1
  134. package/src/plugins/tui/dist/quota-cli.js +0 -184
  135. package/src/plugins/tui/dist/quota-cli.js.map +0 -1
  136. package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js +0 -390
  137. package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js.map +0 -1
  138. package/src/plugins/tui/src/go-key-diagnostic-ui.ts +0 -100
  139. package/src/plugins/tui/src/go-key-diagnostic.ts +0 -125
  140. package/src/plugins/tui/src/quota-adapters.ts +0 -1598
  141. package/src/plugins/tui/src/quota-cli.ts +0 -237
  142. package/src/plugins/tui/src/quota-rpc.ts +0 -209
  143. package/src/plugins/tui/src/quota-v2-model.ts +0 -1032
  144. package/src/plugins/tui/src/quota-v2.tsx +0 -986
@@ -60,6 +60,61 @@ function readVersion() {
60
60
  }
61
61
  }
62
62
 
63
+ /**
64
+ * Merge the TypeSafe decision-model provider entry into the user's
65
+ * `opencode.json` (never replaces existing keys; a non-JSON file is reported,
66
+ * never overwritten). Returns true, or a short failure reason.
67
+ */
68
+ /**
69
+ * Merge (never overwrite) the TypeSafe decision-model entry into the user's
70
+ * OpenCode config, so choosing the TypeSafe route in the wizard needs only the
71
+ * user's own sign-in afterwards. The merge is additive: existing provider
72
+ * entries and an existing jev-1.14.0 model are preserved. Returns true, or a
73
+ * short failure reason for the installer to print.
74
+ */
75
+ function provisionTypesafeProvider() {
76
+ const xdg = process.env.XDG_CONFIG_HOME
77
+ const home = process.env.HOME
78
+ const base = xdg && xdg.startsWith('/') ? xdg : `${home ?? '~'}/.config`
79
+ const candidates = [`${base}/opencode/opencode.json`]
80
+ if (home) candidates.push(`${home}/.config/opencode/opencode.json`)
81
+ const configPath = candidates.find((candidate) => fs.existsSync(candidate))
82
+ if (configPath === undefined) return 'opencode.json not found'
83
+ let data
84
+ try {
85
+ data = JSON.parse(fs.readFileSync(configPath, 'utf8'))
86
+ } catch {
87
+ return 'opencode.json is not plain JSON (comments?)'
88
+ }
89
+ data.providers ??= {}
90
+ data.providers['typesafe-ai'] ??= {}
91
+ data.providers['typesafe-ai'].models ??= {}
92
+ if (data.providers['typesafe-ai'].models['jev-1.14.0'] === undefined) {
93
+ data.providers['typesafe-ai'].models['jev-1.14.0'] = {
94
+ name: 'Jev (TypeSafe direct)',
95
+ modelID: 'jev-latest',
96
+ type: 'decision',
97
+ }
98
+ }
99
+ try {
100
+ fs.writeFileSync(configPath, `${JSON.stringify(data, null, 2)}\n`)
101
+ return true
102
+ } catch (error) {
103
+ return String(error instanceof Error ? error.message : error)
104
+ }
105
+ }
106
+
107
+ /** Value of a repeatable installer flag from the raw argv, or undefined. */
108
+ function readArgValue(name) {
109
+ const prefix = `${name}=`
110
+ for (let i = 1; i < process.argv.length; i++) {
111
+ const arg = process.argv[i]
112
+ if (arg === name) return process.argv[i + 1]
113
+ if (arg.startsWith(prefix)) return arg.slice(prefix.length)
114
+ }
115
+ return undefined
116
+ }
117
+
63
118
  function printUsage() {
64
119
  console.log('Pantheon OpenCode — Multi-agent orchestration platform')
65
120
  console.log('')
@@ -78,12 +133,21 @@ function printUsage() {
78
133
  console.log(' npx pantheon-opencode init --headless # Force non-interactive mode')
79
134
  console.log(' npx pantheon-opencode init -y # Skip confirmations, use defaults')
80
135
  console.log(' npx pantheon-opencode init --components agents,skills,instructions')
136
+ console.log(
137
+ ' npx pantheon-opencode init --decision-model opencode-console-jev/jev-1.13 --decision-monthly-usd 5 --decision-per-decision-usd 0.10',
138
+ )
81
139
  console.log(' npx pantheon-opencode init --opencode-version v1|v2|auto')
82
140
  console.log(' npx pantheon-opencode init --preset <name> # Install and activate model preset')
83
141
  console.log(
84
142
  ' npx pantheon-opencode init --merge-dev-config <path> # Merge a dev config (off by default)',
85
143
  )
86
144
  console.log(' npx pantheon-opencode set-tier <name> # Set active model preset (global)')
145
+ console.log(
146
+ ' npx pantheon-opencode decision-router help|status|setup|preview|holds # read-only',
147
+ )
148
+ console.log(
149
+ ' npx pantheon-opencode decision-router select|enable|consent|caps|period # explicit actions',
150
+ )
87
151
  console.log(
88
152
  ' npx pantheon-opencode update [--stable] # Update package + re-run init (default: beta channel)',
89
153
  )
@@ -192,6 +256,22 @@ async function main() {
192
256
  process.exit(result.status ?? 1)
193
257
  }
194
258
 
259
+ if (command === 'decision-router') {
260
+ const { DecisionRouterUsageError, runDecisionRouterCommand } = await import(
261
+ '../scripts/decision-router.mjs'
262
+ )
263
+ try {
264
+ await runDecisionRouterCommand(args.slice(1))
265
+ } catch (error) {
266
+ // A malformed command line is user input, not a crash: print one line and
267
+ // skip the stack the top-level handler would otherwise dump.
268
+ if (!(error instanceof DecisionRouterUsageError)) throw error
269
+ console.error(`Error: ${error.message}`)
270
+ process.exit(1)
271
+ }
272
+ return
273
+ }
274
+
195
275
  // beta.5: one-command update — check npm dist-tag, install, re-init.
196
276
  // Default channel is `beta` (the prerelease line); `--stable` uses `latest`.
197
277
  if (command === 'update') {
@@ -316,9 +396,15 @@ async function main() {
316
396
  !Array.isArray(options.components) ||
317
397
  options.components.some(
318
398
  (component) =>
319
- !['agents', 'skills', 'instructions', 'commands', 'plugins', 'runtime'].includes(
320
- component,
321
- ),
399
+ ![
400
+ 'agents',
401
+ 'skills',
402
+ 'instructions',
403
+ 'prompts',
404
+ 'commands',
405
+ 'plugins',
406
+ 'runtime',
407
+ ].includes(component),
322
408
  ) ||
323
409
  options.clean !== false ||
324
410
  !['v1', 'v2', 'auto'].includes(options.version) ||
@@ -405,6 +491,9 @@ async function main() {
405
491
  '--merge-dev-config',
406
492
  '--apply-plan',
407
493
  '--save-plan',
494
+ '--decision-model',
495
+ '--decision-monthly-usd',
496
+ '--decision-per-decision-usd',
408
497
  ])
409
498
  for (let i = 1; i < args.length; i++) {
410
499
  const arg = args[i]
@@ -481,9 +570,17 @@ async function main() {
481
570
  console.error(`❌ Invalid --version "${versionOpt}" — expected v1, v2 or auto`)
482
571
  process.exit(1)
483
572
  }
573
+ // The 2.0 deprecation front-run: the legacy plugin line is end-of-life.
574
+ // Loud warning now (the v1 code path still exists for legacy installs);
575
+ // the 2.0 removal turns this into a hard refusal.
576
+ if (versionOpt === 'v1') {
577
+ console.error(
578
+ '⚠️ --opencode-version v1 is DEPRECATED and will be removed in Pantheon 2.0 — the legacy plugin line is end-of-life. OpenCode 2.x hosts are the supported generation; remove the flag (auto detects the host).',
579
+ )
580
+ }
484
581
 
485
- // Resolve the user's explicit selection separately from the defaults. An
486
- // unscoped install gets runtime by default; explicit --components does not.
582
+ // Resolve the user's explicit selection separately from the defaults.
583
+ // Runtime and prompt templates are opt-in in both TTY and headless mode.
487
584
  let componentSelection
488
585
  try {
489
586
  componentSelection = resolveComponentSelection(args, {
@@ -525,6 +622,9 @@ async function main() {
525
622
  // installer's own default (`~/.config/opencode`), so the record lands next
526
623
  // to the config the next run will read.
527
624
  const fallbackTarget = isProject ? process.cwd() : resolveGlobalConfigDirectory(process.env)
625
+ let chosenTarget = reviewedPlan?.target.path ?? fallbackTarget
626
+ let hasAppliedWrites = false
627
+ let recoveryBackup = null
528
628
  /**
529
629
  * Persist the one-line record of this run. Bookkeeping is best-effort: a
530
630
  * failure is reported, never fatal, and never changes the exit code.
@@ -532,7 +632,7 @@ async function main() {
532
632
  * @param {{status: string, reason?: string|null, cancelPoint?: string|null, applied: boolean, target?: string}} outcome
533
633
  */
534
634
  const recordRun = (outcome) => {
535
- const recordTarget = outcome.target ?? result?.target ?? fallbackTarget
635
+ const recordTarget = outcome.target ?? result?.target ?? chosenTarget
536
636
  const record = buildRunRecord({
537
637
  status: outcome.status,
538
638
  reason: outcome.reason ?? null,
@@ -610,16 +710,20 @@ async function main() {
610
710
  // consumes Ctrl-C in raw mode while a question is on screen (that path is
611
711
  // the interactive cancel above), so this covers the rest of the run.
612
712
  const onInterrupt = createInterruptHandler({
613
- message: S.canceledAt(S.cancelPoints.interrupt),
713
+ message: () =>
714
+ hasAppliedWrites
715
+ ? S.interruptedAfterWrite(recoveryBackup)
716
+ : S.canceledAt(S.cancelPoints.interrupt),
614
717
  json: isJson,
615
718
  endGaugeLine,
616
719
  onInterrupt: () => {
617
720
  if (!isDryRun) {
618
721
  recordRun({
619
- status: 'canceled',
620
- reason: 'canceled',
722
+ status: hasAppliedWrites ? 'partial' : 'canceled',
723
+ reason: hasAppliedWrites ? 'interrupted' : 'canceled',
621
724
  cancelPoint: 'interrupt',
622
- applied: false,
725
+ applied: hasAppliedWrites,
726
+ target: chosenTarget,
623
727
  })
624
728
  }
625
729
  },
@@ -688,7 +792,21 @@ async function main() {
688
792
  quiet: isJson,
689
793
  verbose: args.includes('--verbose') && !isJson,
690
794
  configPreview,
795
+ onTargetResolved: (resolvedTarget) => {
796
+ chosenTarget = resolvedTarget
797
+ },
798
+ onWrite: ({ target: writeTarget, backupDir }) => {
799
+ hasAppliedWrites = true
800
+ chosenTarget = writeTarget
801
+ if (backupDir) recoveryBackup = backupDir
802
+ },
691
803
  })
804
+ // File writers and the runtime installer use synchronous APIs. If SIGINT
805
+ // arrives during one of those calls, Node queues the signal callback
806
+ // until the event loop runs again. Keep the handler armed for one turn
807
+ // after the installer returns so a queued post-write interrupt is still
808
+ // recorded as partial instead of being lost to the success path.
809
+ await new Promise((resolve) => setImmediate(resolve))
692
810
  } catch (err) {
693
811
  installError = err
694
812
  } finally {
@@ -711,8 +829,15 @@ async function main() {
711
829
  `${S.installFailed(installError.message)}\n${S.failHintNoMcp}\n${S.failHintForce}`,
712
830
  )
713
831
  }
714
- // No record for a thrown failure: the error itself is the explanation,
715
- // and a run that failed has nothing to remember beyond its message.
832
+ if (!isDryRun) {
833
+ const outcome = installError.installOutcome ?? {}
834
+ recordRun({
835
+ status: outcome.applied ? 'partial' : 'failed',
836
+ reason: 'failed',
837
+ applied: outcome.applied === true,
838
+ target: outcome.target ?? chosenTarget,
839
+ })
840
+ }
716
841
  process.exitCode = 1
717
842
  return
718
843
  }
@@ -812,6 +937,7 @@ async function main() {
812
937
  totals,
813
938
  mcp_servers: mcpServers,
814
939
  mcp_server_count: mcpServers.length,
940
+ runtime_effects: result.runtimeEffects ?? null,
815
941
  files: files.map(({ path: filePath, action, bytes }) => ({
816
942
  path: path.relative(result.target, filePath) || '.',
817
943
  action,
@@ -881,7 +1007,10 @@ async function main() {
881
1007
  const doctorStartedAt = Date.now()
882
1008
  const { spawnSync } = await import('node:child_process')
883
1009
  const doctorScript = path.join(ROOT, 'scripts', 'doctor.mjs')
884
- const doctor = spawnSync(process.execPath, [doctorScript], { stdio: 'inherit', cwd: ROOT })
1010
+ const doctor = spawnSync(process.execPath, [doctorScript, '--target', result.target], {
1011
+ stdio: 'inherit',
1012
+ cwd: ROOT,
1013
+ })
885
1014
  const doctorSeconds = ((Date.now() - doctorStartedAt) / 1000).toFixed(1)
886
1015
  // Never leave "Running health check..." as the last word: report the
887
1016
  // outcome and duration, and propagate the child's exit code so CI sees
@@ -898,6 +1027,56 @@ async function main() {
898
1027
  }
899
1028
  }
900
1029
 
1030
+ // Optional Jev decision-model activation, requested at install time with
1031
+ // explicit caps (the setup-model chain: selection + enable + consent +
1032
+ // user/provider/model caps + period confirmation). Dry-run prints intent
1033
+ // only. Failures never fail the install itself.
1034
+ // Explicit flags win; otherwise honor the wizard's Jev activation choice.
1035
+ const wizardActivation = result.decisionModelActivation ?? null
1036
+ const decisionTarget = readArgValue('--decision-model') ?? wizardActivation?.target ?? null
1037
+ if (decisionTarget) {
1038
+ const monthly = readArgValue('--decision-monthly-usd') ?? wizardActivation?.monthly ?? '5'
1039
+ const perDecision =
1040
+ readArgValue('--decision-per-decision-usd') ?? wizardActivation?.perDecision ?? '0.10'
1041
+ const noConsent = process.argv.includes('--decision-no-consent')
1042
+ console.log('')
1043
+ if (isDryRun) {
1044
+ console.log(` ${S.jevDryRun(decisionTarget)}`)
1045
+ } else {
1046
+ try {
1047
+ const { runDecisionRouterCommand } = await import('../scripts/decision-router.mjs')
1048
+ await runDecisionRouterCommand(
1049
+ [
1050
+ 'setup-model',
1051
+ decisionTarget,
1052
+ '--monthly-usd',
1053
+ monthly,
1054
+ '--per-decision-usd',
1055
+ perDecision,
1056
+ ...(noConsent ? ['--no-consent'] : []),
1057
+ ],
1058
+ { stdout: (line) => console.log(` ${line}`) },
1059
+ )
1060
+ console.log(` ${S.jevConfigured(decisionTarget)}`)
1061
+ if (decisionTarget.startsWith('typesafe-jev')) {
1062
+ const provisioned = provisionTypesafeProvider()
1063
+ console.log(
1064
+ provisioned === true
1065
+ ? ' TypeSafe provider entry merged into opencode.json (models.typesafe-ai, type "decision"). Sign in with `opencode auth login` (TypeSafe) or /connect.'
1066
+ : ` TypeSafe provider entry NOT merged (${provisioned}); merge it manually — see docs/reference/native-decisions.md.`,
1067
+ )
1068
+ }
1069
+ } catch (error) {
1070
+ console.error(
1071
+ ` ${S.jevConfigureFailed(error instanceof Error ? error.message : String(error))}`,
1072
+ )
1073
+ console.error(
1074
+ ` Fix later with: npx pantheon-opencode decision-router setup-model ${decisionTarget} --monthly-usd ${monthly} --per-decision-usd ${perDecision}`,
1075
+ )
1076
+ }
1077
+ }
1078
+ }
1079
+
901
1080
  console.log('')
902
1081
  console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
903
1082
  console.log(` ${S.installedTitle(version)}`)
@@ -908,6 +1087,9 @@ async function main() {
908
1087
  console.log(` ${S.nextLaunch}`)
909
1088
  console.log(` ${S.nextAgents}`)
910
1089
  console.log(` ${S.nextProject}`)
1090
+ if (!decisionTarget) {
1091
+ console.log(` ${S.nextJev}`)
1092
+ }
911
1093
  console.log('')
912
1094
 
913
1095
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantheon-opencode",
3
- "version": "1.6.2-beta.1",
3
+ "version": "1.6.2-beta.10",
4
4
  "description": "Multi-agent orchestration for OpenCode — 14 specialized agents, TDD, Themis review gates.",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -11,6 +11,7 @@
11
11
  "registry": "https://registry.npmjs.org/"
12
12
  },
13
13
  "exports": {
14
+ "./local-decision-router": "./src/pantheon/local-decision-router.ts",
14
15
  "./plugin": "./src/plugin.ts",
15
16
  "./plugin-v2": "./src/plugin-v2.ts",
16
17
  "./v2-bridge": "./src/pantheon/v2-bridge.ts"
@@ -20,6 +21,8 @@
20
21
  "prepare": "husky",
21
22
  "setup": "node scripts/setup.mjs",
22
23
  "build:agents-md": "node scripts/build-agents-md.mjs",
24
+ "build:decision-router": "node scripts/build-decision-router.mjs",
25
+ "check:decision-router": "node scripts/build-decision-router.mjs --check",
23
26
  "skills:lock": "node scripts/update-skills-lock.mjs",
24
27
  "setup:lite": "node bin/pantheon-init.mjs init --yes --clean --components agents,skills,instructions",
25
28
  "doctor": "node scripts/doctor.mjs",
@@ -27,7 +30,8 @@
27
30
  "init": "node bin/pantheon-init.mjs init --yes",
28
31
  "opencode": "OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true opencode",
29
32
  "start": "OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true opencode",
30
- "prepublishOnly": "node scripts/validate-routing.mjs",
33
+ "prepack": "npm run check:decision-router",
34
+ "prepublishOnly": "node scripts/validate-routing.mjs && npm run check:decision-router",
31
35
  "postpublish": "node -e \"console.log('✅ Published pantheon-opencode v' + require('./package.json').version + ' to npm')\"",
32
36
  "version:status": "node scripts/versioning.mjs status",
33
37
  "version:apply": "node scripts/versioning.mjs apply",
@@ -35,7 +39,7 @@
35
39
  "release:dry-run": "node scripts/versioning.mjs status && node scripts/release-notes.mjs && node scripts/package-evidence.mjs",
36
40
  "package:evidence": "node scripts/package-evidence.mjs",
37
41
  "engine:check": "node scripts/validate-node-engine-policy.mjs",
38
- "package:validate": "node scripts/validate-package.mjs && npm run engine:check",
42
+ "package:validate": "node scripts/validate-package.mjs && npm run check:decision-router && npm run engine:check",
39
43
  "lint": "biome ci .",
40
44
  "docs:lint": "node scripts/docs-link-check.mjs",
41
45
  "docs:media": "node scripts/docs-media.mjs",
@@ -87,6 +91,7 @@
87
91
  "src/instructions/*.instructions.md",
88
92
  "src/mcp/*.mjs",
89
93
  "scripts/*.mjs",
94
+ "!scripts/build-decision-router.mjs",
90
95
  "src/mcp/*.sh",
91
96
  "src/routing.yml",
92
97
  "src/pantheon/**",
@@ -100,6 +105,7 @@
100
105
  "src/plugins/tui/**",
101
106
  "!src/plugins/tui/node_modules/**",
102
107
  "src/skills/**",
108
+ "prompts/**",
103
109
  "!**/__pycache__/**",
104
110
  "!**/*.pyc"
105
111
  ],
@@ -114,7 +120,9 @@
114
120
  "@biomejs/biome": "2.5.14",
115
121
  "@commitlint/cli": "21.2.3",
116
122
  "@commitlint/config-conventional": "21.2.3",
123
+ "@opencode/plugin": "2.2.5",
117
124
  "ajv": "8.20.0",
125
+ "esbuild": "0.28.2",
118
126
  "husky": "^9.1.7",
119
127
  "tsx": "4.23.15",
120
128
  "typescript": "7.0.2"
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon",
3
3
  "publisher": "ils15",
4
- "version": "1.6.2-beta.1",
4
+ "version": "1.6.2-beta.10",
5
5
  "displayName": "Pantheon",
6
6
  "description": "Conductor-Delegate orchestration platform with 14 specialized agents, 20 skills, and OpenCode support.",
7
7
  "agents": "./src/agents",
@@ -0,0 +1,58 @@
1
+ # Prompt Files
2
+
3
+ Reusable prompt templates for common development workflows. Each prompt
4
+ specifies a target agent, required tools, and structured instructions.
5
+
6
+ ## Available Prompts (10)
7
+
8
+ | Prompt | Agent | Purpose |
9
+ |---|---|---|
10
+ | **orchestrate-with-zeus** | Zeus | Full feature orchestration — planning, implementation, review, deployment |
11
+ | **implement-feature** | Zeus | End-to-end feature implementation with TDD and quality gates |
12
+ | **plan-architecture** | Athena | Strategic architecture planning with research and TDD-driven plan |
13
+ | **debug-issue** | Apollo | Rapid debugging with parallel file discovery and analysis |
14
+ | **optimize-database** | Demeter | Database schema, query, and performance optimization |
15
+ | **focus** | Zeus | Pin a session goal to keep all work aligned with a single objective |
16
+ | **sketch** | Athena | Interview a rough idea into a structured feature spec (3–5 questions) |
17
+ | **subtask** | Zeus | Delegate a bounded child task to a specialist and receive a structured result |
18
+ | **quick-discovery-large-codebase** | Apollo | Fast-path bounded discovery for large codebases (8-minute cap) |
19
+ | **quick-plan-large-feature** | Athena | Fast-path bounded planning for large features (5-minute cap) |
20
+
21
+ ## Usage
22
+
23
+ Prompt templates are **not** slash commands. OpenCode slash commands live in
24
+ `commands/` and are invoked in chat:
25
+
26
+ ```text
27
+ /pantheon Add CSV export to the reports page, including tests and a review.
28
+ /pantheon-audit Changes in src/auth/
29
+ /pantheon-focus Implement email verification end-to-end with TDD
30
+ /pantheon-deepwork Migrate the billing module
31
+ /pantheon-model status
32
+ /pantheon-optimize
33
+ /pantheon-vision
34
+ /pantheon-consolidate
35
+ ```
36
+
37
+ The templates in this directory are loaded by the command or agent that needs
38
+ them; they are not invoked directly by filename. In particular:
39
+
40
+ - `focus.prompt.md` is used by `/pantheon-focus`.
41
+ - The audit guidance is used by `/pantheon-audit`.
42
+ - `sketch.prompt.md` has **no matching command file**, so it is available as a
43
+ template only. There is currently no `/sketch` command.
44
+
45
+ For the full command list, see the commands directory in the repository. For
46
+ agent roles, see `docs/agents/README.md`.
47
+
48
+ ## Placeholder contract
49
+
50
+ OpenCode expands `$ARGUMENTS` and positional values such as `$1` in slash
51
+ commands. Those are command-runtime variables; prompt templates do not expand
52
+ `$input`, shell variables, angle-bracket examples, or JSON braces.
53
+
54
+ Manual prompt-template inputs use `{{UPPER_SNAKE_CASE}}`, for example
55
+ `{{TASK_INPUT}}` or `{{TARGET_AGENT}}`. The command or agent that loads the
56
+ template fills these fields before dispatch. This repository does not perform
57
+ automatic placeholder substitution or escaping, so callers must insert values
58
+ as data and preserve their intended quoting and boundaries.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: debug-issue
3
+ description: "Rapidly debug issues with parallel file discovery and analysis"
4
+ agent: apollo
5
+ tools: ['search', 'usages']
6
+ ---
7
+
8
+ # Debug Quickly (Apollo - Scout)
9
+
10
+ ## Adaptive Search Strategy
11
+
12
+ Choose only the independent searches that fit the report. These are candidate
13
+ angles, not a required fan-out; a focused bug may need only one or two:
14
+
15
+ Search 1: Exact error message
16
+ Search 2: Mentioned function/class
17
+ Search 3: Related file patterns
18
+ Search 4: Similar test cases
19
+ Search 5: Related issues/PRs
20
+ Search 6: Stack trace patterns
21
+ Search 7: Config files
22
+ Search 8: Logging statements
23
+ Search 9: Mentioned dependencies
24
+ Search 10: Recent changes in area
25
+
26
+ ## Analysis & Synthesis
27
+ - Eliminate duplicates
28
+ - Identify file relationships
29
+ - Extract patterns
30
+ - Return prioritized findings
31
+
32
+ ## Recommendations
33
+
34
+ After analysis, @apollo returns:
35
+ 1. **Root Cause Hypothesis**: What's probably wrong
36
+ 2. **Key Files**: Most relevant files
37
+ 3. **Reproduction Steps**: How to reproduce
38
+ 4. **Suggested Fix**: Solution direction
39
+ 5. **Next Steps**: Next agents to involve
40
+
41
+ ## When to Use
42
+ - Bug report received
43
+ - Confusing error stack trace
44
+ - Performance issue diagnosis
45
+ - Regression debugging
46
+ - When you need quick exploration
@@ -0,0 +1,38 @@
1
+ # =============================================================================
2
+ # Dynamic Agora Prompt
3
+ # Generated: 2026-05-16T13:50:41Z
4
+ # Plan: copilot-free
5
+ # Service: vscode
6
+ # Tier: free
7
+ # Price: $0/mo
8
+ # Monthly Requests: 50
9
+ # =============================================================================
10
+
11
+ You are convening an agora with access to these specialists: aphrodite,apollo athena demeter gaia hephaestus,hermes iris,mnemosyne nyx,prometheus talos,themis zeus
12
+
13
+ ## Platform Capabilities
14
+ Agent Overrides:
15
+ themis: anthropic/claude-sonnet-4-6
16
+ zeus: anthropic/claude-sonnet-4-6
17
+
18
+ ## Instructions
19
+ 1. Select 3-5 relevant agents based on the question domain
20
+ 2. Dispatch them in parallel with the same question
21
+ 3. Synthesize their perspectives into a single recommendation
22
+ 4. Include confidence level and next steps
23
+
24
+ ## Available Specialists
25
+ - @aphrodite: Frontend specialist — React 19, TypeScript strict, WCAG accessibility, responsive design, TDD, modern API patterns, deprecated npm detection via npm-deprecated-check/Biome. Calls apollo as nested subagent to discover components. Sends work to themis for review.
26
+ - @apollo: Read-only investigation scout — 3–10 parallel searches across codebase, external docs, and GitHub. Called by: athena, zeus, hermes, aphrodite, demeter. No edits, no commands.
27
+ - @athena: Strategic planner & architect — research-first, plan-only, never implements. Plans include quality gates: ruff/Biome linting, obsolete lib detection, LTS version policy. Calls apollo as nested subagent for complex discovery.
28
+ - @demeter: Database specialist — SQLAlchemy 2.0, Alembic, query optimization, N+1 prevention, TDD migrations, modern DB libs (avoid obsolete ORM patterns). Calls apollo as nested subagent for optimization patterns. Sends work to themis for review.
29
+ - @gaia: Remote sensing domain specialist — satellite image processing, spectral analysis, SAR, change detection, time series, ML/DL classification, photogrammetry, statistical analysis, scientific literature (MDPI, IEEE TGRS, RSE, ISPRS). Covers full RS pipeline from raw image to product. Calls apollo for discovery. Sends work to themis for review.
30
+ - @hephaestus: AI tooling & pipelines specialist — LangChain/LangGraph chains, RAG architecture, vector stores, embedding strategies. Forges the AI infrastructure agents need. Calls apollo for discovery. Sends work to themis for review.
31
+ - @hermes: Backend specialist — FastAPI, Python, async, TDD (RED→GREEN→REFACTOR), modern Python stdlib, obsolete lib detection via dep-audit/pip-audit. Calls apollo as nested subagent to discover patterns. Sends work to themis for review.
32
+ - @iris: GitHub operations specialist — branches, pull requests, issues, releases, tags. Called by zeus after Themis review or directly for any GitHub workflow task. Never pushes or merges without explicit human approval.
33
+ - @mnemosyne: Memory bank quality owner — initializes .pantheon/memory-bank/, writes ADRs and task records on explicit request. Called by zeus. Never invoked automatically after phases.
34
+ - @nyx: Observability & monitoring specialist — OpenTelemetry tracing, token/cost tracking, agent performance analytics, LangSmith integration. Sees what others cannot in the dark. Calls apollo for discovery. Sends work to themis for review.
35
+ - @prometheus: Infrastructure specialist — Docker multi-stage builds, docker-compose, CI/CD workflows, health checks, env management, container deprecation scans. Calls apollo as nested subagent for pattern discovery. Sends work to themis for validation.
36
+ - @talos: Hotfix express lane — direct fixes for small bugs, CSS, typos, minor logic. No TDD ceremony, no orchestration overhead. Standalone, no subagents. Escalates complex issues to zeus.
37
+ - @themis: Quality & security gate — ruff/Biome linting, dead/legacy code detection, OWASP Top 10, coverage >80%, correctness, deprecation audit. Called by: hermes, aphrodite, demeter, zeus. Escalates blockers to zeus.
38
+ - @zeus: Central orchestrator — never implements. Delegates to: athena (plan), apollo (research), hermes (backend + obsolete lib audit), aphrodite (frontend + deprecated npm audit), demeter (database), prometheus (infra), themis (review + ruff/Biome dead-code/deprecation gate), iris (GitHub), mnemosyne (docs), talos (hotfix), hephaestus (AI pipelines), nyx (observability)
@@ -0,0 +1,51 @@
1
+ # =============================================================================
2
+ # Dynamic Orchestration Prompt
3
+ # Generated: 2026-05-16T13:50:41Z
4
+ # Plan: copilot-free
5
+ # Service: vscode
6
+ # Tier: free
7
+ # Price: $0/mo
8
+ # Monthly Requests: 50
9
+ # =============================================================================
10
+
11
+ You are Zeus, the central orchestrator for the Pantheon multi-agent system.
12
+
13
+ ## Active Configuration
14
+ - Plan: copilot-free
15
+ - Service: vscode
16
+ - Tier: free
17
+ - Price: $0/mo
18
+ - Monthly Request Limit: 50
19
+
20
+ ## Model Tiers
21
+
22
+ ## Available Agents
23
+ - @aphrodite: Frontend specialist — React 19, TypeScript strict, WCAG accessibility, responsive design, TDD, modern API patterns, deprecated npm detection via npm-deprecated-check/Biome. Calls apollo as nested subagent to discover components. Sends work to themis for review.
24
+ - @apollo: Read-only investigation scout — 3–10 parallel searches across codebase, external docs, and GitHub. Called by: athena, zeus, hermes, aphrodite, demeter. No edits, no commands.
25
+ - @athena: Strategic planner & architect — research-first, plan-only, never implements. Plans include quality gates: ruff/Biome linting, obsolete lib detection, LTS version policy. Calls apollo as nested subagent for complex discovery.
26
+ - @demeter: Database specialist — SQLAlchemy 2.0, Alembic, query optimization, N+1 prevention, TDD migrations, modern DB libs (avoid obsolete ORM patterns). Calls apollo as nested subagent for optimization patterns. Sends work to themis for review.
27
+ - @gaia: Remote sensing domain specialist — satellite image processing, spectral analysis, SAR, change detection, time series, ML/DL classification, photogrammetry, statistical analysis, scientific literature (MDPI, IEEE TGRS, RSE, ISPRS). Covers full RS pipeline from raw image to product. Calls apollo for discovery. Sends work to themis for review.
28
+ - @hephaestus: AI tooling & pipelines specialist — LangChain/LangGraph chains, RAG architecture, vector stores, embedding strategies. Forges the AI infrastructure agents need. Calls apollo for discovery. Sends work to themis for review.
29
+ - @hermes: Backend specialist — FastAPI, Python, async, TDD (RED→GREEN→REFACTOR), modern Python stdlib, obsolete lib detection via dep-audit/pip-audit. Calls apollo as nested subagent to discover patterns. Sends work to themis for review.
30
+ - @iris: GitHub operations specialist — branches, pull requests, issues, releases, tags. Called by zeus after Themis review or directly for any GitHub workflow task. Never pushes or merges without explicit human approval.
31
+ - @mnemosyne: Memory bank quality owner — initializes .pantheon/memory-bank/, writes ADRs and task records on explicit request. Called by zeus. Never invoked automatically after phases.
32
+ - @nyx: Observability & monitoring specialist — OpenTelemetry tracing, token/cost tracking, agent performance analytics, LangSmith integration. Sees what others cannot in the dark. Calls apollo for discovery. Sends work to themis for review.
33
+ - @prometheus: Infrastructure specialist — Docker multi-stage builds, docker-compose, CI/CD workflows, health checks, env management, container deprecation scans. Calls apollo as nested subagent for pattern discovery. Sends work to themis for validation.
34
+ - @talos: Hotfix express lane — direct fixes for small bugs, CSS, typos, minor logic. No TDD ceremony, no orchestration overhead. Standalone, no subagents. Escalates complex issues to zeus.
35
+ - @themis: Quality & security gate — ruff/Biome linting, dead/legacy code detection, OWASP Top 10, coverage >80%, correctness, deprecation audit. Called by: hermes, aphrodite, demeter, zeus. Escalates blockers to zeus.
36
+ - @zeus: Central orchestrator — never implements. Delegates to: athena (plan), apollo (research), hermes (backend + obsolete lib audit), aphrodite (frontend + deprecated npm audit), demeter (database), prometheus (infra), themis (review + ruff/Biome dead-code/deprecation gate), iris (GitHub), mnemosyne (docs), talos (hotfix), hephaestus (AI pipelines), nyx (observability)
37
+
38
+ ## Orchestration Rules
39
+ 1. **Planning**: Delegate to @athena for architecture decisions
40
+ 2. **Discovery**: Delegate to @apollo for codebase investigation
41
+ 3. **Implementation**: Dispatch @hermes (backend), @aphrodite (frontend), @demeter (database) in parallel when scopes are independent
42
+ 4. **Review**: Always route completed work to @themis before merge
43
+ 5. **Deploy**: Route infrastructure changes to @prometheus
44
+ 6. **Document**: Route memory tasks to @mnemosyne
45
+ 7. **Hotfix**: Route small fixes to @talos (bypass orchestration)
46
+
47
+ ## Cost-Conscious Routing
48
+ - Use `fast` tier agents for discovery, documentation, and simple queries
49
+ - Use `default` tier agents for standard implementation work
50
+ - Use `premium` tier agents for planning, review, and complex orchestration
51
+ - Respect monthly request limits: 50
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: focus
3
+ description: "Pin a session goal to keep all todos, delegation decisions, and verification steps aligned with a single stated objective"
4
+ agent: zeus
5
+ tools: ['search']
6
+ ---
7
+
8
+ # Pin Session Goal (Zeus + Session-Goal Skill)
9
+
10
+ ## Session Goal
11
+
12
+ **Goal:** {{TASK_INPUT}}
13
+
14
+ ---
15
+
16
+ ## What to do
17
+
18
+ 1. Confirm the goal is clear and actionable. If ambiguous, ask one clarifying question.
19
+ 2. Format the goal using the 4-component structure below.
20
+ 3. Write the pinned goal to `.pantheon/memory-bank/.tmp/current-goal.md`.
21
+ 4. Announce the pinned goal in chat and confirm readiness to proceed.
22
+
23
+ ---
24
+
25
+ ## Goal Format
26
+
27
+ ```
28
+ GOAL: {{WHAT_TO_BUILD}}
29
+ SCOPE: {{SCOPE}}
30
+ SUCCESS CRITERIA: {{SUCCESS_CRITERIA}}
31
+ OUT OF SCOPE: {{OUT_OF_SCOPE}}
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Alignment Rules (apply for the rest of this session)
37
+
38
+ - Every todo must relate to this goal
39
+ - Zeus invokes only agents relevant to this goal
40
+ - Themis checks that implementations serve this goal
41
+ - If a task drifts from the goal, flag it before proceeding
42
+ - Never change the goal silently — confirm with the user first