pantheon-opencode 1.7.0 → 2.0.0-beta.2

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 (173) hide show
  1. package/AGENTS.global.md +2 -2
  2. package/AGENTS.md +3 -3
  3. package/CHANGELOG.md +85 -59
  4. package/README.md +74 -48
  5. package/README.pt-BR.md +19 -19
  6. package/bin/pantheon-init.mjs +11 -48
  7. package/package.json +9 -13
  8. package/plugin.json +2 -2
  9. package/pyproject.toml +1 -1
  10. package/scripts/build-agents-md.mjs +7 -6
  11. package/scripts/{check-plugin-v2-coverage.mjs → check-plugin-coverage.mjs} +7 -7
  12. package/scripts/{decision-router-v2-budget.mjs → decision-router-budget-gates.mjs} +1 -1
  13. package/scripts/{decision-router-v2-egress.mjs → decision-router-egress.mjs} +1 -1
  14. package/scripts/decision-router.mjs +2 -2
  15. package/scripts/docs-media.mjs +1 -1
  16. package/scripts/doctor.mjs +225 -136
  17. package/scripts/install/behavior-overrides.bundle.mjs +123 -0
  18. package/scripts/install/{v2-capabilities.mjs → capabilities.mjs} +7 -7
  19. package/scripts/install/config-migration.mjs +60 -253
  20. package/scripts/install/file-inventory.mjs +6 -4
  21. package/scripts/install/interactive.mjs +1 -1
  22. package/scripts/install/opencode-state.mjs +13 -12
  23. package/scripts/install/opencode-version.mjs +97 -162
  24. package/scripts/install/opencode.mjs +271 -428
  25. package/scripts/install/plan.mjs +1 -9
  26. package/scripts/install/plugin.mjs +19 -35
  27. package/scripts/install/shared.mjs +40 -1
  28. package/scripts/package-evidence.mjs +1 -4
  29. package/scripts/probe-pantheon-cost.mjs +1 -1
  30. package/scripts/reconcile.mjs +5 -7
  31. package/scripts/release-gates.mjs +22 -61
  32. package/scripts/setup-v2-config.mjs +10 -8
  33. package/scripts/setup.mjs +12 -22
  34. package/scripts/sync-tui.mjs +9 -17
  35. package/scripts/{test-opencode-v2-sandbox.sh → test-opencode-sandbox.sh} +9 -9
  36. package/scripts/update-skills-lock.mjs +24 -12
  37. package/scripts/update.mjs +17 -1
  38. package/scripts/validate-routing.mjs +79 -4
  39. package/scripts/validate-sandbox-install.mjs +3 -3
  40. package/skills-lock.json +25 -8
  41. package/src/agents/zeus.md +1 -0
  42. package/src/pantheon/behavior-overrides.ts +191 -0
  43. package/src/pantheon/{v2-bounded-read.ts → bounded-read.ts} +1 -1
  44. package/src/pantheon/cost-command.ts +1 -1
  45. package/src/pantheon/{v2-decision-contracts.ts → decision-contracts.ts} +3 -3
  46. package/src/pantheon/{v2-decision-points → decision-points}/p1-agent.ts +3 -3
  47. package/src/pantheon/{v2-decision-points → decision-points}/p10-claims.ts +2 -2
  48. package/src/pantheon/{v2-decision-points → decision-points}/p11-catalog.ts +2 -2
  49. package/src/pantheon/{v2-decision-points → decision-points}/p2-skill.ts +3 -3
  50. package/src/pantheon/{v2-decision-points → decision-points}/p3-complexity.ts +6 -6
  51. package/src/pantheon/{v2-decision-points → decision-points}/p4-memory.ts +2 -2
  52. package/src/pantheon/{v2-decision-points → decision-points}/p5-themis-verify.ts +2 -2
  53. package/src/pantheon/{v2-decision-points → decision-points}/p6-council.ts +3 -3
  54. package/src/pantheon/{v2-decision-points → decision-points}/p7-loop.ts +5 -5
  55. package/src/pantheon/{v2-decision-points → decision-points}/p8-guardrail.ts +2 -2
  56. package/src/pantheon/{v2-decision-points → decision-points}/p9-memory-compaction.ts +2 -2
  57. package/src/pantheon/{v2-decision-points.ts → decision-points.ts} +5 -5
  58. package/src/pantheon/{v2-decision-policy.ts → decision-policy.ts} +2 -2
  59. package/src/pantheon/{v2-decision-prompt-surface.ts → decision-prompt-surface.ts} +3 -3
  60. package/src/pantheon/{v2-decision-registry.ts → decision-registry.ts} +10 -13
  61. package/src/pantheon/{v2-decision-resource-ids.ts → decision-resource-ids.ts} +1 -1
  62. package/src/pantheon/{v2-decision-shadow.ts → decision-shadow.ts} +1 -1
  63. package/src/pantheon/{v2-decision-telemetry.ts → decision-telemetry.ts} +1 -1
  64. package/src/pantheon/{v2-execute-after.ts → execute-after.ts} +4 -4
  65. package/src/pantheon/goal-store.ts +7 -0
  66. package/src/pantheon/{v2-hook-engine.ts → hook-engine.ts} +3 -3
  67. package/src/pantheon/jev-decision-tool.ts +3 -3
  68. package/src/pantheon/jev-decisions.ts +12 -6
  69. package/src/pantheon/jev-escalation.ts +6 -6
  70. package/src/pantheon/jev-quality-score.ts +2 -2
  71. package/src/pantheon/jev-rank-verify.ts +2 -2
  72. package/src/pantheon/jev-risk-gate.ts +4 -4
  73. package/src/pantheon/local-decision-agents.ts +1 -1
  74. package/src/pantheon/local-decision-router.ts +1 -1
  75. package/src/pantheon/local-decision-tool.ts +2 -2
  76. package/src/pantheon/local-orchestration.ts +1 -1
  77. package/src/pantheon/model-command.ts +1 -1
  78. package/src/pantheon/{v2-vision.ts → native-vision.ts} +12 -15
  79. package/src/pantheon/pantheon-decision-catalog.ts +12 -0
  80. package/src/pantheon/{v2-shell-hooks.ts → shell-hooks.ts} +4 -4
  81. package/src/pantheon/{v2-tools.ts → tools.ts} +4 -4
  82. package/src/pantheon/{v2-unsupported.d.mts → unsupported.d.mts} +3 -3
  83. package/src/pantheon/{v2-unsupported.mjs → unsupported.mjs} +8 -8
  84. package/src/pantheon/update-notifier.ts +101 -0
  85. package/src/pantheon/vision-local.ts +12 -3
  86. package/src/pantheon/vision.ts +120 -2
  87. package/src/{plugin-v2 → plugin}/index.ts +7 -7
  88. package/src/plugin.ts +2870 -500
  89. package/src/plugins/hook-runner.ts +3 -3
  90. package/src/plugins/tui/dist/server.d.ts +23 -9
  91. package/src/plugins/tui/dist/server.d.ts.map +1 -1
  92. package/src/plugins/tui/dist/server.js +25 -12
  93. package/src/plugins/tui/dist/server.js.map +1 -1
  94. package/src/plugins/tui/dist/tui.d.ts +1023 -494
  95. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  96. package/src/plugins/tui/dist/tui.js +5612 -2086
  97. package/src/plugins/tui/dist/tui.js.map +1 -1
  98. package/src/plugins/tui/{index-v2.ts → index.ts} +1 -1
  99. package/src/plugins/tui/package-lock.json +2 -42
  100. package/src/plugins/tui/package.json +4 -10
  101. package/src/plugins/tui/src/cost-data.ts +1 -1
  102. package/src/plugins/tui/src/decision-router-state.ts +242 -0
  103. package/src/plugins/tui/src/doctor-state.ts +198 -0
  104. package/src/plugins/tui/src/index.tsx +4222 -2822
  105. package/src/plugins/tui/src/j1-gate-status.ts +85 -0
  106. package/src/plugins/tui/src/pantheon-settings-state.ts +245 -0
  107. package/src/plugins/tui/src/pantheon-settings.tsx +442 -0
  108. package/src/plugins/tui/src/preset-state.ts +143 -0
  109. package/src/plugins/tui/src/server.ts +23 -10
  110. package/src/plugins/tui/src/update-notice.ts +90 -0
  111. package/src/plugins/tui/src/update-status.ts +98 -0
  112. package/src/plugins/tui/tsconfig.typecheck.json +9 -2
  113. package/src/plugins/tui/tsdown.config.ts +3 -5
  114. package/src/plugins/tui/tui.ts +1 -2
  115. package/src/routing.yml +36 -0
  116. package/src/skills/README.md +16 -1
  117. package/src/skills/artifact-management/SKILL.md +10 -67
  118. package/src/skills/artifact-management/references/artifact-templates.md +71 -0
  119. package/src/skills/auto-continue/SKILL.md +10 -0
  120. package/src/skills/code-review-checklist/SKILL.md +11 -44
  121. package/src/skills/code-review-checklist/references/review-checklists.md +54 -0
  122. package/src/skills/instruction-forge/SKILL.md +57 -0
  123. package/src/skills/instruction-forge/references/agents-md-doctrine.md +50 -0
  124. package/src/skills/instruction-forge/references/eval-doctrine.md +37 -0
  125. package/src/skills/instruction-forge/references/skill-doctrine.md +62 -0
  126. package/src/skills/memory-bank/SKILL.md +11 -90
  127. package/src/skills/memory-bank/references/anti-patterns.md +33 -0
  128. package/src/skills/memory-bank/references/product-adoption.md +19 -0
  129. package/src/skills/memory-bank/references/storage-model.md +21 -0
  130. package/src/skills/memory-bank/references/structure-and-frequency.md +44 -0
  131. package/src/skills/reflect/SKILL.md +1 -0
  132. package/src/skills/session-goal/SKILL.md +7 -54
  133. package/src/skills/session-goal/references/goal-format.md +26 -0
  134. package/src/skills/session-goal/references/session-reuse.md +44 -0
  135. package/src/skills/tdd-with-agents/SKILL.md +11 -101
  136. package/src/skills/tdd-with-agents/references/advanced-testing-patterns.md +58 -0
  137. package/src/skills/tdd-with-agents/references/testing-by-layer.md +60 -0
  138. package/src/skills/visual-review-pipeline/SKILL.md +11 -120
  139. package/src/skills/visual-review-pipeline/references/findings-schema.md +49 -0
  140. package/src/skills/visual-review-pipeline/references/workflow-steps.md +111 -0
  141. package/scripts/hooks/log-session-start.sh +0 -48
  142. package/scripts/hooks/validate-post-conditions.sh +0 -21
  143. package/scripts/hooks/validate-talos-scope.sh +0 -50
  144. package/scripts/hooks/validate-tool-safety.sh +0 -49
  145. package/src/pantheon/goal-loop.ts +0 -314
  146. package/src/pantheon/idle-continuation.ts +0 -52
  147. package/src/pantheon/todo-preserve.ts +0 -301
  148. package/src/pantheon/tool-ceiling.ts +0 -159
  149. package/src/pantheon/v2-bridge.ts +0 -153
  150. package/src/plugin-v2.ts +0 -2954
  151. package/src/plugins/pantheon-hooks.ts +0 -1433
  152. package/src/plugins/tui/dist/server-v2.d.ts +0 -30
  153. package/src/plugins/tui/dist/server-v2.d.ts.map +0 -1
  154. package/src/plugins/tui/dist/server-v2.js +0 -33
  155. package/src/plugins/tui/dist/server-v2.js.map +0 -1
  156. package/src/plugins/tui/dist/tui-v2.d.ts +0 -1039
  157. package/src/plugins/tui/dist/tui-v2.d.ts.map +0 -1
  158. package/src/plugins/tui/dist/tui-v2.js +0 -4597
  159. package/src/plugins/tui/dist/tui-v2.js.map +0 -1
  160. package/src/plugins/tui/src/index-v2.tsx +0 -4496
  161. package/src/plugins/tui/src/server-v2.ts +0 -28
  162. package/src/plugins/tui/tui-v2.ts +0 -2
  163. /package/src/pantheon/{v2-decision-budget.ts → decision-budget.ts} +0 -0
  164. /package/src/pantheon/{v2-decision-egress.ts → decision-egress.ts} +0 -0
  165. /package/src/pantheon/{v2-decision-events.ts → decision-events.ts} +0 -0
  166. /package/src/pantheon/{v2-decision-heuristic.ts → decision-heuristic.ts} +0 -0
  167. /package/src/pantheon/{v2-decision-premises.ts → decision-premises.ts} +0 -0
  168. /package/src/pantheon/{v2-decision-rank.ts → decision-rank.ts} +0 -0
  169. /package/src/pantheon/{v2-decision-verify.ts → decision-verify.ts} +0 -0
  170. /package/src/pantheon/{v2-delegation-enforce.ts → delegation-policy.ts} +0 -0
  171. /package/src/pantheon/{v2-model-overrides.ts → model-overrides.ts} +0 -0
  172. /package/src/pantheon/{v2-native-decisions.ts → native-decisions.ts} +0 -0
  173. /package/src/plugins/tui/src/{opencode-v2.d.ts → opencode.d.ts} +0 -0
@@ -17,17 +17,17 @@
17
17
  * the record itself; no admission decision is changed.
18
18
  */
19
19
 
20
- import {
21
- classifyLocalDecisionComplexity,
22
- type LocalDecisionComplexityDimensions,
23
- type LocalDecisionGateStatus,
24
- } from '../local-decision-router.ts'
25
20
  import {
26
21
  observeShadow,
27
22
  type ShadowDecision,
28
23
  type ShadowRecord,
29
24
  type ShadowSink,
30
- } from '../v2-decision-shadow.ts'
25
+ } from '../decision-shadow.ts'
26
+ import {
27
+ classifyLocalDecisionComplexity,
28
+ type LocalDecisionComplexityDimensions,
29
+ type LocalDecisionGateStatus,
30
+ } from '../local-decision-router.ts'
31
31
 
32
32
  export type ComplexityLabel = 'low' | 'medium' | 'high' | 'abstain'
33
33
  export type ComplexityLevel = 1 | 2 | 3
@@ -14,13 +14,13 @@
14
14
  * source — is rethrown into admission.
15
15
  */
16
16
 
17
- import { type RankFailure, rankCandidates } from '../v2-decision-rank.ts'
17
+ import { type RankFailure, rankCandidates } from '../decision-rank.ts'
18
18
  import {
19
19
  observeShadow,
20
20
  type ShadowDecision,
21
21
  type ShadowRecord,
22
22
  type ShadowSink,
23
- } from '../v2-decision-shadow.ts'
23
+ } from '../decision-shadow.ts'
24
24
 
25
25
  export type MemorySource = 'candidates' | 'none'
26
26
 
@@ -25,13 +25,13 @@ import {
25
25
  type ShadowDecision,
26
26
  type ShadowRecord,
27
27
  type ShadowSink,
28
- } from '../v2-decision-shadow.ts'
28
+ } from '../decision-shadow.ts'
29
29
  import {
30
30
  resolveVerify,
31
31
  type VerifyOutcome,
32
32
  type VerifyRequirement,
33
33
  type VerifyVerdict,
34
- } from '../v2-decision-verify.ts'
34
+ } from '../decision-verify.ts'
35
35
 
36
36
  const TOKEN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/
37
37
 
@@ -15,14 +15,14 @@
15
15
  * that a council ran. It consumes candidates a caller already has.
16
16
  */
17
17
 
18
- import { evaluateAskAnswer, type ScoreQuestion, validateAsk } from '../v2-decision-contracts.ts'
19
- import { rankCandidates } from '../v2-decision-rank.ts'
18
+ import { evaluateAskAnswer, type ScoreQuestion, validateAsk } from '../decision-contracts.ts'
19
+ import { rankCandidates } from '../decision-rank.ts'
20
20
  import {
21
21
  observeShadow,
22
22
  type ShadowDecision,
23
23
  type ShadowRecord,
24
24
  type ShadowSink,
25
- } from '../v2-decision-shadow.ts'
25
+ } from '../decision-shadow.ts'
26
26
 
27
27
  /** Ordinal levels of the council score question (2..10 is the contract range). */
28
28
  export const COUNCIL_SCORE_LEVELS = 5
@@ -5,7 +5,7 @@
5
5
  * PLAN §5.1 branch 1 was selected by measurement (PROBE-D §7): the channel
6
6
  * covers child sessions and background work, so this adapter is built on
7
7
  * `session.execution.succeeded`. It consumes through the 0b contract
8
- * (`v2-decision-events.ts`, PLAN §5.2) and reads only `data.sessionID`; the
8
+ * (`decision-events.ts`, PLAN §5.2) and reads only `data.sessionID`; the
9
9
  * unmetered `properties` field is never read.
10
10
  *
11
11
  * ## The counter is per execution, not per turn (PROBE-D §4.3)
@@ -42,7 +42,7 @@
42
42
  *
43
43
  * ## No effect
44
44
  *
45
- * The flag is OFF by default (`PANTHEON_V2_P7_LOOP`), so the plugin wiring is
45
+ * The flag is OFF by default (`PANTHEON_P7_LOOP`), so the plugin wiring is
46
46
  * inert. Even when enabled, this adapter only observes and records: the shadow
47
47
  * record says `effect: 'none'`, and activation is Phase 4b, not this module.
48
48
  * `execute.before` remains the only hard barrier.
@@ -66,11 +66,11 @@ import {
66
66
  type EventConsumptionSummary,
67
67
  P7_TURN_END_EVENT_TYPE,
68
68
  readEventSessionID,
69
- } from '../v2-decision-events.ts'
70
- import { observeShadow, type ShadowRecord, type ShadowSink } from '../v2-decision-shadow.ts'
69
+ } from '../decision-events.ts'
70
+ import { observeShadow, type ShadowRecord, type ShadowSink } from '../decision-shadow.ts'
71
71
 
72
72
  /** On/off switch read by the plugin wiring. Any other value means off. */
73
- export const P7_LOOP_FLAG_ENV = 'PANTHEON_V2_P7_LOOP'
73
+ export const P7_LOOP_FLAG_ENV = 'PANTHEON_P7_LOOP'
74
74
 
75
75
  /** Execution counts at which the ordinal loop-pressure score rises. */
76
76
  export const P7_LOOP_SCORE_THRESHOLDS = Object.freeze([2, 4] as const)
@@ -48,7 +48,7 @@
48
48
  * barrier: a `throw` there denies and skips permission evaluation, while a
49
49
  * `throw` here does not deny at all (PROBE-F §3.7).
50
50
  *
51
- * Off by default: `PANTHEON_V2_P8_GUARDRAIL` is absent in a default install and
51
+ * Off by default: `PANTHEON_P8_GUARDRAIL` is absent in a default install and
52
52
  * absence means disabled, so this phase ships no behavioural change. Evaluation
53
53
  * is synchronous with no I/O (it cannot delay admission), and every failure —
54
54
  * unreadable payload, unrecognized baseline, a host event that refuses the
@@ -89,7 +89,7 @@
89
89
  */
90
90
 
91
91
  /** On/off switch read by the plugin wiring. Any other value means off. */
92
- export const P8_GUARDRAIL_FLAG_ENV = 'PANTHEON_V2_P8_GUARDRAIL'
92
+ export const P8_GUARDRAIL_FLAG_ENV = 'PANTHEON_P8_GUARDRAIL'
93
93
 
94
94
  /** Permissiveness order. A decision may only move down this scale. */
95
95
  export const P8_EFFECT_RANK = Object.freeze({ deny: 0, ask: 1, allow: 2 } as const)
@@ -36,13 +36,13 @@
36
36
  * `effect: 'none'`.
37
37
  */
38
38
 
39
- import { rankCandidates } from '../v2-decision-rank.ts'
39
+ import { rankCandidates } from '../decision-rank.ts'
40
40
  import {
41
41
  observeShadow,
42
42
  type ShadowDecision,
43
43
  type ShadowRecord,
44
44
  type ShadowSink,
45
- } from '../v2-decision-shadow.ts'
45
+ } from '../decision-shadow.ts'
46
46
 
47
47
  /** Score thresholds that raise priority to level 2 and level 3. */
48
48
  export const COMPACTION_PRIORITY_THRESHOLDS = Object.freeze([0.5, 0.75] as const)
@@ -4,15 +4,15 @@
4
4
  * Each entry carries its domain surface, host surface and tool-vs-hook side,
5
5
  * status, evidence ids, premise ids, blocking condition, event shape where the
6
6
  * point is event-driven, and notes. Resource ids are not stored here: they are
7
- * derived from these fields by `v2-decision-resource-ids.ts`.
7
+ * derived from these fields by `decision-resource-ids.ts`.
8
8
  *
9
9
  * Data only: the status rules, premise register and audit live in
10
- * `v2-decision-registry.ts`. Frozen at module load, because an adapter that
10
+ * `decision-registry.ts`. Frozen at module load, because an adapter that
11
11
  * could rewrite a status could turn a premise into an apparent measurement.
12
12
  *
13
13
  * `mode` declares the mode a point would run in, never a production call site:
14
14
  * `wired` records whether the shipped plugin constructs the adapter, and the
15
- * source-derived audit in `tests/pantheon/v2-decision-wiring.test.ts` fails when
15
+ * source-derived audit in `tests/pantheon/decision-wiring.test.ts` fails when
16
16
  * the flag and the production import graph disagree. P1 and P2 are constructed
17
17
  * at the prompt hook, P3 at `tool.invoke` (its declared surface and the only one
18
18
  * carrying `complexity`/`gateStatus`), P7 on the event channel, P8 on
@@ -22,7 +22,7 @@
22
22
  * outside the harness and the tests, and their `wired` stays `false`.
23
23
  */
24
24
 
25
- import type { DecisionPoint } from './v2-decision-registry.ts'
25
+ import type { DecisionPoint } from './decision-registry.ts'
26
26
 
27
27
  const SHADOW = 'shadow' as const
28
28
 
@@ -157,7 +157,7 @@ export const DECISION_POINT_REGISTRY: readonly DecisionPoint[] = Object.freeze([
157
157
  'a background image job was never exercised (PROBE-D §5.4)',
158
158
  ],
159
159
  notes:
160
- 'Branch 1 of PLAN §5.1 was selected by PROBE-D §7 (measured facts summarized in docs/reference/local-decision-router.md): `session.execution.succeeded` is delivered for child sessions with the child copy of `data.sessionID` — 13/13 children (6 foreground, 5 background, 2 with compaction) — and for background work (PROBE-D §4.1–§4.2). The event does NOT carry `parentID` (`dataKeys=["sessionID"]`, 44/44): attribution comes from `session.created.parentID` or `ctx.session.get`, never from the succeeded event (PROBE-D §4.1). Multiplicity is per EXECUTION, not per turn: 44 `started` = 44 `succeeded` for 46 inbox items; manual compaction adds +1 (C2 = 3), automatic compaction +0 (C1 = 1), a late background notification +1 on the parent (B3/B4/B5 = 2 vs B1/B2 = 1) (PROBE-D §4.3). The adapter implements that execution counter (`v2-decision-points/p7-loop.ts`) behind `PANTHEON_V2_P7_LOOP`, OFF by default; cutover is Phase 4b. Effect stays unmeasured (C6 is closed by PROBE-E; no effect of P7 itself was observed): the adapter records `effect: none` and must never be described as working enforcement while the flag is off. The 12-execution cap (`P7_LOOP_MAX_EXECUTIONS`) is ADVISORY: `reset()` is caller-supplied, no measured user-input surface in the probed host provides a signal to call it, and the streak is not claimed to reset on any event. PROBE-D retires the PRE-01/PM-12 blocking premises; the premise register records PM-12 as closed by that measurement.',
160
+ 'Branch 1 of PLAN §5.1 was selected by PROBE-D §7 (measured facts summarized in docs/reference/local-decision-router.md): `session.execution.succeeded` is delivered for child sessions with the child copy of `data.sessionID` — 13/13 children (6 foreground, 5 background, 2 with compaction) — and for background work (PROBE-D §4.1–§4.2). The event does NOT carry `parentID` (`dataKeys=["sessionID"]`, 44/44): attribution comes from `session.created.parentID` or `ctx.session.get`, never from the succeeded event (PROBE-D §4.1). Multiplicity is per EXECUTION, not per turn: 44 `started` = 44 `succeeded` for 46 inbox items; manual compaction adds +1 (C2 = 3), automatic compaction +0 (C1 = 1), a late background notification +1 on the parent (B3/B4/B5 = 2 vs B1/B2 = 1) (PROBE-D §4.3). The adapter implements that execution counter (`decision-points/p7-loop.ts`) behind `PANTHEON_P7_LOOP`, OFF by default; cutover is Phase 4b. Effect stays unmeasured (C6 is closed by PROBE-E; no effect of P7 itself was observed): the adapter records `effect: none` and must never be described as working enforcement while the flag is off. The 12-execution cap (`P7_LOOP_MAX_EXECUTIONS`) is ADVISORY: `reset()` is caller-supplied, no measured user-input surface in the probed host provides a signal to call it, and the streak is not claimed to reset on any event. PROBE-D retires the PRE-01/PM-12 blocking premises; the premise register records PM-12 as closed by that measurement.',
161
161
  }),
162
162
  Object.freeze<DecisionPoint>({
163
163
  id: 'P8',
@@ -17,9 +17,9 @@ import {
17
17
  type DecisionPointId,
18
18
  type DecisionPointMode,
19
19
  type DecisionPointStatus,
20
- } from './v2-decision-registry.ts'
20
+ } from './decision-registry.ts'
21
21
 
22
- export const DECISION_POLICY_VERSION = 'v2-decision-policy/1'
22
+ export const DECISION_POLICY_VERSION = 'decision-policy/1'
23
23
  export const DEFAULT_DECISIONS_PER_TURN = 32
24
24
 
25
25
  export type PolicyMode = 'shadow' | 'active'
@@ -24,10 +24,10 @@
24
24
  * refusal from a surface that cannot feed them.
25
25
  */
26
26
 
27
+ import { evaluateAgentPoint } from './decision-points/p1-agent.ts'
28
+ import { evaluateSkillPoint } from './decision-points/p2-skill.ts'
29
+ import type { ShadowRecord, ShadowSink } from './decision-shadow.ts'
27
30
  import type { SkillsSource } from './local-decision-prompt.ts'
28
- import { evaluateAgentPoint } from './v2-decision-points/p1-agent.ts'
29
- import { evaluateSkillPoint } from './v2-decision-points/p2-skill.ts'
30
- import type { ShadowRecord, ShadowSink } from './v2-decision-shadow.ts'
31
31
 
32
32
  /** Registry ids wired at the prompt hook by this module. */
33
33
  export const PROMPT_SURFACE_POINT_IDS = Object.freeze(['P1', 'P2'] as const)
@@ -7,7 +7,7 @@
7
7
  * answered for prompt/skill/tool mutations in PROBE-E — and no point's own
8
8
  * effect has been measured. `premise` means the surface or catalog
9
9
  * this point needs was not measured; the premise is registered by id in
10
- * `v2-decision-premises.ts`, and its canonical text lives in `STATUS.md` § Premissas. `deferred` means the
10
+ * `decision-premises.ts`, and its canonical text lives in `STATUS.md` § Premissas. `deferred` means the
11
11
  * final design is suspended by an open condition and no effect is authorised.
12
12
  * `advisory` means the surface was measured, the specified effect was measured
13
13
  * *unreachable*, and the point therefore only records an observation: it
@@ -40,19 +40,16 @@
40
40
  * ## Resource ids (D13)
41
41
  *
42
42
  * Resource ids are not stored per point: they are derived by
43
- * `v2-decision-resource-ids.ts` from the point id, the domain surface, the
43
+ * `decision-resource-ids.ts` from the point id, the domain surface, the
44
44
  * premises and the evidence ids. The audit rejects a collision between two
45
45
  * distinct ids, and the ids are always namespaced under
46
46
  * `pantheon://v2-decision/`.
47
47
  */
48
48
 
49
- import type { AskMode } from './v2-decision-contracts.ts'
50
- import { DECISION_POINT_REGISTRY } from './v2-decision-points.ts'
51
- import { PREMISE_IDS, PREMISE_REGISTER, type PremiseEntry } from './v2-decision-premises.ts'
52
- import {
53
- decisionResourceRefs,
54
- findDecisionResourceIdCollisions,
55
- } from './v2-decision-resource-ids.ts'
49
+ import type { AskMode } from './decision-contracts.ts'
50
+ import { DECISION_POINT_REGISTRY } from './decision-points.ts'
51
+ import { PREMISE_IDS, PREMISE_REGISTER, type PremiseEntry } from './decision-premises.ts'
52
+ import { decisionResourceRefs, findDecisionResourceIdCollisions } from './decision-resource-ids.ts'
56
53
 
57
54
  export const DECISION_POINT_IDS = [
58
55
  'P1',
@@ -170,8 +167,8 @@ export interface DecisionPoint {
170
167
  * Whether the shipped plugin actually constructs this point's adapter.
171
168
  *
172
169
  * This is a claim about the source, not about a probe: the audit in
173
- * `tests/pantheon/v2-decision-wiring.test.ts` derives the answer from the
174
- * production import graph rooted at `src/plugin-v2.ts` and fails when this
170
+ * `tests/pantheon/decision-wiring.test.ts` derives the answer from the
171
+ * production import graph rooted at `src/plugin.ts` and fails when this
175
172
  * flag disagrees. It also derives *where* the handler is constructed and
176
173
  * fails when a wired point's construction site is not its declared
177
174
  * `hostSurface` — a handler called from the wrong hook is not wiring. It is
@@ -199,12 +196,12 @@ export interface DecisionPoint {
199
196
  readonly notes: string
200
197
  }
201
198
 
202
- export { DECISION_POINT_REGISTRY } from './v2-decision-points.ts'
199
+ export { DECISION_POINT_REGISTRY } from './decision-points.ts'
203
200
  export {
204
201
  PREMISE_IDS,
205
202
  PREMISE_REGISTER,
206
203
  type PremiseEntry,
207
- } from './v2-decision-premises.ts'
204
+ } from './decision-premises.ts'
208
205
 
209
206
  const EVIDENCE_ID = /^(?:F-\d{2}|I-\d{2})$/
210
207
  const MEASURED_EVIDENCE_ID = /^F-\d{2}$/
@@ -17,7 +17,7 @@
17
17
  * why a collision check is required rather than assumed.
18
18
  */
19
19
 
20
- import type { DecisionPoint, DecisionPointId, DecisionSurface } from './v2-decision-registry.ts'
20
+ import type { DecisionPoint, DecisionPointId, DecisionSurface } from './decision-registry.ts'
21
21
 
22
22
  /** Scheme shared by every decision-layer resource id. */
23
23
  export const DECISION_RESOURCE_SCHEME = 'pantheon://v2-decision'
@@ -16,7 +16,7 @@
16
16
  * it; the sink cannot change the outcome because there is no outcome to change.
17
17
  */
18
18
 
19
- import type { DecisionPointId } from './v2-decision-registry.ts'
19
+ import type { DecisionPointId } from './decision-registry.ts'
20
20
 
21
21
  const TOKEN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/
22
22
  const UNCLONABLE = Symbol('unclonable-payload')
@@ -20,7 +20,7 @@
20
20
  * can assert exactly what would be emitted.
21
21
  */
22
22
 
23
- import type { DecisionPointId } from './v2-decision-registry.ts'
23
+ import type { DecisionPointId } from './decision-registry.ts'
24
24
 
25
25
  export const TELEMETRY_SCHEMA_VERSION = 1
26
26
  export const TELEMETRY_FIELDS = [
@@ -11,8 +11,8 @@
11
11
  * 3. read-enhancer — a `read` result gains per-line hashline tags
12
12
  * (`N#TAG|content`) so `hashline_edit` refs resolve.
13
13
  *
14
- * On a V2-only install (`opencode.json` `plugins` declares only `plugin-v2`),
15
- * `src/plugin.ts` is NOT loaded, so that chain does not exist. `plugin-v2.ts`
14
+ * On a V2-only install (`opencode.json` `plugins` declares only `plugin`),
15
+ * `src/plugin.ts` is NOT loaded, so that chain does not exist. `plugin.ts`
16
16
  * registered an `execute.after` hook but with an empty body, so the chain was
17
17
  * dead on V2. This module rebuilds it against the REAL V2 event shape.
18
18
  *
@@ -30,7 +30,7 @@
30
30
  * Fail-safe: every path is wrapped so an unexpected shape can never break the
31
31
  * tool result the host is about to surface.
32
32
  *
33
- * @module pantheon/v2-execute-after
33
+ * @module pantheon/execute-after
34
34
  */
35
35
 
36
36
  import {
@@ -288,7 +288,7 @@ export function createV2ExecuteAfter(
288
288
 
289
289
  /**
290
290
  * Resolve a sandbox config from a V2 plugin's `ctx.options.context_sandbox`.
291
- * Exposed so `plugin-v2.ts` resolves it the SAME way V1's config hook does,
291
+ * Exposed so `plugin.ts` resolves it the SAME way V1's config hook does,
292
292
  * rather than silently constructing defaults.
293
293
  */
294
294
  export function resolveV2SandboxConfig(options: unknown): ContextSandboxConfig {
@@ -32,6 +32,13 @@ export interface Goal {
32
32
 
33
33
  const DEFAULT_GOAL_DIR = '.pantheon/goals'
34
34
 
35
+ /** Hard-coded runtime defaults; routing.yml is documentation-only. */
36
+ export const GOAL_LOOP_DEFAULTS = {
37
+ enabled: false,
38
+ cooldownMs: 5000,
39
+ maxContinuations: 25,
40
+ } as const
41
+
35
42
  /**
36
43
  * File-based goal persistence. `save` writes atomically (tmp + rename);
37
44
  * `load` returns undefined when no goal exists yet.
@@ -20,10 +20,10 @@
20
20
  * Fail-closed parity: an in-process scanner has no "missing script" failure,
21
21
  * but an unexpected internal error still refuses to produce a trustworthy
22
22
  * verdict — it returns exit-code 1 WITHOUT the `[SECRET SCAN]` marker, which
23
- * the existing classifier (plugin-v2 `evaluateSecretScanResult`) reads as
23
+ * the existing classifier (plugin `evaluateSecretScanResult`) reads as
24
24
  * fail-closed, exactly as a broken child path always did.
25
25
  *
26
- * @module pantheon/v2-hook-engine
26
+ * @module pantheon/hook-engine
27
27
  */
28
28
  import { appendFileSync, mkdirSync } from 'node:fs'
29
29
  import { join } from 'node:path'
@@ -39,7 +39,7 @@ const BIFROST_HEADER_NAME = `${'x'}${'-bf-'}${'vk'}`
39
39
 
40
40
  /**
41
41
  * High-confidence token formats. MIRRORS `HIGH_CONFIDENCE_PATTERNS` in
42
- * scripts/hooks/scan-secrets.sh and `SECRET_MASK_RE` in src/plugin-v2.ts
42
+ * scripts/hooks/scan-secrets.sh and `SECRET_MASK_RE` in src/plugin.ts
43
43
  * (V2 log masking); the drift is asserted by tests.
44
44
  */
45
45
  const HIGH_CONFIDENCE_RES: readonly RegExp[] = Object.freeze([
@@ -23,6 +23,7 @@
23
23
  * minted. A failed or unreconciled call is a refusal, never a retry.
24
24
  */
25
25
  import { readUserDecisionRouterConfig } from '../../scripts/install/decision-router-config.mjs'
26
+ import { observeShadow, type ShadowSink } from './decision-shadow.ts'
26
27
  import {
27
28
  checkJevEnvelope,
28
29
  consumeJevDecisionResult,
@@ -69,9 +70,8 @@ import {
69
70
  buildDecisionEgressRequest,
70
71
  } from './local-decision-egress-gate.ts'
71
72
  import { verifyNativeUsageForReservation } from './local-decision-usage-evidence.internal.ts'
72
- import { observeShadow, type ShadowSink } from './v2-decision-shadow.ts'
73
- import type { NativeDecisionRequest, ResolvedNativeDecisionRoute } from './v2-native-decisions.ts'
74
- import type { V2ToolDef } from './v2-tools.ts'
73
+ import type { NativeDecisionRequest, ResolvedNativeDecisionRoute } from './native-decisions.ts'
74
+ import type { V2ToolDef } from './tools.ts'
75
75
 
76
76
  export interface V2JevDecisionRuntime {
77
77
  /**
@@ -2,7 +2,7 @@
2
2
  * Native Jev Decisions selection, preparation, and consumption.
3
3
  *
4
4
  * This is the production half of the offline scaffold in
5
- * `v2-native-decisions.ts`: it selects a decision-capable model route from the
5
+ * `native-decisions.ts`: it selects a decision-capable model route from the
6
6
  * user-level decision-router configuration, prepares a bounded typed request,
7
7
  * and consumes a host response as non-authoritative advice. It performs no
8
8
  * I/O of its own: no fetch, no credentials, no transport — egress happens only
@@ -22,13 +22,13 @@ import {
22
22
  DECISION_PROVIDER_ADAPTERS,
23
23
  type DecisionProviderId,
24
24
  } from './local-decision-provider-matrix.ts'
25
- import { PANTHEON_AGENT_CATALOG, PANTHEON_SKILL_CATALOG } from './pantheon-decision-catalog.ts'
26
25
  import {
27
26
  findRouteKind,
28
27
  NATIVE_DECISION_MAX_PROMPT_LENGTH,
29
28
  type NativeDecisionRequest,
30
29
  type ResolvedNativeDecisionRoute,
31
- } from './v2-native-decisions.ts'
30
+ } from './native-decisions.ts'
31
+ import { PANTHEON_AGENT_CATALOG, PANTHEON_SKILL_CATALOG } from './pantheon-decision-catalog.ts'
32
32
 
33
33
  /** Config-level providers that have a native host Decisions route. */
34
34
  export type NativeJevProviderId = Extract<
@@ -184,7 +184,10 @@ export function resolveNativeJevRoute(
184
184
 
185
185
  export const JEV_DECISION_MAX_QUESTIONS = 4
186
186
  /** Wide enough for the full skill catalog (20) plus `none` in preset mode. */
187
- export const JEV_DECISION_MAX_CHOICES = 24
187
+ // Sized for the full catalog + host-installed skills + `none`, with headroom:
188
+ // the catalog grows as skills land, and host skills always ride (field report
189
+ // beta.15). The merge reserves host slots before truncating the catalog.
190
+ export const JEV_DECISION_MAX_CHOICES = 32
188
191
  export const JEV_DECISION_MIN_CHOICES = 2
189
192
  export const JEV_DECISION_MAX_SCORE_LEVELS = 10
190
193
  export const JEV_DECISION_MIN_SCORE_LEVELS = 2
@@ -518,9 +521,12 @@ export function mergeHostSkills(
518
521
  hostSkills: readonly JevHostSkill[] | undefined,
519
522
  descriptions: Map<string, string | undefined>,
520
523
  ): Array<{ value: string; description?: string }> {
521
- const merged = [...pool]
522
- const seen = new Set(merged)
523
524
  const bound = JEV_DECISION_MAX_CHOICES - 1
525
+ // Host skills always ride (field report beta.15): reserve one slot per
526
+ // host-installed skill so a full-catalog fallback can never evict them.
527
+ const catalogBound = hostSkills === undefined ? bound : Math.max(0, bound - hostSkills.length)
528
+ const merged = [...pool].slice(0, catalogBound)
529
+ const seen = new Set(merged)
524
530
  if (hostSkills !== undefined) {
525
531
  for (const skill of hostSkills) {
526
532
  if (merged.length >= bound) break
@@ -17,7 +17,7 @@
17
17
  * decision is computed and recorded; applying it is the separately-reviewed
18
18
  * activation step. The mechanism — set the per-agent override for the delegate
19
19
  * BEFORE dispatch through the existing model-override mechanism
20
- * (`v2-model-overrides.applyV2ModelOverride`), restore the previous model
20
+ * (`model-overrides.applyV2ModelOverride`), restore the previous model
21
21
  * after — is implemented in {@link applyEscalationOverride} and
22
22
  * {@link clearEscalationOverride}, and the shadow observer has NO path to
23
23
  * them: its options carry no agent draft and its body never calls them. The
@@ -75,13 +75,13 @@
75
75
  */
76
76
 
77
77
  import { createHash } from 'node:crypto'
78
+ import { observeShadow, type ShadowSink } from './decision-shadow.ts'
79
+ import { PANTHEON_AGENTS } from './delegation-policy.ts'
78
80
  import { type GatedNativeJevRuntime, runGatedNativeJevCall } from './jev-decision-tool.ts'
79
81
  import { consumeJevDecisionResult } from './jev-decisions.ts'
80
82
  import { mapGateFailureToSkipReason } from './jev-risk-gate.ts'
81
- import { observeShadow, type ShadowSink } from './v2-decision-shadow.ts'
82
- import { PANTHEON_AGENTS } from './v2-delegation-enforce.ts'
83
- import { applyV2ModelOverride, readV2ModelConfiguration } from './v2-model-overrides.ts'
84
- import type { NativeDecisionRequest } from './v2-native-decisions.ts'
83
+ import { applyV2ModelOverride, readV2ModelConfiguration } from './model-overrides.ts'
84
+ import type { NativeDecisionRequest } from './native-decisions.ts'
85
85
 
86
86
  /** On/off switch read by the plugin wiring. Any other value means off. */
87
87
  export const J3_ESCALATION_FLAG_ENV = 'PANTHEON_J3_ESCALATION'
@@ -442,7 +442,7 @@ export interface EscalationOverrideHandle {
442
442
  /**
443
443
  * The ACTIVATION mechanism — never called by the shadow observer. Rides the
444
444
  * existing per-agent model-override mechanism
445
- * (`v2-model-overrides.applyV2ModelOverride`): for a `cheap` verdict, sets the
445
+ * (`model-overrides.applyV2ModelOverride`): for a `cheap` verdict, sets the
446
446
  * delegate's model to {@link J3_ESCALATION_CHEAP_MODEL} on the agent draft
447
447
  * BEFORE dispatch, exactly the way a project preset or `pantheon_model` does,
448
448
  * and returns a handle carrying the previous model. Any other verdict — and
@@ -54,9 +54,9 @@
54
54
  * @module jev-quality-score
55
55
  */
56
56
 
57
+ import { PANTHEON_AGENTS } from './delegation-policy.ts'
57
58
  import { consumeJevDecisionResult } from './jev-decisions.ts'
58
- import { PANTHEON_AGENTS } from './v2-delegation-enforce.ts'
59
- import type { NativeDecisionRequest, ResolvedNativeDecisionRoute } from './v2-native-decisions.ts'
59
+ import type { NativeDecisionRequest, ResolvedNativeDecisionRoute } from './native-decisions.ts'
60
60
 
61
61
  /** Telemetry point id for the output-quality review (J-series: Jev uplift). */
62
62
  export const J4_QUALITY_SCORE_POINT = 'J4'
@@ -48,8 +48,8 @@
48
48
  */
49
49
 
50
50
  import { consumeJevDecisionResult, JEV_DECISION_MAX_QUESTIONS } from './jev-decisions.ts'
51
- import type { NativeDecisionRequest, ResolvedNativeDecisionRoute } from './v2-native-decisions.ts'
52
- import { NATIVE_DECISION_MAX_PROMPT_LENGTH } from './v2-native-decisions.ts'
51
+ import type { NativeDecisionRequest, ResolvedNativeDecisionRoute } from './native-decisions.ts'
52
+ import { NATIVE_DECISION_MAX_PROMPT_LENGTH } from './native-decisions.ts'
53
53
 
54
54
  // ─── Bounds ──────────────────────────────────────────────────────────────
55
55
 
@@ -47,15 +47,15 @@
47
47
  */
48
48
 
49
49
  import { createHash } from 'node:crypto'
50
+ import { observeShadow, type ShadowSink } from './decision-shadow.ts'
51
+ import { secretScanApplies } from './hook-engine.ts'
50
52
  import {
51
53
  type GatedNativeJevFailure,
52
54
  type GatedNativeJevRuntime,
53
55
  runGatedNativeJevCall,
54
56
  } from './jev-decision-tool.ts'
55
57
  import { consumeJevDecisionResult } from './jev-decisions.ts'
56
- import { observeShadow, type ShadowSink } from './v2-decision-shadow.ts'
57
- import { secretScanApplies } from './v2-hook-engine.ts'
58
- import type { NativeDecisionRequest } from './v2-native-decisions.ts'
58
+ import type { NativeDecisionRequest } from './native-decisions.ts'
59
59
 
60
60
  /** On/off switch read by the plugin wiring. Any other value means off. */
61
61
  export const J1_RISK_GATE_FLAG_ENV = 'PANTHEON_J1_RISK_SCORE'
@@ -181,7 +181,7 @@ export function classifyRiskGateScope(tool: unknown): RiskGateScope {
181
181
  /**
182
182
  * Whether one tool call is a J1 observation target: a write/execute scope AND
183
183
  * the secret scan's own exfil-capable gate. The second condition reuses the
184
- * scan's read-only denylist (`v2-hook-engine.secretScanApplies`) so a tool the
184
+ * scan's read-only denylist (`hook-engine.secretScanApplies`) so a tool the
185
185
  * scan never inspects can never be observed either — one list, two consumers.
186
186
  */
187
187
  export function isRiskGateTarget(tool: unknown): tool is string {
@@ -1,7 +1,7 @@
1
+ import { PANTHEON_AGENTS } from './delegation-policy.ts'
1
2
  import type { LocalDecisionPolicy } from './local-orchestration.ts'
2
3
  import { PANTHEON_AGENT_CATALOG, PANTHEON_AGENT_IDS } from './pantheon-decision-catalog.ts'
3
4
  import { isAgentAllowed } from './permission-globs.ts'
4
- import { PANTHEON_AGENTS } from './v2-delegation-enforce.ts'
5
5
 
6
6
  export type AgentRecommendationReason =
7
7
  | 'RECOMMENDED'
@@ -1,4 +1,4 @@
1
- import { PANTHEON_AGENTS } from './v2-delegation-enforce.ts'
1
+ import { PANTHEON_AGENTS } from './delegation-policy.ts'
2
2
 
3
3
  /** Explicit opt-in for the local advisory API. Unset and any value except `1` disable it. */
4
4
  export const LOCAL_DECISION_ROUTER_ENV = 'PANTHEON_LOCAL_DECISION_ROUTER'
@@ -1,4 +1,6 @@
1
1
  import { type ToolContext, tool } from '@opencode-ai/plugin'
2
+ import { evaluateComplexityPoint } from './decision-points/p3-complexity.ts'
3
+ import type { ShadowSink } from './decision-shadow.ts'
2
4
  import {
3
5
  LOCAL_DECISION_COMPLEXITY_DIMENSIONS,
4
6
  type LocalDecisionGateStatus,
@@ -8,8 +10,6 @@ import {
8
10
  loadLocalDecisionPolicy,
9
11
  recommendLocalOrchestration,
10
12
  } from './local-orchestration.ts'
11
- import { evaluateComplexityPoint } from './v2-decision-points/p3-complexity.ts'
12
- import type { ShadowSink } from './v2-decision-shadow.ts'
13
13
 
14
14
  const TOOL_DESCRIPTION =
15
15
  'Zeus-only local advisory selector. Use selectively only when specialist routing is genuinely ' +
@@ -1,5 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises'
2
2
  import { load } from 'js-yaml'
3
+ import { PANTHEON_AGENTS } from './delegation-policy.ts'
3
4
  import {
4
5
  classifyLocalDecisionComplexity,
5
6
  LOCAL_DECISION_COMPLEXITY_DIMENSIONS,
@@ -8,7 +9,6 @@ import {
8
9
  type LocalDecisionGateStatus,
9
10
  } from './local-decision-router.ts'
10
11
  import { isAgentAllowed, type PermissionTaskConfig } from './permission-globs.ts'
11
- import { PANTHEON_AGENTS } from './v2-delegation-enforce.ts'
12
12
 
13
13
  export interface LocalDecisionAgentPolicy {
14
14
  canDelegateTo: readonly string[]
@@ -24,6 +24,7 @@ import { homedir } from 'node:os'
24
24
  import { basename, dirname, join, resolve } from 'node:path'
25
25
  import { z } from 'zod'
26
26
  import { KNOWN_AGENTS } from './model-agents.ts'
27
+ import { readV2ModelConfiguration } from './model-overrides.ts'
27
28
  import {
28
29
  capabilityEntry,
29
30
  hasVision,
@@ -32,7 +33,6 @@ import {
32
33
  resolveActivePreset,
33
34
  } from './presets.mjs'
34
35
  import type { ToolContextLike } from './tool-context.ts'
35
- import { readV2ModelConfiguration } from './v2-model-overrides.ts'
36
36
 
37
37
  export type { KnownAgent } from './model-agents.ts'
38
38
  export { KNOWN_AGENTS } from './model-agents.ts'