pantheon-opencode 1.6.0-beta.6 β†’ 1.6.0-beta.8

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 (54) hide show
  1. package/AGENTS.md +19 -769
  2. package/CHANGELOG.md +53 -0
  3. package/README.md +78 -9
  4. package/README.pt-BR.md +10 -4
  5. package/package.json +5 -1
  6. package/plugin.json +2 -2
  7. package/pyproject.toml +3 -1
  8. package/scripts/build-agents-md.mjs +159 -26
  9. package/scripts/install/agents-md.mjs +2 -2
  10. package/scripts/install/config-migration.mjs +115 -1
  11. package/scripts/install/interactive.mjs +1 -1
  12. package/scripts/install/opencode.mjs +245 -12
  13. package/scripts/install/shared.mjs +115 -7
  14. package/scripts/sync-artifacts.mjs +2 -2
  15. package/scripts/test-opencode-v2-sandbox.sh +155 -4
  16. package/scripts/validate-sandbox-install.mjs +138 -0
  17. package/skills-lock.json +5 -5
  18. package/src/agents/aphrodite.md +18 -36
  19. package/src/agents/demeter.md +8 -27
  20. package/src/agents/gaia.md +1 -0
  21. package/src/agents/hephaestus.md +10 -20
  22. package/src/agents/hermes.md +15 -37
  23. package/src/agents/mnemosyne.md +14 -42
  24. package/src/agents/prometheus.md +16 -19
  25. package/src/agents/talos.md +4 -1
  26. package/src/agents/themis.md +4 -4
  27. package/src/agents/zeus.md +24 -127
  28. package/src/instructions/agent-return-format.instructions.md +2 -3
  29. package/src/instructions/backend-standards.instructions.md +2 -0
  30. package/src/instructions/frontend-standards.instructions.md +3 -1
  31. package/src/instructions/memory-protocol.instructions.md +11 -121
  32. package/src/instructions/zeus-anti-stall.instructions.md +14 -69
  33. package/src/instructions/zeus-communication-rules.instructions.md +0 -1
  34. package/src/instructions/zeus-council-synthesis.instructions.md +32 -260
  35. package/src/instructions/zeus-memory-operations.instructions.md +26 -0
  36. package/src/instructions/zeus-timeout-retry.instructions.md +40 -87
  37. package/src/pantheon/v2-delegation-enforce.ts +87 -0
  38. package/src/pantheon/v2-execute-after.ts +186 -0
  39. package/src/pantheon/v2-unsupported.mjs +0 -23
  40. package/src/plugin-v2.ts +271 -36
  41. package/src/plugins/tui/dist/tui.d.ts +11 -8
  42. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  43. package/src/plugins/tui/dist/tui.js +53 -37
  44. package/src/plugins/tui/package-lock.json +30 -33
  45. package/src/plugins/tui/package.json +5 -1
  46. package/src/plugins/tui/src/index.tsx +103 -82
  47. package/src/plugins/tui/tsdown.config.ts +17 -0
  48. package/src/routing.yml +10 -5
  49. package/src/skills/README.md +3 -3
  50. package/src/skills/artifact-management/SKILL.md +12 -5
  51. package/src/skills/auto-continue/SKILL.md +37 -28
  52. package/src/skills/code-review-checklist/SKILL.md +5 -5
  53. package/src/skills/context-compression/SKILL.md +26 -879
  54. package/src/skills/tdd-with-agents/SKILL.md +18 -10
@@ -1,133 +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
- applyTo: "agents/*.agent.md"
4
+ agents: ["*"]
5
5
  ---
6
6
 
7
7
  # 🧠 Memory Protocol β€” Universal Rules
8
8
 
9
- These rules apply to ALL Pantheon agents. Agent-specific overrides are defined
10
- in each agent's `## 🧠 Memory Protocol` section.
9
+ These rules apply to all agents; each agent file may add domain-specific rules.
11
10
 
12
11
  ## Universal Rules
13
12
 
14
- ### 1. Pre-Work Read-Only Recall
15
- **Call `memory_search()` at task start before any file reads.**
16
- - Use domain-specific context matching your agent's focus area
17
- - Single call per task, not per turn
18
- - Agents have **read-only** memory access β€” only `memory_search()` is available
13
+ ### Retrieval
14
+ - Search only when prior project history could change the outcome; skip self-contained questions and bounded changes.
15
+ - For delegated work, Zeus searches at most once and passes useful hits to the specialist. Reuse supplied results; search separately only if relevant history is needed but missing.
16
+ - Use a targeted query (`top_k=2`); do not search the whole prompt by default. Missing or irrelevant results never block current work.
19
17
 
20
- ### 2. Auto-Store by Zeus on Subtask Summary
21
- **`memory_store()` is called AUTOMATICALLY by Zeus when you return a subtask_summary.**
22
- - Include a clear `summary` field in your return β€” no explicit `memory_store()` call needed
23
- - This is the **ONLY** persistence path: agent β†’ subtask_summary β†’ Zeus β†’ memory_store
24
- - Zeus persists ALL agent returns (implementers and read-only agents alike)
18
+ ### Persistence
19
+ - `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
- ### 3. Write-Ahead Log (WAL)
27
- Before Zeus calls `memory_store()`, it writes a write-ahead log to:
28
- ```
29
- .pantheon/memory-wal/<agent>/<timestamp>.json
30
- ```
31
- - WAL format: `{ agent, phase, summary, files_changed, status, timestamp }`
32
- - WAL is written **before** the store operation β€” if store crashes, WAL is recovered on next session start
33
- - WAL files are ephemeral (auto-cleaned after 7 days)
34
-
35
- ### 4. Relevance Threshold
36
- **Skip search results if relevance score < 0.3.**
37
- - Prevents noise from unrelated past entries
38
- - Applies to `memory_search()` results only
39
-
40
- ### 5. Permanent Documentation
41
- **ADR-level decisions β†’ delegate to `@mnemosyne`.**
42
- - Use for: architecture decisions, significant trade-offs, pattern changes
43
- - Not for: routine task summaries (handled by Auto-Store)
44
-
45
- ## Per-Agent Overrides
46
-
47
- Each agent file defines overrides in its `## 🧠 Memory Protocol` section:
48
- - Domain-specific `memory_search()` context string
49
- - Read-only access via `memory_search()` only β€” no `memory_store` for subagents
50
- - Agent-specific rules (session-end, sprint close, quick-index, etc.)
51
-
52
-
53
- ## Delegation Cache
54
-
55
- Para otimizar decisoes de delegacao e reduzir gasto de tokens:
56
-
57
- 1. **memory_search(query=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: JSON.stringify({agent, background, pattern})
62
- - metadata: JSON.stringify({type: "decision", score: N})
63
-
64
- `value` E `metadata` sao JSON-encoded strings β€” o runtime exige que o
65
- chamador serialize os dois. Objeto cru em `metadata` e rejeitado pelo
66
- `BeforeValidator` do servidor com `metadata must be a JSON object encoded
67
- as a string (got object). json.dumps it first. Example: metadata='{"type":
68
- "decision", "score": 0.9}'`.
69
-
70
- 4. **kv_store(namespace="deleg", key="deleg:<pattern>", value=...)** para padroes recorrentes de delegacao
71
- 5. **kv_get(namespace="deleg", key="deleg:<pattern>")** para reusar decisoes ja tomadas
72
-
73
- Isso elimina ~300 tokens de reasoning por delegacao quando o cache acerta.
74
-
75
- ## Council Decisions Namespace
76
-
77
- Council synthesis decisions are persisted in a dedicated `council_decisions` namespace for precedent fast-path retrieval:
78
-
79
- ### Write Path
80
- After every `/pantheon` council synthesis completes, Zeus stores:
81
- ```
82
- memory_store({
83
- namespace: "council_decisions",
84
- key: "council:<yyyy-mm-dd>:<slug>",
85
- value: JSON.stringify({
86
- question: "original question",
87
- specialists: ["@agent1", "@agent2"],
88
- recommendation: "final recommendation",
89
- confidence: "High|Medium|Low",
90
- agreements: ["point1", "point2"],
91
- divergences: [{"issue": "...", "resolution": "..."}],
92
- response_rate: "X of Y",
93
- themis_audit: "approved|issues",
94
- precedent_used: false,
95
- timestamp: "<ISO-8601>"
96
- }),
97
- metadata: JSON.stringify({
98
- type: "council_decision",
99
- specialist_count: N,
100
- model_tier_used: "premium|default|fast"
101
- })
102
- })
103
- ```
104
- `value` is JSON-serialized before storing (the MCP `memory_store.value` argument is a string).
105
- `metadata` works the same way β€” it is a JSON object encoded as a **string**, so pass
106
- `JSON.stringify({...})`. A raw object is rejected with `metadata must be a JSON object
107
- encoded as a string (got object). json.dumps it first. Example: metadata='{"type":
108
- "decision", "score": 0.9}'` (enforced by a `BeforeValidator` in
109
- `memory_mcp.py`). **Both `value` and `metadata` must be serialized by the caller.**
110
-
111
- ### Read Path (Precedent Fast-Path)
112
- Before dispatching a new council, Zeus runs:
113
- ```
114
- memory_search(query=question, top_k=2, namespace="council_decisions")
115
- ```
116
-
117
- Result interpretation:
118
- | Score | Age | Action |
119
- |-------|-----|--------|
120
- | > 0.85 | < 30 days | Return precedent verbatim (note "⚠️ DecisΓ£o de [data] β€” reavaliar se contexto mudou") as fast-path answer. Skip council dispatch entirely. |
121
- | > 0.85 | >= 30 days | Return with warning "Reavaliar se contexto mudou β€” decisΓ£o tem mais de 30 dias" + proceed with council |
122
- | 0.5 - 0.85 | Any | Include as context for specialists but still dispatch council |
123
- | < 0.5 | Any | Ignore, proceed with fresh council |
124
-
125
- ### TTL & Maintenance
126
- - Council decisions are LONG-TERM (no TTL or TTL = 365 days)
127
- - Stale decisions (age > 90 days) should be flagged but NOT deleted β€” they remain as historical record
128
- - Purge only via explicit namespace cleanup when decisions are superseded by ADRs
129
-
130
- ### When NOT to Use
131
- - Routine task summaries β†’ use `default` namespace (auto-store by Zeus)
132
- - Sprint/progress tracking β†’ use `session` namespace
133
- - 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
- applyTo: "agents/zeus.agent.md"
4
+ agents: [zeus]
5
+ fallback: shared
5
6
  ---
6
7
 
7
8
  # πŸ›‘ ANTI-STALL & STALL DETECTION
@@ -32,85 +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 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=slug, key="heartbeat", session_id=SESSION_ID)` 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=slug, key="heartbeat", content=JSON.stringify({"status": "alive", "last_action": "...", "turn_count": N}), session_id=SESSION_ID)
63
- ```
64
-
65
- ### Checkpoint Auto-Save (PrΓ©-CompactaΓ§Γ£o)
66
- Before ANY delegate dispatch, save a checkpoint:
67
- ```
68
- context_save(slug=slug, key="phase:N", content=JSON.stringify({
69
- "phase": {"current": N, "total": M, "name": "..."},
70
- "turn_count": N, "agent": "...", "summary": "..."
71
- }), session_id=SESSION_ID)
72
- ```
73
- **`content.phase` must be an OBJECT, not a bare number.** `{"phase": 1}` is rejected with
74
- `context_save: content.phase must be an object (got number)`. The server reads `current`
75
- and `total` (non-negative ints) and `name` (string, max 256 **bytes** β€” the guard
76
- measures `len(value.encode())`, so multi-byte characters count as more than one). That
77
- set is not closed: any other key inside `phase` is accepted and ignored, never an
78
- error. The `"phase:N"` slot KEY above is unrelated to `content.phase` and stays a plain
79
- string.
80
- All checkpoints auto-expire after 4h (TTL=14400).
81
-
82
- ### Gatilho de PrΓ©-CompactaΓ§Γ£o (Anti-perda de estado)
83
- Antes da compactaΓ§Γ£o nativa do OpenCode disparar (75-96% do context window),
84
- o Zeus DEVE salvar o estado atual:
85
- 1. Capture session_id do primeiro `context_save` da sessΓ£o
86
- 2. Salve heartbeat + phase atual + tarefas pendentes
87
- 3. SΓ³ entΓ£o permita que a compactaΓ§Γ£o prossiga
88
- ```
89
- # Ao iniciar sessΓ£o (session_id Γ© REQUIRED β€” use o id da sessΓ£o corrente):
90
- result = context_save(slug=slug, key="init", content=JSON.stringify(session_state), session_id=SESSION_ID)
91
- SESSION_ID = result.session_id # ← guarde para toda a sessΓ£o
92
-
93
- # Antes de CADA delegaΓ§Γ£o:
94
- context_save(slug=slug, key=f"pre:{agent}", content=JSON.stringify(current_state), session_id=SESSION_ID)
95
-
96
- # ApΓ³s retorno do agente:
97
- context_save(slug=slug, key=f"post:{agent}", content=JSON.stringify(result_state), session_id=SESSION_ID)
98
- ```
99
- Isso garante que o estado sobreviva Γ  compactaΓ§Γ£o β€” o "latest" pointer
100
- 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.
101
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.
102
56
 
103
57
  ### Context Retrieval
104
- Next-phase agents retrieve previous context via:
105
- ```
106
- context_get(slug=slug, session_id=SESSION_ID) # most recent checkpoint ("latest" is the default key)
107
- context_get(slug=slug, key="phase:3", session_id=SESSION_ID) # specific phase
108
- context_list(slug=slug, session_id=SESSION_ID) # all checkpoints
109
- ```
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.
110
59
 
111
60
  ### Long-Session Progress
112
- Every 5 turns during a long session, update STATUS.md with:
113
- - Current phase
114
- - Completed tasks
115
- - Pending tasks
116
- - 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,37 @@
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(query, namespace="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=question, 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
- 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]
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
- **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
26
+ ## Specialist Response Format
170
27
 
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
28
+ Require `## specialist_response` from `## Agent Return Format`: `position`, `reasoning`, `trade_offs`, `risks`, `confidence`, `agreement_signals`, and `specific_claims`.
177
29
 
178
- ### Step 7 β€” Zeus Synthesize
179
- Use structured `agreement_signals` to auto-detect agreements/divergences. Output synthesis template (see below).
30
+ ## Domain Map
180
31
 
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 |
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 Output Template (enhanced)
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
- - <what 2+ specialists agree on>
53
+ - Points shared by multiple specialists
228
54
 
229
55
  ### Divergences
230
- | Issue | Side A | Side B | Resolution |
231
- |-------|--------|--------|------------|
56
+ | Issue | Sides | Resolution |
232
57
 
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>
58
+ ### Evidence & Moderation (when used)
59
+ Research points, evidence, moderator verdict, cited sources, unresolved issues
238
60
 
239
61
  ### Recommendation
240
- <decisive conclusion>
62
+ Decisive conclusion
241
63
 
242
64
  ### Audit Gate
243
- **Status:** βœ… Themis approved | ⚠️ Issues corrected
65
+ Themis approved, or issues corrected
244
66
 
245
67
  ### Decision Gate
246
- **Confidence:** High/Medium/Low (adjusted for response rate)
68
+ Confidence adjusted for response rate
247
69
  ```
248
70
 
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
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.
@@ -0,0 +1,26 @@
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. Use
22
+ `key="council:<yyyy-mm-dd>:<slug>"`; JSON-stringify both `value` and
23
+ `metadata` for `memory_store(namespace="council_decisions", ...)`. Keep the
24
+ record concise: question, recommendation, specialists, confidence, unresolved
25
+ trade-off, and timestamp. Do not store routine subtask summaries or status
26
+ updates. Use the memory bank for ADRs only when explicitly requested.