pantheon-opencode 1.6.0-beta.7 → 1.6.0-beta.9

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 (66) hide show
  1. package/AGENTS.md +58 -15
  2. package/CHANGELOG.md +61 -94
  3. package/README.md +81 -103
  4. package/README.pt-BR.md +19 -37
  5. package/commands/pantheon-audit.md +7 -1
  6. package/commands/pantheon-consolidate.md +1 -1
  7. package/commands/pantheon-focus.md +17 -0
  8. package/package.json +1 -2
  9. package/plugin.json +2 -2
  10. package/pyproject.toml +1 -1
  11. package/scripts/build-agents-md.mjs +2 -3
  12. package/scripts/doctor.mjs +22 -104
  13. package/scripts/hooks/scan-secrets.sh +97 -0
  14. package/scripts/install/config-migration.mjs +9 -42
  15. package/scripts/install/interactive.mjs +1 -1
  16. package/scripts/install/opencode.mjs +174 -77
  17. package/scripts/install/plugin.mjs +43 -9
  18. package/scripts/install/strings.mjs +0 -8
  19. package/scripts/probe-pantheon-cost.mjs +3 -16
  20. package/scripts/sync-artifacts.mjs +1 -0
  21. package/scripts/sync-tui.mjs +24 -3
  22. package/scripts/test-opencode-v2-sandbox.sh +203 -786
  23. package/scripts/validate-sandbox-install.mjs +138 -0
  24. package/skills-lock.json +4 -5
  25. package/src/agents/aphrodite.md +2 -9
  26. package/src/agents/demeter.md +0 -9
  27. package/src/agents/gaia.md +1 -0
  28. package/src/agents/hephaestus.md +0 -9
  29. package/src/agents/hermes.md +2 -9
  30. package/src/agents/mnemosyne.md +18 -53
  31. package/src/agents/prometheus.md +0 -9
  32. package/src/agents/themis.md +0 -1
  33. package/src/agents/zeus.md +180 -19
  34. package/src/instructions/agent-return-format.instructions.md +48 -3
  35. package/src/instructions/memory-protocol.instructions.md +8 -9
  36. package/src/instructions/zeus-anti-stall.instructions.md +54 -6
  37. package/src/instructions/zeus-council-synthesis.instructions.md +71 -0
  38. package/src/instructions/zeus-memory-operations.instructions.md +4 -4
  39. package/src/instructions/zeus-timeout-retry.instructions.md +81 -7
  40. package/src/pantheon/v2-delegation-enforce.ts +2 -1
  41. package/src/plugin-v2.ts +251 -168
  42. package/src/plugins/pantheon-hooks.ts +35 -82
  43. package/src/plugins/tui/dist/tui-v2.d.ts +9 -0
  44. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -0
  45. package/src/plugins/tui/dist/tui-v2.js +151 -0
  46. package/src/plugins/tui/dist/tui-v2.js.map +1 -0
  47. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  48. package/src/plugins/tui/dist/tui.js +29 -53
  49. package/src/plugins/tui/index-v2.ts +6 -0
  50. package/src/plugins/tui/package-lock.json +5411 -1292
  51. package/src/plugins/tui/package.json +10 -7
  52. package/src/plugins/tui/src/index-v2.tsx +108 -0
  53. package/src/plugins/tui/src/index.tsx +28 -63
  54. package/src/plugins/tui/src/opencode-v2.d.ts +13 -0
  55. package/src/plugins/tui/tsdown.config.ts +2 -2
  56. package/src/plugins/tui/tui-v2.ts +2 -0
  57. package/src/plugins/tui/tui.ts +3 -0
  58. package/src/routing.yml +4 -2
  59. package/src/skills/README.md +7 -12
  60. package/src/skills/agent-coordination/SKILL.md +83 -13
  61. package/src/skills/auto-continue/SKILL.md +13 -14
  62. package/src/skills/context-compression/SKILL.md +26 -879
  63. package/src/skills/session-goal/SKILL.md +14 -5
  64. package/src/pantheon/secret-scanner.ts +0 -489
  65. package/src/plugins/tui/README.md +0 -14
  66. package/src/skills/council-synthesis/SKILL.md +0 -29
package/AGENTS.md CHANGED
@@ -38,9 +38,8 @@ Para validar a instalação global do pacote pantheon-opencode COMO UM USUÁRIO
38
38
 
39
39
  - Rodar: `bash ~/pantheon-sandbox/run-test.sh` (opencode mcp list 5/5 connected + doctor 0 erros + abre TUI isolado)
40
40
  - Regra para agentes: ao validar instalação global (npm pack, `init`, MCPs, hooks), usar o sandbox — NUNCA testar no ambiente de dev
41
- - Prepare/atualize com `bash scripts/test-opencode-v2-sandbox.sh --prepare`; isso gera `run-test.sh`, `start-pantheon.sh` e o README do sandbox
42
- - Descarte somente pelo reset com guardas: `bash scripts/test-opencode-v2-sandbox.sh --reset` (nunca use `rm -rf` manualmente)
43
- - Detalhes: ver `~/pantheon-sandbox/README.md` após o prepare
41
+ - Descarte: `rm -rf ~/pantheon-sandbox`
42
+ - Detalhes: ver `~/pantheon-sandbox/README.md`
44
43
 
45
44
  ## Conventions
46
45
 
@@ -65,7 +64,7 @@ are rendered into only the matching installed agent prompts.
65
64
 
66
65
  # Agent Return Format
67
66
 
68
- Implementation agents (Hermes, Aphrodite, Demeter, Hephaestus, Prometheus) return:
67
+ All implementation agents (Hermes, Aphrodite, Demeter, Hephaestus, Prometheus) MUST return results to Zeus in this format:
69
68
 
70
69
  ## subtask_summary
71
70
  **files_changed:** [list of file paths, one per line]
@@ -76,13 +75,58 @@ Implementation agents (Hermes, Aphrodite, Demeter, Hephaestus, Prometheus) retur
76
75
  **status:** complete | partial (reason) | escalated (reason)
77
76
  **blockers:** [list any blockers or null]
78
77
 
79
- Investigation agents (Apollo, Athena) return structured findings with:
78
+ For investigation agents (Apollo, Athena), return structured findings with:
80
79
  - Key findings as bullet points
81
80
  - File paths with line numbers
82
81
  - Relevant code snippets (max 3 lines each)
83
82
 
83
+ ## Council Specialist Response Format
84
+
85
+ When responding to a `/pantheon` council synthesis invocation, specialists MUST return this structured format:
86
+
87
+ ```
88
+ ## specialist_response
89
+ **position:** <clear one-sentence position answering the question>
90
+ **reasoning:** <2-4 sentences with logical chain>
91
+ **trade_offs:** <what's gained vs lost, specific>
92
+ **risks:** <what could go wrong, max 3 items>
93
+ **confidence:** High | Medium | Low
94
+ **agreement_signals:** agree:@agent1 on <issue>, agree:@agent2 on <issue> | disagree:@agent3 on <issue>
95
+ **specific_claims:** <count of specific factual claims in response>
96
+ ```
97
+
98
+ ### Field Rules
99
+
100
+ | Field | Required | Validation |
101
+ |-------|----------|------------|
102
+ | position | ✅ | Single sentence, must directly answer the question |
103
+ | reasoning | ✅ | 2-4 sentences with logical chain |
104
+ | trade_offs | ✅ | At least one gain and one loss, specific to context |
105
+ | risks | ✅ | Max 3 bullet points |
106
+ | confidence | ✅ | One of: High, Medium, Low |
107
+ | agreement_signals | Optional | Format: `agree:@agent on issue \| disagree:@agent on issue`. Use only when you can reference other specialists expected positions. |
108
+ | specific_claims | ✅ | Integer count of verifiable factual statements in the response |
109
+
110
+ ### Confidence Guidelines
111
+
112
+ - **High**: Position backed by 3+ specific claims with evidence or direct experience
113
+ - **Medium**: Position backed by 1-2 specific claims
114
+ - **Low**: Position is opinion-based or speculative
115
+
116
+ ### Example
117
+ ```
118
+ ## specialist_response
119
+ **position:** The BackgroundJobBoard should be used for council crash recovery
120
+ **reasoning:** The board already supports running→completed→reconciled state machine with persistence. Registering council dispatches there adds ~50ms overhead but prevents total session loss on context crash. The WAL pattern ensures no data loss on restart.
121
+ **trade_offs:** Gain: crash recovery for multi-minute council sessions. Lose: ~50ms registration overhead per council.
122
+ **risks:** Board persistence failure could block council start — implement with fire-and-forget error handling
123
+ **confidence:** High
124
+ **agreement_signals:** agree:@themis on persist-before-notify
125
+ **specific_claims:** 3
126
+ ```
127
+
84
128
  ## Memory Context
85
- If this agent used `memory_recall` or `memory_search`, include the relevant memory entries used as context for the response.
129
+ If memory affected the result, state the takeaway briefly; do not repeat the entry or task context.
86
130
 
87
131
  <!-- Source: src/instructions/memory-protocol.instructions.md -->
88
132
  ## Memory Protocol
@@ -94,18 +138,17 @@ These rules apply to all agents; each agent file may add domain-specific rules.
94
138
 
95
139
  ## Universal Rules
96
140
 
97
- ### Task-start search
98
- **Before any file reads, call exactly once at task start:** `memory_search(query=task_prompt, top_k=2)`.
99
- - Reuse the same result for task context and delegation routing. A KV cache hit does not skip this search or trigger another task FTS search.
100
- - Council-precedent lookup is separate. Use domain-relevant context; do not issue another task-memory search for routing.
101
- - Agents have read-only memory access: only `memory_search()` is available.
141
+ ### Retrieval
142
+ - Search only when prior project history could change the outcome; skip self-contained questions and bounded changes.
143
+ - For delegated work, Zeus searches at most once and passes useful hits to the specialist. Reuse supplied results; search separately only if relevant history is needed but missing.
144
+ - Use a targeted query (`top_k=2`); do not search the whole prompt by default. Missing or irrelevant results never block current work.
102
145
 
103
- ### Summary persistence and WAL
104
- `memory_store()` is called automatically by Zeus when an agent returns a `subtask_summary`; include a clear `summary`. This is the only persistence path, for implementers and read-only agents alike.
105
- Before storing, Zeus writes `.pantheon/memory-wal/<agent>/<timestamp>.json` with `{agent, phase, summary, files_changed, status, timestamp}`. The WAL precedes storage, is recovered next session if storage fails, and expires after 7 days.
146
+ ### Persistence
147
+ - `memory_store()` is manual, not automatic. Store at most one concise, reusable top-level result; never persist routine child summaries, phase updates, test logs, or temporary state.
148
+ - Confirm the store succeeded before claiming persistence. There is no automatic memory WAL or recovery. Add ADRs to the memory bank only when explicitly requested.
106
149
 
107
150
  ### Relevance and permanent records
108
- Skip `memory_search()` results below 0.3 relevance. Delegate ADR-level architecture decisions, significant trade-offs, and pattern changes to @mnemosyne; routine summaries use auto-store.
151
+ Ignore weak matches; routine summaries do not belong in durable memory.
109
152
 
110
153
  <!-- Source: src/instructions/yagni.instructions.md -->
111
154
  ## YAGNI Anti-overengineering
package/CHANGELOG.md CHANGED
@@ -18,122 +18,89 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
18
18
 
19
19
  ## ✅ Closed Issues
20
20
 
21
- ## [v1.6.0-beta.7] - 2026-10-10
21
+ ## [v1.6.0-beta.9] - 2026-10-12
22
22
 
23
23
  &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
24
24
  move this section to a versioned entry and reset the template below. --&gt;
25
25
 
26
26
  ## 🆕 What's New
27
27
 
28
- - **Simpler agent dispatch:** answer no-change questions directly, send bounded
29
- fixes to one specialist, load council instructions on demand, and remove
30
- routine per-task KV/cache routing. No token, cost, or latency savings are
31
- claimed without live measurements.
32
- - **V2 install and permissions:** use a versioned package-root plugin pin and
33
- migrate V1 `task`/`write` permissions to V2 `subagent`/`edit`, retaining the
34
- stricter effect when rules collide.
35
- - **Release and runtime hardening:** bounded in-process secret scanning,
36
- fail-closed V2 registration, TUI timer disposal, truthful doctor reporting,
37
- and guarded V2 sandbox prepare/reset.
28
+ - **Entry point TUI dedicado ao OpenCode V2.** O pacote agora compila e instala
29
+ separadamente os loaders V1/V2, e adiciona `/pantheon-focus` para foco de
30
+ sessão sem depender das goal-tools ausentes no host V2.
38
31
 
39
32
  ## 🐞 Fixed
40
33
 
41
- - TUI usage polling now starts only after its optional slot registers and all
42
- refresh timers are disposed on shutdown.
43
- - Doctor detects version drift in string and object V2 package pins, including
44
- prerelease versions; checkout installs warn when their exact npm pin is not
45
- published yet.
46
- - V2 permission migration maps `task → subagent` and `write → edit` and
47
- preserves the stricter conflicting rule.
34
+ - **Instalação V2:** agentes e slash commands de projeto são instalados nos
35
+ diretórios descobertos pelo host; o TUI seleciona o bundle da geração correta
36
+ e o estado dos componentes só é marcado como instalado após sucesso.
37
+ - **`/pantheon-audit`:** inclui o scanner heurístico no pacote e localiza a cópia
38
+ instalada antes de executar a primeira camada.
39
+ - **`/pantheon-consolidate`:** delega a consolidação ao agente Mnemosyne, dono
40
+ da qualidade do banco de memória.
48
41
 
49
42
  ## ⚠️ Known Issues
50
43
 
51
- - Live provider E2E is blocked by HTTP 403; an interactive model-backed V2 TUI
52
- turn remains unverified.
53
- - The V2 tool canary targets OpenCode 2.0.22 while the installable CLI differs
54
- (issue #216); V1 host end-to-end validation is also deferred.
55
- - The observed P0-4 tool-catalog oscillation has no reproduced cause; its
56
- reproduction harness remains follow-up work.
57
- - V2 `init` from an unpublished source checkout writes a versioned npm pin that
58
- cannot resolve until that version is published; the installer warns.
59
- ## [v1.6.0] - 2026-10-10
44
+ - **Sidebar V2 na sessão inicial:** a captura do TUI recém-aberto ainda não
45
+ mostra o conteúdo Pantheon antes do primeiro prompt; validar o render inicial
46
+ interativo continua sendo um gate aberto para a beta.
47
+ - **Goal persistente no OpenCode V2:** as goal-tools não fazem parte da
48
+ superfície V2 suportada; `/pantheon-focus` não substitui uma goal-tool
49
+ persistente/removível do host.
50
+
51
+ ## [v1.6.0-beta.8] - 2026-10-11
52
+
53
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
54
+ move this section to a versioned entry and reset the template below. --&gt;
55
+
56
+ ## 🐞 Fixed
57
+
58
+ - **opencode-v2** — repair session lookup and beta sandbox reuse
59
+ - **scripts** — isolate beta background service port
60
+ ## [v1.6.0-beta.7] - 2026-10-10
60
61
 
61
- This stable candidate consolidates the beta.1–beta.6 changes. The original beta
62
- entries remain below as historical records so release detail is not discarded.
62
+ &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
63
+ move this section to a versioned entry and reset the template below. --&gt;
63
64
 
64
65
  ## 🆕 What's New
65
66
 
66
- - **OpenCode V2 plugin and installer path:** generation detection, V2 plugin
67
- registration, three functional V2 tools, read-only enforcement, and explicit
68
- reporting of the smaller V2 feature surface. The V1 API path remains in the
69
- package, but no V1 host has been exercised end-to-end in this release.
70
- - **Sandbox validation and release hardening:** fail-closed checks, V2 MCP and
71
- hook probes, package/version inventory validation, and reproducible package
72
- evidence. The sandbox now generates its runner, isolated TUI launcher, and
73
- README during `--prepare`.
74
- - **Dependency and TUI maintenance:** synchronized release manifests, updated
75
- dependency/security overrides, and TUI/runtime consistency checks.
76
- - **Simpler agent dispatch path:** no-change questions can be answered directly;
77
- bounded fixes route to one specialist; council guidance is loaded on demand;
78
- and default routing no longer makes per-task KV/cache lookups. Synthetic
79
- timeout/session behavior unsupported by the host was removed. These changes
80
- simplify the prompt and dispatch path; this release makes no measured token,
81
- cost, or latency improvement claim.
67
+ - **Permissões MCP nativas por agente no OpenCode V1 e V2.** O instalador
68
+ converte a allowlist `mcp_tools` de cada agente em regras nativas: nega por
69
+ padrão os servidores Pantheon omitidos, libera apenas as ferramentas
70
+ declaradas e preserva MCPs de terceiros. O V2 mantém os servidores
71
+ conectados; as regras limitam quais ferramentas cada agente vê.
72
+ - **Guarda V2 de delegação alinhada ao contrato de permissões.** Os hooks de
73
+ permissão e de sessão aplicam as restrições de sessão somente-leitura e a
74
+ matriz caller→target sem conceder acesso além do configurado pelo host.
75
+ - **Menos chamadas automáticas de memória e compressão.** A busca de contexto
76
+ do Zeus reutiliza o resultado de início de tarefa, e o protocolo de
77
+ compressão deixa de recomendar pipelines automáticos extensos.
78
+ - **Prova de identidade da instalação do sandbox.** O teste global compara a
79
+ versão e arquivos do pacote instalado com este checkout e rejeita referências
80
+ npm antigas nas configurações ativas antes de validar o runtime.
81
+ - O `--prepare` agora gera `start-pantheon.sh` para abrir o TUI interativo com o
82
+ beta instalado e HOME, configuração XDG, projeto e banco de dados isolados do
83
+ sandbox. O launcher fixa a porta do serviço gerenciado em `49376` e falha sem
84
+ parar serviços existentes se a porta dedicada já estiver ocupada.
82
85
 
83
86
  ## 🐞 Fixed
84
87
 
85
- - `PANTHEON_V2_MCP_LIST_TIMEOUT` now defaults to 15 seconds in both the harness
86
- and generated `run-test.sh`, including under `set -u`; the default does not
87
- depend on an exported environment variable.
88
- - `PANTHEON_REPO` is resolved consistently for prepare, generated tests, and
89
- reset guards. Relative, dangling, missing, or non-Pantheon paths fail before
90
- packaging; `.repo-dir` is atomically written and validated before use.
91
- - Sandbox prepare/reset reject roots overlapping a checkout or the user's
92
- `HOME`. `PANTHEON_V2_PORT` defaults to 49376, is range-checked, and refuses an
93
- occupied port without reusing or stopping the existing service.
94
- - Sandbox `tmp/` is not blanket-deleted: prepare only expires hash-named Node
95
- compile-cache files owned by the current user and older than 30 days. Runtime
96
- state, unknown entries, and handoff/evidence files remain untouched.
97
- - **V2 plugin registration is stable across install locations.** `init` now
98
- writes the exact `pantheon-opencode@<version>` npm entry and the package root
99
- exports the V2 plugin. This replaces absolute paths into a global prefix or
100
- transient `npx` cache; `doctor` recognizes the pinned package and reports
101
- version drift. A clean production-only package consumer test covers the root
102
- export.
103
- - **V1-to-V2 permissions preserve their intended actions.** Migration maps
104
- `task` to V2 `subagent` and `write` to the `edit` action that also governs
105
- `write`/`patch`. If V1 `edit` and `write` rules collide on one resource, the
106
- more restrictive effect wins. Tests cover global and nested agent rules.
107
- - **`doctor` distinguishes SQLite readiness from tool registration.** The
108
- `node:sqlite` check now says it verifies only the backend prerequisite, not
109
- whether `pantheon_cost` registered on the active host.
110
- - **Release documentation was reconciled with current code.** The V2 caller /
111
- target matrix is enforced by `permission.evaluate`; the bridge export is an
112
- importable utility but is not wired into production; the V2 event count and
113
- package registration format are corrected in both READMEs and the install /
114
- upgrade guides.
88
+ - Referências versionadas/alias do pacote Pantheon que sobravam na lista
89
+ `plugins` agora são reconhecidas pelo instalador e substituídas pelo caminho
90
+ do plugin local correto, sem afetar plugins de terceiros com nomes parecidos.
91
+ - A suíte CI foi separada do caminho crítico de instalação/empacotamento para
92
+ reduzir o tempo até o resultado das verificações do pacote.
93
+ - O `run-test.sh` gerado agora define seu timeout do `mcp list` antes do uso
94
+ sob `set -u`; antes, a variável ausente interrompia o teste antes de chamar
95
+ o CLI. A saída do comando também fica disponível quando o gate falha.
115
96
 
116
97
  ## ⚠️ Known Issues
117
98
 
118
- - **V1 host canary is deferred.** The tested package dependency pair is
119
- `@opencode-ai/plugin@1.18.33` + `@opencode-ai/sdk@1.18.33`; this is not an
120
- end-to-end V1 host compatibility claim. No OpenCode `1.18.35` host support is
121
- asserted.
122
- - **V2 support remains partial.** The tool canary was authored against
123
- `opencode 2.0.22`; the installable CLI has drifted from that canary contract
124
- (tracked in issue #216). See the README compatibility table for the measured
125
- evidence and limitations.
126
- - **Release validation is not complete.** Live provider E2E returned HTTP 403,
127
- the interactive V2 TUI/model-backed turn has not been verified, and the
128
- previously observed within-session tool-catalog oscillation (P0-4) still has
129
- no reproduced cause. This candidate must not be published until the host
130
- validation gates are resolved or explicitly waived.
131
- - **V2 init from an unpublished source checkout cannot bootstrap its own npm
132
- pin.** It writes the exact package version and emits a warning; OpenCode
133
- cannot resolve that version until it is published. This is limited to
134
- running the installer from the repository checkout. After publication, use
135
- the npm-installed or `npx` installer for the supported consumer path.
136
-
99
+ - **A delegação real ainda precisa de confirmação nesta beta.** O teste manual
100
+ anterior de `HERMES-PONG` foi negado com
101
+ `Pantheon delegation denied: authoritative caller session is unavailable`;
102
+ a correção de permissões e a instalação isolada precisam ser verificadas no
103
+ TUI OpenCode V2 antes de considerar a delegação validada.
137
104
  ## [v1.6.0-beta.6] - 2026-10-05
138
105
 
139
106
  &lt;!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
package/README.md CHANGED
@@ -54,6 +54,9 @@ project-local installation, or non-interactive setup, see the
54
54
  [installation guide](docs/INSTALLATION.md).
55
55
  The bundled Python MCP servers use the pinned MCP SDK 2.2.0 and standalone
56
56
  FastMCP 4.0.10 runtime; see the [MCP guide](docs/MCP.md).
57
+ The installer also turns each agent's `mcp_tools` allowlist into native
58
+ per-agent permissions for OpenCode V1 and V2; see the
59
+ [agent MCP reference](docs/AGENT-MCP.md).
57
60
 
58
61
  ## A simple example
59
62
 
@@ -64,13 +67,6 @@ Once OpenCode is running, describe the outcome you want:
64
67
  ```
65
68
 
66
69
  Pantheon helps turn that request into a plan and a sequence of reviewed steps.
67
- For questions that do not require repository changes, Zeus answers directly;
68
- small, reversible fixes use one specialist dispatch. Discovery, planning,
69
- parallel work, and council review are reserved for tasks that benefit from them.
70
-
71
- For a tiny, bounded repair, invoke `@talos` directly (for example,
72
- `@talos fix this typo`). That skips the Zeus orchestration call; use `/pantheon`
73
- for planning, delegation, multi-file work, or quality gates.
74
70
 
75
71
  ## Who is it for?
76
72
 
@@ -87,12 +83,19 @@ clear handoff between stages of work.
87
83
  - Project memory that helps preserve relevant context between sessions.
88
84
  - Optional integrations for common development tasks.
89
85
 
86
+ Memory is used selectively: the coordinator searches once only when project
87
+ history could affect a task, then passes relevant results to specialists. Store
88
+ one concise, reusable outcome at task completion when it will matter later;
89
+ routine child summaries and phase updates stay in the current handoff. The
90
+ session-checkpoint tools are separate, optional persistence APIs and are not
91
+ called automatically by compaction hooks. See [Memory usage](docs/MEMORY.md).
92
+
90
93
  ## Status
91
94
 
92
- Candidate version: **1.6.0-beta.7**. The manifests in this checkout express a
93
- beta candidate, not a confirmed publication; beta publication happens only
94
- after the explicit Release workflow completes successfully. To check the
95
- published beta, consult the npm `beta` dist-tag. Pantheon is designed for OpenCode
95
+ Candidate version: the manifests in this checkout express the version being
96
+ prepared, not a confirmed publication. A beta is published only after the
97
+ Release workflow completes successfully. To check which version is actually
98
+ published, consult the npm `beta` dist-tag. Pantheon is designed for OpenCode
96
99
  and depends on the availability and configuration of OpenCode and any optional
97
100
  services you choose to use. Check the
98
101
  [releases](https://github.com/ils15/pantheon-opencode/releases) and
@@ -135,19 +138,18 @@ host is an unsupported mixed/wrong-generation configuration, not a supported mod
135
138
 
136
139
  ### What the OpenCode 2 path is — and is not
137
140
 
138
- **Not inert.** V2 registers the version-pinned npm package
139
- `pantheon-opencode@<version>` (pinned to the installed Pantheon version); its
140
- package-root export points to `src/plugin-v2.ts`.
141
- It registers real tools with `input`/`output` schemas via
142
- `ctx.tool.transform()`, five event subscriptions, session hooks, and tool/
143
- permission hooks for read-only enforcement and the Pantheon caller→target
144
- delegation matrix. For Pantheon-managed targets, Zeus may delegate to any
145
- registered agent; Athena and Hermes may target Apollo only; other Pantheon
146
- callers and unknown callers are denied. Child sessions cannot delegate to
147
- Pantheon agents. Native/custom targets remain under host permissions. V2 never
148
- adds an allow grant or overrides an explicit host deny; missing or mismatched
149
- identity fails closed for a Pantheon delegation. The three goal tools remain
150
- unsupported and are reported as `goal-tools`.
141
+ **Not inert.** The V2 path (`src/plugin-v2`, registered as a directory because
142
+ the V2 loader rejects bare file paths) registers real tools with real
143
+ `input`/`output` schemas via `ctx.tool.transform()`, 5 event subscriptions,
144
+ session hooks and tool/permission hooks that enforce read-only sessions and the
145
+ caller→target delegation matrix. The matrix applies only to Pantheon-managed
146
+ targets: Zeus may delegate to any registered agent; Athena and Hermes may target
147
+ Apollo only; other Pantheon callers and unknown callers are denied. Child
148
+ sessions cannot delegate to Pantheon agents. Calls between native/custom agents
149
+ remain under host permissions. The V2 path never adds an allow grant or
150
+ overrides an explicit host deny; missing or mismatched identity fails closed
151
+ for the attempted Pantheon delegation. The 3 goal tools remain unsupported and
152
+ are reported as `goal-tools`.
151
153
 
152
154
  **Not complete either, and the V2 support claim is currently narrowed.** Two
153
155
  facts, both recorded in this repository rather than smoothed over:
@@ -170,14 +172,14 @@ facts, both recorded in this repository rather than smoothed over:
170
172
  Treat the 1.6 line's OpenCode 2 support as **real but partial**, and do not read
171
173
  the 1.6.x row as "OpenCode 2 is finished".
172
174
 
173
- ### Verified dependency and host evidence
175
+ ### Verified against which OpenCode versions
174
176
 
175
177
  | What | Verified against | How |
176
178
  |---|---|---|
177
- | V1 plugin API/generation checks | The dependency pair pinned by this release: `@opencode-ai/plugin@1.18.33` + `@opencode-ai/sdk@1.18.33` | `package.json`; generation-gate unit tests over injected host banners; installer end-to-end tests asserting the emitted `opencode.json` shape. This is not a claim that a V1 host was exercised end-to-end. |
179
+ | V1 plugin + generation gate | The OpenCode 1.18.x line. This package pins `@opencode-ai/plugin` and `@opencode-ai/sdk` to `1.18.33`; the highest published `opencode-ai` host package (the one shipping the `opencode` binary) is `1.18.34` | Dependency pin (`package.json`); generation-gate unit tests over injected host banners; installer end-to-end tests asserting the emitted `opencode.json` shape |
178
180
  | V2 plugin tool surface | `opencode 2.0.22` (the host the canary was written against) | `tests/canary/plugin-v2-tool-canary.test.mjs`, driving `hashline_edit` through a real `opencode serve` |
179
181
  | V2 against the current installable CLI | **Not verified.** Canary fails 12/12; see issue #216 | — |
180
- | Exact 1.X host version exercised end-to-end | **Unverified; V1 host canary deferred.** The sandbox runner is V2-only and `--run v1` is rejected | — |
182
+ | Exact 1.X host version the 1.6 line is exercised against end-to-end | **Unverified.** No V1 host leg exists: the sandbox runner is V2-only and `--run v1` is rejected | — |
181
183
 
182
184
  ## Delegation (native `task()`)
183
185
 
@@ -188,17 +190,27 @@ there is no Pantheon-specific delegation tool surface to configure. See
188
190
  [ADR-0011](.pantheon/memory-bank/adr/0011-delegation-engine-contract.md) for the
189
191
  historical engine contract.
190
192
 
191
- This 1.6.0-beta.7 candidate consolidates the final beta.6 follow-ups: safer
192
- V2 installation and permission migration, bounded in-process secret scanning,
193
- sandbox hardening, TUI lifecycle fixes, and a simpler agent dispatch path.
194
- Zeus answers no-change questions directly and routes bounded fixes once; the
195
- council procedure is loaded only for a council, without per-task KV/cache
196
- lookups. Runtime call counts and latency have not been measured. Live provider
197
- E2E and a model-backed interactive V2 TUI turn remain unverified.
198
-
199
- Transient delegation dispatch failures get at most one retry. A refusal or
200
- failed check is not repeated; after the retry fails, the configured fallback
201
- chain applies once or Zeus escalates.
193
+ This beta.8 candidate combines native per-agent MCP permissions for OpenCode V1
194
+ and V2, V2 delegation-permission alignment, simpler memory/compression
195
+ instructions, and a sandbox check that proves the installed package matches
196
+ this checkout instead of silently accepting stale npm-cached code. The isolated
197
+ sandbox launcher also pins the OpenCode background service to its dedicated
198
+ loopback port, rather than colliding with another OpenCode installation. The Zeus
199
+ prompt reuses one task-start memory-search result for context and routing;
200
+ runtime call counts and latency have not been measured. A beta.7 V2 dispatch
201
+ failed because the permission hook passed a bare string to `ctx.session.get`
202
+ instead of the V2 input object `{ sessionID }`; beta.8 corrects the call and
203
+ adds contract tests for the success and failure cases. The user subsequently
204
+ reported a successful Hermes liveness delegation in the active session, but
205
+ freshly restarting and testing the beta.8 sandbox remains the end-to-end gate.
206
+ The original report also included a separate `GET /api/session/{id}/permission`
207
+ 404; the session ID exists in the beta7-candidate database but not the default
208
+ global database. Both OpenCode services were running, so the 404 in the global
209
+ log may come from the other instance; this remains an end-to-end verification
210
+ item.
211
+
212
+ Delegated tasks get at most one retry after an initial timeout or failure. If
213
+ that retry fails, the configured fallback or escalation chain applies.
202
214
 
203
215
  ## Cost tool backend
204
216
 
@@ -289,8 +301,8 @@ per installation; V1 and V2 Pantheon plugins must never be registered together.
289
301
  | | V1 | V2 |
290
302
  |---|---|---|
291
303
  | OpenCode config key | singular `plugin` | plural `plugins` |
292
- | Pantheon registration | `src/plugin.ts` plus `src/plugins/pantheon-hooks.ts` | Version-pinned npm package `pantheon-opencode@<version>` (root export loads V2) |
293
- | Runtime contract | Pantheon V1 plugin: 6 tools (`hashline_edit`, the 3 goal tools, `pantheon_cost`, `pantheon_model`), event/tool hooks and V1 compaction handling | V2 plugin: 3 Pantheon tools when required enforcement registers, 5 event subscriptions, session hooks (`prompt`, `context`), a read-only and secret-scanning `execute.before` hook, plus configuration transforms |
304
+ | Pantheon registration | `src/plugin.ts` plus `src/plugins/pantheon-hooks.ts` | `<installed>/src/plugin-v2` directory (`index.ts` re-exports `src/plugin-v2.ts`) |
305
+ | Runtime contract | Pantheon V1 plugin: 6 tools (`hashline_edit`, the 3 goal tools, `pantheon_cost`, `pantheon_model`), event/tool hooks and V1 compaction handling | Full V2 plugin: 3 tools (`hashline_edit`, `pantheon_cost`, `pantheon_model`), 5 event subscriptions, session hooks (`prompt`, `context`), a read-only-enforcing tool `execute.before` hook, plus configuration transforms |
294
306
  | V1 APIs | Registered | Own tool definitions via `ctx.tool.transform()` — not the V1 plugin path |
295
307
 
296
308
  The V2 plugin provides 3 orchestration tools (`hashline_edit`, `pantheon_cost`,
@@ -328,41 +340,14 @@ every call. Unsupported V2 features are `legacy-hooks` (the V1-specific hook
328
340
  surface), `catalog-transform`, `integration-transform`, `skill-transform` and
329
341
  `goal-tools`.
330
342
 
331
- When `init --opencode-version v2` migrates a V1-shaped permission config, it
332
- translates `task` to the V2 `subagent` action and `write` to `edit` (which also
333
- covers host `write`/`patch`). If legacy `edit` and `write` rules collide on a
334
- resource, migration keeps the stricter effect. Hand-edited V2 configs should
335
- use the native top-level `permissions` array and action/resource/effect form.
336
-
337
- ### Runtime secret-scanning limit
338
-
339
- V1 and V2 use the same in-process scanner on their tool `execute.before` paths.
340
- The scanner accepts up to **5 MiB (5,242,880 UTF-8 bytes) of serialized hook
341
- payload**. Larger or malformed payloads are denied fail-closed; the rejected
342
- payload is not written to the scanner log. This bound applies to the complete
343
- serialized hook payload, not just one argument field. Before calling
344
- `JSON.stringify`, the scanner iteratively preflights compact JSON byte size,
345
- including UTF-8 and JSON escapes, and stops as soon as the limit is exceeded.
346
- It rejects cycles, enumerable accessors and `toJSON` hooks, proxies, excessive
347
- nesting, and non-JSON values without serializing or logging them.
348
-
349
- V2 registers its required enforcement hook before registering Pantheon tools.
350
- If the host rejects that hook, startup reports `secret-scan-hook` and
351
- `pantheon-tools-disabled`, and Pantheon V2 tools are not registered. This does
352
- not disable or claim scanner coverage for native host built-in tools; those may
353
- remain available under the host's own policies. The opt-in timing harness is
354
- reproducible with `npx tsx scripts/bench-secret-scanner.ts`: it runs 3 warmups
355
- and 15 measured calls per size, reporting median timings for the current
356
- `scanSecretText` implementation on safe ASCII strings only. It excludes payload
357
- preflight/serialization and host-hook overhead, is not a historical or
358
- Bash-versus-TypeScript comparison, and makes no speedup claim. It does not print
359
- scan input.
360
-
361
- The package exposes both contracts as importable exports: the package root and
362
- `pantheon-opencode/plugin-v2` load V2; `pantheon-opencode/plugin` loads V1.
363
- `pantheon-opencode/v2-bridge` is currently an importable utility only:
364
- production setup does not wire it into the V2 plugin, so it does not provide
365
- runtime interoperability or restore V1 goal/board features.
343
+ The package exposes both contracts as importable exports: `pantheon-opencode/plugin`
344
+ (V1), `pantheon-opencode/plugin-v2` (V2) and `pantheon-opencode/v2-bridge`
345
+ (optional interop), so a host can load either contract explicitly.
346
+
347
+ The V1→V2 bridge (`src/pantheon/v2-bridge.ts`) enables optional interop:
348
+ V1 infrastructure singletons (BackgroundJobBoard, GoalStore,
349
+ TodoEnforcer, VisionHandler) are passed through V2 `ctx.options`. The bridge is
350
+ optional — V2 works standalone with graceful degradation.
366
351
 
367
352
  Select the contract explicitly when installing:
368
353
 
@@ -379,8 +364,8 @@ the host in this order: an explicit `OPENCODE_VERSION=v1|v2` wins; otherwise an
379
364
  binary is asked for its `--version` and a major of 2 or more selects V2. Every
380
365
  other case — an unreadable probe, an unparseable banner, or a banner whose
381
366
  version-like tokens contradict each other with no tool name to break the tie —
382
- warns once and falls back to V1, because the V2-only package export is not a
383
- valid V1 runtime contract on an unknown 1.x host.
367
+ warns once and falls back to V1, because a plural `plugins` directory entry on
368
+ an unknown 1.x host loses the plugin entirely.
384
369
 
385
370
  The probe prefers the token that follows the tool name, so a runtime token
386
371
  ahead of it (`node v22.1.0 (opencode 1.18.33)`) or a trailing build date
@@ -444,9 +429,8 @@ Key order does not matter.
444
429
  One command keeps an existing installation current:
445
430
 
446
431
  ```bash
447
- # Without a global install, pin the intended npm dist-tag. The `latest` tag
448
- # reflects the most recently published stable release, not an unpublished
449
- # release candidate:
432
+ # Without a global install, ALWAYS pin the dist-tag — plain `npx
433
+ # pantheon-opencode` resolves `latest`, which is the stable release (1.4.3):
450
434
  npx pantheon-opencode@beta update # npm beta channel + config refresh
451
435
  npx pantheon-opencode@beta update --stable # stable channel instead
452
436
 
@@ -534,7 +518,9 @@ full `TARGET_SHA`; a second pack is not interchangeable.
534
518
 
535
519
  CI also rebuilds the TUI with `npm run build --prefix src/plugins/tui` and
536
520
  checks every packaged `dist` artifact byte-for-byte against its checked-in
537
- version, including final newlines.
521
+ version, including final newlines. The build includes separate V1 and native
522
+ OpenCode V2 TUI entrypoints; `init` selects the entrypoint and sidebar slot API
523
+ for the host generation in use.
538
524
 
539
525
  ## Sandbox validation (V2)
540
526
 
@@ -547,12 +533,15 @@ agent delegation. The gate is fail-closed: every required check must return an
547
533
  explicit PASS; timeouts, auth/network/provider failures and missing
548
534
  prerequisites block the run.
549
535
 
550
- The historical hook canary observed at least one callback on an OpenCode
551
- v2.0.18 host; the tool canary was written against v2.0.22. Those observations
552
- do not establish compatibility with the current installable `@opencode-ai/cli@beta`,
553
- an SDK contract for all of 2.x, or a V1 host. This release pins the V1 plugin
554
- dependency pair at `@opencode-ai/plugin@1.18.33` and `@opencode-ai/sdk@1.18.33`;
555
- the V1 host canary remains deferred.
536
+ The runner defaults to the current stable `@opencode/cli` package and its
537
+ `opencode2` alias; set `OPENCODE_V2_SPEC` only when a test needs a different
538
+ host build. This keeps Pantheon beta testing separate from the OpenCode CLI
539
+ release channel.
540
+
541
+ "V2" here refers only to the hook canary observed against an OpenCode v2.0.18
542
+ host, where at least one tested hook callback fired; it does not establish
543
+ compatibility with the stable `@opencode/plugin@2.0.18` SDK or full 2.x
544
+ contract. This branch still pins transitional `@opencode-ai/plugin@1.18.30`.
556
545
  On hosts where both `opencode` and `opencode2` exist, the latter is typically
557
546
  a shim that execs the same binary, so an older side-by-side comparison proved
558
547
  nothing about the binary itself. The project is V2-exclusive, so there is a
@@ -560,12 +549,13 @@ single leg.
560
549
 
561
550
  ```bash
562
551
  scripts/test-opencode-v2-sandbox.sh --prepare # tarball + install + init in the sandbox
552
+ ~/pantheon-sandbox/start-pantheon.sh # interactive TUI in that isolated beta sandbox
563
553
  scripts/test-opencode-v2-sandbox.sh --run v2 # base validation only
564
554
  scripts/test-opencode-v2-sandbox.sh --prompts # base validation + prompt battery
565
555
  scripts/test-opencode-v2-sandbox.sh --rehydrate # offline context rehydration/session-summary probe
566
556
  scripts/test-opencode-v2-sandbox.sh --hooks # V2 hook callback canary
567
557
  scripts/test-opencode-v2-sandbox.sh --rehydrate --hooks # run both canaries
568
- scripts/test-opencode-v2-sandbox.sh --reset # guarded reset of the sandbox root
558
+ scripts/test-opencode-v2-sandbox.sh --reset # wipe the sandbox root
569
559
  ```
570
560
 
571
561
  Modes are combinable (e.g. `--prepare --run v2 --prompts`). `--rehydrate` runs
@@ -578,20 +568,8 @@ rehydration fails, and the command returns a failing status afterward. These
578
568
  are test/sandbox canaries, not proof of Pantheon security enforcement. Binaries
579
569
  are resolved strictly inside the sandbox npm prefix — a non-prepared sandbox
580
570
  fails fast instead of silently testing the host installation. The sandbox is
581
- always built from the checkout this script lives in unless `PANTHEON_REPO` is
582
- set to an absolute path for an existing `pantheon-opencode` checkout. The same
583
- resolved checkout is used by prepare and the generated `run-test.sh`; dangling,
584
- relative, and non-Pantheon paths fail before packaging. `--prepare` generates
585
- `run-test.sh`, `start-pantheon.sh`, and a sandbox-local `README.md`.
586
-
587
- `PANTHEON_V2_PORT` selects the dedicated loopback port (default `49376`). The
588
- harness validates the port and refuses an occupied listener without reusing or
589
- stopping it. `PANTHEON_V2_HOST` defaults to `127.0.0.1` and rejects non-loopback
590
- addresses. `PANTHEON_V2_MCP_LIST_TIMEOUT` controls each `mcp list` call
591
- (default `15` seconds). On prepare, only hash-named Node compile-cache files
592
- owned by the current user and older than 30 days may expire under
593
- `tmp/node-compile-cache`; runtime state and unrecognized files (including
594
- handoff evidence) are preserved.
571
+ always built from the checkout this script lives in; it never infers a
572
+ repository from a sibling directory.
595
573
 
596
574
  This validates the prepared isolated sandbox only. A PASS is not proof of
597
575
  support for every real host or for host configurations that were not exercised.
@@ -610,7 +588,7 @@ Env overrides:
610
588
  |----------|---------|---------|
611
589
  | `PANTHEON_SANDBOX_ROOT` | `~/pantheon-sandbox` | Sandbox root (refused if unsafe for `--reset`) |
612
590
  | `OPENCODE_V1_SPEC` | `opencode-ai@1.18.18` | Configures the V1 plugin only; the V2-only sandbox runner does not consume or support it |
613
- | `OPENCODE_V2_SPEC` | `@opencode-ai/cli@beta` | npm spec providing the `opencode2` binary |
591
+ | `OPENCODE_V2_SPEC` | `@opencode/cli@latest` | npm spec providing the `opencode2` binary |
614
592
  | `PANTHEON_SANDBOX_MODEL` | `opencode-go/mimo-v2.5` | Model used by init and prompts |
615
593
  | `PANTHEON_PROMPT_TIMEOUT` | `300` | Per-prompt timeout in seconds |
616
594