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
@@ -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
- applyTo: "agents/zeus.agent.md"
4
+ agents: [zeus]
5
+ fallback: shared
5
6
  ---
6
7
 
7
8
  # 🛑 ANTI-STALL & STALL DETECTION
@@ -15,94 +16,46 @@ You MUST self-monitor for these stall conditions:
15
16
  | Symptom | Detection Rule | Recovery Action |
16
17
  |---------|---------------|-----------------|
17
18
  | 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`, then follow the fallback chain in `## ⏱️ Timeout & Retry Enforcement` |
19
+ | Delegation black hole | No result or host completion notification after the applicable timeout | Stop dependent work; do not call an unavailable cancel/status tool. Follow `## ⏱️ Timeout & Retry Enforcement`, report uncertainty, and retry/reroute only under that policy |
19
20
  | Circular delegation | Same specialist re-dispatched for same task 2+ times without progress | Break cycle: dispatch to different specialist OR escalate to user |
20
21
  | 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
22
  | Context thrash | Re-reading same files repeatedly without new action | Stop re-reading. State: "Already have context on [file]. Proceeding with [action]." |
22
23
 
23
24
  ## Phase Reminder
24
25
 
25
- After dispatching background specialists, you MUST:
26
- 1. DO NOT poll running jobs or consume their partial output
27
- 2. DO NOT advance dependent work until terminal results arrive
28
- 3. Continue orchestration ONLY on non-overlapping independent work
29
- 4. If nothing independent remains, briefly report what was launched and WAIT
26
+ Use the root `subagent` dispatch observed in the Beta 10 runtime; `task()` is host/API terminology, and the exact signature/background options depend on the active runtime. Prefer synchronous delegation unless the visible schema supports background and the host exposes a way to observe completion. For asynchronous work:
27
+ 1. Do not invoke `task_status`, `cancel_task`, or board methods unless a corresponding tool is actually exposed (none was exposed in the reported Beta 10 root catalog).
28
+ 2. Do not advance dependent work until a result or host-provided completion notification arrives.
29
+ 3. Continue orchestration only on non-overlapping independent work.
30
+ 4. If nothing independent remains, briefly report what was dispatched and wait for host notification; do not claim job tracking or recovery.
30
31
 
31
32
  Self-check every 3 turns: "Am I waiting on a delegate? Have I polled without need? Is there independent work I can do?"
32
33
 
33
34
  ## Delegate Retry Enhancement
34
35
 
35
- When a delegation fails (timeout, empty response, error):
36
-
37
- 1. **FIRST:** Check if the error is a known pattern:
38
- - "Agent not responding" → verify agent name matches routing.yml
39
- - "Context exceeded" → reduce scope, split into smaller tasks
40
- - "Permission denied" → verify agent has correct tools/permissions
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
- On tasks expected to run > 5 turns:
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
- All session state lives in **pantheon-persistence** (namespace `checkpoint:<slug>`).
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
- Next-phase agents retrieve previous context via:
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
- Every 5 turns during a long session, update STATUS.md with:
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,7 +1,6 @@
1
1
  ---
2
2
  description: "Communication rules for Zeus and all Pantheon agents — clarity, conciseness, and directness"
3
3
  name: "Zeus Communication Rules"
4
- applyTo: "agents/zeus.agent.md"
5
4
  ---
6
5
 
7
6
  # 🗣️ COMMUNICATION RULES
@@ -1,203 +1,36 @@
1
1
  ---
2
- description: "Council synthesis — dispatch 2-4 specialists inline for multi-perspective decisions with precedent fast-path, confidence cross-validation, rebuttal rounds, and Themis audit gate"
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
- applyTo: "agents/zeus.agent.md"
4
+ agents: [zeus]
5
+ fallback: shared
5
6
  ---
6
7
 
7
8
  # 🏛️ INLINE COUNCIL SYNTHESIS — /pantheon
8
9
 
9
- When a question requires multiple expert perspectives on a trade-off or architecture decision, **dispatch specialists inline** (visible to user) instead of delegating to a hidden subagent.
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
- ## Trigger Patterns (detect ANY)
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
- ```mermaid
21
- ---
22
- config:
23
- look: classic
24
- theme: dark
25
- ---
26
- sequenceDiagram
27
- participant U as User
28
- participant Z as Zeus
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. **Select and dispatch:** Choose at most 3 agents using the domain map below. Dispatch through the root `subagent` tool observed in the Beta 10 runtime. `task()` is host/API terminology; signature, background mode, and parallel dispatch depend on the active runtime schema. Keep first-round prompts independent: do not include other specialists' responses. Dispatch in parallel when the observed tool/runtime supports it; synchronous or sequential dispatch is also valid if each first-round prompt excludes prior first-round responses. Specialists therefore cannot know actual peer positions in the first round: do not ask them to guess, signal agreement/disagreement, or refer to themselves/peers speculatively. First-round `agreement_signals` must be omitted or set to `none`.
17
+ 4. **Collect:** Use returned subagent results or host-provided completion notifications. Do not call `task_status` or claim job tracking/recovery when unavailable. Note timeouts and missing responses explicitly. Partial responses are acceptable only from read-only @apollo or @gaia.
18
+ 5. **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. Assess the claims and evidence actually present in each response; a self-reported `specific_claims` count is advisory, not evidence or proof of confidence.
19
+ 6. **Resolve divergence:** After all initial responses arrive, Zeus groups their actual substantive positions by issue and derives agreement from those positions, not from speculative or self-reported `agreement_signals`. For each comparable issue, compare every unordered pair of specialists who provided a comparable substantive position on that issue. A pair agrees only when its substantive positions are compatible; every pair whose positions are not aligned counts as divergent. For an issue with `n` specialists providing comparable positions, include `n*(n-1)/2` pairs in `total_comparable_pairs`; sum this across included issues. Exclude issues with fewer than two comparable positions and state that they were excluded. Calculate `agreement_rate = agreeing_pairs / total_comparable_pairs`: unanimity is 100%, all pairs in divergence is 0%, and non-aligned pairs are divergences. If the denominator is zero, the rate is indeterminate/has no basis; never substitute an artificial zero or trigger rebuttal from an undefined rate. Below 50%, and only if no agent timed out, run one rebuttal round with all responses and the current synthesis draft. In that round, signals may refer only to peer responses visible in the rebuttal prompt; treat revised responses as final and recompute the rate from their actual positions. If the defined rate 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.
20
+ 7. **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.
21
+ 8. **Persist (conditional):** Store the decision only if a memory-write tool is explicitly exposed and permitted in the active root tool list; require its success result before saying it was saved. Otherwise say the decision was not persisted. The `BackgroundJobBoard` is internal and has no root-callable board tool in the reported runtime.
139
22
 
140
- 1. **Identify divergence points** — Parse all specialist responses (initial + rebuttal) and extract specific issues where positions differ
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]
23
+ The `BackgroundJobBoard` is internal bookkeeping, not a tool available to Zeus root; do not call `board.registerLaunch`, `markReconciled`, `recoverRunningJobs`, or `formatForPrompt`, and do not assume crash recovery. If context is lost, continue only from results still present in the conversation or a host handoff; otherwise report the missing context and ask how to proceed.
151
24
 
152
- **divergence_point_2:** ...
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
25
+ ## Specialist Response Format
170
26
 
171
- **Rules:**
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
27
+ Require `## specialist_response` from `## Agent Return Format`. The first round must not prompt specialists to infer other agents' views; agreement signals are omitted or `none` until actual peer responses are visible.
177
28
 
178
- ### Step 7 — Zeus Synthesize
179
- Use structured `agreement_signals` to auto-detect agreements/divergences. Output synthesis template (see below).
29
+ ## Domain Map
180
30
 
181
- ### Step 8 — Themis Audit Gate (Fase 1)
182
- Post-synthesis, dispatch @themis:
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 |
31
+ | Domain | Candidate agents |
32
+ |---|---|
33
+ | Architecture | athena, hermes, demeter, themis |
201
34
  | Security | themis, hermes, prometheus, nyx |
202
35
  | Database | demeter, hermes, prometheus |
203
36
  | AI/RAG | hephaestus, nyx |
@@ -206,94 +39,32 @@ Specialists MUST return the structured `## specialist_response` format (position
206
39
  | Observability | nyx, hermes |
207
40
  | General | athena, themis, hermes |
208
41
 
209
- ## Synthesis Output Template (enhanced)
42
+ ## User-Facing Synthesis
210
43
 
211
- ```
44
+ ```text
212
45
  ## 🏛️ 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)
46
+ Question / date / response rate / timed-out agents / precedent / research context
220
47
 
221
48
  ### Specialist Perspectives
222
49
  | Agent | Position | Trade-offs | Confidence |
223
- |-------|----------|------------|------------|
224
- | @agent1 | ... | ... | High/Med/Low |
225
50
 
226
51
  ### Agreements
227
- - <what 2+ specialists agree on>
52
+ - Points shared by multiple specialists
228
53
 
229
54
  ### Divergences
230
- | Issue | Side A | Side B | Resolution |
231
- |-------|--------|--------|------------|
55
+ | Issue | Specialist positions (attribute each side to its agent) | Resolution |
232
56
 
233
- ### Evidence & Moderation (if tie-break activated)
234
- **Divergence points researched:** <list>
235
- **Evidence summary:** <key findings from web>
236
- **Moderator verdict:** <Themis final determination>
237
- **Sources:** <citations>
57
+ ### Evidence & Moderation (when used)
58
+ Research points, evidence, moderator verdict, cited sources, unresolved issues
238
59
 
239
60
  ### Recommendation
240
- <decisive conclusion>
61
+ Decisive conclusion
241
62
 
242
63
  ### Audit Gate
243
- **Status:** ✅ Themis approved | ⚠️ Issues corrected
64
+ Themis approved, or issues corrected
244
65
 
245
66
  ### Decision Gate
246
- **Confidence:** High/Medium/Low (adjusted for response rate)
67
+ Confidence adjusted for response rate
247
68
  ```
248
69
 
249
- ## Themis Audit Gate Rules (Fase 1)
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
70
+ Initial agreement signals remain omitted/`none`; consensus and agreements are derived by Zeus from compared substantive positions and presented in the synthesis. Preserve actual specialist timeout or unresolved-tie details in the response. The user invokes this flow with `/pantheon <question>`; `--research` enables the Apollo pre-scan.
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: "Zeus-only council memory procedures"
3
+ name: "Zeus Memory Operations"
4
+ agents: [zeus]
5
+ fallback: shared
6
+ ---
7
+
8
+ # Zeus Memory Operations
9
+
10
+ ## Routing
11
+
12
+ Reuse relevant memory already present in the request or task context. If prior project history matters and no result is present, Zeus may do one targeted search and pass useful hits with the delegation. Do not search on every turn or add KV/cache calls to ordinary dispatches.
13
+
14
+ ## Council Decisions
15
+
16
+ Before a council, search separately from the task-level lookup only when a past council decision could affect the recommendation:
17
+ `memory_search(query=question, top_k=2, namespace="council_decisions")`.
18
+ Use a recent, directly matching decision only after checking current context;
19
+ otherwise treat it as background, never as authority to skip a needed review.
20
+
21
+ Persist only reusable, material decisions, and only if a memory-write tool is
22
+ explicitly exposed and permitted in the active root tool list. The reported Beta
23
+ 10 Zeus root has `memory_search` but no `memory_store` grant/tool; search access
24
+ does not imply write access. If a write tool is available, use
25
+ `key="council:<yyyy-mm-dd>:<slug>"`, JSON-stringify both `value` and `metadata`,
26
+ and confirm success before claiming persistence. Otherwise tell the user the
27
+ decision was not persisted. Keep any saved record concise: question, recommendation,
28
+ specialists, confidence, unresolved trade-off, and timestamp. Do not store routine
29
+ subtask summaries or status updates. Use the memory bank for ADRs only when
30
+ explicitly requested.