pantheon-opencode 1.5.2 → 1.6.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pantheon/code-mode/README.md +4 -2
- package/.pantheon/code-mode/checkpoint_session.py +138 -102
- package/.pantheon/code-mode/compress-inline.py +102 -57
- package/.pantheon/code-mode/manifest.json +2 -8
- package/AGENTS.global.md +182 -0
- package/AGENTS.md +10 -891
- package/CHANGELOG.md +343 -0
- package/README.md +577 -79
- package/README.pt-BR.md +345 -60
- package/bin/pantheon-init.mjs +26 -3
- package/commands/pantheon-audit.md +7 -1
- package/commands/pantheon-consolidate.md +1 -1
- package/commands/pantheon-deepwork.md +14 -3
- package/commands/pantheon-focus.md +17 -0
- package/commands/pantheon-optimize.md +2 -2
- package/commands/pantheon-vision.md +61 -12
- package/package.json +30 -11
- package/plugin.json +2 -2
- package/pyproject.toml +11 -16
- package/scripts/build-agents-md.mjs +376 -58
- package/scripts/changelog-merge.mjs +161 -0
- package/scripts/check-plugin-v2-coverage.mjs +213 -0
- package/scripts/ci-validate-yaml.py +7 -5
- package/scripts/{code_mode_server.py → code_mode.py} +119 -27
- package/scripts/cost.mjs +244 -41
- package/scripts/doctor.mjs +236 -29
- package/scripts/install/agents-md.mjs +4 -4
- package/scripts/install/cli-ui.mjs +1 -1
- package/scripts/install/config-migration.mjs +319 -6
- package/scripts/install/health-check.mjs +26 -37
- package/scripts/install/interactive.mjs +7 -7
- package/scripts/install/migrate.mjs +1 -1
- package/scripts/install/opencode-version.mjs +246 -4
- package/scripts/install/opencode.mjs +627 -179
- package/scripts/install/plugin.mjs +43 -9
- package/scripts/install/shared.mjs +120 -12
- package/scripts/install/vision-prompt.mjs +161 -0
- package/scripts/install-mcp.mjs +28 -9
- package/scripts/{mcp_persistence_server.py → mcp_persistence.py} +392 -78
- package/{src/mcp/mcp_resources_server.py → scripts/mcp_resources.py} +2 -2
- package/scripts/{memory_mcp_server.py → memory_mcp.py} +372 -198
- package/scripts/postinstall.mjs +0 -7
- package/scripts/probe-context-rehydrate.mjs +36 -13
- package/scripts/probe-pantheon-cost.mjs +71 -15
- package/scripts/prune.mjs +2 -2
- package/scripts/run-node-tests.mjs +189 -0
- package/scripts/sync-artifacts.mjs +26 -13
- package/scripts/sync-tui.mjs +24 -3
- package/scripts/test-opencode-v2-sandbox.sh +1913 -0
- package/scripts/validate-routing.mjs +43 -3
- package/scripts/validate-sandbox-install.mjs +138 -0
- package/scripts/versioning.mjs +13 -1
- package/scripts/vision-status.mjs +682 -0
- package/skills-lock.json +15 -16
- package/src/agents/aphrodite.md +20 -37
- package/src/agents/apollo.md +7 -3
- package/src/agents/athena.md +63 -35
- package/src/agents/demeter.md +8 -28
- package/src/agents/gaia.md +1 -1
- package/src/agents/hephaestus.md +10 -21
- package/src/agents/hermes.md +15 -38
- package/src/agents/iris.md +1 -1
- package/src/agents/mnemosyne.md +23 -60
- package/src/agents/nyx.md +1 -1
- package/src/agents/prometheus.md +16 -20
- package/src/agents/talos.md +10 -2
- package/src/agents/themis.md +5 -5
- package/src/agents/zeus.md +99 -130
- package/src/instructions/agent-return-format.instructions.md +18 -3
- package/src/instructions/backend-standards.instructions.md +2 -0
- package/src/instructions/frontend-standards.instructions.md +3 -1
- package/src/instructions/memory-protocol.instructions.md +11 -110
- package/src/instructions/zeus-anti-stall.instructions.md +14 -61
- package/src/instructions/zeus-communication-rules.instructions.md +0 -1
- package/src/instructions/zeus-council-synthesis.instructions.md +32 -260
- package/src/instructions/zeus-memory-operations.instructions.md +26 -0
- package/src/instructions/zeus-timeout-retry.instructions.md +40 -87
- package/src/mcp/{code_mode_server.py → code_mode.py} +119 -27
- package/src/mcp/eval_store.py +2 -2
- package/src/mcp/mcp_codemap_module.py +559 -129
- package/src/mcp/{mcp_persistence_server.py → mcp_persistence.py} +392 -78
- package/{scripts/mcp_resources_server.py → src/mcp/mcp_resources.py} +2 -2
- package/src/mcp/{memory_mcp_server.py → memory_mcp.py} +373 -250
- package/src/mcp/{pantheon_vision_server.py → pantheon_vision.py} +396 -40
- package/src/mcp/requirements-mcp.txt +10 -6
- package/src/mcp/requirements-vision.txt +4 -2
- package/src/pantheon/cost-command.ts +399 -101
- package/src/pantheon/delegation-enforce.ts +10 -1
- package/src/pantheon/model-command.ts +18 -7
- package/src/pantheon/presets.d.mts +0 -8
- package/src/pantheon/presets.mjs +5 -32
- package/src/pantheon/todo-enforcer.ts +1 -1
- package/src/pantheon/v2-bounded-read.ts +640 -0
- package/src/pantheon/v2-delegation-enforce.ts +214 -0
- package/src/pantheon/v2-execute-after.ts +186 -0
- package/src/pantheon/v2-tools.ts +429 -0
- package/src/pantheon/v2-unsupported.d.mts +11 -0
- package/src/pantheon/v2-unsupported.mjs +90 -0
- package/src/pantheon/v2-vision.ts +622 -0
- package/src/pantheon/vision-local.ts +531 -0
- package/src/pantheon/vision.ts +1161 -116
- package/src/plugin-v2.ts +1244 -288
- package/src/plugin.ts +12 -9
- package/src/plugins/tui/dist/server.d.ts +1 -2
- package/src/plugins/tui/dist/server.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.d.ts +154 -0
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -0
- package/src/plugins/tui/dist/tui-v2.js +659 -0
- package/src/plugins/tui/dist/tui-v2.js.map +1 -0
- package/src/plugins/tui/dist/tui.d.ts +85 -82
- package/src/plugins/tui/dist/tui.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui.js +72 -59
- package/src/plugins/tui/index-v2.ts +6 -0
- package/src/plugins/tui/package-lock.json +5504 -1341
- package/src/plugins/tui/package.json +25 -15
- package/src/plugins/tui/src/index-v2.tsx +734 -0
- package/src/plugins/tui/src/index.tsx +106 -85
- package/src/plugins/tui/src/opencode-v2.d.ts +13 -0
- package/src/plugins/tui/tsconfig.build.json +5 -0
- package/src/plugins/tui/tsconfig.typecheck.json +5 -0
- package/src/plugins/tui/tsdown.config.ts +22 -2
- package/src/plugins/tui/tui-v2.ts +2 -0
- package/src/plugins/tui/tui.ts +3 -0
- package/src/routing.yml +11 -22
- package/src/skills/README.md +34 -39
- package/src/skills/agent-coordination/SKILL.md +7 -2
- package/src/skills/artifact-management/SKILL.md +12 -5
- package/src/skills/auto-continue/SKILL.md +54 -95
- package/src/skills/code-review-checklist/SKILL.md +5 -5
- package/src/skills/context-compression/SKILL.md +26 -879
- package/src/skills/session-goal/SKILL.md +14 -5
- package/src/skills/spec-driven-development/SKILL.md +3 -1
- package/src/skills/tdd-with-agents/SKILL.md +18 -10
- package/.pantheon/code-mode/eval-llm-judge.py +0 -255
- package/.pantheon/code-mode/eval-monte-carlo.py +0 -368
- package/.pantheon/code-mode/eval-run.py +0 -197
- package/.pantheon/code-mode/eval-static.py +0 -321
- package/.pantheon/code-mode/session-end-save.py +0 -186
- package/.pantheon/code-mode/session-end-save.sh +0 -18
- package/opencode.json +0 -58
- package/scripts/recover-zenodo-deposition.mjs +0 -146
- package/scripts/test-opencode-v1-v2-sandbox.sh +0 -862
- package/scripts/validate-zenodo-release.mjs +0 -154
- package/scripts/zenodo-artifact.mjs +0 -94
- package/scripts/zenodo-release-state.mjs +0 -53
- package/src/skills/orchestration-workflow/SKILL.md +0 -311
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Standardized return format for agent delegation results"
|
|
3
3
|
name: "Agent Return Format"
|
|
4
|
-
|
|
4
|
+
agents: ["*"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Agent Return Format
|
|
@@ -22,6 +22,22 @@ 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
43
|
When responding to a `/pantheon` council synthesis invocation, specialists MUST return this structured format:
|
|
@@ -68,5 +84,4 @@ When responding to a `/pantheon` council synthesis invocation, specialists MUST
|
|
|
68
84
|
```
|
|
69
85
|
|
|
70
86
|
## Memory Context
|
|
71
|
-
If
|
|
72
|
-
used as context for the response.
|
|
87
|
+
If memory affected the result, state the takeaway briefly; do not repeat the entry or task context.
|
|
@@ -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
|
-
-
|
|
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,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Universal memory protocol rules for all Pantheon agents with agent-specific overrides"
|
|
3
3
|
name: "Memory Protocol"
|
|
4
|
-
|
|
4
|
+
agents: ["*"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# 🧠 Memory Protocol — Universal Rules
|
|
8
8
|
|
|
9
|
-
These rules apply to
|
|
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
|
-
###
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
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
|
-
###
|
|
21
|
-
|
|
22
|
-
-
|
|
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
|
+
- `memory_store()` is manual, not automatic. Store at most one concise, reusable top-level result; never persist routine child summaries, phase updates, test logs, or temporary state.
|
|
20
|
+
- Confirm the store succeeded before claiming persistence. There is no automatic memory WAL or recovery. Add ADRs to the memory bank only when explicitly requested.
|
|
25
21
|
|
|
26
|
-
###
|
|
27
|
-
|
|
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
|
|
22
|
+
### Relevance and permanent records
|
|
23
|
+
Ignore weak matches; routine summaries do not belong in durable memory.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Stall detection, phase reminders, delegate retry, and progress checkpoints for Zeus"
|
|
3
3
|
name: "Zeus Anti-Stall"
|
|
4
|
-
|
|
4
|
+
agents: [zeus]
|
|
5
|
+
fallback: shared
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# 🛑 ANTI-STALL & STALL DETECTION
|
|
@@ -32,77 +33,29 @@ Self-check every 3 turns: "Am I waiting on a delegate? Have I polled without nee
|
|
|
32
33
|
|
|
33
34
|
## Delegate Retry Enhancement
|
|
34
35
|
|
|
35
|
-
When a delegation
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
2. **Retry ONCE** with rephrased prompt — add: "Previous attempt failed with: [error]. Adjusted approach: [what changed]."
|
|
43
|
-
|
|
44
|
-
3. **If retry also fails** → do NOT retry blindly; follow the fallback chain and escalation protocol in `## ⏱️ Timeout & Retry Enforcement`.
|
|
36
|
+
When a delegation has a transient dispatch failure (timeout, crash, or empty
|
|
37
|
+
response), check known causes first and allow at most one corrected retry per
|
|
38
|
+
agent/task. Do not retry a scope refusal or a failed test/validation; reroute
|
|
39
|
+
only when the correct specialist is clear, otherwise diagnose or escalate.
|
|
40
|
+
After a transient retry fails, follow the canonical fallback chain once and
|
|
41
|
+
escalate rather than restarting it. See `## ⏱️ Timeout & Retry Enforcement`.
|
|
45
42
|
|
|
46
43
|
## Progress Checkpoint
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
For long-running or multi-phase tasks expected to run > 5 turns only:
|
|
49
46
|
- After turn 5: output `[CHECKPOINT] Completed so far: [summary]. Remaining: [list].`
|
|
50
47
|
- After turn 10: re-evaluate. If < 50% done, consider splitting or escalating.
|
|
51
48
|
- If 3 consecutive turns produce no tool calls: trigger Stall Detection Protocol (see above).
|
|
52
49
|
|
|
53
50
|
## Heartbeat & Checkpoint Integration
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
No file I/O, no checkpoint_session.py — TTL (4h) handles cleanup automatically.
|
|
57
|
-
|
|
58
|
-
### Heartbeat Check
|
|
59
|
-
- If `context_get(slug, "heartbeat")` returns a checkin older than 300s, log a stall warning and resume
|
|
60
|
-
- Write heartbeat after every anti-stall recovery action:
|
|
61
|
-
```
|
|
62
|
-
context_save(slug, "heartbeat", json({"status": "alive", "last_action": "...", "turn_count": N}))
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Checkpoint Auto-Save (Pré-Compactação)
|
|
66
|
-
Before ANY delegate dispatch, save a checkpoint:
|
|
67
|
-
```
|
|
68
|
-
context_save(slug, "phase:N", json({
|
|
69
|
-
"phase": N, "turn_count": N, "agent": "...", "summary": "..."
|
|
70
|
-
}), session_id=SESSION_ID)
|
|
71
|
-
```
|
|
72
|
-
All checkpoints auto-expire after 4h (TTL=14400).
|
|
73
|
-
|
|
74
|
-
### Gatilho de Pré-Compactação (Anti-perda de estado)
|
|
75
|
-
Antes da compactação nativa do OpenCode disparar (75-96% do context window),
|
|
76
|
-
o Zeus DEVE salvar o estado atual:
|
|
77
|
-
1. Capture session_id do primeiro `context_save` da sessão
|
|
78
|
-
2. Salve heartbeat + phase atual + tarefas pendentes
|
|
79
|
-
3. Só então permita que a compactação prossiga
|
|
80
|
-
```
|
|
81
|
-
# Ao iniciar sessão:
|
|
82
|
-
result = context_save(slug, "init", session_state)
|
|
83
|
-
SESSION_ID = result.session_id # ← guarde para toda a sessão
|
|
84
|
-
|
|
85
|
-
# Antes de CADA delegação:
|
|
86
|
-
context_save(slug, f"pre:{agent}", current_state, session_id=SESSION_ID)
|
|
87
|
-
|
|
88
|
-
# Após retorno do agente:
|
|
89
|
-
context_save(slug, f"post:{agent}", result_state, session_id=SESSION_ID)
|
|
90
|
-
```
|
|
91
|
-
Isso garante que o estado sobreviva à compactação — o "latest" pointer
|
|
92
|
-
sempre aponta para o checkpoint mais recente, mesmo após compactação.
|
|
52
|
+
Use checkpoints only for long-running or multi-phase work when `context_save` and `context_get` are available. Never add persistence calls for a bounded task.
|
|
93
53
|
|
|
54
|
+
### Checkpoint / Pre-Compaction
|
|
55
|
+
Checkpoint only when context loss is plausible and both checkpoint tools are present. Save once at a meaningful boundary using `content=JSON.stringify(state)` and an explicit session ID; `state` must be an object with object-valued `phase`/`goal`/`delegations`/`heartbeat` fields and an array `tail`, and omit an unset `goal`. A successful save needs no immediate read. Checkpoints expire after 4h.
|
|
94
56
|
|
|
95
57
|
### Context Retrieval
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
context_get(slug, "latest") # most recent checkpoint
|
|
99
|
-
context_get(slug, "phase:3") # specific phase
|
|
100
|
-
context_list(slug) # all checkpoints
|
|
101
|
-
```
|
|
58
|
+
Read a checkpoint only when resuming a workflow with a known session ID. Do not retrieve it after every dispatch; carry ordinary handoffs in the task context.
|
|
102
59
|
|
|
103
60
|
### Long-Session Progress
|
|
104
|
-
|
|
105
|
-
- Current phase
|
|
106
|
-
- Completed tasks
|
|
107
|
-
- Pending tasks
|
|
108
|
-
- Any blockers
|
|
61
|
+
For long-lived multi-phase work, update an existing/requested progress record every 5 turns with completed and pending work and blockers. Do not create STATUS.md for a bounded task.
|
|
@@ -1,203 +1,37 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Council synthesis — dispatch 2-
|
|
2
|
+
description: "Council synthesis — dispatch 2-3 specialists inline for multi-perspective decisions with precedent fast-path, confidence cross-validation, rebuttal rounds, and Themis audit gate"
|
|
3
3
|
name: "Zeus Council Synthesis"
|
|
4
|
-
|
|
4
|
+
agents: [zeus]
|
|
5
|
+
fallback: shared
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# 🏛️ INLINE COUNCIL SYNTHESIS — /pantheon
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Use an inline specialist council for material trade-offs, architecture/security choices, technology selection, cost/quality decisions, or multi-stakeholder questions. Do not use it for ordinary implementation tasks.
|
|
10
11
|
|
|
11
|
-
##
|
|
12
|
-
- Trade-off questions: "which is better?", "should we use X or Y?", "compare A and B"
|
|
13
|
-
- Architecture decisions with long-term impact
|
|
14
|
-
- Security/compliance choices
|
|
15
|
-
- Technology selection (databases, frameworks, providers, libraries)
|
|
16
|
-
- "Is this safe?", "trade-offs of...", "what are the risks?"
|
|
17
|
-
- Cost vs quality decisions
|
|
18
|
-
- Multi-stakeholder concerns (frontend + backend + infra)
|
|
12
|
+
## Dispatch and Synthesis
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
participant M as Memory (Precedent)
|
|
30
|
-
participant A as Apollo (Research)
|
|
31
|
-
participant B as BackgroundJobBoard
|
|
32
|
-
participant S1 as Specialist 1
|
|
33
|
-
participant S2 as Specialist 2
|
|
34
|
-
participant S3 as Specialist 3
|
|
35
|
-
participant W as Web Search
|
|
36
|
-
participant T as Themis (Audit + Moderator)
|
|
37
|
-
|
|
38
|
-
U->>Z: /pantheon [--research] question
|
|
39
|
-
Z->>M: memory_search(council_decisions)
|
|
40
|
-
alt Precedent found (score > 0.85)
|
|
41
|
-
M-->>Z: ⚠️ Cached decision
|
|
42
|
-
Z->>U: Fast-path precedent
|
|
43
|
-
else No precedent
|
|
44
|
-
opt --research flag
|
|
45
|
-
Z->>A: 30s pre-scan
|
|
46
|
-
A-->>Z: Context brief
|
|
47
|
-
end
|
|
48
|
-
Z->>B: registerLaunch({council session})
|
|
49
|
-
par Dispatch all specialists
|
|
50
|
-
Z->>S1: Domain query + shared context
|
|
51
|
-
Z->>S2: Domain query + shared context
|
|
52
|
-
Z->>S3: Domain query + shared context
|
|
53
|
-
end
|
|
54
|
-
par Collect responses
|
|
55
|
-
S1-->>Z: Structured response
|
|
56
|
-
S2-->>Z: Structured response
|
|
57
|
-
S3-->>Z: Structured response
|
|
58
|
-
end
|
|
59
|
-
Note over Z: Cross-validate confidence
|
|
60
|
-
alt Agreement rate < 50%
|
|
61
|
-
Z->>S1: Rebuttal round
|
|
62
|
-
Z->>S2: Rebuttal round
|
|
63
|
-
Z->>S3: Rebuttal round
|
|
64
|
-
S1-->>Z: Refined response
|
|
65
|
-
S2-->>Z: Refined response
|
|
66
|
-
S3-->>Z: Refined response
|
|
67
|
-
Note over Z: Ainda divergência?
|
|
68
|
-
alt Agreement rate STILL < 50%
|
|
69
|
-
Z->>W: browser_search() for each divergence point
|
|
70
|
-
W-->>Z: Evidence brief with sources
|
|
71
|
-
Z->>T: Dispatches as moderator
|
|
72
|
-
Note over T: Reviews evidence + specialist responses
|
|
73
|
-
T-->>Z: Moderator verdict
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
Z->>Z: Synthesize (with evidence if tie-broken)
|
|
77
|
-
Z->>T: Audit synthesis fidelity
|
|
78
|
-
T-->>Z: ✅ / ⚠️ Issues
|
|
79
|
-
Z->>M: Store decision
|
|
80
|
-
Z->>B: Mark reconciled
|
|
81
|
-
Z->>U: 🏛️ Council Synthesis
|
|
82
|
-
end
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Dispatch Sequence (9-Step Protocol)
|
|
86
|
-
|
|
87
|
-
### Step 0 — Precedent Fast-Path (Fase 1)
|
|
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.
|
|
89
|
-
|
|
90
|
-
### Step 0b — Apollo Pre-Scan (Fase 2, --research flag)
|
|
91
|
-
If `/pantheon --research <question>`: dispatch @apollo with 30s timeout. Inject findings as `shared_context` into ALL specialist prompts. Skip if flag absent.
|
|
92
|
-
|
|
93
|
-
### Step 1 — Register on BackgroundJobBoard (Fase 1)
|
|
94
|
-
Before dispatching specialists:
|
|
95
|
-
```
|
|
96
|
-
board.registerLaunch({
|
|
97
|
-
taskID: "council:<uuid>",
|
|
98
|
-
parentSessionID: "<session-id>",
|
|
99
|
-
agent: "zeus",
|
|
100
|
-
description: "Council: <question>",
|
|
101
|
-
objective: "Synthesize specialist recommendations"
|
|
102
|
-
})
|
|
103
|
-
```
|
|
104
|
-
Enables crash recovery — if context is lost mid-synthesis, the board preserves session state.
|
|
105
|
-
|
|
106
|
-
### Step 2 — Select Specialists
|
|
107
|
-
Use domain-to-specialist mapping table (below). Max 3 specialists.
|
|
108
|
-
|
|
109
|
-
### Step 3 — Dispatch ALL task() calls in ONE message
|
|
110
|
-
Each specialist prompt MUST include:
|
|
111
|
-
- Structured output template (see Specialist Output Format below)
|
|
112
|
-
- `shared_context` if Apollo pre-scan was done
|
|
113
|
-
- Timeout per role: 120s for reviewers, 60s for explorers/implementers
|
|
114
|
-
|
|
115
|
-
### Step 4 — Collect Responses
|
|
116
|
-
Wait for all responses. Note TIMEOUT agents. Partial results OK only for read-only specialists (@apollo, @gaia).
|
|
117
|
-
|
|
118
|
-
### Step 5 — Confidence Cross-Validation (Fase 2)
|
|
119
|
-
For each specialist response, validate confidence claims:
|
|
120
|
-
|
|
121
|
-
| Reported | Minimum Required | Action |
|
|
122
|
-
|----------|-----------------|--------|
|
|
123
|
-
| High | ≥ 3 specific claims | If fewer → downgrade to Medium, annotate "(auto-downgraded from High: only N specific claims)" |
|
|
124
|
-
| Medium | ≥ 1 specific claim | Pass |
|
|
125
|
-
| Low | Any response | Pass |
|
|
126
|
-
|
|
127
|
-
"Specific claim" = statement with evidence, data point, or verifiable fact (not opinion).
|
|
128
|
-
|
|
129
|
-
### Step 6 — Divergence-Gated Rebuttal Round (Fase 2, conditional)
|
|
130
|
-
Calculate agreement rate = `min(agreements, divergences) / total_points` from structured `agreement_signals`. If < 50% agreement:
|
|
131
|
-
- Dispatch ONE rebuttal round: specialists see ALL other responses and refine their own
|
|
132
|
-
- Updated responses treated as final
|
|
133
|
-
- Hard cap: MAX 3 total rounds (initial + 2 rebuttals)
|
|
134
|
-
- Skip if any TIMEOUT occurred (can't rebuttal without all voices)
|
|
135
|
-
|
|
136
|
-
### Step 6b — Modo Desempate com Evidência (Fase 2, conditional)
|
|
137
|
-
|
|
138
|
-
If after Step 6 the agreement rate is STILL < 50% (rebuttal did not resolve divergence):
|
|
14
|
+
1. **Precedent:** Run the separate `council_decisions` search defined in `## Memory Protocol`. Apply its age/score rules; if no fast-path decision applies, continue.
|
|
15
|
+
2. **Research (optional):** For `/pantheon --research <question>`, ask @apollo for a 30s pre-scan and pass findings as `shared_context` to every specialist.
|
|
16
|
+
3. **Register:** Before dispatch, call `board.registerLaunch` with a council task ID, parent session, Zeus, question, and synthesis objective. This enables crash recovery.
|
|
17
|
+
4. **Select and dispatch:** Choose at most 3 agents using the domain map below. Send all `task()` calls in one message. Each prompt includes the question, shared context, required response format, and role timeout (120s reviewers; 60s explorers/implementers).
|
|
18
|
+
5. **Collect:** Wait for all responses and note timeouts. Partial responses are acceptable only from read-only @apollo or @gaia.
|
|
19
|
+
6. **Validate confidence:** High requires at least 3 verifiable claims; otherwise downgrade to Medium and state why. Medium requires at least 1 claim; Low needs no minimum. Opinions alone are not specific claims.
|
|
20
|
+
7. **Resolve divergence:** Compute agreement rate as `min(agreements, divergences) / total_points` from structured `agreement_signals`. Below 50%, and only if no agent timed out, run one rebuttal round with all responses and the current synthesis draft. Treat revised responses as final. If disagreement remains below 50%, research factual divergence points with official docs, benchmarks, or issues (max 3 searches; seek 2 independent sources per point when possible). Skip research for subjective-only disagreements. Send responses and a cited evidence brief to @themis as moderator; request verdicts, overall direction, confidence, and unresolved issues. Low confidence or unresolved points remain explicit in the synthesis. Moderator and audit roles are separate.
|
|
21
|
+
8. **Synthesize and audit:** Use the output format below, then ask @themis to compare raw responses with the synthesis. Check representation of every specialist, preserved divergences, accurate attribution, and confidence specificity. Fix any issue before delivery.
|
|
22
|
+
9. **Persist:** Store the decision using the `council_decisions` write format in `## Memory Protocol`, then call `board.markReconciled(task_id)`.
|
|
139
23
|
|
|
140
|
-
|
|
141
|
-
2. **Web research** — For EACH divergence point, Zeus calls `browser_search()` or `webfetch()` to find factual evidence:
|
|
142
|
-
- Benchmarks, documentation, GitHub issues, official sources
|
|
143
|
-
- At least 2 independent sources per point when possible
|
|
144
|
-
- Focus on factual data, not opinion
|
|
145
|
-
3. **Compile Evidence Brief** — Structure findings as:
|
|
146
|
-
```
|
|
147
|
-
## evidence_brief
|
|
148
|
-
**divergence_point_1:** <description>
|
|
149
|
-
**evidence_found:** <facts from web, max 3 sentences>
|
|
150
|
-
**sources:** [URL1, URL2]
|
|
24
|
+
If context is lost, use `board.recoverRunningJobs()` and `board.formatForPrompt()` to find unreconciled work. Re-dispatch a crashed council with the same question and label it as a retry.
|
|
151
25
|
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
4. **Dispatch @themis as moderator** — Send ONE task with:
|
|
155
|
-
- All specialist responses (initial + rebuttal)
|
|
156
|
-
- The evidence brief
|
|
157
|
-
- Prompt: "Act as impartial moderator. These specialists disagree on [points]. Here is web evidence on each point. Issue a final verdict for each divergence point, citing specific evidence. Return structured verdict."
|
|
158
|
-
5. **Themis returns moderator verdict** in this format:
|
|
159
|
-
```
|
|
160
|
-
## moderator_verdict
|
|
161
|
-
**divergence_points_analyzed:** <count>
|
|
162
|
-
**verdicts:**
|
|
163
|
-
- <point 1>: <decision> — evidence: <citation>
|
|
164
|
-
- <point 2>: <decision> — evidence: <citation>
|
|
165
|
-
**overall_direction:** <which approach is better supported by evidence>
|
|
166
|
-
**confidence:** High | Medium | Low
|
|
167
|
-
**unresolved:** <any points still unclear despite evidence>
|
|
168
|
-
```
|
|
169
|
-
6. **Zeus incorporates verdict** into synthesis (Step 7), showing which evidence supported which conclusion
|
|
26
|
+
## Specialist Response Format
|
|
170
27
|
|
|
171
|
-
|
|
172
|
-
- Only triggers when agreement rate < 50% AFTER rebuttal round
|
|
173
|
-
- Skip if NO divergence points are web-researchable (purely subjective/opinion-based disagreements)
|
|
174
|
-
- Max 3 web searches per council (prevents runaway)
|
|
175
|
-
- If Themis confidence is Low or points remain unresolved, note this explicitly in synthesis
|
|
176
|
-
- Themis moderator role is SEPARATE from the Themis Audit Gate (Step 8) — they serve different functions
|
|
28
|
+
Require `## specialist_response` from `## Agent Return Format`: `position`, `reasoning`, `trade_offs`, `risks`, `confidence`, `agreement_signals`, and `specific_claims`.
|
|
177
29
|
|
|
178
|
-
|
|
179
|
-
Use structured `agreement_signals` to auto-detect agreements/divergences. Output synthesis template (see below).
|
|
30
|
+
## Domain Map
|
|
180
31
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
task(subagent_type: "themis", prompt: "Audit this council synthesis for fidelity. Compare raw specialist responses against the synthesized output. Check: (1) Any specialist misrepresented? (2) Divergences hidden or softened? (3) Confidence claims match response specificity? Return ✅ or list specific issues.")
|
|
185
|
-
```
|
|
186
|
-
- If ✅ → proceed
|
|
187
|
-
- If issues → fix each issue before delivering to user
|
|
188
|
-
|
|
189
|
-
### Step 9 — Persist & Reconcile (Fase 1)
|
|
190
|
-
Persist the decision using the write path in `## Memory Protocol > Council Decisions Namespace`, then `board.markReconciled("<task-id>")`.
|
|
191
|
-
|
|
192
|
-
## Specialist Output Format (Fase 1 — machine-parseable structured fields)
|
|
193
|
-
|
|
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`.
|
|
195
|
-
|
|
196
|
-
## Domain-to-Specialist Mapping
|
|
197
|
-
|
|
198
|
-
| Domain | Specialists |
|
|
199
|
-
|--------|-------------|
|
|
200
|
-
| Architecture | hermes, demeter, themis, athena |
|
|
32
|
+
| Domain | Candidate agents |
|
|
33
|
+
|---|---|
|
|
34
|
+
| Architecture | athena, hermes, demeter, themis |
|
|
201
35
|
| Security | themis, hermes, prometheus, nyx |
|
|
202
36
|
| Database | demeter, hermes, prometheus |
|
|
203
37
|
| AI/RAG | hephaestus, nyx |
|
|
@@ -206,94 +40,32 @@ Specialists MUST return the structured `## specialist_response` format (position
|
|
|
206
40
|
| Observability | nyx, hermes |
|
|
207
41
|
| General | athena, themis, hermes |
|
|
208
42
|
|
|
209
|
-
## Synthesis
|
|
43
|
+
## User-Facing Synthesis
|
|
210
44
|
|
|
211
|
-
```
|
|
45
|
+
```text
|
|
212
46
|
## 🏛️ Council Synthesis
|
|
213
|
-
|
|
214
|
-
**Question:** <original question>
|
|
215
|
-
**Date:** <date>
|
|
216
|
-
**Response rate:** X of Y specialists responded
|
|
217
|
-
**Timed out:** @agent1, @agent2 (if any)
|
|
218
|
-
**Precedent used:** yes/no (which one, date)
|
|
219
|
-
**Research context:** <shared_context summary> (if --research)
|
|
47
|
+
Question / date / response rate / timed-out agents / precedent / research context
|
|
220
48
|
|
|
221
49
|
### Specialist Perspectives
|
|
222
50
|
| Agent | Position | Trade-offs | Confidence |
|
|
223
|
-
|-------|----------|------------|------------|
|
|
224
|
-
| @agent1 | ... | ... | High/Med/Low |
|
|
225
51
|
|
|
226
52
|
### Agreements
|
|
227
|
-
-
|
|
53
|
+
- Points shared by multiple specialists
|
|
228
54
|
|
|
229
55
|
### Divergences
|
|
230
|
-
| Issue |
|
|
231
|
-
|-------|--------|--------|------------|
|
|
56
|
+
| Issue | Sides | Resolution |
|
|
232
57
|
|
|
233
|
-
### Evidence & Moderation (
|
|
234
|
-
|
|
235
|
-
**Evidence summary:** <key findings from web>
|
|
236
|
-
**Moderator verdict:** <Themis final determination>
|
|
237
|
-
**Sources:** <citations>
|
|
58
|
+
### Evidence & Moderation (when used)
|
|
59
|
+
Research points, evidence, moderator verdict, cited sources, unresolved issues
|
|
238
60
|
|
|
239
61
|
### Recommendation
|
|
240
|
-
|
|
62
|
+
Decisive conclusion
|
|
241
63
|
|
|
242
64
|
### Audit Gate
|
|
243
|
-
|
|
65
|
+
Themis approved, or issues corrected
|
|
244
66
|
|
|
245
67
|
### Decision Gate
|
|
246
|
-
|
|
68
|
+
Confidence adjusted for response rate
|
|
247
69
|
```
|
|
248
70
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
1. Every specialist mentioned in synthesis? → ✅
|
|
252
|
-
2. Divergences from raw responses preserved (not softened/hidden)? → ✅
|
|
253
|
-
3. No specialist attributed a position they didn't state? → ✅
|
|
254
|
-
4. Confidence claims match response specificity? → ✅
|
|
255
|
-
5. If any ❌, list specific issues for Zeus to fix before delivery
|
|
256
|
-
|
|
257
|
-
## Rebuttal Round Rules (Fase 2)
|
|
258
|
-
|
|
259
|
-
1. Only triggers when agreement rate < 50%
|
|
260
|
-
2. MAX 3 rounds total (including initial dispatch)
|
|
261
|
-
3. Skip if any TIMEOUT (can't rebuttal without all voices)
|
|
262
|
-
4. Each rebuttal round: specialist sees ALL other responses + current synthesis draft
|
|
263
|
-
5. Refined responses replace originals for the final synthesis
|
|
264
|
-
6. If agreement rate STILL < 50% after rebuttal → Step 6b (Modo Desempate com Evidência)
|
|
265
|
-
|
|
266
|
-
## Crash Recovery via BackgroundJobBoard (Fase 1)
|
|
267
|
-
|
|
268
|
-
If Zeus context crashes mid-council:
|
|
269
|
-
1. On restart, `board.recoverRunningJobs()` marks running jobs as error
|
|
270
|
-
2. Check `board.formatForPrompt()` for unreconciled terminal jobs
|
|
271
|
-
3. Re-dispatch council with same question, noting: "⚠️ Retry — previous council session crashed. Using same question."
|
|
272
|
-
|
|
273
|
-
## Performance Budget
|
|
274
|
-
|
|
275
|
-
| Step | Latency | Phase |
|
|
276
|
-
|------|---------|-------|
|
|
277
|
-
| Precedent fast-path | < 500ms | Fase 1 |
|
|
278
|
-
| Apollo pre-scan | +30s (optional, --research) | Fase 2 |
|
|
279
|
-
| Specialist dispatch | bounded by slowest (60-120s) | — |
|
|
280
|
-
| Rebuttal round | +60s (conditional, < 50% agreement) | Fase 2 |
|
|
281
|
-
| Web search (tie-break) | +15s (conditional, < 50% after rebuttal) | Fase 2 |
|
|
282
|
-
| Themis moderator | +15s (conditional, tie-break activated) | Fase 2 |
|
|
283
|
-
| Themis audit | +15s | Fase 1 |
|
|
284
|
-
| **Total worst case** (research + rebuttal + tie-break) | ~255s | — |
|
|
285
|
-
| **Total typical** (no research, no rebuttal, no tie-break) | ~45-90s | — |
|
|
286
|
-
|
|
287
|
-
> **Note**: The user can explicitly invoke this via `/pantheon <question>`. The `--research` flag adds Apollo pre-scan. All decisions are stored in `council_decisions` memory namespace for fast-path retrieval on future councils.
|
|
288
|
-
|
|
289
|
-
## Modo Desempate Rules (Fase 2)
|
|
290
|
-
|
|
291
|
-
1. Only triggers when agreement rate < 50% AFTER rebuttal round
|
|
292
|
-
2. If no divergence points are web-researchable (pure opinion disagreement), skip — Zeus synthesizes with lower confidence
|
|
293
|
-
3. Max 3 web searches per council invocation
|
|
294
|
-
4. Themis moderator role is DISTINCT from Themis audit gate:
|
|
295
|
-
- Moderator: resolves substantive disagreement between specialists (reads evidence, gives verdict)
|
|
296
|
-
- Audit gate: checks synthesis fidelity against raw responses (quality assurance)
|
|
297
|
-
Both run in the same council invocation, at different steps
|
|
298
|
-
5. If Themis moderator confidence is Low, mark as "unresolved tie" in the synthesis output
|
|
299
|
-
6. Evidence from web search must be cited with source URL or document reference — no anonymous claims
|
|
71
|
+
The user invokes this flow with `/pantheon <question>`; `--research` enables the Apollo pre-scan. Preserve actual specialist timeout or unresolved-tie details in the response.
|