pantheon-opencode 1.5.0-beta.14 → 1.5.0-beta.16
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.
- package/AGENTS.md +14 -63
- package/CHANGELOG.md +65 -0
- package/README.md +1 -2
- package/README.pt-BR.md +1 -1
- package/commands/pantheon.md +1 -35
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/pyproject.toml +2 -5
- package/src/agents/zeus.md +4 -26
- package/src/instructions/memory-protocol.instructions.md +6 -3
- package/src/instructions/zeus-anti-stall.instructions.md +2 -4
- package/src/instructions/zeus-council-synthesis.instructions.md +3 -28
- package/src/instructions/zeus-timeout-retry.instructions.md +3 -28
- package/src/mcp/toon_codec.py +2 -4
- package/src/pantheon/background-job-board.ts +4 -4
- package/src/pantheon/delegate-manager.ts +95 -10
- package/src/pantheon/delegation-classifier.ts +3 -4
- package/src/pantheon/delegation-finalize.ts +69 -7
- package/src/pantheon/delegation.ts +16 -4
- package/src/pantheon/presets.d.mts +0 -20
- package/src/pantheon/presets.mjs +0 -64
- package/src/plugin-v2.ts +4 -6
- package/src/plugin.ts +6 -6
- package/src/plugins/pantheon-hooks.ts +1 -1
- package/src/plugins/tui/dist/tui.d.ts +43 -36
- package/src/plugins/tui/dist/tui.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui.js +102 -38
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/index.tsx +168 -67
- package/src/routing.yml +0 -16
- package/scripts/dev-tui.sh +0 -48
- package/scripts/generate-preset-docs.mjs +0 -300
- package/scripts/generate-prompts.sh +0 -222
- package/scripts/hash_verify.py +0 -192
- package/scripts/install/component.mjs +0 -24
- package/scripts/install/migrate-config.mjs +0 -302
- package/scripts/test-context-compression.sh +0 -169
- package/src/pantheon/auto-wake.ts +0 -85
- package/src/pantheon/chat-reminders.ts +0 -9
- package/src/pantheon/comment-checker.ts +0 -48
- package/src/pantheon/compaction-assert.ts +0 -160
- package/src/pantheon/compaction-handoff.ts +0 -304
- package/src/pantheon/cost-tracker.ts +0 -108
- package/src/pantheon/dispatch-guard.ts +0 -109
- package/src/pantheon/permission-eval.ts +0 -284
- package/src/pantheon/preemptive-compact.ts +0 -76
- package/src/pantheon/provider-capabilities.ts +0 -221
- package/src/pantheon/provider-stream-tracker.ts +0 -182
- package/src/pantheon/retry-policy.ts +0 -212
- package/src/pantheon/token-opt.ts +0 -689
- package/src/pantheon/toon-codec.ts +0 -481
- package/src/pantheon/v2-events.ts +0 -148
- package/src/pantheon/v2-hooks.ts +0 -287
- package/src/pantheon/v2-tool-definitions.ts +0 -331
- package/src/pantheon/zeus-delegate-with-retry.ts +0 -406
package/AGENTS.md
CHANGED
|
@@ -301,7 +301,9 @@ memory_store({
|
|
|
301
301
|
agreements: ["point1", "point2"],
|
|
302
302
|
divergences: [{"issue": "...", "resolution": "..."}],
|
|
303
303
|
response_rate: "X of Y",
|
|
304
|
-
themis_audit: "approved|issues"
|
|
304
|
+
themis_audit: "approved|issues",
|
|
305
|
+
precedent_used: false,
|
|
306
|
+
timestamp: "<ISO-8601>"
|
|
305
307
|
},
|
|
306
308
|
metadata: {
|
|
307
309
|
type: "council_decision",
|
|
@@ -310,6 +312,7 @@ memory_store({
|
|
|
310
312
|
}
|
|
311
313
|
})
|
|
312
314
|
```
|
|
315
|
+
`value` is JSON-serialized before storing (the MCP `memory_store.value` argument is a string).
|
|
313
316
|
|
|
314
317
|
### Read Path (Precedent Fast-Path)
|
|
315
318
|
Before dispatching a new council, Zeus runs:
|
|
@@ -320,8 +323,8 @@ memory_search(question, top_k=2, namespace="council_decisions")
|
|
|
320
323
|
Result interpretation:
|
|
321
324
|
| Score | Age | Action |
|
|
322
325
|
|-------|-----|--------|
|
|
323
|
-
| > 0.85 | < 30 days | Return precedent as fast-path answer. Skip council dispatch entirely. |
|
|
324
|
-
| > 0.85 | >= 30 days | Return with warning "Reavaliar se contexto mudou" + proceed with council |
|
|
326
|
+
| > 0.85 | < 30 days | Return precedent verbatim (note "⚠️ Decisão de [data] — reavaliar se contexto mudou") as fast-path answer. Skip council dispatch entirely. |
|
|
327
|
+
| > 0.85 | >= 30 days | Return with warning "Reavaliar se contexto mudou — decisão tem mais de 30 dias" + proceed with council |
|
|
325
328
|
| 0.5 - 0.85 | Any | Include as context for specialists but still dispatch council |
|
|
326
329
|
| < 0.5 | Any | Ignore, proceed with fresh council |
|
|
327
330
|
|
|
@@ -371,7 +374,7 @@ You MUST self-monitor for these stall conditions:
|
|
|
371
374
|
| Symptom | Detection Rule | Recovery Action |
|
|
372
375
|
|---------|---------------|-----------------|
|
|
373
376
|
| Silent loop | 3+ consecutive turns with no tool call AND no visible progress | Output `[STALL_DETECTED]` and re-read your task definition. If still stuck, escalate to user with: "I appear to be stuck on [task]. Options: (1) retry with different approach, (2) delegate to specialist, (3) simplify scope." |
|
|
374
|
-
| Delegation black hole | Agent dispatched but no response after 2x the timeout from routing.yml | Log the hang, cancel via `cancel_task`,
|
|
377
|
+
| Delegation black hole | Agent dispatched but no response after 2x the timeout from routing.yml | Log the hang, cancel via `cancel_task`, then follow the fallback chain in `## ⏱️ Timeout & Retry Enforcement` |
|
|
375
378
|
| Circular delegation | Same specialist re-dispatched for same task 2+ times without progress | Break cycle: dispatch to different specialist OR escalate to user |
|
|
376
379
|
| Idle after completion | All background tasks completed but no synthesis/next step for 2+ turns | Force synthesis: summarize all completed results and propose next action |
|
|
377
380
|
| Context thrash | Re-reading same files repeatedly without new action | Stop re-reading. State: "Already have context on [file]. Proceeding with [action]." |
|
|
@@ -397,9 +400,7 @@ When a delegation fails (timeout, empty response, error):
|
|
|
397
400
|
|
|
398
401
|
2. **Retry ONCE** with rephrased prompt — add: "Previous attempt failed with: [error]. Adjusted approach: [what changed]."
|
|
399
402
|
|
|
400
|
-
3. **If retry also fails** →
|
|
401
|
-
- Dispatch to fallback agent (from routing.yml)
|
|
402
|
-
- If no fallback, escalate to user with: "Task [X] failed after retry. Options: (a) simplify, (b) different agent, (c) manual intervention."
|
|
403
|
+
3. **If retry also fails** → do NOT retry blindly; follow the fallback chain and escalation protocol in `## ⏱️ Timeout & Retry Enforcement`.
|
|
403
404
|
|
|
404
405
|
## Progress Checkpoint
|
|
405
406
|
|
|
@@ -564,10 +565,7 @@ sequenceDiagram
|
|
|
564
565
|
## Dispatch Sequence (9-Step Protocol)
|
|
565
566
|
|
|
566
567
|
### Step 0 — Precedent Fast-Path (Fase 1)
|
|
567
|
-
|
|
568
|
-
- Score > 0.85 AND age < 30 days → return precedent verbatim with note "⚠️ Decisão de [data] — reavaliar se contexto mudou". SKIP entire dispatch.
|
|
569
|
-
- Score > 0.85 AND age > 30 days → return precedent with ⚠️ "Reavaliar se contexto mudou — decisão tem mais de 30 dias"
|
|
570
|
-
- Else → proceed to Step 0b
|
|
568
|
+
Run the precedent read path defined in `## Memory Protocol > Council Decisions Namespace` (`memory_search(query, top_k=2, namespace="council_decisions")`). If no precedent applies, proceed to Step 0b.
|
|
571
569
|
|
|
572
570
|
### Step 0b — Apollo Pre-Scan (Fase 2, --research flag)
|
|
573
571
|
If `/pantheon --research <question>`: dispatch @apollo with 30s timeout. Inject findings as `shared_context` into ALL specialist prompts. Skip if flag absent.
|
|
@@ -669,33 +667,11 @@ task(subagent_type: "themis", prompt: "Audit this council synthesis for fidelity
|
|
|
669
667
|
- If issues → fix each issue before delivering to user
|
|
670
668
|
|
|
671
669
|
### Step 9 — Persist & Reconcile (Fase 1)
|
|
672
|
-
|
|
673
|
-
memory_store({
|
|
674
|
-
namespace: "council_decisions",
|
|
675
|
-
key: "council:<yyyy-mm-dd>:<slug>",
|
|
676
|
-
value: JSON.stringify({
|
|
677
|
-
question, specialists, recommendation, confidence,
|
|
678
|
-
agreements, divergences, precedent_used, timestamp
|
|
679
|
-
}),
|
|
680
|
-
metadata: {type: "council_decision", specialist_count: N}
|
|
681
|
-
})
|
|
682
|
-
board.markReconciled("<task-id>")
|
|
683
|
-
```
|
|
670
|
+
Persist the decision using the write path in `## Memory Protocol > Council Decisions Namespace`, then `board.markReconciled("<task-id>")`.
|
|
684
671
|
|
|
685
672
|
## Specialist Output Format (Fase 1 — machine-parseable structured fields)
|
|
686
673
|
|
|
687
|
-
Specialists MUST return
|
|
688
|
-
|
|
689
|
-
```
|
|
690
|
-
## specialist_response
|
|
691
|
-
**position:** <clear one-sentence position>
|
|
692
|
-
**reasoning:** <2-4 sentences>
|
|
693
|
-
**trade_offs:** <what's gained vs lost>
|
|
694
|
-
**risks:** <what could go wrong>
|
|
695
|
-
**confidence:** High | Medium | Low
|
|
696
|
-
**agreement_signals:** agree: @agent1, @agent2 on [issue] | disagree: @agent3 on [issue]
|
|
697
|
-
**specific_claims:** <count of specific factual claims in response>
|
|
698
|
-
```
|
|
674
|
+
Specialists MUST return the structured `## specialist_response` format (position, reasoning, trade_offs, risks, confidence, agreement_signals, specific_claims) defined in `## Agent Return Format > Council Specialist Response Format`.
|
|
699
675
|
|
|
700
676
|
## Domain-to-Specialist Mapping
|
|
701
677
|
|
|
@@ -928,39 +904,14 @@ ANY NO → full task (IMPL artifact + Themis review mandatory)
|
|
|
928
904
|
3. **No Themis dependency** — output doesn't feed into a phase that requires review
|
|
929
905
|
|
|
930
906
|
## Subtask Return Format
|
|
931
|
-
|
|
932
|
-
```
|
|
933
|
-
## subtask_summary
|
|
934
|
-
**files_changed:** [paths]
|
|
935
|
-
**summary:** What was done
|
|
936
|
-
**tests:** ✅ or N/A
|
|
937
|
-
**status:** complete | partial | escalated
|
|
938
|
-
```
|
|
907
|
+
Return the standard `## subtask_summary` defined in `## Agent Return Format` (files_changed, summary, tests, coverage, tokens, status, blockers).
|
|
939
908
|
|
|
940
909
|
## Timeout Parcial (Partial Results)
|
|
941
910
|
|
|
942
|
-
Timeout
|
|
943
|
-
- ✅ @apollo — can return partial file list ("found 7 of 12 files before timeout")
|
|
944
|
-
- ✅ @gaia — can return partial literature findings
|
|
945
|
-
|
|
946
|
-
- ✅ @talos — can confirm progress if hotfix times out
|
|
947
|
-
- ❌ Never for implementers or reviewers — must complete or fail
|
|
948
|
-
|
|
949
|
-
When dispatching with partial-OK, set expectation:
|
|
950
|
-
```
|
|
951
|
-
@apollo Search for auth files. Timeout parcial OK — return whatever you have.
|
|
952
|
-
```
|
|
911
|
+
Only agents marked ✅ in the Timeout Behavior table above may return partial results: @apollo (partial file list, e.g. "found 7 of 12 files before timeout"), @gaia (partial literature findings) and @talos (confirm progress if a hotfix times out). Never for implementers or reviewers — they must complete or fail. When dispatching with partial-OK, set the expectation: `@apollo Search for auth files. Timeout parcial OK — return whatever you have.`
|
|
953
912
|
|
|
954
913
|
---
|
|
955
914
|
|
|
956
915
|
# 📊 TIMEOUT TRACKING
|
|
957
916
|
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
| Agent | Timeout | Status | Partial OK? |
|
|
961
|
-
|-------|---------|--------|-------------|
|
|
962
|
-
| @apollo | 60s | ✅ complete | ✅ |
|
|
963
|
-
| @hermes | 180s | ⏳ in progress | ❌ |
|
|
964
|
-
| @themis | 120s | ⏳ in progress | ❌ |
|
|
965
|
-
|
|
966
|
-
Log timeouts to `/memories/session/timeout-log.md` for later analysis.
|
|
917
|
+
Track in-flight delegations against the Timeout Behavior table above. Log timeouts to `/memories/session/timeout-log.md` for later analysis.
|
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,71 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
18
18
|
|
|
19
19
|
## ✅ Closed Issues
|
|
20
20
|
|
|
21
|
+
## [v1.5.0-beta.16] - 2026-09-15
|
|
22
|
+
|
|
23
|
+
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
|
24
|
+
move this section to a versioned entry and reset the template below. -->
|
|
25
|
+
|
|
26
|
+
## 🆕 What's New
|
|
27
|
+
|
|
28
|
+
- **Modernização CI/supply-chain:** 22 actions SHA-pinadas; `gitleaks-action` v3
|
|
29
|
+
(fix crítico — a v2 morria com Node 20 em 2026-09-16) com CLI 8.30.1; cache
|
|
30
|
+
npm/pip; Dependabot; CodeQL `+python` e `codeql-config`; permissões reduzidas
|
|
31
|
+
no `docs.yml`; job `version-check` fundido no `validate`; `upload-artifact` v7
|
|
32
|
+
e `download-artifact` v8.
|
|
33
|
+
- **Lean:** ~17 módulos mortos removidos de `src/pantheon/`, docs/scripts
|
|
34
|
+
obsoletos, `teste/`/`testes/`, `Dockerfile`/`docker-compose` (de outro projeto)
|
|
35
|
+
e caches; ~38% dos arquivos de teste removidos/consolidados; testes mínimos
|
|
36
|
+
readicionados para os módulos vivos (tool-ceiling, native-probe).
|
|
37
|
+
- **Instructions:** deduplicação das instruções compartilhadas — contexto menor
|
|
38
|
+
sem perder nenhuma regra.
|
|
39
|
+
|
|
40
|
+
## 🐞 Fixed
|
|
41
|
+
|
|
42
|
+
- **2 flakes determinísticos eliminados:** TTL do MCP persistence
|
|
43
|
+
(`test_ttl_expiry_real_time`) e `logger.test.mjs` deixaram de depender de
|
|
44
|
+
timing/carga do host.
|
|
45
|
+
- **Refs stale corrigidas:** referências de versão/ambiente atualizadas para
|
|
46
|
+
Node 22+.
|
|
47
|
+
|
|
48
|
+
## [v1.5.0-beta.15] - 2026-09-15
|
|
49
|
+
|
|
50
|
+
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
|
51
|
+
move this section to a versioned entry and reset the template below. -->
|
|
52
|
+
|
|
53
|
+
## 🆕 What's New
|
|
54
|
+
|
|
55
|
+
- **Delegation `read` devolve o relatório completo:** o retorno de `read` passa a
|
|
56
|
+
ler o relatório integral do disco (com cap configurável e marker explícito de
|
|
57
|
+
truncamento) em vez do recibo resumido — o conteúdo é o mesmo tanto no caminho
|
|
58
|
+
nativo quanto no legado, com paridade garantida entre eles.
|
|
59
|
+
- **`sanitizeReceiptText` UTF-8-safe:** a sanitização de recibos deixou de corromper
|
|
60
|
+
caracteres multibyte; acentuação e demais codepoints UTF-8 são preservados no
|
|
61
|
+
caminho nativo e no legado.
|
|
62
|
+
- **TUI — cor de status na row inteira:** cada linha do painel Delegations passa a
|
|
63
|
+
ser pintada pelo estado — vermelho = falha, verde = concluído, amarelo = em
|
|
64
|
+
andamento — com o glyph mantido como canal redundante para acessibilidade.
|
|
65
|
+
|
|
66
|
+
## 🐞 Fixed
|
|
67
|
+
|
|
68
|
+
- **TUI — painel Delegations só da sessão ativa:** o painel deixa de renderizar
|
|
69
|
+
rows cross-session/órfãs que causavam "Session not found" ao clicar; a lista
|
|
70
|
+
agora cobre apenas a sessão ativa, mantendo a retenção de concluídas (2 min)
|
|
71
|
+
e falhas (10 min).
|
|
72
|
+
- **Guards de estado e navegação órfã:** transições prematuras para `done` são
|
|
73
|
+
bloqueadas e a navegação defensiva ignora alvos órfãos, evitando seleção
|
|
74
|
+
inválida no painel.
|
|
75
|
+
- **Isolamento do board nos testes:** testes que importam o plugin real agora
|
|
76
|
+
isolam o BackgroundJobBoard, eliminando o fantasma "preserve this running
|
|
77
|
+
delegation"; o board real foi limpo.
|
|
78
|
+
- **Lean no core:** 17 módulos mortos de `src/pantheon/` removidos, ~38% dos
|
|
79
|
+
arquivos de teste removidos/consolidados e docs/scripts órfãos limpos, com
|
|
80
|
+
testes mínimos readicionados para os módulos vivos (tool-ceiling, native-probe).
|
|
81
|
+
- **Flake de TTL determinístico:** `test_ttl_expiry_real_time` deixou de competir
|
|
82
|
+
com a truncagem de microssegundos do SQLite — o teste agora espera o início de
|
|
83
|
+
um segundo limpo antes do store e usa margem sobre o TTL, eliminando o flake
|
|
84
|
+
dependente de carga (test-only).
|
|
85
|
+
|
|
21
86
|
## [v1.5.0-beta.14] - 2026-09-14
|
|
22
87
|
|
|
23
88
|
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
package/README.md
CHANGED
|
@@ -172,8 +172,7 @@ script's SHA-256 without regenerating it.
|
|
|
172
172
|
covering OpenCode V1/V2 side by side — see
|
|
173
173
|
[Sandbox validation](#sandbox-validation-v1v2).
|
|
174
174
|
- Beta2 agent-economy policy: direct native delegation, bounded compaction
|
|
175
|
-
carry-forward, compact context encoding, and quality floors
|
|
176
|
-
[Beta2 agent economy policy](docs/ws3-token-opt-measurements.md#beta2-agent-economy-policy).
|
|
175
|
+
carry-forward, compact context encoding, and quality floors.
|
|
177
176
|
- A `--prompts` installer flag is planned for a future release.
|
|
178
177
|
|
|
179
178
|
## OpenCode V1/V2 — Dual Version (1.5.0-beta.2)
|
package/README.pt-BR.md
CHANGED
|
@@ -31,7 +31,7 @@ de planejar o trabalho, avançar, conferir resultados e preservar o contexto
|
|
|
31
31
|
|
|
32
32
|
## Comece em 2 minutos
|
|
33
33
|
|
|
34
|
-
Requisitos: [OpenCode 1.18.4+](https://opencode.ai/docs/) e Node.js
|
|
34
|
+
Requisitos: [OpenCode 1.18.4+](https://opencode.ai/docs/) e Node.js 22+.
|
|
35
35
|
|
|
36
36
|
No projeto em que você quer usar o Pantheon:
|
|
37
37
|
|
package/commands/pantheon.md
CHANGED
|
@@ -9,41 +9,7 @@ agent: zeus
|
|
|
9
9
|
**When:** Architecture trade-offs, technology selection, security assessments, multi-stakeholder concerns
|
|
10
10
|
**Returns:** Structured synthesis with recommendation, confidence level, resolved divergences
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Choose 2-3 agents based on domain:
|
|
15
|
-
|
|
16
|
-
| Domain | Specialists |
|
|
17
|
-
|--------|-------------|
|
|
18
|
-
| Architecture | hermes, demeter, themis, athena |
|
|
19
|
-
| Security | themis, hermes, prometheus, nyx |
|
|
20
|
-
| Database | demeter, hermes, prometheus |
|
|
21
|
-
| AI/RAG | hephaestus, nyx |
|
|
22
|
-
| Infrastructure | prometheus, hermes, themis |
|
|
23
|
-
| Frontend/UX | aphrodite, themis, hermes |
|
|
24
|
-
| Observability | nyx, hermes |
|
|
25
|
-
| General | athena, themis, hermes |
|
|
26
|
-
|
|
27
|
-
Send ALL `task()` calls in a single message. Each must return: Recommendation · Reasoning · Trade-offs · Risks · Confidence.
|
|
28
|
-
|
|
29
|
-
## Synthesis Structure
|
|
30
|
-
|
|
31
|
-
After ALL responses arrive, produce EXACTLY this structure:
|
|
32
|
-
|
|
33
|
-
### 📋 Individual Assessments
|
|
34
|
-
For each specialist: Recommendation, Reasoning, Trade-offs, Risks, Confidence
|
|
35
|
-
|
|
36
|
-
### ✅ Agreements
|
|
37
|
-
Where 2+ specialists converge
|
|
38
|
-
|
|
39
|
-
### ⚡ Divergences
|
|
40
|
-
Where they disagree — resolve each one with reasoning
|
|
41
|
-
|
|
42
|
-
### 🔥 Total Divergence
|
|
43
|
-
If ALL specialists disagree on a point, call this out explicitly
|
|
44
|
-
|
|
45
|
-
### 🏆 Recommendation
|
|
46
|
-
Decisive conclusion with confidence level
|
|
12
|
+
Dispatch, specialist selection, and synthesis follow the canonical `## Zeus Council Synthesis` protocol (Steps 0–9: precedent fast-path, dispatch, confidence cross-validation, rebuttal, tie-break, Themis audit, persist). Send ALL `task()` calls in a single message; each specialist returns the `## specialist_response` structure from `## Agent Return Format`.
|
|
47
13
|
|
|
48
14
|
## Question:
|
|
49
15
|
$ARGUMENTS
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon",
|
|
3
3
|
"publisher": "ils15",
|
|
4
|
-
"version": "1.5.0-beta.
|
|
4
|
+
"version": "1.5.0-beta.16",
|
|
5
5
|
"displayName": "Pantheon",
|
|
6
6
|
"description": "Conductor-Delegate orchestration platform with 14 specialized agents, 21 skills, and OpenCode support.",
|
|
7
7
|
"agents": "./src/agents",
|
package/pyproject.toml
CHANGED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.backends._legacy:_Backend"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pantheon"
|
|
7
|
-
version = "1.5.0-beta.
|
|
7
|
+
version = "1.5.0-beta.16"
|
|
8
8
|
description = "Multi-agent orchestration framework"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = []
|
|
@@ -37,10 +37,8 @@ ignore = ["E501"]
|
|
|
37
37
|
"scripts/scrub-secrets.py" = ["N999"]
|
|
38
38
|
# These modules defer optional/heavy imports until the corresponding command is used.
|
|
39
39
|
"scripts/vector_memory/*.py" = ["PLC0415"]
|
|
40
|
-
"tests/test_code_mode_args.py" = ["PLC0415"]
|
|
41
40
|
"tests/test_code_mode_sandbox.py" = ["PLC0415", "N806"]
|
|
42
41
|
"tests/test_code_mode_server.py" = ["PLC0415"]
|
|
43
|
-
"tests/test_eval_store.py" = ["PLC0415", "PLR2004"]
|
|
44
42
|
"tests/test_memory_mcp_server.py" = ["PLC0415", "PLR2004"]
|
|
45
43
|
# Existing public APIs and test fixtures are intentionally broad/simple; refactoring
|
|
46
44
|
# them would be behavior-affecting rather than a mechanical lint correction.
|
|
@@ -54,8 +52,7 @@ ignore = ["E501"]
|
|
|
54
52
|
"scripts/vector_memory/query.py" = ["PLR0913"]
|
|
55
53
|
"src/mcp/eval_store.py" = ["PLR2004"]
|
|
56
54
|
"tests/test_code_mode_frontmatter.py" = ["PLR2004"]
|
|
57
|
-
"tests/
|
|
58
|
-
"tests/test_eval_static.py" = ["PLR2004"]
|
|
55
|
+
"tests/test_eval.py" = ["PLR2004"]
|
|
59
56
|
"tests/test_mcp_persistence_server.py" = ["PLR2004"]
|
|
60
57
|
|
|
61
58
|
[tool.mypy]
|
package/src/agents/zeus.md
CHANGED
|
@@ -301,32 +301,10 @@ vão a idle com todos incompletos. Guards (todos no `src/pantheon/todo-enforcer.
|
|
|
301
301
|
|
|
302
302
|
## Wave 4 (PR #46): Empty-Result Retry + /cost + Themis Tier
|
|
303
303
|
|
|
304
|
-
### Empty-Result Retry (
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
```
|
|
310
|
-
import { createDispatchGuard } from '.../src/pantheon/dispatch-guard.ts' # via code-mode ou subagente
|
|
311
|
-
|
|
312
|
-
guard = createDispatchGuard({ retryOnEmpty: true, logger: { warn: console.warn } })
|
|
313
|
-
|
|
314
|
-
# classificar resultado de task_status/wait:
|
|
315
|
-
# 'content' → tem texto, pronto
|
|
316
|
-
# 'empty-mode1' → SEM texto E SEM tokens (nada voltou) → RETRY 1x
|
|
317
|
-
# 'empty-mode2' → SEM texto, MAS tokens (raciocinou, perdeu a parte de texto;
|
|
318
|
-
# assinatura da falha themis Wave-2) → RETRY 1x
|
|
319
|
-
|
|
320
|
-
out = await guard.maybeRetry(result, async () => { ...task() de novo... })
|
|
321
|
-
# out.retried=true se redisparou; CAP DURO de 1 retry — nunca 2x.
|
|
322
|
-
# Se o retry voltar vazio, `out.retried=false` — NAO tente de novo: escale.
|
|
323
|
-
```
|
|
324
|
-
Regra: retry 1x APENAS em `empty-mode1`/`empty-mode2`. Resultado com conteudo
|
|
325
|
-
nunca redispara. Apos 1 retry vazio → escalate (mesma regra do TODO Enforcer).
|
|
326
|
-
|
|
327
|
-
> **Waves DEVEM usar `zeusDelegateWithRetry`** (`src/pantheon/zeus-delegate-with-retry.ts`) — encapsula `delegate → waitForTerminal → classify → retry 1x → escalate` com cap duro 1; se ainda vazio throw `ZeusEscalationError` (escale: tente outro agente, simplifique, manual).
|
|
328
|
-
> Uso alto-nível: `import { zeusDelegateWithRetry } from './pantheon/zeus-delegate-with-retry.ts'` → `await zeusDelegateWithRetry({ board, client, sessionID, agent, prompt })`.
|
|
329
|
-
> Uso baixo-nível: `createZeusRetryHelper().executeWithRetry(first, () => secondRead())` — classifica empty e decide retry/escalate (mesmo cap 1).
|
|
304
|
+
### Empty-Result Retry (runtime — automatic)
|
|
305
|
+
Empty-response detection (`empty-mode1` / `empty-mode2`) and stuck-agent
|
|
306
|
+
classification are wired at runtime in `delegation-classifier.ts` (consumed by
|
|
307
|
+
`delegation.ts`). No manual retry helper is required.
|
|
330
308
|
|
|
331
309
|
### /cost — pantheon_cost tool (WIRED no plugin)
|
|
332
310
|
`pantheon_cost({ days?: number })` le o `opencode.db` READ-ONLY usando o backend
|
|
@@ -84,7 +84,9 @@ memory_store({
|
|
|
84
84
|
agreements: ["point1", "point2"],
|
|
85
85
|
divergences: [{"issue": "...", "resolution": "..."}],
|
|
86
86
|
response_rate: "X of Y",
|
|
87
|
-
themis_audit: "approved|issues"
|
|
87
|
+
themis_audit: "approved|issues",
|
|
88
|
+
precedent_used: false,
|
|
89
|
+
timestamp: "<ISO-8601>"
|
|
88
90
|
},
|
|
89
91
|
metadata: {
|
|
90
92
|
type: "council_decision",
|
|
@@ -93,6 +95,7 @@ memory_store({
|
|
|
93
95
|
}
|
|
94
96
|
})
|
|
95
97
|
```
|
|
98
|
+
`value` is JSON-serialized before storing (the MCP `memory_store.value` argument is a string).
|
|
96
99
|
|
|
97
100
|
### Read Path (Precedent Fast-Path)
|
|
98
101
|
Before dispatching a new council, Zeus runs:
|
|
@@ -103,8 +106,8 @@ memory_search(question, top_k=2, namespace="council_decisions")
|
|
|
103
106
|
Result interpretation:
|
|
104
107
|
| Score | Age | Action |
|
|
105
108
|
|-------|-----|--------|
|
|
106
|
-
| > 0.85 | < 30 days | Return precedent as fast-path answer. Skip council dispatch entirely. |
|
|
107
|
-
| > 0.85 | >= 30 days | Return with warning "Reavaliar se contexto mudou" + proceed with council |
|
|
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 |
|
|
108
111
|
| 0.5 - 0.85 | Any | Include as context for specialists but still dispatch council |
|
|
109
112
|
| < 0.5 | Any | Ignore, proceed with fresh council |
|
|
110
113
|
|
|
@@ -15,7 +15,7 @@ You MUST self-monitor for these stall conditions:
|
|
|
15
15
|
| Symptom | Detection Rule | Recovery Action |
|
|
16
16
|
|---------|---------------|-----------------|
|
|
17
17
|
| Silent loop | 3+ consecutive turns with no tool call AND no visible progress | Output `[STALL_DETECTED]` and re-read your task definition. If still stuck, escalate to user with: "I appear to be stuck on [task]. Options: (1) retry with different approach, (2) delegate to specialist, (3) simplify scope." |
|
|
18
|
-
| Delegation black hole | Agent dispatched but no response after 2x the timeout from routing.yml | Log the hang, cancel via `cancel_task`,
|
|
18
|
+
| Delegation black hole | Agent dispatched but no response after 2x the timeout from routing.yml | Log the hang, cancel via `cancel_task`, then follow the fallback chain in `## ⏱️ Timeout & Retry Enforcement` |
|
|
19
19
|
| Circular delegation | Same specialist re-dispatched for same task 2+ times without progress | Break cycle: dispatch to different specialist OR escalate to user |
|
|
20
20
|
| Idle after completion | All background tasks completed but no synthesis/next step for 2+ turns | Force synthesis: summarize all completed results and propose next action |
|
|
21
21
|
| Context thrash | Re-reading same files repeatedly without new action | Stop re-reading. State: "Already have context on [file]. Proceeding with [action]." |
|
|
@@ -41,9 +41,7 @@ When a delegation fails (timeout, empty response, error):
|
|
|
41
41
|
|
|
42
42
|
2. **Retry ONCE** with rephrased prompt — add: "Previous attempt failed with: [error]. Adjusted approach: [what changed]."
|
|
43
43
|
|
|
44
|
-
3. **If retry also fails** →
|
|
45
|
-
- Dispatch to fallback agent (from routing.yml)
|
|
46
|
-
- If no fallback, escalate to user with: "Task [X] failed after retry. Options: (a) simplify, (b) different agent, (c) manual intervention."
|
|
44
|
+
3. **If retry also fails** → do NOT retry blindly; follow the fallback chain and escalation protocol in `## ⏱️ Timeout & Retry Enforcement`.
|
|
47
45
|
|
|
48
46
|
## Progress Checkpoint
|
|
49
47
|
|
|
@@ -85,10 +85,7 @@ sequenceDiagram
|
|
|
85
85
|
## Dispatch Sequence (9-Step Protocol)
|
|
86
86
|
|
|
87
87
|
### Step 0 — Precedent Fast-Path (Fase 1)
|
|
88
|
-
|
|
89
|
-
- Score > 0.85 AND age < 30 days → return precedent verbatim with note "⚠️ Decisão de [data] — reavaliar se contexto mudou". SKIP entire dispatch.
|
|
90
|
-
- Score > 0.85 AND age > 30 days → return precedent with ⚠️ "Reavaliar se contexto mudou — decisão tem mais de 30 dias"
|
|
91
|
-
- Else → proceed to Step 0b
|
|
88
|
+
Run the precedent read path defined in `## Memory Protocol > Council Decisions Namespace` (`memory_search(query, top_k=2, namespace="council_decisions")`). If no precedent applies, proceed to Step 0b.
|
|
92
89
|
|
|
93
90
|
### Step 0b — Apollo Pre-Scan (Fase 2, --research flag)
|
|
94
91
|
If `/pantheon --research <question>`: dispatch @apollo with 30s timeout. Inject findings as `shared_context` into ALL specialist prompts. Skip if flag absent.
|
|
@@ -190,33 +187,11 @@ task(subagent_type: "themis", prompt: "Audit this council synthesis for fidelity
|
|
|
190
187
|
- If issues → fix each issue before delivering to user
|
|
191
188
|
|
|
192
189
|
### Step 9 — Persist & Reconcile (Fase 1)
|
|
193
|
-
|
|
194
|
-
memory_store({
|
|
195
|
-
namespace: "council_decisions",
|
|
196
|
-
key: "council:<yyyy-mm-dd>:<slug>",
|
|
197
|
-
value: JSON.stringify({
|
|
198
|
-
question, specialists, recommendation, confidence,
|
|
199
|
-
agreements, divergences, precedent_used, timestamp
|
|
200
|
-
}),
|
|
201
|
-
metadata: {type: "council_decision", specialist_count: N}
|
|
202
|
-
})
|
|
203
|
-
board.markReconciled("<task-id>")
|
|
204
|
-
```
|
|
190
|
+
Persist the decision using the write path in `## Memory Protocol > Council Decisions Namespace`, then `board.markReconciled("<task-id>")`.
|
|
205
191
|
|
|
206
192
|
## Specialist Output Format (Fase 1 — machine-parseable structured fields)
|
|
207
193
|
|
|
208
|
-
Specialists MUST return
|
|
209
|
-
|
|
210
|
-
```
|
|
211
|
-
## specialist_response
|
|
212
|
-
**position:** <clear one-sentence position>
|
|
213
|
-
**reasoning:** <2-4 sentences>
|
|
214
|
-
**trade_offs:** <what's gained vs lost>
|
|
215
|
-
**risks:** <what could go wrong>
|
|
216
|
-
**confidence:** High | Medium | Low
|
|
217
|
-
**agreement_signals:** agree: @agent1, @agent2 on [issue] | disagree: @agent3 on [issue]
|
|
218
|
-
**specific_claims:** <count of specific factual claims in response>
|
|
219
|
-
```
|
|
194
|
+
Specialists MUST return the structured `## specialist_response` format (position, reasoning, trade_offs, risks, confidence, agreement_signals, specific_claims) defined in `## Agent Return Format > Council Specialist Response Format`.
|
|
220
195
|
|
|
221
196
|
## Domain-to-Specialist Mapping
|
|
222
197
|
|
|
@@ -126,39 +126,14 @@ ANY NO → full task (IMPL artifact + Themis review mandatory)
|
|
|
126
126
|
3. **No Themis dependency** — output doesn't feed into a phase that requires review
|
|
127
127
|
|
|
128
128
|
## Subtask Return Format
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
## subtask_summary
|
|
132
|
-
**files_changed:** [paths]
|
|
133
|
-
**summary:** What was done
|
|
134
|
-
**tests:** ✅ or N/A
|
|
135
|
-
**status:** complete | partial | escalated
|
|
136
|
-
```
|
|
129
|
+
Return the standard `## subtask_summary` defined in `## Agent Return Format` (files_changed, summary, tests, coverage, tokens, status, blockers).
|
|
137
130
|
|
|
138
131
|
## Timeout Parcial (Partial Results)
|
|
139
132
|
|
|
140
|
-
Timeout
|
|
141
|
-
- ✅ @apollo — can return partial file list ("found 7 of 12 files before timeout")
|
|
142
|
-
- ✅ @gaia — can return partial literature findings
|
|
143
|
-
|
|
144
|
-
- ✅ @talos — can confirm progress if hotfix times out
|
|
145
|
-
- ❌ Never for implementers or reviewers — must complete or fail
|
|
146
|
-
|
|
147
|
-
When dispatching with partial-OK, set expectation:
|
|
148
|
-
```
|
|
149
|
-
@apollo Search for auth files. Timeout parcial OK — return whatever you have.
|
|
150
|
-
```
|
|
133
|
+
Only agents marked ✅ in the Timeout Behavior table above may return partial results: @apollo (partial file list, e.g. "found 7 of 12 files before timeout"), @gaia (partial literature findings) and @talos (confirm progress if a hotfix times out). Never for implementers or reviewers — they must complete or fail. When dispatching with partial-OK, set the expectation: `@apollo Search for auth files. Timeout parcial OK — return whatever you have.`
|
|
151
134
|
|
|
152
135
|
---
|
|
153
136
|
|
|
154
137
|
# 📊 TIMEOUT TRACKING
|
|
155
138
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
| Agent | Timeout | Status | Partial OK? |
|
|
159
|
-
|-------|---------|--------|-------------|
|
|
160
|
-
| @apollo | 60s | ✅ complete | ✅ |
|
|
161
|
-
| @hermes | 180s | ⏳ in progress | ❌ |
|
|
162
|
-
| @themis | 120s | ⏳ in progress | ❌ |
|
|
163
|
-
|
|
164
|
-
Log timeouts to `/memories/session/timeout-log.md` for later analysis.
|
|
139
|
+
Track in-flight delegations against the Timeout Behavior table above. Log timeouts to `/memories/session/timeout-log.md` for later analysis.
|
package/src/mcp/toon_codec.py
CHANGED
|
@@ -9,7 +9,7 @@ absent/fails.
|
|
|
9
9
|
Only the standard library (``json`` + ``re``) — prohibited: external
|
|
10
10
|
gateway, generative embedding.
|
|
11
11
|
|
|
12
|
-
Encoding rules
|
|
12
|
+
Encoding rules:
|
|
13
13
|
|
|
14
14
|
- Scalars: ``None``/``True``/``False`` → ``null``/``true``/``false``;
|
|
15
15
|
numbers → shortest form; strings bare when unambiguous, else
|
|
@@ -20,8 +20,7 @@ Encoding rules (mirrored byte-for-byte by ``src/pantheon/toon-codec.ts``):
|
|
|
20
20
|
- Lists of scalars: ``- item`` lines; empty list → ``[]``.
|
|
21
21
|
- Lists of dicts with uniform keys: ``@table k1|k2`` header + ``v1|v2``
|
|
22
22
|
rows (savings are per payload class — ~11% on content-dominated board
|
|
23
|
-
records up to ~47% on large tabular checkpoints
|
|
24
|
-
``docs/ws3-token-opt-measurements.md`` for the reproducible table).
|
|
23
|
+
records up to ~47% on large tabular checkpoints).
|
|
25
24
|
- Dict values never need quoting for ``:`` (split is on the FIRST colon);
|
|
26
25
|
list items / top-level scalars that look like ``key: ...`` are quoted.
|
|
27
26
|
"""
|
|
@@ -471,7 +470,6 @@ def toon_size_report(value: Any) -> dict[str, Any]:
|
|
|
471
470
|
Reports BOTH chars and tokens: token ratios on tiny payloads suffer
|
|
472
471
|
ceiling bias (``ceil`` rounds 161→41 vs 143→36), so the char columns are
|
|
473
472
|
the honest basis and the token columns show what metering will debit.
|
|
474
|
-
Per-class numbers: see ``docs/ws3-token-opt-measurements.md``.
|
|
475
473
|
"""
|
|
476
474
|
compact_json = json.dumps(value, ensure_ascii=False, separators=(",", ":"))
|
|
477
475
|
toon = toon_encode(value)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Background Job Board — state machine for tracking background agent jobs.
|
|
3
3
|
*
|
|
4
4
|
* Tracks jobs through a state machine (running → completed/error/cancelled → reconciled),
|
|
5
|
-
* supports alias generation per session, persistence via adapter,
|
|
5
|
+
* supports alias generation per session, persistence via adapter, wake signal files,
|
|
6
6
|
* and terminal state listeners (persist-before-notify write-ahead-log pattern).
|
|
7
7
|
*
|
|
8
8
|
* Pure TypeScript — zero external dependencies beyond Node.js builtins (fs/path).
|
|
@@ -123,7 +123,7 @@ export interface BoardOptions {
|
|
|
123
123
|
/** Maximum completed jobs kept per agent for reuse (default: 3). */
|
|
124
124
|
maxReusablePerAgent?: number
|
|
125
125
|
/**
|
|
126
|
-
* Directory for
|
|
126
|
+
* Directory for wake signal files.
|
|
127
127
|
* When set, a `.signal.json` file is atomically written on every terminal transition.
|
|
128
128
|
* When null or undefined, no signal files are written.
|
|
129
129
|
*/
|
|
@@ -175,7 +175,7 @@ function getAgentPrefix(agent: string): string {
|
|
|
175
175
|
* - Strict state machine with validated transitions
|
|
176
176
|
* - Per-session, per-agent alias generation (apo-1, her-2, …)
|
|
177
177
|
* - Optional persistence via injected PersistenceAdapter
|
|
178
|
-
* - Optional
|
|
178
|
+
* - Optional wake signal files on terminal transitions
|
|
179
179
|
* - Terminal state listeners with persist-before-notify guarantee
|
|
180
180
|
* - expire/prune helpers for session lifecycle management
|
|
181
181
|
*/
|
|
@@ -652,7 +652,7 @@ export class BackgroundJobBoard {
|
|
|
652
652
|
}
|
|
653
653
|
|
|
654
654
|
/**
|
|
655
|
-
* Delete the
|
|
655
|
+
* Delete the wake signal file for an alias (`<alias>.signal.json`).
|
|
656
656
|
* No-op (false) when no signalDir is configured or the file is absent.
|
|
657
657
|
* The delegate manager calls this on the spot right after auto-reconcile.
|
|
658
658
|
*/
|