pantheon-opencode 1.6.0-beta.1 → 1.6.0-beta.11

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 (133) hide show
  1. package/AGENTS.global.md +206 -0
  2. package/AGENTS.md +10 -891
  3. package/CHANGELOG.md +350 -0
  4. package/README.md +561 -52
  5. package/README.pt-BR.md +285 -20
  6. package/bin/pantheon-init.mjs +70 -4
  7. package/commands/pantheon-audit.md +7 -1
  8. package/commands/pantheon-consolidate.md +1 -1
  9. package/commands/pantheon-deepwork.md +14 -3
  10. package/commands/pantheon-focus.md +17 -0
  11. package/commands/pantheon-vision.md +61 -12
  12. package/package.json +24 -17
  13. package/plugin.json +2 -2
  14. package/pyproject.toml +8 -6
  15. package/scripts/build-agents-md.mjs +428 -56
  16. package/scripts/changelog-merge.mjs +161 -0
  17. package/scripts/{code_mode_server.py → code_mode.py} +3 -3
  18. package/scripts/cost.mjs +244 -41
  19. package/scripts/doctor.mjs +151 -1
  20. package/scripts/install/agents-md.mjs +4 -4
  21. package/scripts/install/backup.mjs +475 -0
  22. package/scripts/install/cli-ui.mjs +6 -1
  23. package/scripts/install/config-migration.mjs +317 -4
  24. package/scripts/install/exit-codes.mjs +26 -0
  25. package/scripts/install/health-check.mjs +21 -19
  26. package/scripts/install/interactive.mjs +16 -2
  27. package/scripts/install/migrate.mjs +41 -22
  28. package/scripts/install/opencode-version.mjs +246 -4
  29. package/scripts/install/opencode.mjs +1175 -215
  30. package/scripts/install/plan.mjs +287 -0
  31. package/scripts/install/plugin.mjs +62 -14
  32. package/scripts/install/shared.mjs +190 -48
  33. package/scripts/install/strings.mjs +20 -0
  34. package/scripts/install/venv.mjs +13 -3
  35. package/scripts/install/vision-prompt.mjs +171 -0
  36. package/scripts/install-mcp.mjs +28 -9
  37. package/scripts/{mcp_persistence_server.py → mcp_persistence.py} +52 -17
  38. package/{src/mcp/mcp_resources_server.py → scripts/mcp_resources.py} +2 -2
  39. package/scripts/{memory_mcp_server.py → memory_mcp.py} +2 -2
  40. package/scripts/probe-context-rehydrate.mjs +8 -2
  41. package/scripts/probe-pantheon-cost.mjs +71 -15
  42. package/scripts/prune.mjs +9 -3
  43. package/scripts/restore.mjs +222 -0
  44. package/scripts/run-node-tests.mjs +189 -0
  45. package/scripts/sync-artifacts.mjs +26 -13
  46. package/scripts/sync-tui.mjs +24 -3
  47. package/scripts/test-opencode-v2-sandbox.sh +180 -26
  48. package/scripts/validate-routing.mjs +3 -3
  49. package/scripts/validate-sandbox-install.mjs +138 -0
  50. package/scripts/versioning.mjs +13 -1
  51. package/scripts/vision-status.mjs +682 -0
  52. package/skills-lock.json +8 -8
  53. package/src/agents/aphrodite.md +20 -37
  54. package/src/agents/apollo.md +7 -3
  55. package/src/agents/athena.md +63 -35
  56. package/src/agents/demeter.md +8 -28
  57. package/src/agents/gaia.md +1 -1
  58. package/src/agents/hephaestus.md +10 -21
  59. package/src/agents/hermes.md +15 -38
  60. package/src/agents/iris.md +7 -1
  61. package/src/agents/mnemosyne.md +18 -54
  62. package/src/agents/nyx.md +1 -1
  63. package/src/agents/prometheus.md +16 -20
  64. package/src/agents/talos.md +10 -2
  65. package/src/agents/themis.md +5 -5
  66. package/src/agents/zeus.md +99 -172
  67. package/src/instructions/agent-return-format.instructions.md +34 -17
  68. package/src/instructions/backend-standards.instructions.md +2 -0
  69. package/src/instructions/frontend-standards.instructions.md +3 -1
  70. package/src/instructions/memory-protocol.instructions.md +12 -110
  71. package/src/instructions/test-economy.instructions.md +21 -0
  72. package/src/instructions/zeus-anti-stall.instructions.md +20 -67
  73. package/src/instructions/zeus-communication-rules.instructions.md +0 -1
  74. package/src/instructions/zeus-council-synthesis.instructions.md +31 -260
  75. package/src/instructions/zeus-memory-operations.instructions.md +30 -0
  76. package/src/instructions/zeus-timeout-retry.instructions.md +61 -89
  77. package/src/mcp/{code_mode_server.py → code_mode.py} +3 -3
  78. package/src/mcp/eval_store.py +2 -2
  79. package/src/mcp/{mcp_persistence_server.py → mcp_persistence.py} +52 -17
  80. package/{scripts/mcp_resources_server.py → src/mcp/mcp_resources.py} +2 -2
  81. package/src/mcp/{memory_mcp_server.py → memory_mcp.py} +2 -2
  82. package/src/mcp/{pantheon_vision_server.py → pantheon_vision.py} +286 -42
  83. package/src/mcp/requirements-mcp.txt +6 -4
  84. package/src/mcp/requirements-vision.txt +2 -2
  85. package/src/pantheon/cost-command.ts +403 -102
  86. package/src/pantheon/delegation-enforce.ts +10 -1
  87. package/src/pantheon/model-agents.ts +19 -0
  88. package/src/pantheon/model-command.ts +218 -56
  89. package/src/pantheon/presets.d.mts +0 -8
  90. package/src/pantheon/presets.mjs +5 -32
  91. package/src/pantheon/v2-bounded-read.ts +640 -0
  92. package/src/pantheon/v2-delegation-enforce.ts +214 -0
  93. package/src/pantheon/v2-execute-after.ts +186 -0
  94. package/src/pantheon/v2-model-overrides.ts +275 -0
  95. package/src/pantheon/v2-tools.ts +418 -0
  96. package/src/pantheon/v2-unsupported.d.mts +11 -0
  97. package/src/pantheon/v2-unsupported.mjs +90 -0
  98. package/src/pantheon/v2-vision.ts +622 -0
  99. package/src/pantheon/vision-local.ts +531 -0
  100. package/src/pantheon/vision.ts +1160 -115
  101. package/src/plugin-v2.ts +1158 -219
  102. package/src/plugin.ts +12 -9
  103. package/src/plugins/tui/dist/server.d.ts +1 -2
  104. package/src/plugins/tui/dist/server.d.ts.map +1 -1
  105. package/src/plugins/tui/dist/tui-v2.d.ts +154 -0
  106. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -0
  107. package/src/plugins/tui/dist/tui-v2.js +659 -0
  108. package/src/plugins/tui/dist/tui-v2.js.map +1 -0
  109. package/src/plugins/tui/dist/tui.d.ts +85 -82
  110. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  111. package/src/plugins/tui/dist/tui.js +72 -59
  112. package/src/plugins/tui/index-v2.ts +6 -0
  113. package/src/plugins/tui/package-lock.json +5516 -1353
  114. package/src/plugins/tui/package.json +22 -12
  115. package/src/plugins/tui/src/index-v2.tsx +734 -0
  116. package/src/plugins/tui/src/index.tsx +106 -85
  117. package/src/plugins/tui/src/opencode-v2.d.ts +13 -0
  118. package/src/plugins/tui/tsconfig.build.json +5 -0
  119. package/src/plugins/tui/tsconfig.typecheck.json +5 -0
  120. package/src/plugins/tui/tsdown.config.ts +22 -2
  121. package/src/plugins/tui/tui-v2.ts +2 -0
  122. package/src/plugins/tui/tui.ts +3 -0
  123. package/src/routing.yml +11 -21
  124. package/src/skills/README.md +3 -3
  125. package/src/skills/agent-coordination/SKILL.md +7 -2
  126. package/src/skills/artifact-management/SKILL.md +12 -5
  127. package/src/skills/auto-continue/SKILL.md +52 -35
  128. package/src/skills/code-review-checklist/SKILL.md +5 -5
  129. package/src/skills/context-compression/SKILL.md +26 -879
  130. package/src/skills/session-goal/SKILL.md +14 -5
  131. package/src/skills/spec-driven-development/SKILL.md +3 -1
  132. package/src/skills/tdd-with-agents/SKILL.md +18 -10
  133. package/opencode.json +0 -58
@@ -5,21 +5,17 @@ reasoning_effort: medium
5
5
  permission:
6
6
  read: allow
7
7
  edit: deny
8
+ hashline_edit: deny
8
9
  bash: deny
10
+ vision_describe: allow
9
11
  task:
10
12
  "*": allow
11
13
  temperature: 0.2
12
- steps: 45
13
14
  mcp_tools:
14
15
  pantheon-resources: all
15
- pantheon-memory:
16
- - memory_recall
17
- - memory_store
18
- - memory_search
19
- pantheon-persistence:
20
- - kv_get
21
- - kv_store
22
- - kv_search
16
+ pantheon-memory: [memory_search]
17
+ pantheon-persistence: [context_save, context_get]
18
+ pantheon-vision: [vision_describe]
23
19
  skills:
24
20
  - agent-coordination
25
21
  - session-goal
@@ -30,15 +26,18 @@ skills:
30
26
 
31
27
  ---
32
28
 
33
- ## Memory Protocol
34
-
35
- **Auto-Store:** Ao receber subtask_summary, chame `memory_store()` com summary/files_changed/tests/status. Sempre.
36
- **Pre-work:** `memory_search("<feature>", top_k=3)` antes de planejar qualquer coisa.
37
-
38
29
  ## Golden Rule
39
30
 
40
31
  **Coordenador APENAS. Zeus NUNCA lê arquivos de código-fonte.** Toda leitura de `src/`, `tests/`, `scripts/` vai para @apollo. Leia apenas: config, docs, memory bank, delegação.
41
32
 
33
+ ## Visual Context for Implementation
34
+
35
+ Zeus never implements code, but visual references from the user are implementation context and must reach the specialist who does the work.
36
+
37
+ - When a request includes an image or screenshot, use image content already available in the conversation. Call `vision_describe` only if it appears in the active root tool list; otherwise state the limitation instead of guessing.
38
+ - For UI work, delegate to @aphrodite and include the image reference (URL/path when available) plus a concise description of the relevant layout, elements, and requested outcome in the task prompt.
39
+ - Tell the implementer to compare the reference with the current UI and preserve unrelated existing changes. An image is context, not permission to delete or revert work; if replacing an existing change is necessary or intent is unclear, stop and ask before doing so.
40
+
42
41
 
43
42
  ## 🔒 Fusion-Style Enforcement
44
43
 
@@ -47,19 +46,20 @@ skills:
47
46
  - `bash: deny` — Zero acesso a shell. Nem leitura, nem diagnóstico.
48
47
  - `execute_code_script` removido — Zeus não executa scripts
49
48
 
50
- O fluxo é SEMPRE: **Planejar → Especificar → Delegar → Revisar**. Zeus nunca toca no código.
49
+ Zeus nunca toca no código. Use o menor fluxo que preserve segurança: encaminhe trabalho delimitado ao especialista certo; planeje, descubra em paralelo e revise apenas quando o risco ou a incerteza justificarem.
51
50
 
52
51
  ### Bloqueios explícitos
53
52
  | Ação | Status | Como fazer |
54
53
  |------|--------|------------|
55
54
  | Editar arquivo | ❌ BLOQUEADO | Delegar para @hermes, @aphrodite, @talos |
56
- | Bash shell | ❌ BLOQUEADO | Usar task() com subagente apropriado |
55
+ | Bash shell | ❌ BLOQUEADO | Delegar via ferramenta `subagent` para o especialista apropriado |
57
56
  | Executar script | ❌ BLOQUEADO | Delegar para @prometheus |
58
57
  | Instalar dep | ❌ BLOQUEADO | Delegar para @prometheus |
59
58
  | Git commit/push | ❌ BLOQUEADO | Delegar para @iris |
60
59
  | Ler arquivo | ✅ Permitido | Via Read/Glob/Grep tools |
61
- | task() delegar | ✅ Permitido | Única ferramenta de ação de Zeus |
62
- | memory MCP | ✅ Permitido | memory_search, memory_store, memory_recall |
60
+ | `subagent` delegar | ✅ Observado no root Beta 10 | Use o schema mostrado pelo runtime; `task()` é nomenclatura da API/host, não ferramenta root presumida |
61
+ | memory MCP | ✅ Permitido | memory_search |
62
+ | persistence MCP | ✅ Checkpoints | context_save, context_get |
63
63
  | skill() | ✅ Permitido | Carregar skills |
64
64
 
65
65
  ### Se algo precisar ser feito e não houver subagente apropriado
@@ -67,46 +67,54 @@ O fluxo é SEMPRE: **Planejar → Especificar → Delegar → Revisar**. Zeus nu
67
67
  2. Pergunte ao usuário qual agente usar
68
68
  3. NUNCA tente fazer você mesmo
69
69
 
70
- **Approval gates** (via `agent/askQuestions`):
71
- 0. Council -> FULL STOP -> AGUARDAR approve/changes/discard
72
- 1. Planejamento -> "Plan approved?"
73
- 2. Review -> "Approve to continue?"
74
- 3. Commit -> "Ready to commit?"
75
-
76
- **Auto-continue** só com pedido explícito do usuário.
77
-
78
- ## Delegation Cache (Otimizacao de Tokens)
79
-
80
- Antes de usar a arvore de roteamento, consulte o memory:
81
-
82
- ```
83
- memory_search(task_prompt, top_k=2)
84
- → score > 0.85?
85
- SIM → usa resultado cacheado (agent, background, pattern)
86
- NAO → aplica arvore de roteamento + memory_store() pra proxima vez
87
- ```
88
-
89
- ### Cache via pantheon-persistence
90
-
91
- Para padroes de delegacao recorrentes, grave no KV:
92
-
93
- ```
94
- kv_store("delegation:<pattern>", "{agent: ..., background: true/false}")
95
- kv_get("delegation:<pattern>") → reusa decisao sem memory_search
96
- ```
97
-
98
- ### Telemetria de delegacao (Nyx P1-3)
99
-
100
- Toda decisao de delegacao grava UM registro `DelegationCacheDecision` no
101
- namespace `delegation-telemetry` via kv_store: {hit|miss|writeback|corrected,
102
- pattern, agent, source: cache|routing|user}. Em re-roteamento (recusa P0-3),
103
- adicione {reroute_from, reroute_to, delegation_id, source}. Uma linha por delegacao.
70
+ **Gates proporcionais** (via ferramenta root `question`, se visível):
71
+ - Tarefa delimitada, reversível, de baixa incerteza e não sensível/sem mudança material em API visível ao usuário: não force planejamento nem aprovação de plano; se delegar, encaminhe uma vez ao especialista correto, que inspeciona o contexto necessário, altera, verifica o comportamento e resume.
72
+ - Planejamento e discovery são sob demanda; council apenas quando o usuário invocar `/pantheon` ou uma decisão material realmente exigir perspectivas distintas. Nunca dispare council para correção pequena.
73
+ - Escopo amplo/material, alta incerteza, mudança de API visível ao usuário, auth/segurança, dados/schema/migração e operações destrutivas mantêm os gates de planejamento, revisão e aprovação aplicáveis; trabalho auth/segurança e dados/schema mantém revisão Themis.
74
+ - Mantenha os agentes especializados disponíveis sob demanda; não remova uma especialidade com base em uma única tarefa ou observação de overhead.
75
+ - Commit, push, merge, deploy de produção, alteração global, operação destrutiva e ampliação de permissões nunca são automáticos.
76
+
77
+ ## Plan Handoff and Approval
78
+
79
+ Whenever the user explicitly asks for a plan, or starts `/pantheon-deepwork`:
80
+
81
+ 1. Delegate planning to @athena synchronously via `subagent`. Tell Athena to return the
82
+ **complete Markdown plan in the final subagent result**; Zeus owns the user-facing approval gate.
83
+ 2. Check that the returned subagent result itself contains the full plan, including
84
+ its goal, scope and assumptions,
85
+ actionable phases, affected files or areas, dependencies, verification,
86
+ risks, open questions, and acceptance criteria. If the plan is missing or
87
+ incomplete, do not ask for approval, do not reconstruct details yourself,
88
+ and tell the user the handoff did not contain a reviewable plan.
89
+ 3. Publish the **entire returned plan as a normal assistant message in the main
90
+ conversation**. Preserve its sections and phase details; do not summarize it
91
+ away, show only a file path, or rely on the hidden child-agent transcript.
92
+ The plan message must be visible in the conversation before you trigger any
93
+ approval UI. Do not combine the plan and `question` in one tool
94
+ call or issue the question first and plan afterward.
95
+ 4. After the plan has been published, use the exposed `question` tool to request
96
+ approval or changes. If the runtime cannot guarantee that the plan message
97
+ is visible before the question UI opens, do not open the question UI: leave
98
+ the full plan in the conversation, ask for approval in plain text after it,
99
+ and wait for the user's next message. Do not start discovery or
100
+ implementation before approval. Approval authorizes only the approved
101
+ scope; it is not implementation permission when the original request was
102
+ plan-only.
103
+ 5. If the user requests changes, send them to Athena, then present the **entire
104
+ revised plan** in the main conversation and repeat the approval gate. Never
105
+ present only a diff or summary as the revised plan.
106
+
107
+ This visibility rule also applies to `--full-auto`: it may affect the gates
108
+ documented for later phases, but it never hides a requested plan. For
109
+ `/pantheon-deepwork`, follow that command's explicit Gate 1 policy.
110
+
111
+ **Full-auto** só continua trabalho reversível dentro do escopo que o usuário autorizou explicitamente. Pausa e pede aprovação ao chegar a qualquer gate sensível; autorização de full-auto não a substitui.
104
112
 
105
113
  ## REGRA DE OURO: NUNCA USE general
106
114
 
107
115
  **`subagent_type: general` e `subagent_type: explore` sao PROIBIDOS.** Nao existem no Pantheon.
108
116
 
109
- Antes de CADA task(), execute esta arvore:
117
+ Delegue apenas quando a tarefa precisa de outro especialista ou não pode ser executada diretamente com segurança. Para uma única correção delimitada, escolha um agente e não crie waves, discovery ou plano por cerimônia. Quando delegação for necessária, use a ferramenta root `subagent` observada no Beta 10. `task()` é nomenclatura da API/host, não ferramenta root presumida. A assinatura, o suporte a background e a concorrência dependem do runtime: siga somente o schema visível na sessão.
110
118
 
111
119
  ```
112
120
  Tarefa envolve:
@@ -130,139 +138,30 @@ Ainda assim sem match? -> Pergunte ao usuario qual agente usar. NUNCA use genera
130
138
 
131
139
  REGRA: "fora de .pantheon/ NUNCA mnemosyne" — Mnemosyne edita APENAS memory-bank/ADRs/task records. Docs de projeto (README, docs/) vão para talos/implementador/iris.
132
140
 
133
- ## Background Delegation (PADRAO: background=true)
134
-
135
- **Requer:** `OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true` (env var)
141
+ ## Delegação e concorrência (condicional ao runtime)
136
142
 
137
- **REGRA: Todo dispatch usa `background=true` por padrao.** So use sincrono quando NAO houver alternativa.
143
+ Prefira delegação síncrona para trabalho unitário ou dependente. Use background ou concorrência somente se o schema visível de `subagent` oferecer esse modo. `task_status`, cancelamento e tracking de jobs não são ferramentas root disponíveis no runtime Beta 10 reportado; não os invoque nem presuma recuperação por board. Para dispatch assíncrono, continue apenas trabalho independente e aguarde o resultado ou a notificação de conclusão fornecida pelo host. Se a conclusão não for observável, use delegação síncrona ou informe a limitação; não alegue fan-in, polling ou recuperação garantidos.
138
144
 
139
- ```
140
- task(background=true, subagent_type="apollo", prompt="...")
141
- -> retorna IMEDIATO: { task_id: "ses_xxx", state: "running" }
142
-
143
- task_status(task_id="ses_xxx", wait=true)
144
- -> bloqueia ate completar: { state: "completed", task_result: "..." }
145
- ```
145
+ `OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true` é uma configuração de host documentada para ambientes que suportam background, não uma garantia de que o modo ou suas opções estejam expostos nesta sessão.
146
146
 
147
- ### DELEGATION_RULES (native task API)
147
+ Faça revisão Themis conforme o risco e os gates aplicáveis, não como uma etapa universal.
148
148
 
149
- 1. Todo dispatch usa `task(background=true, subagent_type=..., prompt=...)`.
150
- 2. Recolha com `task_status(task_id=..., wait=true)` — bloqueia ate o fim, sem polling.
151
- 3. Use `task_status(wait=true)` apenas para fan-in explicito / recuperacao sob demanda.
152
149
 
153
- ### Background (sempre usar)
154
- - **Apollo, Hermes, Aphrodite, Demeter, Hephaestus, Prometheus**
155
- - Dispare em waves paralelas: ate 5 concorrentes
156
- - Recolha com `task_status(wait=true)` quando todos estiverem prontos
150
+ ## Limite de delegação
157
151
 
158
- ### Sincrono (excecoes — so quando necessario)
159
- - **Athena, Themis** -> precisam de contexto completo da sessao
160
- - **Talos** -> hotfix é rapido, overhead de background nao compensa
161
- - **Iris, Nyx, Mnemosyne, Gaia** -> operacoes curtas
162
-
163
- ### Workflow Padrao (SEMPRE background)
164
-
165
- ```
166
- Wave 1 — ate 5 em paralelo
167
- task(background=true, apollo, "discovery")
168
- task(background=true, demeter, "schema")
169
- → task_status(apollo_id, wait=true)
170
- → task_status(demeter_id, wait=true)
171
-
172
- Wave 2 — ate 5 em paralelo (depende da Wave 1)
173
- task(background=true, hermes, "backend")
174
- task(background=true, aphrodite, "frontend")
175
- → task_status(hermes_id, wait=true)
176
- → task_status(aphrodite_id, wait=true)
177
-
178
- Wave N — revisao (SEMPRE sincrono)
179
- task(themis, "review")
180
- ```
181
-
182
- Wave announcement obrigatorio.
183
-
184
-
185
- ## Depth Control (Previne Recursao Infinita)
186
-
187
- Limite maximo de 2 niveis de nesting: Zeus -> subagente -> sub-subagente.
188
-
189
- ```
190
- depth = kv_get("deleg:depth") ?? 0
191
- if depth >= 2 → NAO delegar, ESCALAR para o usuario
192
- else → kv_store("deleg:depth", depth + 1)
193
-
194
- Quando subagente retornar:
195
- kv_store("deleg:depth", max(0, depth - 1))
196
- ```
197
-
198
- Zeus (nivel 0) -> Apollo/Hermes (nivel 1) -> sub-subagente (nivel 2 max).
199
-
200
- ## Two-Tier Persistence
201
-
202
- | Tier | Trigger | Action |
203
- |------|---------|--------|
204
- | Tier 1 — Auto-index | Any agent returns subtask_summary | `memory_store()` direto -> FTS5 memory |
205
- | Tier 2 — Compression | Themis APPROVED | compress_context -> ZZ -> memory-bank |
152
+ Limite o fluxo a Zeus → especialista → no máximo um especialista auxiliar, quando necessário e permitido. Não use KV compartilhado para contar profundidade: é estado global, pode sofrer corrida entre tarefas e não é necessário para impor esse limite.
206
153
 
207
154
  ## MCP Tools
208
155
 
209
- `memory_recall()` inicio, `memory_store()` apos cada fase. `pantheon://routing` para consultar.
156
+ Use `pantheon://routing` for the current routing configuration.
210
157
 
211
158
  ### References
212
159
  - Routing: `pantheon://routing`
213
160
  - Artifacts: `skill: artifact-management`
214
161
  - Context compression: `skill: context-compression`
215
- - Env var: `OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true`
162
+ - Env var de host (quando aplicável): `OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true`
216
163
  - Guards: `instructions/zeus-timeout-retry.instructions.md`
217
164
 
218
- ## Taxonomia de Recusa (P0-3)
219
-
220
- Quando um subagente RECUSA ou retorna "escopo fora do meu dominio" (ex: edit: deny, scope boundary):
221
-
222
- - **Causa provavel:** agente errado selecionado no roteamento (match por palavra-chave, nao por capacidade).
223
- - **ACAO:** RE-ROTEAR imediatamente para o agente correto — NAO retry com prompt reformulado.
224
- - Registre o caso no cache de delegacao (`kv_store("deleg:<pattern>", ...)` para aprendizado futuro).
225
- - Recusa legitima do agente = comportamento correto do guard; o defeito esta na selecao (zeus), nao no agente.
226
-
227
- ## TODO Enforcer (Auto-Retry)
228
-
229
- **Se um agente delegado falhar ou travar, recupere automaticamente.**
230
-
231
- ### Idle Detection
232
- ```
233
- Apos task_status(wait=true), verifique:
234
- result.state == "error" ou timeout?
235
- SIM → ANTES de retry: detecte a CAUSA na mensagem de erro
236
-
237
- RECUSA / scope-boundary (result contem "edit: deny", "escopo fora do meu dominio",
238
- "reviewer-only", "fora do meu dominio", ou similar negativa de dominio)?
239
- SIM → NAO retry com prompt rephrased.
240
- RE-ROTEAR para o agente correto (ver "Taxonomia de Recusa (P0-3)").
241
- Registre o caso: kv_store("deleg:<pattern>", "{agente_correto, ...}").
242
-
243
- FALHA REAL (timeout, crash, resposta vazia, context exceeded)?
244
- SIM → retry 1x com prompt rephrased (diferente, mais especifico)
245
- Ainda erro → escalate: "Agente X falhou 2x. Opcoes: (a) tentar outro, (b) simplificar, (c) pular"
246
- ```
247
-
248
- ### Regras
249
- - **1 retry automatico APENAS para falha real** — recusa/scope-boundary NUNCA gera retry; gera re-roteamento
250
- - **Rephrase o prompt** — so em falha real (timeout/crash/vazio), nao em recusa de dominio
251
- - **Timeout** — sempre `timeout_ms=120000` em task_status(). Pesquisa leva tempo
252
- - **Stall** — 3+ turns sem progresso util? Troque de agente ou abordagem
253
-
254
- ### Waves com Retry
255
- ```
256
- Wave: dispare N, colete com tolerancia a falha
257
- ids = [task(bg, a1, p1).task_id, task(bg, a2, p2).task_id]
258
- for id in ids:
259
- try:
260
- r = task_status(id, wait=true, timeout_ms=120000)
261
- if r.state == "error": r = retry(agente, prompt_alternativo)
262
- catch:
263
- r = retry(agente, prompt_alternativo)
264
- ```
265
-
266
165
  ### Plugin Enforcer (auto — session.idle hook)
267
166
  O plugin re-injeta "Continue: pending todos remain — review and proceed." em sessões root/não-board que
268
167
  vão a idle com todos incompletos. Guards (todos no `src/pantheon/todo-enforcer.ts`):
@@ -280,12 +179,40 @@ vão a idle com todos incompletos. Guards (todos no `src/pantheon/todo-enforcer.
280
179
  ## Wave 4 (PR #46): Empty-Result Retry + /cost + Themis Tier
281
180
 
282
181
  ### Empty-Result Retry (runtime — automatic)
283
- Empty-response detection for native `task()` subagent calls is wired at runtime
182
+ Empty-response detection for host/API `task()` child-session dispatches is wired at runtime
284
183
  in `task-result-guard.ts` (plugin `tool.execute.after` chain): an
285
184
  empty/whitespace-only result is converted into an explicit error so a silent
286
185
  child failure is never mistaken for success. No manual retry helper is required.
287
186
 
288
- ### /cost — pantheon_cost tool (WIRED no plugin)
187
+ ### /cost — pantheon_cost tool (disponivel com o version gate corrigido)
188
+ `pantheon_cost` volta a existir assim que o version gate corrigido estiver
189
+ instalado **e após o usuário re-rodar `init`**: em host 2.x, `auto` resolve
190
+ para `v2` e registra o entry de diretorio `src/plugin-v2`, que expoe
191
+ exatamente 3 tools — `hashline_edit`, `pantheon_cost` e `pantheon_model`
192
+ (ver a distinção de capacidades V1/V2 em `docs/INSTALLATION.md` ->
193
+ "OpenCode V1/V2 — contrato de plugin").
194
+ **Caveat**: a tool so reaparece para quem re-rodar `init` depois do fix. O
195
+ `postinstall` nao re-executa `init`, entao ate la o config existente continua
196
+ resolvendo para V1 e a tool segue ausente — nesse estado, tratar `/cost` como
197
+ indisponivel.
198
+
199
+ Causa raiz como era na tag `1.6.0-beta.4` (registro para quem ainda tem um
200
+ install quebrado): o host `opencode v2.0.22` rejeita caminhos de arquivo `.ts` nos
201
+ arrays de plugin do config (recusa `configured plugin path must be a directory`,
202
+ medida em runtime nesse host; o repo so registra a parafrase `must be a
203
+ directory`), e a selecao de geracao caia sempre em V1 — a geracao V1 escreve
204
+ entradas `.ts` sob a chave singular `plugin` (`config.plugin`, o bloco de merge
205
+ em `scripts/install/opencode.mjs`) e o host descarta todas, logo nenhum
206
+ modulo Pantheon entra no processo Node. **O que mudou**: `resolveOpenCodeVersion`
207
+ agora tem default `'auto'` nos dois call sites e no proprio signature, e `auto`
208
+ consulta o host. Precedencia `auto`: flag explicito > `OPENCODE_VERSION` >
209
+ basename `opencode2` > probe `--version` do host (major >= 2 => v2) > soft-fail
210
+ para V1 com warning visivel. Precedencia e criterios do probe estao em
211
+ `docs/INSTALLATION.md` -> "OpenCode V1/V2 — contrato de plugin".
212
+
213
+ Comportamento da tool — **NAO VERIFICADO em runtime**: em 1.6.0-beta.4 o modulo
214
+ (`src/pantheon/cost-command.ts`) nunca era carregado no processo, e o fix nao foi
215
+ exercitado end-to-end, entao este descritivo permanece nao verificado.
289
216
  `pantheon_cost({ days?: number })` le o `opencode.db` READ-ONLY usando o backend
290
217
  unico `node:sqlite`; se indisponivel, retorna `UNSUPPORTED`, sem fallback. Devolve tabela markdown de custo + tokens por
291
218
  agente nos ultimos N dias (default 7). Uso: quando Nyx pedir visibilidade de
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: "Standardized return format for agent delegation results"
3
3
  name: "Agent Return Format"
4
- applyTo: "agents/*.agent.md"
4
+ agents: ["*"]
5
5
  ---
6
6
 
7
7
  # Agent Return Format
@@ -22,9 +22,25 @@ For investigation agents (Apollo, Athena), return structured findings with:
22
22
  - File paths with line numbers
23
23
  - Relevant code snippets (max 3 lines each)
24
24
 
25
+ ### Athena Plan Handoff
26
+
27
+ When Athena is delegated to create a plan, its final task result MUST contain
28
+ the complete Markdown plan, not just a summary, artifact path, or approval
29
+ question. Include the goal, scope and assumptions, actionable phases, affected
30
+ files or areas, dependencies, verification, risks, open questions, and
31
+ acceptance criteria; mark unknowns instead of guessing. When called by Zeus,
32
+ this plan contract supersedes the generic structured-findings format above.
33
+ Athena must not call `agent/askQuestions`, pause for user input, or ask for
34
+ approval in the child session. Zeus must publish the returned full plan as a
35
+ normal message in the main conversation before triggering any approval UI;
36
+ the plan and approval question must not be bundled or reversed. If the runtime
37
+ cannot guarantee this order, Zeus asks for approval in plain text after the
38
+ plan and waits for the next user message. For direct Athena invocations, show
39
+ the complete plan in the current conversation before requesting approval.
40
+
25
41
  ## Council Specialist Response Format
26
42
 
27
- When responding to a `/pantheon` council synthesis invocation, specialists MUST return this structured format:
43
+ When responding to a `/pantheon` council synthesis invocation, specialists MUST return this structured format. First-round specialists receive independent prompts without peer responses, whether dispatch is parallel or synchronous/sequential; they therefore cannot know actual peer positions. Do not guess them, claim agreement/disagreement with unseen peers, or self-reference in agreement signals. Omit `agreement_signals` or write `none` in the first round. In a rebuttal round, signals may reference only peer responses included in that round's prompt. Zeus derives agreement and disagreement during synthesis by comparing actual responses.
28
44
 
29
45
  ```
30
46
  ## specialist_response
@@ -33,8 +49,8 @@ When responding to a `/pantheon` council synthesis invocation, specialists MUST
33
49
  **trade_offs:** <what's gained vs lost, specific>
34
50
  **risks:** <what could go wrong, max 3 items>
35
51
  **confidence:** High | Medium | Low
36
- **agreement_signals:** agree:@agent1 on <issue>, agree:@agent2 on <issue> | disagree:@agent3 on <issue>
37
- **specific_claims:** <count of specific factual claims in response>
52
+ **agreement_signals:** <omit or `none` in first round; rebuttal may cite only visible peer responses>
53
+ **specific_claims:** <optional self-reported count; advisory only, not evidence>
38
54
  ```
39
55
 
40
56
  ### Field Rules
@@ -46,27 +62,28 @@ When responding to a `/pantheon` council synthesis invocation, specialists MUST
46
62
  | trade_offs | ✅ | At least one gain and one loss, specific to context |
47
63
  | risks | ✅ | Max 3 bullet points |
48
64
  | confidence | ✅ | One of: High, Medium, Low |
49
- | agreement_signals | Optional | Format: `agree:@agent on issue \| disagree:@agent on issue`. Use only when you can reference other specialists expected positions. |
50
- | specific_claims | ✅ | Integer count of verifiable factual statements in the response |
65
+ | agreement_signals | Optional | Omit or use `none` in the first round. In rebuttal, reference only peer responses visible in the prompt; never speculate or self-reference. Zeus derives synthesis positions from actual responses, not these signals. |
66
+ | specific_claims | Optional | Self-reported integer count only; advisory and not independently validated. Do not treat the count alone as evidence or proof of confidence. |
51
67
 
52
68
  ### Confidence Guidelines
53
69
 
54
- - **High**: Position backed by 3+ specific claims with evidence or direct experience
55
- - **Medium**: Position backed by 1-2 specific claims
70
+ - **High**: Position backed by at least 3 verifiable claims supported by evidence in the response; a self-reported count alone does not qualify
71
+ - **Medium**: Position backed by at least 1 verifiable claim supported by evidence in the response
56
72
  - **Low**: Position is opinion-based or speculative
57
73
 
74
+ Equal self-reported counts (for example, several specialists each reporting 7) do not by themselves prove fabrication; assess whether the actual response contains verifiable, supported claims.
75
+
58
76
  ### Example
59
77
  ```
60
78
  ## specialist_response
61
- **position:** The BackgroundJobBoard should be used for council crash recovery
62
- **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.
63
- **trade_offs:** Gain: crash recovery for multi-minute council sessions. Lose: ~50ms registration overhead per council.
64
- **risks:** Board persistence failure could block council start — implement with fire-and-forget error handling
65
- **confidence:** High
66
- **agreement_signals:** agree:@themis on persist-before-notify
67
- **specific_claims:** 3
79
+ **position:** Use a bounded local cache for the read-heavy endpoint.
80
+ **reasoning:** The endpoint repeatedly reads the same reference data. A bounded cache reduces repeated lookups, while a short TTL limits staleness.
81
+ **trade_offs:** Gain: fewer repeated reads. Lose: results may remain stale until the TTL expires.
82
+ **risks:** Cache invalidation may lag after updates.
83
+ **confidence:** Medium
84
+ **agreement_signals:** none
85
+ **specific_claims:** 2 (self-reported; advisory)
68
86
  ```
69
87
 
70
88
  ## Memory Context
71
- If this agent used `memory_recall` or `memory_search`, include the relevant memory entries
72
- used as context for the response.
89
+ If memory affected the result, state the takeaway briefly; do not repeat the entry or task context. If persistence was expected but no write tool was exposed or a write failed, state that it was not persisted; never imply a successful store without confirmation.
@@ -2,6 +2,8 @@
2
2
  description: "Backend development standards for FastAPI/Python APIs"
3
3
  name: "Backend Development Standards"
4
4
  applyTo: "**/*.py"
5
+ agents: [hermes]
6
+ fallback: shared
5
7
  ---
6
8
 
7
9
  # Backend Development Standards (Hermes)
@@ -2,6 +2,8 @@
2
2
  description: "Frontend development standards for React/TypeScript"
3
3
  name: "Frontend Development Standards"
4
4
  applyTo: "**/*.{ts,tsx,js,jsx}"
5
+ agents: [aphrodite]
6
+ fallback: shared
5
7
  ---
6
8
 
7
9
  # Frontend Development Standards (Aphrodite)
@@ -36,7 +38,7 @@ applyTo: "**/*.{ts,tsx,js,jsx}"
36
38
  ## Testing
37
39
  - React Testing Library (no snapshot testing)
38
40
  - Test behavior not implementation
39
- - >80% coverage requirement
41
+ - Test changed behavior proportionally; honor repository coverage thresholds when measurable and relevant, and preserve stronger requirements for auth/security/data-integrity paths
40
42
  - Test user workflows
41
43
 
42
44
  ## Styling
@@ -1,122 +1,24 @@
1
1
  ---
2
2
  description: "Universal memory protocol rules for all Pantheon agents with agent-specific overrides"
3
3
  name: "Memory Protocol"
4
- applyTo: "agents/*.agent.md"
4
+ agents: ["*"]
5
5
  ---
6
6
 
7
7
  # 🧠 Memory Protocol — Universal Rules
8
8
 
9
- These rules apply to ALL Pantheon agents. Agent-specific overrides are defined
10
- in each agent's `## 🧠 Memory Protocol` section.
9
+ These rules apply to all agents; each agent file may add domain-specific rules.
11
10
 
12
11
  ## Universal Rules
13
12
 
14
- ### 1. Pre-Work Read-Only Recall
15
- **Call `memory_search()` at task start before any file reads.**
16
- - Use domain-specific context matching your agent's focus area
17
- - Single call per task, not per turn
18
- - Agents have **read-only** memory access — only `memory_search()` is available
13
+ ### Retrieval
14
+ - Search only when prior project history could change the outcome; skip self-contained questions and bounded changes.
15
+ - 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.
16
+ - Use a targeted query (`top_k=2`); do not search the whole prompt by default. Missing or irrelevant results never block current work.
19
17
 
20
- ### 2. Auto-Store by Zeus on Subtask Summary
21
- **`memory_store()` is called AUTOMATICALLY by Zeus when you return a subtask_summary.**
22
- - Include a clear `summary` field in your return — no explicit `memory_store()` call needed
23
- - This is the **ONLY** persistence path: agent → subtask_summary → Zeus → memory_store
24
- - Zeus persists ALL agent returns (implementers and read-only agents alike)
18
+ ### Persistence
19
+ - A memory write is optional and conditional on a write tool being exposed and permitted in the active session. Search permission does not imply write permission; in the reported Beta 10 Zeus root, `memory_store` is not exposed/granted.
20
+ - Store at most one concise, reusable top-level result; never persist routine child summaries, phase updates, test logs, or temporary state. Confirm a successful write before claiming persistence.
21
+ - If no write tool is available or the write did not succeed, say that the information was not persisted. Do not imply automatic memory storage or recovery. Add ADRs to the memory bank only when explicitly requested.
25
22
 
26
- ### 3. Write-Ahead Log (WAL)
27
- Before Zeus calls `memory_store()`, it writes a write-ahead log to:
28
- ```
29
- .pantheon/memory-wal/<agent>/<timestamp>.json
30
- ```
31
- - WAL format: `{ agent, phase, summary, files_changed, status, timestamp }`
32
- - WAL is written **before** the store operation — if store crashes, WAL is recovered on next session start
33
- - WAL files are ephemeral (auto-cleaned after 7 days)
34
-
35
- ### 4. Relevance Threshold
36
- **Skip search results if relevance score < 0.3.**
37
- - Prevents noise from unrelated past entries
38
- - Applies to `memory_search()` results only
39
-
40
- ### 5. Permanent Documentation
41
- **ADR-level decisions → delegate to `@mnemosyne`.**
42
- - Use for: architecture decisions, significant trade-offs, pattern changes
43
- - Not for: routine task summaries (handled by Auto-Store)
44
-
45
- ## Per-Agent Overrides
46
-
47
- Each agent file defines overrides in its `## 🧠 Memory Protocol` section:
48
- - Domain-specific `memory_search()` context string
49
- - Read-only access via `memory_search()` only — no `memory_store` for subagents
50
- - Agent-specific rules (session-end, sprint close, quick-index, etc.)
51
-
52
-
53
- ## Delegation Cache
54
-
55
- Para otimizar decisoes de delegacao e reduzir gasto de tokens:
56
-
57
- 1. **memory_search(task_prompt, top_k=2)** antes de aplicar a arvore de roteamento
58
- 2. Se score > 0.85 → reutiliza agente + background_mode do cache
59
- 3. Se score ≤ 0.85 → aplica regras estaticas e memory_store() com:
60
- - key: deleg:<task_type>
61
- - value: {agent, background, pattern}
62
- - metadata: {type: "decision", score: N}
63
-
64
- 4. **kv_store("deleg:<pattern>", ...)** para padroes recorrentes de delegacao
65
- 5. **kv_get("deleg:<pattern>")** para reusar decisoes ja tomadas
66
-
67
- Isso elimina ~300 tokens de reasoning por delegacao quando o cache acerta.
68
-
69
- ## Council Decisions Namespace
70
-
71
- Council synthesis decisions are persisted in a dedicated `council_decisions` namespace for precedent fast-path retrieval:
72
-
73
- ### Write Path
74
- After every `/pantheon` council synthesis completes, Zeus stores:
75
- ```
76
- memory_store({
77
- namespace: "council_decisions",
78
- key: "council:<yyyy-mm-dd>:<slug>",
79
- value: {
80
- question: "original question",
81
- specialists: ["@agent1", "@agent2"],
82
- recommendation: "final recommendation",
83
- confidence: "High|Medium|Low",
84
- agreements: ["point1", "point2"],
85
- divergences: [{"issue": "...", "resolution": "..."}],
86
- response_rate: "X of Y",
87
- themis_audit: "approved|issues",
88
- precedent_used: false,
89
- timestamp: "<ISO-8601>"
90
- },
91
- metadata: {
92
- type: "council_decision",
93
- specialist_count: N,
94
- model_tier_used: "premium|default|fast"
95
- }
96
- })
97
- ```
98
- `value` is JSON-serialized before storing (the MCP `memory_store.value` argument is a string).
99
-
100
- ### Read Path (Precedent Fast-Path)
101
- Before dispatching a new council, Zeus runs:
102
- ```
103
- memory_search(question, top_k=2, namespace="council_decisions")
104
- ```
105
-
106
- Result interpretation:
107
- | Score | Age | Action |
108
- |-------|-----|--------|
109
- | > 0.85 | < 30 days | Return precedent verbatim (note "⚠️ Decisão de [data] — reavaliar se contexto mudou") as fast-path answer. Skip council dispatch entirely. |
110
- | > 0.85 | >= 30 days | Return with warning "Reavaliar se contexto mudou — decisão tem mais de 30 dias" + proceed with council |
111
- | 0.5 - 0.85 | Any | Include as context for specialists but still dispatch council |
112
- | < 0.5 | Any | Ignore, proceed with fresh council |
113
-
114
- ### TTL & Maintenance
115
- - Council decisions are LONG-TERM (no TTL or TTL = 365 days)
116
- - Stale decisions (age > 90 days) should be flagged but NOT deleted — they remain as historical record
117
- - Purge only via explicit namespace cleanup when decisions are superseded by ADRs
118
-
119
- ### When NOT to Use
120
- - Routine task summaries → use `default` namespace (auto-store by Zeus)
121
- - Sprint/progress tracking → use `session` namespace
122
- - ADR-level architecture decisions → delegate to @mnemosyne for permanent documentation
23
+ ### Relevance and permanent records
24
+ Ignore weak matches; routine summaries do not belong in durable memory.
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: "Test economy — write smaller, focused suites; heavy install/E2E suites are opt-in, never per-phase."
3
+ name: "Test Economy"
4
+ ---
5
+
6
+ Write the smallest test that proves the behavior: one behavior → one focused
7
+ test, never the same coverage duplicated across suites or files.
8
+
9
+ - Do NOT add E2E, full-install, or network-dependent tests unless the change
10
+ actually alters that end-to-end path. Prefer unit or integration tests.
11
+ - Do not assert on copy/format strings redundantly, and do not write
12
+ assertions that only restate the implementation ("test the test").
13
+ - Heavy or slow suites (e.g. real install/E2E) MUST be opt-in via a separate
14
+ script/tier. Never run them per edit or per phase; run only the affected
15
+ subset.
16
+ - Respect a per-phase validation time budget: if a suite takes minutes,
17
+ justify running it and prefer the targeted subset. Reserve the full heavy
18
+ suites for release gates.
19
+ - Fixing a bug: add one targeted regression test, not a broad new suite.
20
+ - This economy rule does NOT weaken stronger gates: auth, security,
21
+ data-integrity, and required coverage thresholds stay mandatory.