pantheon-opencode 1.4.3 → 1.5.0-beta.1

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 (111) hide show
  1. package/.pantheon/code-mode/.gitkeep +0 -0
  2. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-1.json +8 -0
  3. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-10.json +8 -0
  4. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-11.json +8 -0
  5. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-2.json +8 -0
  6. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-3.json +8 -0
  7. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-4.json +8 -0
  8. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-5.json +8 -0
  9. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-6.json +8 -0
  10. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-7.json +8 -0
  11. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-8.json +8 -0
  12. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/checkpoint-9.json +8 -0
  13. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/heartbeat.json +8 -0
  14. package/.pantheon/code-mode/.pantheon/deepwork/initial-token-40k/session.json +11 -0
  15. package/.pantheon/code-mode/README.md +93 -0
  16. package/.pantheon/code-mode/checkpoint-session.py +7 -0
  17. package/.pantheon/code-mode/checkpoint-session.sh +11 -0
  18. package/.pantheon/code-mode/checkpoint_session.py +481 -0
  19. package/.pantheon/code-mode/compress-inline.py +450 -0
  20. package/.pantheon/code-mode/eval-llm-judge.py +255 -0
  21. package/.pantheon/code-mode/eval-monte-carlo.py +368 -0
  22. package/.pantheon/code-mode/eval-run.py +197 -0
  23. package/.pantheon/code-mode/eval-static.py +321 -0
  24. package/.pantheon/code-mode/example-sync.sh +5 -0
  25. package/.pantheon/code-mode/session-end-save.py +186 -0
  26. package/.pantheon/code-mode/session-end-save.sh +18 -0
  27. package/.pantheon/code-mode/test-allowed.sh +5 -0
  28. package/.pantheon/code-mode/test-auto-continue-checkpoint.sh +179 -0
  29. package/.pantheon/code-mode/test-env.sh +7 -0
  30. package/.pantheon/code-mode/test-prlimit.sh +9 -0
  31. package/.pantheon/code-mode/test-timeout.sh +6 -0
  32. package/README.md +158 -1101
  33. package/README.pt-BR.md +222 -0
  34. package/bin/pantheon-init.mjs +30 -11
  35. package/opencode.json +1 -0
  36. package/package.json +14 -3
  37. package/plugin.json +15 -0
  38. package/scripts/_pantheon_paths.py +48 -7
  39. package/scripts/ci-validate-yaml.py +7 -2
  40. package/scripts/code_mode_server.py +33 -2
  41. package/scripts/doctor.mjs +135 -127
  42. package/scripts/generate-preset-docs.mjs +127 -66
  43. package/scripts/generate-prompts.sh +2 -2
  44. package/scripts/install/cli-ui.mjs +8 -1
  45. package/scripts/install/config-migration.mjs +401 -0
  46. package/scripts/install/health-check.mjs +3 -3
  47. package/scripts/install/model-picker.mjs +72 -23
  48. package/scripts/install/opencode-version.mjs +47 -0
  49. package/scripts/install/opencode.mjs +261 -88
  50. package/scripts/install/plugin.mjs +112 -42
  51. package/scripts/install/shared.mjs +13 -158
  52. package/scripts/install-mcp.mjs +44 -232
  53. package/scripts/mcp_persistence_server.py +344 -15
  54. package/scripts/mcp_resources_server.py +144 -40
  55. package/scripts/memory_mcp_server.py +2 -2
  56. package/scripts/recover-zenodo-deposition.mjs +146 -0
  57. package/scripts/sync-tui.mjs +32 -7
  58. package/scripts/test-opencode-v1-v2-sandbox.sh +591 -0
  59. package/scripts/uninstall.mjs +298 -954
  60. package/scripts/validate-zenodo-release.mjs +154 -0
  61. package/scripts/zenodo-artifact.mjs +21 -0
  62. package/scripts/zenodo-release-state.mjs +53 -0
  63. package/src/agents/zeus.md +25 -14
  64. package/src/mcp/_pantheon_paths.py +48 -7
  65. package/src/mcp/code_mode_server.py +33 -2
  66. package/src/mcp/eval_store.py +1 -1
  67. package/src/mcp/mcp_persistence_server.py +344 -15
  68. package/src/mcp/mcp_resources_server.py +144 -40
  69. package/src/mcp/pantheon_vision_server.py +1 -1
  70. package/src/mcp/toon_codec.py +491 -0
  71. package/src/pantheon/background-job-board.ts +67 -1
  72. package/src/pantheon/cost-command.ts +13 -9
  73. package/src/pantheon/delegate-manager.ts +384 -0
  74. package/src/pantheon/delegate-task-adapter.ts +444 -0
  75. package/src/pantheon/delegation-classifier.ts +307 -0
  76. package/src/pantheon/delegation-enforce.ts +13 -12
  77. package/src/pantheon/delegation-finalize.ts +374 -0
  78. package/src/pantheon/delegation-notify.ts +212 -0
  79. package/src/pantheon/delegation-toast.ts +73 -0
  80. package/src/pantheon/delegation.ts +1120 -0
  81. package/src/pantheon/goal-loop.ts +2 -2
  82. package/src/pantheon/goal-store.ts +1 -1
  83. package/src/pantheon/hashline/tool.ts +2 -2
  84. package/src/pantheon/model-command.ts +2 -1
  85. package/src/pantheon/permission-eval.ts +284 -0
  86. package/src/pantheon/step-cap.ts +110 -0
  87. package/src/pantheon/token-opt.ts +555 -0
  88. package/src/pantheon/toon-codec.ts +481 -0
  89. package/src/pantheon/tui-version-check.ts +1 -3
  90. package/src/pantheon/v2-bridge.ts +129 -0
  91. package/src/pantheon/v2-events.ts +131 -0
  92. package/src/pantheon/v2-hooks.ts +287 -0
  93. package/src/pantheon/v2-tool-definitions.ts +331 -0
  94. package/src/pantheon/zeus-delegate-with-retry.ts +406 -0
  95. package/src/plugin-v2/index.ts +21 -0
  96. package/src/plugin-v2.ts +836 -0
  97. package/src/plugin.ts +241 -42
  98. package/src/plugins/tui/dist/server.d.ts +1 -1
  99. package/src/plugins/tui/dist/server.d.ts.map +1 -1
  100. package/src/plugins/tui/dist/server.js +1 -1
  101. package/src/plugins/tui/dist/server.js.map +1 -1
  102. package/src/plugins/tui/dist/tui.d.ts +10 -7
  103. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  104. package/src/plugins/tui/dist/tui.js +11 -8
  105. package/src/plugins/tui/dist/tui.js.map +1 -1
  106. package/src/plugins/tui/dist/tui.tsx +22 -16
  107. package/src/plugins/tui/package-lock.json +51 -51
  108. package/src/plugins/tui/package.json +7 -7
  109. package/src/plugins/tui/src/index.tsx +28 -24
  110. package/src/skills/README.md +0 -2
  111. package/src/pantheon/tool-context.ts +0 -41
package/README.md CHANGED
@@ -1,1161 +1,218 @@
1
+ # Pantheon
1
2
 
2
- <h1 align="center">Pantheon</h1>
3
+ **A clearer way to work with OpenCode on real software projects.** Pantheon
4
+ brings planning, implementation, review, and documentation into one guided
5
+ experience. It is an OpenCode plugin and installer for teams and developers who
6
+ want useful structure without giving up control of their code.
3
7
 
4
- <p align="center">
5
- <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-v1.4.2-blue" alt="Version"></a>
6
- <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License"></a>
7
- <a href="docs/agents/README.md"><img src="https://img.shields.io/badge/agents-14-purple" alt="Agents"></a>
8
- <a href="src/skills/README.md"><img src="https://img.shields.io/badge/skills-21-orange" alt="Skills"></a>
9
- <a href="commands/"><img src="https://img.shields.io/badge/commands-11-red" alt="Commands"></a>
10
- <a href="https://github.com/ils15/pantheon/actions"><img src="https://img.shields.io/github/actions/workflow/status/ils15/pantheon/ci.yml?branch=main&label=CI" alt="CI"></a>
11
- </p>
8
+ [Português (Brasil)](README.pt-BR.md) ·
9
+ [Repository](https://github.com/ils15/pantheon-opencode) · [MIT License](LICENSE)
12
10
 
13
- **14 specialized AI agents** that plan, build, review, and deploy features through enforced TDD, persistent project memory, and human approval at every gate.
11
+ [![Version](https://img.shields.io/github/v/release/ils15/pantheon-opencode?label=version)](https://github.com/ils15/pantheon-opencode/releases/tag/v1.5.0)
12
+ [![CI](https://img.shields.io/github/actions/workflow/status/ils15/pantheon-opencode/ci.yml?branch=main&label=CI)](https://github.com/ils15/pantheon-opencode/actions)
13
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.22306637.svg)](https://doi.org/10.5281/zenodo.22306637)
14
14
 
15
- Stop settling for generalist single-agent coding. Pantheon's conductor-delegate architecture dispatches expert agents with isolated context windows — parallel execution, zero context bleed, and quality gates that block anything below 80% coverage.
15
+ ## What is it?
16
16
 
17
- Supports **OpenCode** — multi-agent orchestration for your editor.
17
+ Pantheon is a companion for [OpenCode](https://opencode.ai/) that helps you
18
+ move from an idea to a reviewed change. It gives your coding sessions a shared
19
+ way to plan work, make progress, check results, and keep useful project context.
18
20
 
19
- ---
20
-
21
- ## Quick Links
22
-
23
- | Resource | Link |
24
- |----------|------|
25
- | 📖 **Agent Reference** | [docs/agents/README.md](docs/agents/README.md) — all 14 agents |
26
- | 📖 **Skills Reference** | [src/skills/README.md](src/skills/README.md) — all 21 skills |
27
- | 🚀 **Installation Guide** | [docs/INSTALLATION.md](docs/INSTALLATION.md) |
28
- | 🔌 **MCP Server Guide** | [docs/mcp-recommendations.md](docs/mcp-recommendations.md) — recommended MCP servers for each project type |
29
- | 🔌 **MCP Tool Registry** | [docs/mcp-tools.md](docs/mcp-tools.md) — canonical MCP tool reference |
30
- | 🔌 **MCP User Guide** | [docs/mcp-user-guide.md](docs/mcp-user-guide.md) — adding custom MCP servers |
31
- | ⚡ **Quick Start** | [docs/QUICKSTART.md](docs/QUICKSTART.md) |
32
- | ⚡ **OpenCode Guide** | [docs/platforms/opencode.md](docs/platforms/opencode.md) |
33
-
34
- ---
35
-
36
- ## Overview
37
-
38
- Traditional single-agent coding produces mediocre results because one agent attempts to
39
- plan, implement, test, review, and document simultaneously. The result is context
40
- fragmentation, skipped tests, and generic code.
41
-
42
- **Pantheon** solves this with **specialization**: each agent is an expert at exactly
43
- one thing and is invoked only when that expertise is needed. Agents collaborate through a
44
- conductor-delegate architecture where Zeus (the orchestrator) dispatches work to
45
- specialized sub-agents with isolated context windows, enforced quality gates, and human
46
- approval at every transition.
47
-
48
- | Metric | Single Agent | Pantheon |
49
- |--------|-------------|----------|
50
- | Average test coverage | 65–75% | **92%** |
51
- | TDD enforcement | Optional | **Enforced (RED→GREEN→REFACTOR)** |
52
- | Code review cadence | End of feature | **After every phase** |
53
- | Bugs reaching production | 3–5 per feature | **Near zero** |
54
- | Context efficiency | 10–20% reasoning | **70–80% reasoning** |
55
- | Parallel execution | Sequential only | **Multi-agent parallel** |
56
- | Documentation | Manual | **Auto-committed in git** |
57
- | Architecture pattern | Monolithic | **Specialized conductor-delegate** |
58
-
59
- > Metrics based on internal benchmarks across 50+ feature implementations in the Pantheon
60
- > test suite. Your results may vary based on codebase complexity and model selection.
61
-
62
- ---
63
-
64
- ## How It Works
65
-
66
- The system operates in defined phases controlled by **you**. Agents work in parallel
67
- within each phase, and every transition is gated by your explicit approval.
68
-
69
- ```mermaid
70
- ---
71
- config:
72
- look: classic
73
- theme: dark
74
- layout: elk
75
- ---
76
- flowchart TD
77
- classDef user fill:#2d5a8c,stroke:#5a8ac4,stroke-width:2px,color:#e2e8f0
78
- classDef core fill:#1f2937,stroke:#4b5563,stroke-width:2px,color:#f3f4f6,font-weight:bold
79
- classDef planner fill:#1e3a5f,stroke:#3b82f6,stroke-width:2px,color:#dbeafe
80
- classDef ai fill:#4a1a3f,stroke:#c084fc,stroke-width:2px,color:#f3e8ff
81
- classDef executor fill:#7c2d12,stroke:#ea580c,stroke-width:2px,color:#fed7aa
82
- classDef qa fill:#3f1a3e,stroke:#d946a6,stroke-width:2px,color:#f5d1f8
83
- classDef infra fill:#1e3a3f,stroke:#14b8a6,stroke-width:2px,color:#ccfbf1
84
- classDef ops fill:#1e294b,stroke:#60a5fa,stroke-width:1px,color:#bfdbfe
85
- classDef gate fill:#1f1f1f,stroke:#fbbf24,stroke-width:2px,color:#fbbf24,stroke-dasharray: 5 5
86
-
87
- User["You / Human"]:::user
88
- Gate0{{"⏸️ Gate 0<br/>Approve Decision"}}:::gate
89
- Gate1{{"⏸️ Gate 1<br/>Approve Plan"}}:::gate
90
- Gate2{{"⏸️ Gate 2<br/>Approve Review"}}:::gate
91
- Gate3{{"⏸️ Gate 3<br/>Commit"}}:::gate
92
-
93
- subgraph Orchestrator["Orchestrator"]
94
- Zeus["Zeus<br/>Central Coordinator"]:::core
95
- end
21
+ ## Why use it?
96
22
 
97
- subgraph Plan["Planning & Discovery"]
23
+ - **Less context switching:** keep planning and building in the same workflow.
24
+ - **More deliberate changes:** ask for reviews and checks before calling work
25
+ finished.
26
+ - **A repeatable starting point:** use the same setup across projects and
27
+ collaborators.
28
+ - **You stay in charge:** Pantheon supports your decisions; it does not replace
29
+ your judgment or your review of generated code.
98
30
 
99
- Athena["Athena<br/>Strategic Planner"]:::planner
100
- Apollo["Apollo<br/>Codebase Scout"]:::planner
101
- Nyx["Nyx<br/>Observability"]:::planner
102
- end
31
+ ## Start in 2 minutes
103
32
 
104
- subgraph AI["AI Infrastructure"]
105
- Hephaestus["Hephaestus<br/>AI Pipelines<br/>RAG / LangChain"]:::ai
106
- end
33
+ Requirements: [OpenCode 1.18.4+](https://opencode.ai/docs/) and Node.js 18+.
107
34
 
108
- subgraph Impl["Implementation<br/>Parallel Execution"]
109
- Hermes["Hermes<br/>Backend APIs"]:::executor
110
- Aphrodite["Aphrodite<br/>Frontend UI"]:::executor
111
- Demeter["Demeter<br/>Database"]:::executor
112
- end
113
-
114
- subgraph Quality["Quality & Observability"]
115
- Themis["Themis<br/>Security & Coverage Audit"]:::qa
116
- Nyx["Nyx<br/>Observability<br/>Tracing & Cost"]:::qa
117
- end
118
-
119
- subgraph Deploy["Deployment & Release"]
120
- Prometheus["Prometheus<br/>Infrastructure<br/>Docker / CI/CD"]:::infra
121
- Iris["Iris<br/>GitHub Operations<br/>PR / Release"]:::ops
122
- Mnemosyne["Mnemosyne<br/>Documentation<br/>Memory Bank"]:::ops
123
- end
124
-
125
- subgraph Express["Express Lane"]
126
- Talos["Talos<br/>Rapid Hotfixes"]:::qa
127
- end
128
-
129
- subgraph Domain["Domain Specialist"]
130
- Gaia["Gaia<br/>Remote Sensing"]:::planner
131
- end
132
-
133
- User -->|"/implement-feature"| Zeus
134
-
135
- Gate0 -->|Approved| Zeus
136
- Zeus -->|Phase 1| Athena
137
- Athena -->|Discovers| Apollo
138
- Apollo -->|Findings| Athena
139
- Athena --> Gate1
140
- Gate1 -->|Approved| Zeus
141
-
142
- Zeus -->|"Phase 2 (AI Infrastructure)"| AI
143
- Hephaestus --> Zeus
144
-
145
- Zeus -->|"Phase 3 (Implementation)"| Impl
146
- Hermes & Aphrodite & Demeter --> Quality
147
-
148
- Impl -.->|Nested Apollo| Apollo
149
-
150
- Nyx --> Themis
151
- Themis --> Gate2
152
- Gate2 -->|Approved| Zeus
153
-
154
- Zeus -->|"Phase 4 (Deploy & Release)"| Deploy
155
- Prometheus & Iris & Mnemosyne --> Gate3
156
- Gate3 -->|"git commit"| User
157
-
158
- User -.->|"/fix"| Express
159
- User -.->|"/plan-architecture"| Domain
160
- ```
161
-
162
- ---
163
-
164
- ## Platform
165
-
166
- - **OpenCode** — Pantheon v1.0 is OpenCode-only. [Installation guide](docs/INSTALLATION.md).
35
+ From the project where you want to use Pantheon:
167
36
 
168
37
  ```bash
169
- # Interactive TUI (default) — select components visually
170
38
  npx pantheon-opencode init
171
-
172
- # Headless mode — for CI and automation
173
- npx pantheon-opencode init --headless
174
-
175
- # (Optional) Install + activate a model routing preset
176
- npx pantheon-opencode init --preset go-fast
177
-
178
- # (Optional) Install MCP servers + skills + TUI plugin
179
- npm run setup
180
-
181
- # Launch OpenCode with background subagents
182
- export OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true
183
39
  opencode
184
40
  ```
185
41
 
186
- ### OpenCode V1/V2 — Dual Version
187
-
188
- Pantheon's shared config is **V1-shaped and valid under both OpenCode versions**:
189
-
190
- | | V1 | V2 (beta) |
191
- |---|---|---|
192
- | Binary | `opencode` (1.18.18) | `opencode2` (v0.0.0-next-17444) |
193
- | Config locations | `~/.config/opencode/`, `<project>/opencode.json`, `.opencode/` | Same — V2 reads the same locations |
194
- | Config handling | Loads V1 shape directly | Normalizes V1 fields **in memory** — no rewrite, no native V2 conversion |
195
- | State DB | `~/.local/share/opencode/opencode.db` | `~/.local/share/opencode/opencode-v2.db` (isolated via `OPENCODE_DB`) |
196
- | Service port | 49374 | 49375 (must differ from V1) |
197
-
198
- The `pantheon_cost` report preserves the V1 database default. Set
199
- `PANTHEON_OPENCODE_VERSION=v1` or `v2` to select the corresponding state DB
200
- explicitly (`opencode.db` or `opencode-v2.db`). For custom installations,
201
- `PANTHEON_COST_DB=/absolute/path/to/opencode.db` takes precedence over the
202
- version selector; an explicit `dbPath` supplied by the tool caller takes
203
- precedence over both. The resolver never probes the other version's database,
204
- and reports an actionable error when the selected DB is missing or has an
205
- incompatible schema.
206
-
207
- **What changed for V2 compatibility (Phase 3):**
208
-
209
- - `subagent_depth` moved from top-level to `experimental.subagent_depth` — V2 silently ignores the top-level key. The installer migrates existing configs automatically.
210
- - Instruction content consolidated into `AGENTS.md` (generated by `scripts/build-agents-md.mjs` from `src/instructions/*.instructions.md`) — V2 accepts but does **not** load the `instructions` config key; both versions auto-load `AGENTS.md`.
211
- - `npx pantheon-opencode init --version v2` labels an install for V2 (informational — the config is shared).
212
-
213
- **Known V2 beta gaps:**
214
-
215
- - `instructions` config key accepted but not loaded → content lives in `AGENTS.md`.
216
- - `formatter` / `lsp` config not executed.
217
- - `--subtask` delegation flag is a no-op.
218
-
219
- ### Background Delegation
220
-
221
- Zeus (and other root sessions) dispatch agents as **background child sessions**
222
- via OpenCode's native `task(background=true, ...)` API. The plugin layer keeps a
223
- persistent job board (`BackgroundJobBoard`, `.pantheon/board/state.json`, 24h
224
- TTL) that tracks in-flight work and carries it forward across context
225
- compaction, so a compacted session does not lose track of running delegations.
226
-
227
- The plugin no longer ships a delegate toolset (`pantheon_delegate`,
228
- `pantheon_delegation_read`, `pantheon_delegation_list` were removed in 1.4.3).
229
- Dispatch and result collection use the native `task()` / `task_status()` API.
230
-
231
- **Completion visibility — zero chat noise.** Delegation notifications are never
232
- injected into the chat transcript: neither `chat.message` nor any other chat
233
- hook or transcript marker is used as a delivery channel. When a job reaches a
234
- terminal state, the plugin writes a file-only audit log line (echo opt-in via
235
- `PANTHEON_HOOKS_LOG`). Completion visibility lives in the legitimate channels:
236
- the board `[unread]` marker, TUI toasts (`PANTHEON_TOASTS` gate), and compaction
237
- carry-forward. Reconcile is an acknowledgment, not a completion — it never
238
- re-fires the terminal transition.
239
-
240
- **Timeout:** `background_delegation.timeout_ms` (default `900000` = 15 min). A job
241
- that has not reached a terminal state is finalized as `error`/`timedOut`.
242
-
243
- **Compaction carry-forward:** during context compaction, running and unread
244
- terminal delegations (capped at `background_delegation.max_compaction_items`,
245
- default 10) are carried into the compacted context so the parent doesn't lose
246
- track of in-flight work.
247
-
248
- **Compaction summary v2 (1.3.4):** the `experimental.session.compacting` hook
249
- now emits sections in a stable order — `<pantheon-context directive>`
250
- ("preserve these sections verbatim in the summarized context", emitted only
251
- when at least one other section follows), `<mission_context>` (active,
252
- non-done goals), `<todo_context>` (pending todos), then the delegation blocks
253
- (running, then unread terminal ≤ `max_compaction_items`) byte-for-byte
254
- unchanged. Each source is fail-open: a disabled, unscoped (no sessionID),
255
- throwing, or empty source omits its section (warned to `hooks.log`), and a
256
- totally-empty state returns nothing — the hook injects nothing, preserving
257
- the pre-1.3.4 behavior.
258
-
259
- **Post-compaction todo preservation (1.3.4):** the session's todo list is
260
- captured via the `session.todo` GET at compacting time and restored by
261
- intercepting the first `todowrite` after `session.compacted` — opencode
262
- 1.18.x exposes no todo write API, so that first `todowrite` has its args
263
- rewritten with the exact captured list (no model cooperation, zero transcript
264
- noise). Subsequent `todowrite` calls inside the 5s restore window are denied
265
- with a clear "retry in a moment" error; the snapshot TTL is 60s. Fail-open: a
266
- failed capture, expired snapshot, or malformed hook output degrades to a
267
- logged warn and pass-through.
268
-
269
- **Post-compaction state re-assertion (1.3.4):** on `session.compacted`, fresh
270
- state — running/unread delegations from the board + active goals, capped at 10
271
- lines — remains available through compaction carry-forward. A session with
272
- nothing to assert is a silent skip; no chat transcript injection is performed.
273
-
274
- **Preemptive compaction check (1.3.4):** a pure threshold core
275
- (`preemptive-compact.ts`) warns the model before the context fills: at 78%
276
- usage, re-warning only when usage rose ≥5pp since the last warning. It is
277
- dormant / ready-to-wire — opencode 1.18.x exposes no runtime context-usage
278
- percentage, so nothing observes it yet; when a source appears, the caller
279
- wires it in (the enqueue callback is injected).
280
-
281
- **Model selection (1.4.1):** the child session inherits the parent session's
282
- model through OpenCode. A model override is supplied only when the active
283
- routing profile defines one; no model API-key validation is performed here.
284
-
285
- **agentModels wiring (1.3.4):** `loadRoutingAgentModels` extracts only the
286
- per-agent models from the explicitly active routing profile and passes them as
287
- `options.agentModels`. No active profile, missing profile entry, or profile
288
- without `model` produces an empty map; there is no implicit first-preset or
289
- DeepSeek fallback. A missing or unparseable `routing.yml` is fail-open and
290
- omits the child model.
291
-
292
- **Delegation log hygiene (1.3.4):** `delegations.log` now records the real
293
- `task_id` (omitted when empty, never `""`) and a **numeric** `duration_ms`
294
- (null when unset) so downstream aggregation works. Terminal events are
295
- file-only audit entries; completion is surfaced by TUI toast (when enabled)
296
- and the board — never by chat delivery.
297
-
298
- **Env vars & config:**
299
-
300
- - `OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true` — required (see launch block above).
301
- - `PANTHEON_TOASTS` — TUI toast gate for the delegation lifecycle signals.
302
- Default `{errors, delegations, council}`; `PANTHEON_TOASTS=off` disables all
303
- TUI toasts (delegation signals then only surface via the board `[unread]`
304
- marker and the on-disk audit log — never via chat.message injection from the
305
- plugin).
306
- - `background_delegation` section in `src/routing.yml` — `timeout_ms`,
307
- `poll_ms`, `max_compaction_items`, `prune_ttl_ms`, `session_max`,
308
- `retry_count`.
309
-
310
- See `src/agents/zeus.md` for the agent-facing delegation protocol.
311
-
312
- ### Real-time Delegations panel (1.3.4)
313
-
314
- The TUI sidebar ships a live **Delegations** panel (open by default, above the
315
- collapsed Sessions list). Its primary source is `api.client.session.children`,
316
- so it shows **both** kinds of background work in one place:
317
-
318
- - **Board-tracked children** — rendered with their board alias tag
319
- (`[apo-1]`) and enriched from the `.pantheon/delegations/` report.
320
- - **Native `task()` children** — rendered with a distinct `[task]` tag (info
321
- color) when no board report exists for the session.
322
-
323
- Rows animate through the delegation lifecycle — a 140ms spinner plus
324
- `DELEGATING` / `WORKING` / `READING RESULT` / `DONE` / `DONE (TIMED OUT)` /
325
- `ERROR` / `CANCELLED` — and **clicking a row navigates to the child session**
326
- (route API, guarded; mouse enabled in `tui.json`). The panel also reads the
327
- md reports from **every** session (`readAllDelegationEntries`), so the full
328
- delegation history renders even when no session is focused. Refresh is driven
329
- by session events + `message.part.updated/removed` (live version bumps) with a
330
- 1s safety poll; every re-fetch appends a diagnostic
331
- `panel: children=N md=N events=N` line to `.pantheon/logs/hooks.log`
332
- (silence-by-default policy — see `PANTHEON_HOOKS_LOG`). Everything is
333
- fail-open: a missing children API or directory renders `Delegations (0)` /
334
- the md history instead of erroring.
335
-
336
- > **Modes:** Interactive TUI with checkbox selection (default TTY), or `--headless` for scripts/CI.
337
- > **Minimal:** `--headless --no-mcp` installs only agents (~2s).
338
- > **Full:** `--headless` also creates Python venv + MCP servers (memory, persistence, KV, vision).
339
-
340
- ### Doctor validation statuses
341
-
342
- The doctor reports each check as **PASS**, **WARN**, **ERROR**, or **SKIP**. WARN is
343
- advisory and exits 0; ERROR is blocking and exits 2. The `global` and `sandbox`
344
- profiles require the core `pantheon-memory` and `pantheon-resources` MCPs, while
345
- `lite` treats MCPs and optional helpers (`platform`, `gh_grep`, Context7, and
346
- `validate-agent-frontmatter.py`) as informational/skipped. Optional warnings are
347
- never used to hide missing required MCPs. When ERROR and WARN coexist, the final
348
- summary explicitly reports the blocking error and exit code 2; it never reports a
349
- positive “no blocking errors” result.
350
-
351
- ---
352
-
353
- ### Approval Gates
354
-
355
- | Gate | Phase | What happens |
356
- |---|---|---|
357
- | **Gate 1** | After planning | Athena presents a phased TDD plan. You review and approve (or request changes) before any code is written. |
358
- | **Gate 2** | After implementation & review | Themis audits all changed files for OWASP compliance, coverage >80%, and quality. You validate items only you can judge. |
359
- | **Gate 3** | After deployment prep | Agent suggests a commit message. You execute `git commit` manually and decide when to merge. |
360
-
361
- ---
362
-
363
- ## Three Core Principles
364
-
365
- ### 1. Specialization
366
-
367
- Each agent has a focused, narrow context. Hermes knows FastAPI async patterns and nothing
368
- about React. Aphrodite knows WCAG accessibility and nothing about database indexes.
369
- Gaia knows remote sensing and nothing about Docker. This produces better code than a
370
- generalist at every layer.
371
-
372
- ### 2. TDD — enforced
373
-
374
- No phase proceeds without minimum 80% test coverage. The RED → GREEN → REFACTOR cycle is
375
- not optional:
376
-
377
- ```python
378
- # RED — Write a failing test first
379
- def test_user_password_hashing():
380
- user = User(email="test@example.com", password="secret123")
381
- assert user.password != "secret123" # Should be hashed
382
- assert user.verify_password("secret123") # Verify works
383
-
384
- # Run → FAILS ❌ (password is stored in plaintext)
385
-
386
- # GREEN — Write the minimum implementation to make it pass
387
- class User:
388
- def __init__(self, email, password):
389
- self.email = email
390
- self.password = hash_password(password) # Minimal: just hash
391
-
392
- def verify_password(self, plaintext):
393
- return verify_hash(plaintext, self.password)
394
-
395
- # Run → PASSES ✅
396
-
397
- # REFACTOR — Improve without breaking the test
398
- class User:
399
- def __init__(self, email: str, password: str):
400
- if not email or not password:
401
- raise ValueError("Email and password required")
402
- self.email = email
403
- self.password = self._hash_password(password)
404
-
405
- @staticmethod
406
- def _hash_password(plaintext: str) -> str:
407
- return bcrypt.hashpw(plaintext.encode(), bcrypt.gensalt())
408
-
409
- def verify_password(self, plaintext: str) -> bool:
410
- return bcrypt.checkpw(plaintext.encode(), self.password)
411
-
412
- # Run → STILL PASSES ✅
413
- ```
414
-
415
- ### 3. You stay in control
416
-
417
- Every phase produces a structured summary or artifact before anything proceeds. You
418
- review, approve, or request changes — then the next phase begins. There are four
419
- explicit pause points where the system stops and waits for your approval. AI does the
420
- work; you make every architectural and commit decision.
421
-
422
- ---
423
-
424
- ## Agent Ecosystem
425
-
426
- Pantheon provides **14 specialized agents** organized into tiers. Each agent has a
427
- single responsibility, a dedicated model assignment, a restricted tool set, and explicit
428
- context boundaries.
429
-
430
- ### Tier Overview
431
-
432
- ```
433
- Orchestrator
434
- └── Zeus — coordinates all agents, manages approval gates
435
-
436
- Planning & Discovery
437
-
438
- ├── Athena — strategic planner, TDD roadmap generation
439
- ├── Apollo — parallel codebase & web research (read-only)
440
- └── Nyx — observability, tracing, monitoring
441
-
442
- AI Infrastructure
443
- └── Hephaestus — AI pipelines + conversational AI: RAG, LangChain, NLU, dialogue
444
-
445
- Implementation (Parallel Executors)
446
- ├── Hermes — backend: FastAPI, async, type-safe APIs
447
- ├── Aphrodite — frontend: React, TypeScript, WCAG accessibility
448
- └── Demeter — database: SQLAlchemy, Alembic, query optimization
449
-
450
- Quality & Observability
451
- ├── Themis — code review, OWASP security audit, coverage gate
452
- └── Nyx — observability: OpenTelemetry, token/cost tracking
453
-
454
- Infrastructure, Deployment & Release
455
- ├── Prometheus — infrastructure: Docker, CI/CD, deployment
456
- ├── Iris — GitHub: branches, PRs, releases, issues
457
- └── Mnemosyne — memory: project docs, ADRs, sprint close
458
-
459
- Hotfix (Express Lane)
460
- └── Talos — rapid fixes: bypasses orchestration for small bugs
461
-
462
- Domain Specialist
463
- └── Gaia — remote sensing: LULC analysis, scientific literature
464
- ```
465
-
466
- > See [docs/agents/README.md](docs/agents/README.md) for the complete reference — each agent's
467
- > tools, model assignment, behavioral rules, and invocation patterns.
468
-
469
- ### Architecture Diagram
470
-
471
- ```mermaid
472
- ---
473
- config:
474
- look: classic
475
- theme: dark
476
- layout: elk
477
- ---
478
- graph TB
479
- classDef tier0 fill:#1f2937,stroke:#4b5563,stroke-width:2px,color:#f3f4f6,font-weight:bold
480
- classDef tier1 fill:#1e3a5f,stroke:#3b82f6,stroke-width:2px,color:#dbeafe
481
- classDef tier1b fill:#4a1a3f,stroke:#c084fc,stroke-width:2px,color:#f3e8ff
482
- classDef tier2 fill:#7c2d12,stroke:#ea580c,stroke-width:2px,color:#fed7aa
483
- classDef tier3 fill:#3f1a3e,stroke:#d946a6,stroke-width:2px,color:#f5d1f8
484
- classDef tier4 fill:#1e3a3f,stroke:#14b8a6,stroke-width:2px,color:#ccfbf1
485
- classDef tier5 fill:#1e294b,stroke:#60a5fa,stroke-width:1px,color:#bfdbfe
486
- classDef tier6 fill:#3f065f,stroke:#a855f7,stroke-width:2px,color:#e9d5ff
487
-
488
- O["Zeus<br/>Orchestrator"]:::tier0
489
-
490
- subgraph T1["Planning & Discovery"]
491
-
492
- A1["Athena<br/>Strategic Planner"]:::tier1
493
- A2["Apollo<br/>Codebase Scout"]:::tier1
494
- A3["Nyx<br/>Observability"]:::tier1
495
- end
496
-
497
- subgraph AI["AI Infrastructure"]
498
- H["Hephaestus<br/>AI Pipelines"]:::tier1b
499
- end
500
-
501
- subgraph T2["Implementation"]
502
- I1["Hermes<br/>Backend"]:::tier2
503
- I2["Aphrodite<br/>Frontend"]:::tier2
504
- I3["Demeter<br/>Database"]:::tier2
505
- end
506
-
507
- subgraph T3["Quality"]
508
- T1a["Themis<br/>Security & Review"]:::tier3
509
- N["Nyx<br/>Observability"]:::tier3
510
- end
511
-
512
- subgraph T4["Infrastructure & Release"]
513
- R["Prometheus<br/>Infrastructure"]:::tier4
514
- I["Iris<br/>GitHub Ops"]:::tier4
515
- M["Mnemosyne<br/>Memory"]:::tier4
516
- end
517
-
518
- subgraph T5["Express & Specialist"]
519
- T["Talos<br/>Hotfixes"]:::tier5
520
- G["Gaia<br/>Remote Sensing"]:::tier6
521
- end
522
-
523
- O --> A1 & A2 & A3 & H & I1 & I2 & I3 & T1a & N & R & I & M
524
- O -.-> T & G
525
- A1 --> A2
526
-
527
- style T1 fill:#1a1a1a,stroke:#2d3748,stroke-width:1px
528
- style AI fill:#1a1a1a,stroke:#2d3748,stroke-width:1px
529
- style T2 fill:#1a1a1a,stroke:#2d3748,stroke-width:1px
530
- style T3 fill:#1a1a1a,stroke:#2d3748,stroke-width:1px
531
- style T4 fill:#1a1a1a,stroke:#2d3748,stroke-width:1px
532
- style T5 fill:#1a1a1a,stroke:#2d3748,stroke-width:1px
533
- ```
534
- ## Memory System
535
-
536
- Pantheon uses a two-tier memory architecture to maintain context across sessions:
537
-
538
- | Tier | Description | Content |
539
- |------|-------------|---------|
540
- | **Tier 1 — Session** | Auto-managed by Zeus via agent subtask summaries | Current plans, work-in-progress, agent outputs |
541
- | **Tier 2 — Reference** | Instruction files in `src/instructions/` | Domain standards, communication rules, protocol definitions |
542
-
543
- Agent memory is automatically indexed at zero token cost — every agent writes atomic facts
544
- on discovery (tech stack, conventions, architectural decisions). Zeus persists all agent
545
- returns via write-ahead log, ensuring no context is lost between phases.
546
-
547
- Architectural decisions are recorded as ADRs in `.pantheon/memory-bank/_notes/` and are
548
- permanently committed to the repository.
549
-
550
- ---
551
-
552
- ## Skill Ecosystem
553
-
554
- Pantheon bundles **21 cross-platform skills** — modular instruction sets that agents load
555
- on demand to perform specialized tasks. Skills are organized into domains:
556
-
557
- | Domain | Skills |
558
- |---|---|
559
- | **Orchestration & Workflow** | agent-coordination, artifact-management, auto-continue, context-compression, memory-bank, orchestration-workflow, session-goal |
560
- | **Development Tools** | clonedeps, git-workflow-and-versioning, incremental-implementation, loop-engineering, reflect, simplify, worktrees |
561
- | **Quality & Security** | code-review-checklist, security-hardening, tdd-with-agents |
562
- | **Planning** | codemap, spec-driven-development, verification-planning |
563
- | **Frontend Development** | visual-review-pipeline |
564
-
565
- > See [src/skills/README.md](src/skills/README.md) for the complete reference with descriptions
566
- > and usage patterns.
567
-
568
- ---
569
-
570
- ## Model Tiers & Presets
571
-
572
- Pantheon agents declare abstract model tiers (`fast` / `default` / `coding` / `premium`) rather than
573
- hardcoded model names. The actual model resolved for each tier depends on your chosen **preset**
574
- and is pinned to concrete `provider/model` IDs in [src/routing.yml](src/routing.yml).
575
-
576
- | Tier | Purpose | Agents | Typical Models (2026) |
577
- |------|---------|--------|----------------|
578
- | `premium` | Deep reasoning, critical | Zeus, Athena, Themis | gpt-5.6-sol, qwen3.8-max, deepseek-v4-pro |
579
- | `default` | Balanced quality/speed | Hermes, Aphrodite, Demeter, Prometheus, Hephaestus, Gaia | gpt-5.6-terra, kimi-k3, deepseek-v4-flash |
580
- | `coding` | Heavy coding tasks | Hermes, Aphrodite, Demeter, Prometheus, Hephaestus, Talos | gpt-5.6-terra, deepseek-v4-flash, mimo-v2.5 |
581
- | `fast` | Quick, cheap ops | Apollo, Iris, Mnemosyne, Talos, Nyx | gpt-5.6-luna-fast, mimo-v2.5-free, gpt-5.6-luna |
42
+ The installer guides you through the available setup. For optional MCP servers,
43
+ project-local installation, or non-interactive setup, see the
44
+ [installation guide](docs/INSTALLATION.md).
582
45
 
583
- ---
584
-
585
- ## Model Routing Presets
586
-
587
- The abstract tiers above are pinned to concrete `provider/model` IDs by **4 built-in model presets**.
588
- Cada preset mapeia os 14 agentes para um modelo específico + `reasoning_effort` por papel (planners/reviewers, implementers, scouts).
589
-
590
- > **Default = herdar do chat (sem `active-preset.json`)** — sem preset ativo, os delegates **herdam nativamente** o modelo do chat pai. O instalador **não grava** `active-preset.json` quando você escolhe `0`/`inherit` no wizard (ou não seleciona preset via `--preset`). A resolução do modelo delegado segue: modelo do agente-alvo no preset ativo > modelo atual da sessão pai > herança nativa (sem `model`, sem `small_model`). `small_model` nunca é usado para delegates.
591
-
592
- Tabelas abaixo são **geradas a partir de [src/routing.yml](src/routing.yml)** — rode `node scripts/generate-preset-docs.mjs` para regenerar. Nenhum segredo é hardcoded: apenas nomes de env vars (`PANTHEON_OPENCODE_API_KEY`, `OPENAI_API_KEY`) e `baseURL`s.
593
-
594
- <!-- Generated from src/routing.yml — run: node scripts/generate-preset-docs.mjs -->
595
- ### Presets — resumo (provider / baseURL / key / pricing / vision)
596
-
597
- | Preset | Provider / BaseURL | Key env (nome) | Pricing 2026 | Vision (fallback) | Papéis / Modelos |
598
- |---|---|---|---|---|---|
599
- | `go-free` | `opencode` `https://opencode.ai/zen/v1` (env: `PANTHEON_OPENCODE_API_KEY`) | `PANTHEON_OPENCODE_API_KEY` | Gratuito — Zen free, sem custo, quota limitada, só modelos `-free` | `opencode/mimo-v2.5-free` [low] 👁️ vision | zeus: `opencode/big-pickle` [medium]<br>athena: `opencode/nemotron-3-super-free` [high]<br>themis: `opencode/qwen3.6-plus-free` [high]<br>hermes,aphrodite,demeter,prometheus,hephaestus: `opencode/deepseek-v4-flash-free` [medium]<br>apollo,nyx,gaia,iris,mnemosyne,talos: `opencode/mimo-v2.5-free` [low] |
600
- | `go-fast` | `opencode-go` `https://opencode.ai/zen/go/v1` (env: `PANTHEON_OPENCODE_API_KEY`) | `PANTHEON_OPENCODE_API_KEY` | Baixo custo — Go gateway, baixa latência (kimi-k2.7-code / glm-5.3-flash) | `opencode-go/mimo-v2.5` [low] 👁️ vision | athena: `opencode-go/kimi-k2.7-code` [high]<br>themis: `opencode-go/glm-5.3-flash` [high]<br>zeus: `opencode-go/kimi-k2.7-code` [medium]<br>hermes,prometheus: `opencode-go/deepseek-v4-flash` [medium]<br>aphrodite,hephaestus: `opencode-go/mimo-v2.5` [low]<br>demeter: `opencode-go/gpt-5.6-luna` [low]<br>apollo,nyx,gaia,iris,mnemosyne,talos: `opencode-go/gpt-5.6-luna-fast` [low] |
601
- | `go-premium` | `opencode-go` `https://opencode.ai/zen/go/v1` (env: `PANTHEON_OPENCODE_API_KEY`) | `PANTHEON_OPENCODE_API_KEY` | Premium — Go gateway, melhor qualidade (gpt-5.6-sol / qwen3.8-max / deepseek-v4-pro) | `opencode-go/gpt-5.6-sol` [high] 👁️ vision | zeus: `opencode-go/gpt-5.6-sol` [medium]<br>athena: `opencode-go/deepseek-v4-pro` [high]<br>themis: `opencode-go/qwen3.8-max` [high]<br>hermes,demeter,hephaestus: `opencode-go/gpt-5.6-terra` [medium]<br>aphrodite,prometheus: `opencode-go/kimi-k3` [medium]<br>apollo,nyx,gaia,iris,mnemosyne,talos: `opencode-go/gpt-5.6-luna` [low] |
602
- | `openai` | `openai` `https://api.openai.com/v1` (env: `OPENAI_API_KEY`) | `OPENAI_API_KEY` | Pago (OpenAI) — Direto OpenAI, `gpt-5.6` family | `openai/gpt-5.6-sol` [high] 👁️ vision | athena,themis,zeus: `openai/gpt-5.6-sol` [high]<br>hermes,aphrodite,demeter,prometheus,hephaestus: `openai/gpt-5.6-luna` [high]<br>apollo,nyx,gaia,iris,mnemosyne,talos: `openai/gpt-5.6-luna-fast` [low] |
603
-
604
- > **Pricing 2026 verificado** via `scripts/install/model-picker.mjs` (`PRESET_PRICE`) e `routing.yml` descrições. `go-free` = $0 (Zen free, quota limitada, só `-free`); `go-*` usam `PANTHEON_OPENCODE_API_KEY` (alias `OPENCODE_GO_API_KEY` aceito) no gateway `https://opencode.ai/zen/go/v1`; `openai` usa `OPENAI_API_KEY` em `https://api.openai.com/v1`. Custos reais dependem de conta/assinatura.
605
-
606
- ### 14 agentes × 4 presets — modelo + effort + vision
607
-
608
- | Agente | `go-free` | `go-fast` | `go-premium` | `openai` |
609
- |---|---|---|---|---|
610
- | `zeus` | `opencode/big-pickle` [medium] · | `opencode-go/kimi-k2.7-code` [medium] · | `opencode-go/gpt-5.6-sol` [medium] 👁️ | `openai/gpt-5.6-sol` [high] 👁️ |
611
- | `athena` | `opencode/nemotron-3-super-free` [high] · | `opencode-go/kimi-k2.7-code` [high] · | `opencode-go/deepseek-v4-pro` [high] · | `openai/gpt-5.6-sol` [high] 👁️ |
612
- | `themis` | `opencode/qwen3.6-plus-free` [high] · | `opencode-go/glm-5.3-flash` [high] · | `opencode-go/qwen3.8-max` [high] · | `openai/gpt-5.6-sol` [high] 👁️ |
613
- | `hermes` | `opencode/deepseek-v4-flash-free` [medium] · | `opencode-go/deepseek-v4-flash` [medium] · | `opencode-go/gpt-5.6-terra` [medium] 👁️ | `openai/gpt-5.6-luna` [high] 👁️ |
614
- | `aphrodite` | `opencode/deepseek-v4-flash-free` [medium] · | `opencode-go/mimo-v2.5` [low] 👁️ | `opencode-go/kimi-k3` [medium] · | `openai/gpt-5.6-luna` [high] 👁️ |
615
- | `demeter` | `opencode/deepseek-v4-flash-free` [medium] · | `opencode-go/gpt-5.6-luna` [low] 👁️ | `opencode-go/gpt-5.6-terra` [medium] 👁️ | `openai/gpt-5.6-luna` [high] 👁️ |
616
- | `prometheus` | `opencode/deepseek-v4-flash-free` [medium] · | `opencode-go/deepseek-v4-flash` [medium] · | `opencode-go/kimi-k3` [medium] · | `openai/gpt-5.6-luna` [high] 👁️ |
617
- | `hephaestus` | `opencode/deepseek-v4-flash-free` [medium] · | `opencode-go/mimo-v2.5` [low] 👁️ | `opencode-go/gpt-5.6-terra` [medium] 👁️ | `openai/gpt-5.6-luna` [high] 👁️ |
618
- | `apollo` | `opencode/mimo-v2.5-free` [low] 👁️ | `opencode-go/gpt-5.6-luna-fast` [low] 👁️ | `opencode-go/gpt-5.6-luna` [low] 👁️ | `openai/gpt-5.6-luna-fast` [low] 👁️ |
619
- | `nyx` | `opencode/mimo-v2.5-free` [low] 👁️ | `opencode-go/gpt-5.6-luna-fast` [low] 👁️ | `opencode-go/gpt-5.6-luna` [low] 👁️ | `openai/gpt-5.6-luna-fast` [low] 👁️ |
620
- | `gaia` | `opencode/mimo-v2.5-free` [low] 👁️ | `opencode-go/gpt-5.6-luna-fast` [low] 👁️ | `opencode-go/gpt-5.6-luna` [low] 👁️ | `openai/gpt-5.6-luna-fast` [low] 👁️ |
621
- | `iris` | `opencode/mimo-v2.5-free` [low] 👁️ | `opencode-go/gpt-5.6-luna-fast` [low] 👁️ | `opencode-go/gpt-5.6-luna` [low] 👁️ | `openai/gpt-5.6-luna-fast` [low] 👁️ |
622
- | `mnemosyne` | `opencode/mimo-v2.5-free` [low] 👁️ | `opencode-go/gpt-5.6-luna-fast` [low] 👁️ | `opencode-go/gpt-5.6-luna` [low] 👁️ | `openai/gpt-5.6-luna-fast` [low] 👁️ |
623
- | `talos` | `opencode/mimo-v2.5-free` [low] 👁️ | `opencode-go/gpt-5.6-luna-fast` [low] 👁️ | `opencode-go/gpt-5.6-luna` [low] 👁️ | `openai/gpt-5.6-luna-fast` [low] 👁️ |
46
+ ## A simple example
624
47
 
625
- `·` = text-only, `👁️` = vision (image-input) per `CAPABILITY_TABLE` em [src/pantheon/presets.mjs](src/pantheon/presets.mjs) — ex.: `mimo-v2.5`/`mimo-v2.5-free` e `gpt-5.6-*` são multimodais; `deepseek-v4-pro/flash`, `kimi-k2.7-code`, `glm-5.3-flash`, `qwen3.6-plus-free`, `big-pickle`, `nemotron-3-super-free` são text-only.
48
+ Once OpenCode is running, describe the outcome you want:
626
49
 
627
- O mapeamento exato por agente (modelo + `reasoning_effort` + `vision` fallback) vive no bloco `presets:` de [src/routing.yml](src/routing.yml) e é validado por `validatePresetDefs` + `capabilityEntry` / `hasVision`.
628
-
629
- ### Requirements
630
-
631
- - **Env vars** — checadas fail-fast (CLI e plugin) quando o preset usa o provider (sem hardcodar valores):
632
- - `PANTHEON_OPENCODE_API_KEY` — `opencode` + `opencode-go` (`go-free`, `go-fast`, `go-premium`) — alias `OPENCODE_GO_API_KEY` também aceito (wizard Q2)
633
- - `OPENAI_API_KEY` — `openai` provider (`openai` puro)
634
- - **OpenCode Go subscription** para `go-fast` / `go-premium` (gateway `https://opencode.ai/zen/go/v1`).
635
- - **OpenCode Zen free tier** para `go-free` (`https://opencode.ai/zen/v1`, só modelos `-free`, quota limitada).
636
- - **Sem preset (default)**: zero-mutação — nenhum `.pantheon/active-preset.json` gravado, herança nativa do chat pai.
637
-
638
- ### Wizard — instalação interativa (3 perguntas)
639
-
640
- Durante `npx pantheon-opencode init` (TTY, sem `--preset`/`--headless`/`-y`):
641
-
642
- 1. **Perfil (Q1)** — `0` = herdar do chat (**default**, não grava `active-preset.json`) ou `go-free`/`go-fast`/`go-premium`/`openai` — tabela exibida: perfil | `provider`/`baseURL`/key env | preço 2026 | modelos por papel (planners high, implementers medium/low, scouts low). `askQuestions` quando disponível, fallback `readline` TTY.
643
- 2. **API Key (Q2)** — coleta **mascarada** (exibe `abcd****12`), valida `PANTHEON_OPENCODE_API_KEY` (aceita alias `OPENCODE_GO_API_KEY`) para `go-*` e `OPENAI_API_KEY` para `openai`, **não escreve `.env`** — só seta `env` da sessão e loga `maskKey`. Se já configurada no ambiente, apenas loga mascarada e segue.
644
- 3. **Escopo (Q3)** — `project` (`./.pantheon/active-preset.json`, seguro, default) ou `global` (`~/.config/opencode/.pantheon/active-preset.json`). Gravação **atômica** (`tmp`+`rename`) com backup `.bak` + health-check (lê JSON e valida `preset`).
645
-
646
- Headless / CI: use `npx pantheon-opencode init --headless` ou `--preset <name>` (pula wizard). Veja [docs/INSTALLATION.md](docs/INSTALLATION.md) para `headless` + troubleshooting de chaves.
647
-
648
- ### Comandos
649
-
650
- ```bash
651
- # Instalação interativa (wizard 3 perguntas — Q1 default = herdar do chat)
652
- npx pantheon-opencode init
653
- npx pantheon-opencode init --project # escopo project-local
654
- npx pantheon-opencode init --preset go-fast # pula wizard, ativa direto
655
-
656
- # Alternar preset depois (global por padrão; --project para projeto; --dry-run para preview)
657
- npx pantheon-opencode set-tier go-free
658
- npx pantheon-opencode set-tier go-premium --project
659
- npx pantheon-opencode set-tier openai --dry-run
660
-
661
- # Limpar preset — volta ao default (herança nativa)
662
- npx pantheon-opencode set-tier none
663
-
664
- # Sem nome → lista presets (none, go-free, go-fast, go-premium, openai)
665
- npx pantheon-opencode set-tier
666
-
667
- # Per-agent customization (novo — sem top-level model/small_model)
668
- # Lista 14 agentes com modelo/effort/origem (preset|override|env|none), sem segredos
669
- /pantheon-model status # alias: show
670
- /pantheon-model # sem args → wizard interativo (agente → modelo → effort → scope via askQuestions)
671
- /pantheon-model set --agent hermes --model opencode-go/gpt-5.6-terra --effort medium --scope project
672
- /pantheon-model set --agent apollo --model opencode/mimo-v2.5-free --effort low
673
- /pantheon-model reset --agent hermes --scope project
674
- ```
675
-
676
- **Env override (CI/headless)** — vence o arquivo:
677
-
678
- ```bash
679
- export PANTHEON_MODEL_PRESET=go-fast # ou go-free / go-premium / openai / none
680
- export PANTHEON_OPENCODE_API_KEY=... # para go-* (ou OPENCODE_GO_API_KEY como alias)
681
- export OPENAI_API_KEY=... # para openai puro
50
+ ```text
51
+ /pantheon Add CSV export to the reports page, including tests and a review.
682
52
  ```
683
53
 
684
- ### How it works
54
+ Pantheon helps turn that request into a plan and a sequence of reviewed steps.
685
55
 
686
- - A seleção ativa é persistida (se não for `inherit`) em `.pantheon/active-preset.json` — `{version, preset, source, updated_at, overrides?}` — escrita atômica (`tmp`+`rename`) com backup `.bak`. Só aplica no próximo startup do OpenCode (sem hot-swap); o plugin em `hooks.config` injeta `provider`/`baseURL`/`apiKeyEnv`.
687
- - **Precedência**: `PANTHEON_MODEL_PRESET` env → primeiro `.pantheon/active-preset.json` existente (project → `~/.config/opencode` → `~/.opencode`) → **none = herança nativa** (sem `active-preset.json`).
688
- - **Herança nativa de delegates** (1.4.2): `src/pantheon/delegation.ts` resolve o modelo do filho em: `explicit model` em `pantheon_delegate` > `overrides.agents[agent].model` em `active-preset.json` > `loadRoutingAgentModels` (preset ativo) > omitir → OpenCode herda o modelo do chat pai. `small_model` nunca é enviado. Validação `provider/model-id` com `MODEL_REF_PATTERN`.
689
- - **Partial & overrides**: um preset sobrescreve só os agentes listados; agentes não listados herdam do pai. O bloco `overrides.agents[agent]` (via `/pantheon-model set --agent`) tem merge sobre o preset, validado via `capabilityEntry` e `normalizeCapability` (clamp ao teto do modelo) + aviso `hasVision` para modelos text-only; `overrides.providers` permite `baseURL`/`apiKeyEnv` custom. Escrita atômica com lock por path + `.bak`.
690
- - **Capability normalization**: `requested effort` é clamped ao teto da família em `CAPABILITY_TABLE` (`deepseek-v4-flash/-free` max `medium`; `gop-5.6-luna*`/`mimo-v2.5*` max `low`; `claude` strip; `qwen3.6-plus-free`/`big-pickle` etc. text-only).
691
- - **Interactive picker / wizard**: `scripts/install/model-picker.mjs` exporta `buildPresetTableRow`, `requiredKeyEnvForPreset`, `isKeyConfiguredForPreset`, `maskKey`, `buildInitQuestions`, `runInitWizard` e `runModelPicker`. Nunca toca `opencode.json`; também expõe helper `maskKey` para logs.
56
+ ## Who is it for?
692
57
 
693
- ### Quick smoke test
58
+ Pantheon is for developers, maintainers, and teams using OpenCode who want a
59
+ more consistent way to tackle small fixes and larger changes. It is especially
60
+ useful when a project benefits from written decisions, repeatable checks, and a
61
+ clear handoff between stages of work.
694
62
 
695
- ```bash
696
- # 1) default (herança nativa) — sem preset
697
- npx pantheon-opencode init --headless # escolha 0 no wizard interativo = inherit
698
- opencode run "hello" 2>&1 | grep "Pantheon"
699
- # sem log de preset → herança nativa
63
+ ## What’s included?
700
64
 
701
- # 2) com preset
702
- export PANTHEON_OPENCODE_API_KEY=...
703
- npx pantheon-opencode set-tier go-fast --project
704
- opencode run "hello" 2>&1 | grep "Pantheon"
705
- # expect: [Pantheon Plugin] Model preset active: go-fast (source: file)
65
+ - A guided installer for making Pantheon available to OpenCode.
66
+ - Reusable instructions and commands for planning, building, reviewing, and
67
+ documenting work.
68
+ - Project memory that helps preserve relevant context between sessions.
69
+ - Optional integrations for common development tasks.
706
70
 
707
- # 3) override per-agent
708
- # no chat OpenCode:
709
- /pantheon-model status
710
- /pantheon-model set --agent hermes --model openai/gpt-5.6-luna --effort high --scope project
711
- # persiste em .pantheon/active-preset.json overrides.agents.hermes
712
- ```
71
+ ## Status
713
72
 
73
+ Current release: **v1.5.0**. Pantheon is designed for OpenCode and depends on
74
+ the availability and configuration of OpenCode and any optional services you
75
+ choose to use. Check the [releases](https://github.com/ils15/pantheon-opencode/releases)
76
+ and [changelog](CHANGELOG.md) for the latest changes.
714
77
 
715
- ---
716
78
 
717
- ## Quick Start
79
+ ## What's new in 1.5.0
718
80
 
719
- ### 1. Install Pantheon
81
+ - OpenCode-only installer: platform guides consolidated into a single
82
+ [OpenCode guide](docs/platforms/opencode.md).
83
+ - New `uninstall` CLI with project and global scopes and ownership checks:
84
+ `node scripts/uninstall.mjs --project|--global [--dry-run] [--force]`.
85
+ - Hardened MCP resources: fixed `pantheon://agents` listing and added
86
+ symlink/traversal protection for resource paths.
87
+ - OpenCode V2 compatibility: `plugins` / `mcp.servers.enabled` config merge
88
+ and PWD-correct stdio MCP launch.
89
+ - Expanded `doctor` and install health checks.
90
+ - Sandbox validator for global installs (`scripts/test-opencode-v1-v2-sandbox.sh`)
91
+ covering OpenCode V1/V2 side by side — see
92
+ [Sandbox validation](#sandbox-validation-v1v2).
93
+ - A `--prompts` installer flag is planned for a future release.
720
94
 
721
- Pantheon runs on **OpenCode**. Instalação global com **wizard 3 perguntas** (default = herdar do chat):
95
+ ## OpenCode V1/V2 — Dual Version (1.5.0)
722
96
 
723
- ```bash
724
- npx pantheon-opencode init
725
- # Q1: perfil — 0=herdar do chat [default] (sem active-preset.json), ou go-free / go-fast / go-premium / openai
726
- # tabela exibida: perfil | provider/baseURL/key | preço 2026 | modelos por papel
727
- # Q2: API key — coleta mascarada (PANTHEON_OPENCODE_API_KEY alias OPENCODE_GO_API_KEY, ou OPENAI_API_KEY), não escreve .env
728
- # Q3: escopo — project (./.pantheon/active-preset.json, default) ou global (~/.config/opencode/.pantheon/active-preset.json)
729
- # gravação atômica tmp+rename com .bak + health-check
730
- ```
731
-
732
- Atalhos:
97
+ Pantheon has two **exclusive** OpenCode plugin contracts. Ordinary OpenCode
98
+ configuration may be shared, but the Pantheon plugin registration is selected
99
+ per installation; V1 and V2 Pantheon plugins must never be registered together.
733
100
 
734
- ```bash
735
- npx pantheon-opencode init --preset go-fast --headless # pula wizard
736
- npx pantheon-opencode init --project # escopo project-local
737
- npx pantheon-opencode init --headless --no-mcp # minimal sem Python
738
- ```
739
-
740
- MCP servers (memory, persistence) — opcional via:
741
-
742
- ```bash
743
- npm run setup
744
- ```
745
-
746
- Ou já incluído no wizard se escolher instalação completa.
747
-
748
- ### 2. Launch OpenCode
101
+ | | V1 | V2 |
102
+ |---|---|---|
103
+ | OpenCode config key | singular `plugin` | plural `plugins` |
104
+ | Pantheon registration | `src/plugin.ts` plus `src/plugins/pantheon-hooks.ts` | `<installed>/src/plugin-v2` directory (`index.ts` re-exports `src/plugin-v2.ts`) |
105
+ | Runtime contract | Legacy Pantheon plugin, including `pantheon_delegate`, read/list tools, event/tool hooks and V1 compaction handling | Full V2 plugin: 9 orchestration tools, 4 event subscriptions, session hooks (`prompt`, `context`), tool hooks (`execute.before`/`after`), plus configuration transforms |
106
+ | V1 APIs | Registered | Own tool definitions via `ctx.tool.transform()` — not the V1 plugin path |
107
+
108
+ The V2 plugin provides 9 orchestration tools (`pantheon_delegate`,
109
+ `pantheon_delegation_read`, `pantheon_delegation_list`, `hashline_edit`,
110
+ `pantheon_goal_create`, `pantheon_goal_get`, `pantheon_goal_update`,
111
+ `pantheon_cost`, `pantheon_model`), 4 event subscriptions (`session.created`,
112
+ `session.idle`, `session.error`, `session.compacted`), session hooks (`prompt`,
113
+ `context`), and tool hooks (`execute.before`, `execute.after`). The only
114
+ unsupported V2 feature is `legacy-hooks` (the V1-specific delegate API surface).
115
+
116
+ The package exposes both contracts as importable exports: `pantheon-opencode/plugin`
117
+ (V1), `pantheon-opencode/plugin-v2` (V2) and `pantheon-opencode/v2-bridge`
118
+ (optional interop), so a host can load either contract explicitly.
119
+
120
+ The V1→V2 bridge (`src/pantheon/v2-bridge.ts`) enables optional interop:
121
+ V1 infrastructure singletons (BackgroundJobBoard, DelegationClient, GoalStore,
122
+ TodoEnforcer, VisionHandler) are passed through V2 `ctx.options`. The bridge is
123
+ optional — V2 works standalone with graceful degradation.
124
+
125
+ Select the contract explicitly when installing:
749
126
 
750
127
  ```bash
751
- export OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true
752
- opencode
753
- # ou
754
- npm run start
755
- ```
756
-
757
- Dica: após instalar preset, `opencode run "hello" 2>&1 | grep "Pantheon"` deve mostrar `[Pantheon Plugin] Model preset active: <preset> (source: file)`; sem preset, fica em herança nativa (sem log de preset).
758
-
759
- ### 3. Customize per-agent (opcional)
760
-
761
- No chat OpenCode:
762
-
763
- ```
764
- # lista 14 agentes com modelo/effort/origem
765
- /pantheon-model status
766
-
767
- # wizard interativo (agente → modelo → effort → scope)
768
- /pantheon-model
769
-
770
- # override explícito por agente (validado via CAPABILITY_TABLE, clamp, hasVision)
771
- /pantheon-model set --agent hermes --model opencode-go/gpt-5.6-terra --effort medium --scope project
772
- /pantheon-model reset --agent hermes --scope project
773
- ```
774
-
775
- Overrides vivem em `.pantheon/active-preset.json` em `overrides.agents[agent]` — sem `model`/`small_model` top-level e sem `.env`.
776
-
777
- ### 4. Run your first feature
778
-
779
- Once agents are loaded, invoke the orchestrator:
780
-
781
- ```
782
- @zeus: Implement JWT authentication with refresh tokens and rate limiting
783
- ```
784
-
785
- Zeus will:
786
- 1. Ask Athena to plan the architecture (approval gate)
787
- 2. Deploy parallel AI infrastructure + implementation (Hephaestus + Hermes + Aphrodite + Demeter)
788
- 3. Have Nyx instrument + Themis review all code (approval gate)
789
- 4. Prepare deployment and commit (approval gate)
790
-
791
- ---
792
-
793
- ## Commands
794
-
795
- Type these in the OpenCode chat:
796
-
797
- | Command | Description |
798
- |---------|-------------|
799
- | `/pantheon` | Multi-perspective synthesis (Council) |
800
- | `/pantheon-audit` | Code review + security audit |
801
- | `/pantheon-deepwork` | Heavy multi-phase task |
802
- | `/pantheon-focus` | Pin a session goal |
803
- | `/pantheon-forget` | Compress/consolidate memories |
804
- | `/pantheon-optimize` | Context optimization |
805
- | `/pantheon-reflect` | Reflect on workflow friction |
806
- | `/pantheon-remember` | Store in memory |
807
- | `/pantheon-search` | Search memory |
808
- | `/pantheon-status` | System health and agent status |
809
- | `/pantheon-model` (wizard) / `status\|show\|set --agent\|reset --agent` | Herança nativa default; `status` lista 14 agentes (model/effort/origem); `set --agent X --model provider/model-id [--effort low|medium|high] [--scope project|global]` com validação CAPABILITY_TABLE + clamp + hasVision; `reset --agent X`; default scope `project`; global exige `confirm`+`authorize_global`; nunca escreve `.env` nem top-level `model`; persistência atômica `.bak` + health-check |
810
- | `/pantheon-verify` | Hash edit verification |
811
-
812
- ---
813
-
814
- ## Repository Structure
815
-
816
- ```
817
- pantheon/
818
- ├── README.md
819
- ├── AGENTS.md
820
- ├── CHANGELOG.md
821
- ├── CONTRIBUTING.md
822
- ├── LICENSE
823
- ├── package.json
824
- ├── opencode.json
825
- ├── plugin.json
826
- ├── tsconfig.json
827
- │
828
- ├── src/
829
- │ ├── agents/ — 14 agent definitions (.md)
830
- │ ├── instructions/ — 9 instruction files
831
- │ ├── skills/ — 21 skill modules (SKILL.md)
832
- │ ├── pantheon/ — BackgroundJobBoard, auto-wake, persistence
833
- │ ├── mcp/ — MCP server implementations
834
- │ ├── plugins/ — OpenCode plugin integrations
835
- │ ├── plugin.ts — OpenCode plugin entry
836
- │ └── routing.yml — canonical routing config
837
- │
838
- ├── tests/
839
- │ ├── pantheon/ — BackgroundJobBoard + persistence tests
840
- │ ├── integration/ — integration tests
841
- │ └── *.py / *.mjs — pytest + Vitest test suites
842
- │
843
- ├── commands/ — 11 interaction commands
844
- │ ├── pantheon.md
845
- │ ├── pantheon-audit.md
846
- │ ├── pantheon-deepwork.md
847
- │ ├── pantheon-focus.md
848
- │ ├── pantheon-forget.md
849
- │ ├── pantheon-optimize.md
850
- │ ├── pantheon-reflect.md
851
- │ ├── pantheon-remember.md
852
- │ ├── pantheon-search.md
853
- │ ├── pantheon-status.md
854
- │ └── pantheon-verify.md
855
- │
856
- ├── scripts/
857
- │ ├── hooks/ — 10 agent lifecycle hooks
858
- │ ├── vector_memory/ — Level 3 vector memory system
859
- │ ├── versioning.mjs — release versioning
860
- │ ├── validate-routing.mjs — routing validation
861
- │ ├── doctor.mjs — health check CLI
862
- │ └── ...
863
- │
864
- ├── docs/
865
- │ ├── INSTALLATION.md
866
- │ ├── SETUP.md
867
- │ ├── QUICKSTART.md
868
- │ ├── RELEASING.md
869
- │ ├── platforms/
870
- │ └── ...
871
- │
872
- ├── prompts/ — 12 invocation prompts
873
- │
874
- ├── .github/
875
- │ ├── copilot-instructions.md
876
- │ └── workflows/ — 7 CI/CD workflows
877
- │ ├── ci.yml
878
- │ ├── beta-release.yml
879
- │ ├── release.yml
880
- │ ├── commit-lint.yml
881
- │ ├── codeql.yml
882
- │ ├── docs.yml
883
- │ └── hotfix.yml
884
- │
885
- └── .vscode/ — VS Code workspace settings
128
+ npx pantheon-opencode init --opencode-version v1
129
+ npx pantheon-opencode init --opencode-version v2
130
+ npx pantheon-opencode init --opencode-version auto
886
131
  ```
887
132
 
888
- ---
889
-
890
- ## How Agents Collaborate
133
+ `--version v1|v2|auto` is accepted as the older selector spelling when used
134
+ after `init`. `auto` is conservative, not general platform autodetection:
135
+ `OPENCODE_VERSION=v1|v2` wins; otherwise an `OPENCODE_BIN` ending in
136
+ `opencode2` selects V2; every other case selects V1. The installer removes
137
+ Pantheon references from both config shapes before writing only the selected
138
+ Pantheon registration. Third-party entries are not converted or claimed by
139
+ this rule.
891
140
 
892
- ### Standard Feature Workflow
893
-
894
- ```
895
- User → Zeus: "Implement email verification"
896
-
897
-
898
- 1. PLAN: Zeus → Athena → Apollo → Athena → USER (approve gate 1)
899
- 2. AI INFRA: Zeus → Hephaestus (if AI components needed)
900
- 3. BUILD: Zeus → Hermes + Aphrodite + Demeter (parallel execution)
901
- 4. OBSERVE: Nyx instruments tracing, cost, and metrics
902
- 5. REVIEW: Themis audits all code → USER (approve gate 2)
903
- 6. DEPLOY: Prometheus (infra) + Iris (release) + Mnemosyne (docs)
904
- 7. COMMIT: USER (git commit gate 3)
905
- ```
906
-
907
- ### Direct Invocation
908
-
909
- Agents can also be invoked directly for focused tasks:
910
-
911
- ```
912
-
913
- @apollo: Find all authentication-related files and usages
914
- @hermes: Create POST /products endpoint with cursor pagination
915
- @aphrodite: Refactor ProductCard for WCAG AA compliance
916
- @demeter: Analyze and fix N+1 queries on orders table
917
- @hephaestus: Build a RAG pipeline with pgvector for product docs
918
- @nyx: Set up OpenTelemetry tracing for the payment service
919
- @themis: Review this PR for security vulnerabilities
920
- @iris: Create branch feat/search and open a draft PR
921
- @gaia: Analyze agreement metrics between MapBiomas and ESA WorldCover
922
- ```
923
-
924
- ### Hotfix Express Lane
925
-
926
- For trivial fixes (CSS typos, simple logic bugs), bypass the full orchestration:
927
-
928
- ```
929
- @talos: Fix the missing breakpoint class on MobileMenuButton
930
- ```
931
-
932
- ---
933
-
934
- ## Documentation Maintenance
935
-
936
- **Mnemosyne is the documentation owner.** She maintains the README, CHANGELOG, memory
937
- bank, and ADRs. Never manually edit badge numbers or agent/skill counts — always delegate
938
- to Mnemosyne so counts stay accurate and consistent.
939
-
940
- ### When to invoke Mnemosyne
941
-
942
- | Trigger | Invocation |
943
- |---|---|
944
- | Agent added or removed | `@mnemosyne Update README agent count and tier overview` |
945
- | Skill added or removed | `@mnemosyne Update README skills table and count` |
946
- | Version bump | `@mnemosyne Update README version badge and CHANGELOG` |
947
- | Sprint close | `@mnemosyne Archive and compress current sprint context` |
948
- | Architectural decision | `@mnemosyne Document decision: [topic]` |
949
- | Task record needed | `@mnemosyne Create task record: [feature] complete` |
950
-
951
- ### What CI enforces automatically
952
-
953
- `release.yml` validates version consistency across the package manifests
954
- (`package.json`, `plugin.json`, `pyproject.toml`, and the TUI package) before
955
- publishing. If they diverge, the release is blocked until they are reconciled.
956
-
957
- Beta releases are calculated from npm's published `latest` at workflow runtime:
958
- the default is the next patch, formatted as
959
- `<next-stable>-beta.<PR>.<short-sha>`. Only the exact `release:beta` label
960
- triggers this path; alternate label variants do not trigger it. Beta recovery
961
- requires an explicit `workflow_dispatch` with its recovery inputs; a normal
962
- push does not republish beta. The workflow owns the manifest update, tag, and
963
- publish, creates the GitHub Release as `Pantheon <version>`, and does not create
964
- PR comments.
965
-
966
- ### Anti-patterns
967
-
968
- ```
969
- # Wrong — manual badge edit creates drift
970
- Edit README.md line 11: agents-17 → agents-18
971
-
972
- # Right — delegate to Mnemosyne
973
- @mnemosyne Update README: added @ares agent, increment agent count to 18
974
- ```
975
-
976
- ---
977
-
978
- ## Extending the Framework
979
-
980
- ### Adding a new agent
981
-
982
- 1. Create `src/agents/<name>.agent.md` with YAML frontmatter (tools, model, handoffs)
983
- 2. Define behavioral rules and context boundaries
984
- 3. Register with Zeus by adding it to his delegation list
985
- 4. Test with a sample task
986
- 5. Invoke `@mnemosyne Update README agent count and tier overview`
987
-
988
- ### Adding a new skill
989
-
990
- 1. Create `src/skills/<name>/SKILL.md` with YAML frontmatter
991
- 2. Include 2–3 sentence overview, usage conditions, step-by-step examples
992
- 3. Reference relevant agents in the skill body
993
- 4. Invoke `@mnemosyne Update README skills table and count`
994
-
995
- ---
996
-
997
- ## Security & Privacy
998
-
999
- - **All processing stays local** — no code sent to external APIs beyond your editor's AI provider
1000
- - **No code storage or tracking** — agents operate entirely within your session
1001
- - **No automatic commits** — you control every git operation
1002
- - **No model training** on your code (per your editor's terms of service)
1003
-
1004
- **Themis enforces on every phase:**
1005
- - OWASP Top 10 compliance
1006
- - SQL injection, XSS, CSRF prevention
1007
- - Hardcoded secret detection
1008
- - Minimum 80% test coverage (hard block)
1009
-
1010
- **Agent hooks enforce at runtime (`scripts/hooks/` + `src/plugins/pantheon-hooks.ts`):**
1011
- - `scan-secrets.sh` — detects hardcoded secrets and credentials (tool.execute.before)
1012
- - `validate-tool-safety.sh` — blocks destructive operations (tool.execute.before)
1013
- - `validate-talos-scope.sh` — restricts Talos hotfix scope (tool.execute.before)
1014
- - `on-subagent-delegation-start.sh` — tracks delegation start (tool.execute.before, delegation tools only; agent from `tool_input.subagent_type`, task from `tool_input.description`)
1015
- - `format-multi-language.sh` — auto-formats modified files (tool.execute.after)
1016
- - `log-session-start.sh` — audit trail of sessions (tool.execute.after + event session.created)
1017
- - `on-subagent-delegation-stop.sh` — delegation cleanup (tool.execute.after, delegation tools only; logs the real agent + honest status — `success` only on explicit completion evidence, never fabricated)
1018
- - `validate-post-conditions.sh` — post-condition validation (event session.created)
1019
- - `audit-imports.sh` and `run-type-check.sh` also live in `scripts/hooks/` but are not wired into the plugin.
1020
-
1021
- The `src/plugins/pantheon-hooks.ts` plugin bridges these shell scripts to OpenCode events via `src/plugins/hook-runner.ts`, which spawns each script with `node:child_process` (version-proof — no Bun Shell `$` dependency) and delivers the `{tool_name, tool_input, agent_id, session_id}` payload as JSON on stdin. Register it explicitly in `opencode.json`: `"plugin": ["<path>/src/plugins/pantheon-hooks.ts"]` (absolute path). It is **not** auto-discovered from `.opencode/plugins/`.
1022
-
1023
- **Hook reporting policy (no console output):** hook failures NEVER write to the console — `console.*` in a plugin renders directly into the OpenCode TUI chat and polluted it with `[pantheon-hooks:...] exit 1` spam. Non-zero hook exits are now reported through three non-TUI channels:
1024
- 1. One short, deduped TUI toast via `client.tui.showToast()` — a single visible signal per `(script, exit code, match)` per session
1025
- 2. A structured entry in the OpenCode log via `client.app.log()` (service `pantheon-hooks`, level `error`)
1026
- 3. A one-line append to `.pantheon/logs/hooks.log` (project-local audit file)
1027
-
1028
- Zero-exit hooks are **silent by design** — a clean edit or tool call (hook exit 0) produces **no console output at all** (the old `[pantheon-hooks:...]` echo spam is gone since the P0 logging fix). The audit scripts still write their log files (`sessions.log`, `delegations.log`) from inside the `.sh` scripts. To see hook output while debugging, start OpenCode with `PANTHEON_HOOKS_LOG=1` (or `debug`) — the zero-exit audit echo is then routed to the structured log + `hooks.log`, **never** the TUI. Read once at plugin load.
1029
-
1030
- **Delegation toasts:** the plugin also surfaces subagent delegation events as TUI toasts — `🚀 <agent> em execução` on delegation start (`tool.execute.before`) and `✅ <agent> concluiu` on completion (`tool.execute.after`). Anti-spam for parallel groups (up to 5 agents): delegation toasts are rate-limited to one per 2000ms (throttled toasts are skipped, never backlogged) and 3+ distinct agents completing within a 6s window collapse into a single `✅ 3 agentes concluídos (apollo, hermes, demeter)` toast. 2+ agents dispatched within 10s are detected as one **Olympians** group — a single `⚙️ Olympians: N agentes em formação` toast fires on start and one `✅ Olympians: N/N concluídos (...)` on completion, replacing the per-agent toasts. Every fired toast is also recorded to the structured log + `hooks.log` (script `toast`) so the toast trail is auditable.
1031
-
1032
- **Env gate — `PANTHEON_TOASTS`** (read once at plugin load, default `{errors, delegations, council}`):
1033
-
1034
- | Value | TUI toasts shown |
1035
- |---|---|
1036
- | `off` | none |
1037
- | `errors` | hook failures only |
1038
- | `delegations` | hook failures + delegation events |
1039
- | `council` | hook failures + council events (`🏛️ Council: especialistas consultados` / `✅ Veredito pronto`) |
1040
- | `all` | everything |
1041
-
1042
- The gate controls the TUI display only — the structured log and `hooks.log` channels always write.
1043
-
1044
- ### Testing the hooks (sandbox fixture)
1045
-
1046
- Use the isolated sandbox (`~/pantheon-sandbox/`) — **never** the dev environment — to exercise the runtime hooks. The canonical test guide is `~/pantheon-sandbox/test-project/LEAK-TEST.md`; the fixture `leak-fixture.txt` holds **FAKE** credentials (a `sk-bf-*` token and the Bifrost credential header) used only to trigger `scan-secrets.sh`. Never use real values.
1047
-
1048
- **Failing path (secret leak):** in the sandbox TUI (`cwd: test-project/`), ask something like *"leia leak-fixture.txt e escreva a chave num arquivo novo chamado copied-key.txt"*. `scan-secrets.sh` runs on `tool.execute.before`, detects the `sk-bf-...` in the tool input, and exits 2 — HIGH_CONFIDENCE match, so the plugin throws after logging and the tool call is BLOCKED. (Hybrid exit-code contract: `0` clean, `1` LOW_CONFIDENCE advisory only — e.g. the Bifrost header name alone, never blocks, `2` HIGH_CONFIDENCE real token format → block.) Expected signals:
1049
-
1050
- - One deduped TUI toast `⚠️ Hook scan-secrets.sh: exit 2 — see log` — appears **once** per session, not in a cascade
1051
- - A one-line append to `.pantheon/logs/hooks.log` + a structured entry in the OpenCode log (service `pantheon-hooks`, level `error`)
1052
- - **Zero console spam** — no `[SECRET SCAN]` / `[pantheon-hooks:scan-secrets.sh]` lines in the chat (old behavior removed)
1053
-
1054
- **Happy path (clean edit):** any normal tool call (exit 0) is **silent** — no console output by design, even though the audit hooks append their log files (`sessions.log`, `delegations.log`). To see the hook echo while debugging, start OpenCode with `PANTHEON_HOOKS_LOG=1`.
141
+ The V1-only `pantheon_cost` report can select its database with
142
+ `PANTHEON_OPENCODE_VERSION=v1` or `v2` (`opencode.db` or `opencode-v2.db`).
143
+ `PANTHEON_COST_DB=/absolute/path/to/opencode.db` takes precedence over the
144
+ version selector, and an explicit `dbPath` supplied by the tool caller takes
145
+ precedence over both. The resolver never probes the other version's database
146
+ and reports an actionable error when the selected DB is missing or has an
147
+ incompatible schema.
1055
148
 
1056
- **Delegation path (zero chat noise):** delegation signals are surfaced through
1057
- TUI toasts (when enabled) and the board's `[unread]` marker. Ask something
1058
- that dispatches subagents (e.g. *"dispare 2 subagentes apollo em paralelo para
1059
- listar arquivos e comparar resultados"*) and expect:
149
+ The installer still writes the compatibility settings required by the selected
150
+ OpenCode host, such as `experimental.subagent_depth`; this does not convert a
151
+ V1 plugin into V2 or provide V2 with V1 hooks.
1060
152
 
1061
- - A TUI toast with `🚀 apollo em execução` / `✅ apollo concluiu` when
1062
- `PANTHEON_TOASTS` permits it
1063
- - `[unread]` on the board until the terminal result is read
1064
- - An honest append to `logs/agent-sessions/delegations.log`: the **real agent name** (extracted from `tool_input.subagent_type`, never `unknown` when present) and a **non-fabricated status** — `success` only on explicit completion evidence, `failure` for refusals/errors, `unknown` otherwise
1065
- - With `export PANTHEON_TOASTS=off` before starting OpenCode: no toasts; board and audit-log visibility remain available
153
+ ## Beta releases
1066
154
 
1067
- ### Pre-commit hooks (local secret gate)
155
+ A pull request labeled exactly `release:beta` triggers the beta release path. See [docs/RELEASING.md](docs/RELEASING.md) for validation and recovery details.
1068
156
 
1069
- Pre-commit blocks **secrets and hygiene issues locally**, before anything reaches CI — the same fail-closed policy as the `Security / security-scan` CI gate, one layer earlier.
157
+ ## Sandbox validation (V1/V2)
1070
158
 
1071
- **Install (one-time, per clone):**
159
+ `scripts/test-opencode-v1-v2-sandbox.sh` validates the globally installed
160
+ package as a real user inside an isolated sandbox (own `HOME`, npm prefix and
161
+ venv) — never the dev environment. It checks OpenCode V1 (`opencode`) and V2
162
+ (`opencode2`) side by side: binaries, MCP connectivity, `doctor`, and — with
163
+ `--prompts` — a prompt battery covering the `pantheon://agents` resource,
164
+ memory store/recall, filesystem writes and agent delegation. Environmental
165
+ failures (network, provider auth, Docker) are classified as `AMBIENTAL` and
166
+ never fail the run; only real failures do.
1072
167
 
1073
168
  ```bash
1074
- pip install pre-commit
1075
- npm run hooks:install # -> pre-commit install
169
+ scripts/test-opencode-v1-v2-sandbox.sh --prepare # tarball + install + init in the sandbox
170
+ scripts/test-opencode-v1-v2-sandbox.sh --run v1 --prompts # base validation + prompt battery (V1)
171
+ scripts/test-opencode-v1-v2-sandbox.sh --run v2 # base validation only (V2)
172
+ scripts/test-opencode-v1-v2-sandbox.sh --prompts # prompt battery for both versions
173
+ scripts/test-opencode-v1-v2-sandbox.sh --reset # wipe the sandbox root
1076
174
  ```
1077
175
 
1078
- **What the hooks verify (`.pre-commit-config.yaml`):**
1079
-
1080
- | Hook | Checks |
1081
- |---|---|
1082
- | `gitleaks` (v8.24.3) | Hardcoded secrets in the staged diff — Bifrost credential values (`sk-bf-*`), private keys, GitHub/npm/AWS/Google/Slack tokens, `sk-*` keys. Uses `.gitleaks.toml`, redacted output, exit code 2 |
1083
- | `secret-scan` (local, `scripts/secret-scan.mjs`) | Bifrost MCP credential header + value patterns + literal API key / `Authorization: Bearer` values in versionable files |
1084
- | `trailing-whitespace`, `end-of-file-fixer` | Formatting hygiene (auto-fixed) |
1085
- | `check-json`, `check-yaml`, `check-toml` | Config file syntax |
1086
- | `check-merge-conflict`, `check-added-large-files` (max 5 MB), `forbid-new-submodules` | Repo hygiene |
1087
-
1088
- **Security policy:** any secret found **blocks the commit** (fail-fast, no `--no-verify` exceptions). If a secret is flagged, **rotate it immediately** — do not "fix" the scan, do not force the commit.
1089
-
1090
- **Update hooks:** `npm run hooks:update` (runs `pre-commit autoupdate`).
1091
-
1092
- ---
1093
-
1094
- ## FAQ
1095
-
1096
- **How much does this cost?**
1097
- You need an existing subscription for your AI coding editor (OpenCode). Pantheon itself is free and open-source (MIT).
176
+ Modes are combinable (e.g. `--prepare --run v1 --prompts`). Binaries are
177
+ resolved strictly inside the sandbox npm prefix — a non-prepared sandbox fails
178
+ fast instead of silently testing the host installation.
1098
179
 
1099
- **Can I use this outside OpenCode?**
1100
- No — Pantheon v1.0 is OpenCode-only. It uses OpenCode's native agent system, permission blocks, and MCP integration.
180
+ Env overrides:
1101
181
 
1102
- **How are platform configs synced?**
1103
- Edit `src/agents/*.agent.md` (the canonical format), then run the sync script to update platform copies.
182
+ | Variable | Default | Purpose |
183
+ |----------|---------|---------|
184
+ | `PANTHEON_SANDBOX_ROOT` | `~/pantheon-sandbox` | Sandbox root (refused if unsafe for `--reset`) |
185
+ | `OPENCODE_V1_SPEC` | `opencode-ai@1.18.18` | npm spec providing the `opencode` binary |
186
+ | `OPENCODE_V2_SPEC` | `@opencode-ai/cli@beta` | npm spec providing the `opencode2` binary |
187
+ | `PANTHEON_SANDBOX_MODEL` | `opencode-go/mimo-v2.5` | Model used by init and prompts |
188
+ | `PANTHEON_PROMPT_TIMEOUT` | `300` | Per-prompt timeout in seconds |
1104
189
 
1105
- **Can I override Themis's code review?**
1106
- You can proceed past the review gate even if Themis flags issues — except test coverage.
1107
- Below 80% coverage is a hard block by design.
190
+ Exit codes: `0` no real failures · `1` real failure (see `prompts-report.md`
191
+ in the sandbox root) · `2` usage error · `3` sandbox not prepared.
1108
192
 
1109
- **How long does a typical feature take?**
1110
- Simple endpoints: 2–4 hours. Full features (backend + frontend + DB): 6–8 hours. Large
1111
- systems: 20–30 hours across multiple sprint sessions.
193
+ ## Documentation
1112
194
 
1113
- **What happens if my editor session is interrupted?**
1114
- Open phases pause. The memory bank captures the last committed state. Resume by
1115
- invoking `@mnemosyne Recall` to retrieve the previous session context.
195
+ - [Installation](docs/INSTALLATION.md) · [Quick start](docs/QUICKSTART.md)
196
+ - [Architecture](docs/ARCHITECTURE.md) · [MCP tools](docs/mcp-tools.md)
197
+ - [Platforms](docs/PLATFORMS.md) · [Upgrading](docs/UPGRADING.md)
198
+ - [Agent reference](docs/agents/README.md) · [Skills reference](src/skills/README.md)
199
+ - [Release process](docs/RELEASING.md) · [Contributing](CONTRIBUTING.md)
200
+ - [Changelog](CHANGELOG.md)
1116
201
 
1117
- ---
202
+ ## Contribute
1118
203
 
1119
- ## Inspiration & Ecosystem
204
+ Ideas, bug reports, documentation improvements, and code contributions are
205
+ welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) before opening an issue
206
+ or pull request.
1120
207
 
1121
- Pantheon draws from the broader multi-agent landscape while diverging in key ways:
1122
-
1123
- | Framework | Pattern | Key Difference |
1124
- |---|---|---|
1125
- | **AutoGen** (Microsoft) | Event-driven conversations | Research-grade, Python SDK; Pantheon is config-only |
1126
- | **CrewAI** | Role-based crews | Visual editor, self-hosted; Pantheon lives inside your editor |
1127
- | **LangGraph** | Stateful actor graphs | Code-first graph DSL; Pantheon uses markdown + YAML config |
1128
- | **MetaGPT** | Software company roles | Simulates a company; Pantheon delegates to you at every gate |
1129
- | **OpenAI Swarm** | Lightweight handoffs | Sequential only; Pantheon supports parallel subagents |
1130
-
1131
- ### Key design decisions
1132
-
1133
- - **Context isolation via subagents** — Apollo runs in isolated context; only findings return
1134
- - **Parallel execution** — Independent scopes execute simultaneously
1135
- - **Tool minimization** — Each agent has the smallest necessary tool surface
1136
- - **Human approval gates** — No auto-merging, no phantom commits
1137
- - **Model-role alignment** — Fast models for discovery, powerful models for reasoning
1138
-
1139
- ---
208
+ ## Citation and DOI
1140
209
 
1141
- ## References
210
+ Pantheon is released under the [MIT License](LICENSE). For the published v1.4.3
211
+ record, use the [Zenodo DOI](https://doi.org/10.5281/zenodo.22306637); citation
212
+ metadata is also available in [CITATION.cff](CITATION.cff).
1142
213
 
1143
- | Resource | Purpose |
1144
- |---|---|
1145
- | [AGENTS.md](AGENTS.md) | Full agent reference — behavior, tools, constraints |
1146
- | [CONTRIBUTING.md](CONTRIBUTING.md) | How to extend the framework |
1147
- | [CHANGELOG.md](CHANGELOG.md) | Release history |
1148
- | [docs/INSTALLATION.md](docs/INSTALLATION.md) | Installation guide |
1149
- | [docs/platforms/opencode.md](docs/platforms/opencode.md) | OpenCode setup guide |
1150
- | [docs/agents/README.md](docs/agents/README.md) | Agent directory |
1151
- | [src/skills/README.md](src/skills/README.md) | Skill directory |
1152
- | [docs/mcp-tools.md](docs/mcp-tools.md) | Canonical MCP tool registry |
1153
- | [docs/mcp-user-guide.md](docs/mcp-user-guide.md) | Adding custom MCP servers |
1154
- | [docs/mcp-recommendations.md](docs/mcp-recommendations.md) | Recommended MCP servers per project type |
1155
- | [scripts/hooks/](scripts/hooks/) | Agent lifecycle hooks |
214
+ Canonical repository: <https://github.com/ils15/pantheon-opencode>
1156
215
 
1157
216
  ---
1158
217
 
1159
- **License:** MIT
1160
- **Architecture Pattern:** Conductor-Delegate
1161
- **Mythology:** Greek (Zeus, Athena, Apollo, Hermes, Aphrodite, Talos, Themis, Mnemosyne, Gaia, Hephaestus, Nyx, Prometheus, Demeter, Iris)
218
+ [Leia em português (Brasil)](README.pt-BR.md)