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
@@ -0,0 +1,304 @@
1
+ /**
2
+ * P9 (memory at compaction) shadow adapter — measured carrier only.
3
+ *
4
+ * Measured on the OpenCode 2.2.5 host (PROBE-A, §5.4):
5
+ *
6
+ * - F-01: the compaction payload carries a **top-level `sessionID`** string.
7
+ * The nested `session` object is ABSENT; reading a nested session id would
8
+ * key the decision by a carrier this host never sends. This adapter reads
9
+ * `payload.sessionID` and nothing else as the session carrier.
10
+ * - F-02: text crosses in `payload.system` as an **array** of parts. Injection
11
+ * is a pushed part; the `system(string)` branch is dead on 2.2.5 and is
12
+ * never written here. A string carrier is a shape drift and is refused.
13
+ * - F-03: the summary is persisted as a `compaction` message and re-injected
14
+ * as a user checkpoint next turn, correlated by that message id. Correlation
15
+ * therefore comes from the caller, never from the payload.
16
+ * - F-04: manual and automatic compaction share the carrier; the automatic
17
+ * path simply carries fewer `messages`.
18
+ *
19
+ * Fail-closed: a missing or unusable top-level session id produces **no
20
+ * decision at all** — no retention, no priority — because there is no key to
21
+ * attribute it to. The same holds for an unusable `system` carrier and for an
22
+ * absent memory source: nothing is guessed from a partial payload.
23
+ *
24
+ * Scope, stated so it cannot be over-read: the carrier is measured on
25
+ * **top-level** sessions and on a **child** session. PROBE-G §3.1 spawned a real
26
+ * child session and compacted it 3/3: the hook fires there, the payload carries
27
+ * the child's `sessionID` at top level, and the shape is identical to the
28
+ * top-level one (same 7 keys, no nested `session`, `system` an array of 4 parts),
29
+ * so no child-specific branch is needed. `reason:"overflow"` remains UNKNOWN and
30
+ * is deliberately not designed for: PROBE-G §3.2 could not induce it in 6 error
31
+ * shapes — the host retried and completed, and the one failure-recovery
32
+ * compaction observed was persisted as `reason:"auto"`. The checkpoint
33
+ * summary/reinjection inside a child session was not exercised (PROBE-G §4.6),
34
+ * and the `messages` channel was never exercised (PM-05), so this adapter does
35
+ * not depend on it. Shadow: the decision is recorded and the record says
36
+ * `effect: 'none'`.
37
+ */
38
+
39
+ import { rankCandidates } from '../v2-decision-rank.ts'
40
+ import {
41
+ observeShadow,
42
+ type ShadowDecision,
43
+ type ShadowRecord,
44
+ type ShadowSink,
45
+ } from '../v2-decision-shadow.ts'
46
+
47
+ /** Score thresholds that raise priority to level 2 and level 3. */
48
+ export const COMPACTION_PRIORITY_THRESHOLDS = Object.freeze([0.5, 0.75] as const)
49
+
50
+ /**
51
+ * The adapter's own retention policy — declared, frozen and never measured.
52
+ *
53
+ * `retainAbove: 0` means a candidate with a non-positive rank score is not
54
+ * retained. Priority is `1 + thresholds met by the top retained score`, so the
55
+ * level rises with support and never falls when a candidate is added. This is
56
+ * a deterministic convention, not a claim about memory quality, and in shadow
57
+ * it changes nothing.
58
+ */
59
+ export const COMPACTION_RETENTION_POLICY = Object.freeze({
60
+ retainAbove: 0,
61
+ priorityThresholds: COMPACTION_PRIORITY_THRESHOLDS,
62
+ })
63
+
64
+ export interface CompactionMemoryDecision {
65
+ /** `noul`: 1 retain, 0 discard. */
66
+ readonly retain: 0 | 1
67
+ /** `score`: ordinal priority 1–3, or `null` when nothing is retained. */
68
+ readonly priority: 1 | 2 | 3 | null
69
+ /** Retained ids in rank order; empty on discard. */
70
+ readonly retainedIds: readonly string[]
71
+ }
72
+
73
+ export interface CompactionMemoryPointResult {
74
+ readonly record: ShadowRecord
75
+ /** Top-level session id (F-01), or `null` when it could not be read. */
76
+ readonly sessionID: string | null
77
+ /** The id this observation is keyed by — the top-level session id, never nested. */
78
+ readonly decisionKey: string | null
79
+ /** Number of `system` parts observed (F-02); `0` when the carrier was unusable. */
80
+ readonly systemPartCount: number
81
+ /** `null` when no decision could be stated (fail-closed). */
82
+ readonly memoryDecision: CompactionMemoryDecision | null
83
+ /** Caller-supplied `compaction` message id used to correlate the next turn (F-03). */
84
+ readonly compactionMessageID: string | null
85
+ /** Token explaining the decision; always present. */
86
+ readonly reason: string
87
+ }
88
+
89
+ /** A single-line identifier: a control character would break any record line. */
90
+ function hasControlCharacter(value: string): boolean {
91
+ for (const character of value) {
92
+ const code = character.codePointAt(0) ?? 0
93
+ if (code < 0x20 || code === 0x7f) return true
94
+ }
95
+ return false
96
+ }
97
+
98
+ interface Value<T> {
99
+ readonly ok: boolean
100
+ readonly value: T | null
101
+ readonly reason: string
102
+ }
103
+
104
+ function ok<T>(value: T): Value<T> {
105
+ return { ok: true, value, reason: '' }
106
+ }
107
+
108
+ function fail<T>(reason: string): Value<T> {
109
+ return { ok: false, value: null, reason }
110
+ }
111
+
112
+ function isRecord(value: unknown): value is Record<string, unknown> {
113
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
114
+ }
115
+
116
+ function isUsableString(value: unknown): value is string {
117
+ return typeof value === 'string' && value.trim().length > 0 && !hasControlCharacter(value)
118
+ }
119
+
120
+ /** Read the session carrier: top-level `sessionID` only (F-01). */
121
+ function readSessionID(payload: Record<string, unknown>): Value<string> {
122
+ const candidate = payload.sessionID
123
+ if (candidate === undefined || candidate === null) {
124
+ return fail('compaction.session.absent')
125
+ }
126
+ if (!isUsableString(candidate)) return fail('compaction.session.invalid')
127
+ return ok(candidate.trim())
128
+ }
129
+
130
+ /** Read the text carrier: an array of `{ type, text }` parts (F-02). */
131
+ function readSystem(payload: Record<string, unknown>): Value<number> {
132
+ const system = payload.system
133
+ if (system === undefined || system === null) return fail('compaction.system.absent')
134
+ if (!Array.isArray(system)) return fail('compaction.system.unsupported')
135
+ if (system.length === 0) return fail('compaction.system.empty')
136
+ for (const part of system) {
137
+ if (!isRecord(part) || typeof part.text !== 'string') {
138
+ return fail('compaction.system.invalid')
139
+ }
140
+ }
141
+ return ok(system.length)
142
+ }
143
+
144
+ /** Read the caller-supplied correlation id; a payload-carried id is not a source. */
145
+ function readCorrelation(input: Record<string, unknown>): string | null {
146
+ return isUsableString(input.compactionMessageID) ? input.compactionMessageID.trim() : null
147
+ }
148
+
149
+ interface MemoryAnalysis {
150
+ readonly decision: ShadowDecision
151
+ readonly sessionID: string | null
152
+ readonly systemPartCount: number
153
+ readonly memoryDecision: CompactionMemoryDecision | null
154
+ readonly compactionMessageID: string | null
155
+ }
156
+
157
+ function refusal(reason: string): MemoryAnalysis {
158
+ return {
159
+ decision: { decision: 'refusal', reason },
160
+ sessionID: null,
161
+ systemPartCount: 0,
162
+ memoryDecision: null,
163
+ compactionMessageID: null,
164
+ }
165
+ }
166
+
167
+ /** Apply the declared retention policy to a non-empty ranked candidate list. */
168
+ function applyPolicy(ranked: readonly { id: string; score: number }[]): {
169
+ decision: ShadowDecision
170
+ memoryDecision: CompactionMemoryDecision
171
+ } {
172
+ const retained = ranked.filter(
173
+ (candidate) => candidate.score > COMPACTION_RETENTION_POLICY.retainAbove,
174
+ )
175
+ const top = retained[0]
176
+ if (top === undefined) {
177
+ return {
178
+ decision: { decision: 'memory.discard', reason: 'compaction.memory.discarded' },
179
+ memoryDecision: { retain: 0, priority: null, retainedIds: [] },
180
+ }
181
+ }
182
+ const met = COMPACTION_PRIORITY_THRESHOLDS.filter((threshold) => top.score >= threshold).length
183
+ const priority = Math.min(3, 1 + met) as 1 | 2 | 3
184
+ return {
185
+ decision: { decision: 'memory.retain', reason: 'compaction.memory.retained' },
186
+ memoryDecision: {
187
+ retain: 1,
188
+ priority,
189
+ retainedIds: retained.map((candidate) => candidate.id),
190
+ },
191
+ }
192
+ }
193
+
194
+ function analyze(input: unknown): MemoryAnalysis {
195
+ if (!isRecord(input) || !isRecord(input.payload)) {
196
+ return refusal('compaction.payload.absent')
197
+ }
198
+ const payload = input.payload
199
+
200
+ const session = readSessionID(payload)
201
+ if (!session.ok || session.value === null) {
202
+ return refusal(session.reason || 'compaction.session.absent')
203
+ }
204
+ const sessionID = session.value
205
+
206
+ const correlation = readCorrelation(input)
207
+ const system = readSystem(payload)
208
+ if (!system.ok || system.value === null) {
209
+ return {
210
+ decision: { decision: 'refusal', reason: system.reason },
211
+ sessionID,
212
+ systemPartCount: 0,
213
+ memoryDecision: null,
214
+ compactionMessageID: correlation,
215
+ }
216
+ }
217
+
218
+ const candidates = input.candidates
219
+ if (candidates === undefined || candidates === null) {
220
+ return {
221
+ decision: { decision: 'refusal', reason: 'compaction.memory.source.absent' },
222
+ sessionID,
223
+ systemPartCount: system.value,
224
+ memoryDecision: null,
225
+ compactionMessageID: correlation,
226
+ }
227
+ }
228
+ if (!Array.isArray(candidates)) {
229
+ return {
230
+ decision: { decision: 'refusal', reason: 'compaction.memory.source.unsupported' },
231
+ sessionID,
232
+ systemPartCount: system.value,
233
+ memoryDecision: null,
234
+ compactionMessageID: correlation,
235
+ }
236
+ }
237
+ if (candidates.length === 0) {
238
+ return {
239
+ decision: { decision: 'memory.discard', reason: 'compaction.memory.none' },
240
+ sessionID,
241
+ systemPartCount: system.value,
242
+ memoryDecision: { retain: 0, priority: null, retainedIds: [] },
243
+ compactionMessageID: correlation,
244
+ }
245
+ }
246
+
247
+ const ranked = rankCandidates(candidates)
248
+ if (!ranked.ok) {
249
+ return {
250
+ decision: {
251
+ decision: 'refusal',
252
+ reason: `memory.rank.${ranked.code.toLowerCase().split('_').join('.')}`,
253
+ },
254
+ sessionID,
255
+ systemPartCount: system.value,
256
+ memoryDecision: null,
257
+ compactionMessageID: correlation,
258
+ }
259
+ }
260
+
261
+ const applied = applyPolicy(ranked.ordered)
262
+ return {
263
+ decision: applied.decision,
264
+ sessionID,
265
+ systemPartCount: system.value,
266
+ memoryDecision: applied.memoryDecision,
267
+ compactionMessageID: correlation,
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Observe P9 in shadow.
273
+ *
274
+ * @param input `{ payload, candidates?, compactionMessageID? }` — the compaction
275
+ * payload is observed, never written; nothing is pushed into it.
276
+ * @param sink Optional shadow-record observer.
277
+ */
278
+ export function evaluateCompactionMemoryPoint(
279
+ input: unknown,
280
+ sink?: ShadowSink,
281
+ ): CompactionMemoryPointResult {
282
+ let analysis: MemoryAnalysis = refusal('compaction.payload.absent')
283
+ const record = observeShadow(
284
+ 'P9',
285
+ input,
286
+ (isolated) => {
287
+ analysis = analyze(isolated)
288
+ return analysis.decision
289
+ },
290
+ sink,
291
+ )
292
+
293
+ const contained = record.decision === 'unavailable'
294
+ const sessionID = contained ? null : analysis.sessionID
295
+ return {
296
+ record,
297
+ sessionID,
298
+ decisionKey: sessionID,
299
+ systemPartCount: contained ? 0 : analysis.systemPartCount,
300
+ memoryDecision: contained ? null : analysis.memoryDecision,
301
+ compactionMessageID: contained ? null : analysis.compactionMessageID,
302
+ reason: record.reason,
303
+ }
304
+ }
@@ -0,0 +1,242 @@
1
+ /**
2
+ * The P1…P11 registry table — the single per-point record.
3
+ *
4
+ * Each entry carries its domain surface, host surface and tool-vs-hook side,
5
+ * status, evidence ids, premise ids, blocking condition, event shape where the
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`.
8
+ *
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
11
+ * could rewrite a status could turn a premise into an apparent measurement.
12
+ *
13
+ * `mode` declares the mode a point would run in, never a production call site:
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
16
+ * the flag and the production import graph disagree. P1 and P2 are constructed
17
+ * at the prompt hook, P3 at `tool.invoke` (its declared surface and the only one
18
+ * carrying `complexity`/`gateStatus`), P7 on the event channel, P8 on
19
+ * permission.evaluate, P9 on the compaction hook (the only surface carrying its
20
+ * top-level `sessionID`) and P11 inside `ctx.tool.transform` (the only measured
21
+ * catalogue surface); P4, P5, P6 and P10 remain library code with no caller
22
+ * outside the harness and the tests, and their `wired` stays `false`.
23
+ */
24
+
25
+ import type { DecisionPoint } from './v2-decision-registry.ts'
26
+
27
+ const SHADOW = 'shadow' as const
28
+
29
+ /** The registry. Frozen: adapters read it, nothing mutates it. */
30
+ export const DECISION_POINT_REGISTRY: readonly DecisionPoint[] = Object.freeze([
31
+ Object.freeze<DecisionPoint>({
32
+ id: 'P1',
33
+ surface: 'agent',
34
+ hostSurface: 'session.hook.prompt',
35
+ toolOrHook: 'hook',
36
+ hostPoint: "session.hook('prompt')",
37
+ primitives: ['choice'],
38
+ mode: SHADOW,
39
+ status: 'premise',
40
+ wired: true,
41
+ evidence: ['F-08'],
42
+ premises: ['PM-06', 'PM-07'],
43
+ blockingCondition:
44
+ 'PM-07 open: a host-populated prompt.agents was never observed, so no effect of a prompt mutation on the next turn was measured for P1. C6 itself is closed by PROBE-E and is not the blocker',
45
+ notes:
46
+ 'Measured only as prompt-payload shape (F-08). Populated prompt.agents was never observed.',
47
+ }),
48
+ Object.freeze<DecisionPoint>({
49
+ id: 'P2',
50
+ surface: 'skill',
51
+ hostSurface: 'session.hook.prompt',
52
+ toolOrHook: 'hook',
53
+ hostPoint: "session.hook('prompt') + filterSkills; catalog source ctx.skill",
54
+ primitives: ['choice', 'rank'],
55
+ mode: SHADOW,
56
+ status: 'advisory',
57
+ wired: true,
58
+ evidence: ['F-06', 'F-08', 'F-09', 'F-10'],
59
+ premises: ['PRE-02', 'PM-06', 'PM-07', 'PM-13'],
60
+ blockingCondition:
61
+ 'P2b cancelled by measurement: no measured mutation surface reaches project skills (PROBE-E §5.1/§9), so effective filtering is unreachable and P2 records only',
62
+ unknowns: [
63
+ 'other project-skill removal paths were not exercised (PROBE-E §7)',
64
+ 'mutation inside a child/subagent session is UNKNOWN (PROBE-E §7)',
65
+ ],
66
+ notes:
67
+ 'P2 é no-op empírico no caminho default (F-09, PRE-02). P2a resolves the skill source, but the shipped prompt hook passes no `skillsDraft` — `applyTurnDecisionToPrompt(prompt, decision)` — so `skillsSource` is only `none` or `prompt` at runtime and the `draft` source (resolveSkillSource) has no production caller. P2b was cancelled, not emulated: skill.transform add/remove changes the next turn only for builtin draft entries; project skills are unreachable (get returns null, remove is ok without effect, an add override is not rendered). P2 never filters and claims no token reduction. PM-13 applies by analogy: an effect announced without an observable artifact is not an effect.',
68
+ }),
69
+ Object.freeze<DecisionPoint>({
70
+ id: 'P3',
71
+ surface: 'complexity',
72
+ hostSurface: 'tool.invoke',
73
+ toolOrHook: 'tool',
74
+ hostPoint: 'ask.score + noul (tool pantheon_local_decision)',
75
+ primitives: ['score', 'noul'],
76
+ mode: SHADOW,
77
+ status: 'premise',
78
+ wired: true,
79
+ evidence: [],
80
+ premises: ['PM-06', 'PM-09'],
81
+ blockingCondition:
82
+ 'PM-09 open: no tool call was measured, so the tool.invoke surface that would carry complexity scoring was never exercised. C6 is closed by PROBE-E and is not the blocker',
83
+ notes:
84
+ 'Complexity classification is contract-only in this phase. Wired at its declared `tool.invoke`: `pantheon_local_decision` execute hands the adapter its own input, whose schema requires `complexity` and `gateStatus`, so the adapter classifies from the payload that reaches it instead of refusing from the prompt hook. PM-09 stays open — no tool call was ever measured — so this records a decision only when the tool is invoked and never applies one.',
85
+ }),
86
+ Object.freeze<DecisionPoint>({
87
+ id: 'P4',
88
+ surface: 'memory',
89
+ hostSurface: 'session.hook.context',
90
+ toolOrHook: 'hook',
91
+ hostPoint: 'rank (context → system)',
92
+ primitives: ['rank'],
93
+ mode: SHADOW,
94
+ status: 'measured',
95
+ wired: false,
96
+ evidence: ['F-02', 'F-03'],
97
+ premises: ['PM-05'],
98
+ blockingCondition: null,
99
+ notes:
100
+ "System-array carrier and checkpoint reinjection measured (F-02, F-03); channel exclusivity unproven (PM-05). Unwired: the measured `session.hook('context')` payload carries `sessionID`, `model`, `system` (text parts), `messages`, `options`, `agent` and `tools` — no candidate list with `id`/`score`/`justification`, which is the adapter's only input. Constructing it there could pass nothing but `undefined` and record `memory.source.absent` on every request, so it stays library code until a measured surface carries the candidates it ranks. Memory TEXT crossing in `system` is the carrier, not a candidate source, and is not read as one.",
101
+ }),
102
+ Object.freeze<DecisionPoint>({
103
+ id: 'P5',
104
+ surface: 'verification',
105
+ hostSurface: 'session.hook.execute.after',
106
+ toolOrHook: 'hook',
107
+ hostPoint: 'verify (execute.after / context)',
108
+ primitives: ['verify'],
109
+ mode: SHADOW,
110
+ status: 'premise',
111
+ wired: false,
112
+ evidence: [],
113
+ premises: ['PM-09'],
114
+ blockingCondition:
115
+ 'C8 open: permission.evaluate and execute.before were registered but never fired; no tool call was measured',
116
+ notes:
117
+ 'Verdicts PASS/FAIL/BLOCK; failed_to_respond in mandatory verification is BLOCK. Unwired: the adapter verifies a DECLARED `{ requirements, responses }` pair and no measured surface carries either — the `execute.after` event is `{ tool, sessionID, agent, messageID, id, input, status, result }`, with no verification declaration and no response map. The surface is additionally unmeasured (PM-09, C8 open: the tool hooks were registered and never fired), so constructing it there would record `themis.requirements.absent` on every call instead of a verdict.',
118
+ }),
119
+ Object.freeze<DecisionPoint>({
120
+ id: 'P6',
121
+ surface: 'council',
122
+ hostSurface: 'session.hook.prompt',
123
+ toolOrHook: 'hook',
124
+ hostPoint: 'rank + score (prompt)',
125
+ primitives: ['rank', 'score'],
126
+ mode: SHADOW,
127
+ status: 'measured',
128
+ wired: false,
129
+ evidence: ['F-08'],
130
+ premises: ['PM-07'],
131
+ blockingCondition: null,
132
+ notes:
133
+ 'Prompt payload shape measured (F-08); populated prompt.agents was never observed (PM-07). Unwired: the prompt surface carries `prompt.agents`/`prompt.skills`, never the `{ id, score, justification }` candidate list this adapter ranks, so constructing it there would only record a permanent `council.source.absent` refusal. No measured surface carries council candidates; it stays library code until one does.',
134
+ }),
135
+ Object.freeze<DecisionPoint>({
136
+ id: 'P7',
137
+ surface: 'loop',
138
+ hostSurface: 'event.channel',
139
+ toolOrHook: 'hook',
140
+ hostPoint: 'session.execution.succeeded — data.sessionID',
141
+ primitives: ['noul', 'score'],
142
+ mode: 'migration',
143
+ status: 'measured',
144
+ wired: true,
145
+ evidence: ['F-11', 'F-12', 'F-13', 'I-01'],
146
+ premises: [],
147
+ blockingCondition: null,
148
+ trigger: 'session.execution.succeeded',
149
+ eventShape: {
150
+ type: 'session.execution.succeeded',
151
+ carrier: 'data.sessionID',
152
+ forbiddenCarriers: ['properties'],
153
+ },
154
+ unknowns: [
155
+ 'session.execution.failed / .interrupted in a child session were never induced (PROBE-D §5.1)',
156
+ 'nested subagent depth >= 2 was never exercised (PROBE-D §5.2)',
157
+ 'a background image job was never exercised (PROBE-D §5.4)',
158
+ ],
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.',
161
+ }),
162
+ Object.freeze<DecisionPoint>({
163
+ id: 'P8',
164
+ surface: 'guardrail',
165
+ hostSurface: 'permission.evaluate',
166
+ toolOrHook: 'hook',
167
+ hostPoint: 'noul (permission.evaluate only; execute.before untouched)',
168
+ primitives: ['noul'],
169
+ mode: 'off',
170
+ status: 'advisory',
171
+ wired: true,
172
+ evidence: [],
173
+ premises: ['PM-09', 'PM-16'],
174
+ blockingCondition:
175
+ 'Not activatable by measurement (PROBE-F): the two declared rules match none of the 24 measured permission.evaluate payloads — `action` is always a valid token and the top-level `sessionID` is always present (PROBE-F §3.2) — so with the flag on the outcome is `p8.rule.none` / `guardrail.keep` and nothing is narrowed (PROBE-F §6 I-F3, a static evaluation of the rules against the measured shape; the flag was never enabled). The host also treats an unrecognised effect as `ask` and executes after the ask path resolves, so "refuse and keep" does not block (PROBE-F §3.6). `permission.evaluate.egress` is unreachable in this host: a tool declaring that permission registers but is never advertised to the provider (PROBE-F §3.9). Activation is not waiting on review — as declared, the rule set narrows nothing on this host',
176
+ securityInvariant:
177
+ 'execute.before remains the only hard barrier. No adapter may allow what that barrier denies. A throw in permission.evaluate does not deny; a throw in execute.before does (PROBE-F §3.7).',
178
+ unknowns: [
179
+ 'permission.evaluate delivery, payload shape, effect-write honouring, ordering and the existing-deny branch were measured (PROBE-F §3.1–§3.5); permission.evaluate.egress was NOT (PROBE-F §3.9: the action is never advertised to the provider)',
180
+ 'accessor/proxy write targets, inherited effect and non-writable own properties are still unproven as host inputs; the write refuses a non-own or accessor descriptor (p8.write.delegation), but the measured host delivered a plain writable data property every time (PROBE-F §3.2)',
181
+ 'no payload made a declared rule match, so P8 narrowing in a real host was never observed: the flag was never enabled (PROBE-F §5.2). The inert verdict comes from the measured payload plus the declared rules, not from a flag-on run',
182
+ ],
183
+ notes:
184
+ 'Starts off, not shadow. Only permission.evaluate is wired: execute.before is untouched and P8 adds no second barrier there. The Phase 5 review (N1–N8, conditions PH5-1…PH5-5) kept activation blocked; its code findings were repaired without activating the flag: N1 (discarded result / proof before P8), N3 (silent rejection) and N4 (no flag-on test) — apply() runs before writeProof, so the proof records the post-apply effect (PH5-1); the guardrail outcome is emitted through the 0b telemetry sink carrying the `mode` this entry declares — `off`, never `active` (N10a); the record is emitted only after the delegation policy has decided and only when a fresh re-read of the event still holds the effect it describes (N10b, N9); the write refuses accessor and non-own descriptors with p8.write.delegation (PH5-2). PH5-3 and PH5-4 are the flag-on integration test and the documentation of the flag and its blast radius. C8 was then settled by measurement, not by review: PROBE-F delivered 24 real permission.evaluate events, measured the payload (`["sessionID","agent","action","resources","metadata","source","effect"]`, `effect` an own writable data property pre-populated with `allow` or `ask`), the order (`session.tool.called` → `execute.before` → `permission.evaluate` → [`permission.asked`] → execute), and measured that a written `deny` IS honoured (tool blocked, nothing written). The result is not an eligible guardrail: neither declared rule can match a delivered payload (valid `action` token, `sessionID` always present), the host lets an unrecognised effect resolve as `ask` and proceed, and `permission.evaluate.egress` is unreachable — so the current rule set narrows nothing and the point is recorded as advisory, not as awaiting review. PM-09 and PM-16 record what C8 was blocked on; PROBE-F measured them for 9 of the 10 paths, so neither is the blocker any more. wired stays true because the plugin still constructs the adapter, and the flag stays OFF (`mode: off`).',
185
+ }),
186
+ Object.freeze<DecisionPoint>({
187
+ id: 'P9',
188
+ surface: 'compaction',
189
+ hostSurface: 'session.hook.compaction',
190
+ toolOrHook: 'hook',
191
+ hostPoint: 'noul + score (compaction)',
192
+ primitives: ['noul', 'score'],
193
+ mode: SHADOW,
194
+ status: 'measured',
195
+ wired: true,
196
+ scope: 'overflow-unmeasured',
197
+ evidence: ['F-01', 'F-02', 'F-03', 'F-04'],
198
+ premises: ['PM-04', 'PM-05'],
199
+ blockingCondition: null,
200
+ unknowns: [
201
+ 'reason:"overflow" was not inducible in 6 error shapes (PROBE-G §3.2): the host retried and completed, and the one failure-recovery compaction observed was persisted as reason:"auto" — the carrier that path produces is UNKNOWN',
202
+ 'the checkpoint summary/reinjection inside a child session was not exercised (PROBE-G §4.6)',
203
+ 'the messages channel was never exercised',
204
+ 'no measured surface carries the memory candidate list P9 would retain or discard',
205
+ ],
206
+ notes:
207
+ 'Measured on top-level sessions (top-level sessionID carrier, F-01; system-array text, F-02) and on a child session (PROBE-G §3.1: the hook fires 3/3 with the CHILD sessionID at top level, the same 7-key payload, no nested `session`, and `system` as an array of 4 parts — identical to the top-level shape, so the adapter needs no child-specific branch). Overflow is a different answer: `reason:"overflow"` was NOT inducible in 6 error shapes (400 JSON, text/plain, SSE error, empty body, persistent failure, persistent failure with x-should-retry:false); the host retried and completed in four, and the persistent case compacted with reason:"auto", so the overflow path and its carrier remain unmeasured (PROBE-G §3.2/§4). Wired at its declared `session.hook(\'compaction\')` in shadow: the handler hands the adapter the event as-is, the adapter reads `payload.sessionID` and the `system` part array and nothing else, and the injected context is unchanged — the record carries the decision key and `systemPartCount`, and the adapter pushes nothing. A payload whose only id is a nested `session.id` produces NO decision (fail-closed), because the 2.2.5 host never sends `session` at all (F-01). The memory candidate list is an optional caller input and no measured surface carries it, so the wired record states `compaction.memory.source.absent` — a named refusal, never a retention or priority claim.',
208
+ }),
209
+ Object.freeze<DecisionPoint>({
210
+ id: 'P10',
211
+ surface: 'claims',
212
+ hostSurface: 'session.hook.prompt',
213
+ toolOrHook: 'hook',
214
+ hostPoint: 'verify (per council member; prompt surface)',
215
+ primitives: ['verify'],
216
+ mode: SHADOW,
217
+ status: 'premise',
218
+ wired: false,
219
+ evidence: [],
220
+ premises: [],
221
+ blockingCondition:
222
+ 'Not implemented: per-counselor claims were never designed or measured (DISCOVERY §4); no measured surface carries `counsellors[].claims[]`',
223
+ notes:
224
+ 'Explicit verdict per claim; failed_to_respond is BLOCK in mandatory verification. The prompt hook is the only measured council surface (F-08), but that payload carries neither counsellors nor claims, so the point is unwired: constructing it there would record `claims.absent` forever. The declaration records intent and the boundary, not exercised coverage.',
225
+ }),
226
+ Object.freeze<DecisionPoint>({
227
+ id: 'P11',
228
+ surface: 'catalog',
229
+ hostSurface: 'tool.transform',
230
+ toolOrHook: 'tool',
231
+ hostPoint: 'own adapter in tool.transform',
232
+ primitives: ['choice'],
233
+ mode: SHADOW,
234
+ status: 'measured',
235
+ wired: true,
236
+ evidence: ['F-05', 'F-07'],
237
+ premises: ['PM-06', 'PM-08'],
238
+ blockingCondition: null,
239
+ notes:
240
+ "Host catalog context is ABSENT at every measured point (F-05) and was removed from the design; the adapter uses the tool.transform draft (F-07). Wired inside the `ctx.tool.transform` callback in shadow: it reads the draft the host hands it (`list` plus the six measured members) and calls nothing else, so the only mutation on that draft is Pantheon's own `namespace`/`add`. Shadow has no responder, so the record names the validated `choice` question over the draft ids (`catalog.no.answer`) and never a selection; a draft that is absent or shaped differently fails closed with a reason instead of throwing into admission.",
241
+ }),
242
+ ])