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
package/AGENTS.md
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
1
|
+
<!-- pantheon:generated:begin — Pantheon-managed region; regenerated on install/upgrade, never edit inside -->
|
|
1
2
|
<!-- Generated by scripts/build-agents-md.mjs — do not edit directly. -->
|
|
2
|
-
<!-- Source of truth:
|
|
3
|
+
<!-- Source of truth: the static project sections in scripts/build-agents-md.mjs. -->
|
|
4
|
+
<!-- pantheon:agents-md v2 artifact=project generated-at=2026-10-14T15:44:12-03:00 sha=a305942 -->
|
|
3
5
|
|
|
4
|
-
# Pantheon
|
|
6
|
+
# Pantheon — Repository Setup
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
| Agent | Role |
|
|
11
|
-
|-------|------|
|
|
12
|
-
| @aphrodite | Frontend specialist — React 19, TypeScript strict, WCAG accessibility, responsive design, TDD, modern API patterns, deprecated npm detection. Calls apollo for discovery, sends to themis for review. |
|
|
13
|
-
| @apollo | Read-only investigation scout — 3–10 parallel searches across codebase, external docs, and GitHub. Called by: athena, zeus, hermes, aphrodite, demeter. No edits, no commands. |
|
|
14
|
-
| @athena | Strategic planner & architect — research-first, plan-only, never implements. Plans include quality gates (ruff/Biome, dep detection, LTS policy). Calls apollo for discovery. |
|
|
15
|
-
| @demeter | Database specialist — SQLAlchemy 2.0, Alembic, query optimization, N+1 prevention, TDD migrations, modern DB libs. Calls apollo for discovery, sends to themis. |
|
|
16
|
-
| @gaia | Remote sensing domain specialist — satellite image processing, spectral analysis, SAR, change detection, time series, ML/DL classification. Read-only analysis of geospatial data. |
|
|
17
|
-
| @hephaestus | AI tooling & pipelines specialist — LangChain/LangGraph chains, RAG architecture, vector stores, embedding strategies. Forges AI infrastructure. Calls apollo, sends to themis. |
|
|
18
|
-
| @hermes | Backend specialist — FastAPI, Python, async, TDD (RED→GREEN→REFACTOR), modern Python stdlib, obsolete lib detection. Calls apollo for discovery, sends to themis. |
|
|
19
|
-
| @iris | GitHub operations specialist — branches, pull requests, issues, releases, tags. Called by zeus after review. Never pushes or merges without explicit human approval. Integrates with VS Code GitHub Pull Requests extension. |
|
|
20
|
-
| @mnemosyne | Memory bank quality owner — initializes .pantheon/memory-bank/, writes ADRs and task records on explicit request. Called by zeus. Never invoked automatically after phases. |
|
|
21
|
-
| @nyx | Observability & monitoring specialist — OpenTelemetry tracing, token/cost tracking, agent performance analytics, LangSmith integration. Calls apollo for discovery, sends to themis. |
|
|
22
|
-
| @prometheus | Infrastructure + model provider specialist — Docker, CI/CD, multi-model routing, cost optimization, provider abstraction |
|
|
23
|
-
| @talos | Hotfix express lane — direct fixes for small bugs, CSS, typos, minor logic. No TDD ceremony, no orchestration overhead. Standalone, no subagents. Escalates complex issues to zeus. |
|
|
24
|
-
| @themis | Quality & security gate — ruff/Biome linting, dead/legacy code detection, OWASP Top 10, coverage >80%, correctness, deprecation audit. Called by implementers; escalates blockers to zeus. |
|
|
25
|
-
| @zeus | Central orchestrator — never implements. Delegates to: athena, apollo, hermes, aphrodite, demeter, prometheus, themis, iris, mnemosyne, talos, hephaestus, nyx |
|
|
8
|
+
Shared Pantheon rules (agent table, return format, memory protocol, YAGNI,
|
|
9
|
+
communication rules) live in the global `~/.config/opencode/AGENTS.md`; this
|
|
10
|
+
file carries only repository-specific setup so no rule is loaded twice.
|
|
26
11
|
|
|
27
12
|
## OpenCode Setup
|
|
28
13
|
|
|
@@ -43,875 +28,9 @@ Para validar a instalação global do pacote pantheon-opencode COMO UM USUÁRIO
|
|
|
43
28
|
|
|
44
29
|
## Conventions
|
|
45
30
|
|
|
46
|
-
- TDD:
|
|
47
|
-
-
|
|
31
|
+
- TDD: RED→GREEN→REFACTOR for testable behavior; use focused checks for micro-edits
|
|
32
|
+
- Honor repository coverage thresholds when relevant; preserve stronger auth/security/data-integrity gates
|
|
48
33
|
- Async/await on all I/O
|
|
49
34
|
- Type hints on all functions
|
|
50
35
|
- PRs always update the README — every pull request must document newly added features, behaviors, env vars, or commands in the README before being opened.
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
# Agent Instructions
|
|
55
|
-
|
|
56
|
-
The following sections are consolidated from `src/instructions/*.instructions.md`
|
|
57
|
-
so both OpenCode V1 (auto-loads AGENTS.md) and V2 (loads AGENTS.md, ignores the
|
|
58
|
-
`instructions` config key) receive identical instruction content.
|
|
59
|
-
|
|
60
|
-
<!-- Source: src/instructions/agent-return-format.instructions.md -->
|
|
61
|
-
## Agent Return Format
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# Agent Return Format
|
|
65
|
-
|
|
66
|
-
All implementation agents (Hermes, Aphrodite, Demeter, Hephaestus, Prometheus) MUST return results to Zeus in this format:
|
|
67
|
-
|
|
68
|
-
## subtask_summary
|
|
69
|
-
**files_changed:** [list of file paths, one per line]
|
|
70
|
-
**summary:** What was done, in 2-3 sentences
|
|
71
|
-
**tests:** ✅ All passing / ⚠️ X failing / ❌ Not run (reason)
|
|
72
|
-
**coverage:** X% (if applicable)
|
|
73
|
-
**tokens:** ~N input / ~M output (estimated)
|
|
74
|
-
**status:** complete | partial (reason) | escalated (reason)
|
|
75
|
-
**blockers:** [list any blockers or null]
|
|
76
|
-
|
|
77
|
-
For investigation agents (Apollo, Athena), return structured findings with:
|
|
78
|
-
- Key findings as bullet points
|
|
79
|
-
- File paths with line numbers
|
|
80
|
-
- Relevant code snippets (max 3 lines each)
|
|
81
|
-
|
|
82
|
-
## Council Specialist Response Format
|
|
83
|
-
|
|
84
|
-
When responding to a `/pantheon` council synthesis invocation, specialists MUST return this structured format:
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
## specialist_response
|
|
88
|
-
**position:** <clear one-sentence position answering the question>
|
|
89
|
-
**reasoning:** <2-4 sentences with logical chain>
|
|
90
|
-
**trade_offs:** <what's gained vs lost, specific>
|
|
91
|
-
**risks:** <what could go wrong, max 3 items>
|
|
92
|
-
**confidence:** High | Medium | Low
|
|
93
|
-
**agreement_signals:** agree:@agent1 on <issue>, agree:@agent2 on <issue> | disagree:@agent3 on <issue>
|
|
94
|
-
**specific_claims:** <count of specific factual claims in response>
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Field Rules
|
|
98
|
-
|
|
99
|
-
| Field | Required | Validation |
|
|
100
|
-
|-------|----------|------------|
|
|
101
|
-
| position | ✅ | Single sentence, must directly answer the question |
|
|
102
|
-
| reasoning | ✅ | 2-4 sentences with logical chain |
|
|
103
|
-
| trade_offs | ✅ | At least one gain and one loss, specific to context |
|
|
104
|
-
| risks | ✅ | Max 3 bullet points |
|
|
105
|
-
| confidence | ✅ | One of: High, Medium, Low |
|
|
106
|
-
| agreement_signals | Optional | Format: `agree:@agent on issue \| disagree:@agent on issue`. Use only when you can reference other specialists expected positions. |
|
|
107
|
-
| specific_claims | ✅ | Integer count of verifiable factual statements in the response |
|
|
108
|
-
|
|
109
|
-
### Confidence Guidelines
|
|
110
|
-
|
|
111
|
-
- **High**: Position backed by 3+ specific claims with evidence or direct experience
|
|
112
|
-
- **Medium**: Position backed by 1-2 specific claims
|
|
113
|
-
- **Low**: Position is opinion-based or speculative
|
|
114
|
-
|
|
115
|
-
### Example
|
|
116
|
-
```
|
|
117
|
-
## specialist_response
|
|
118
|
-
**position:** The BackgroundJobBoard should be used for council crash recovery
|
|
119
|
-
**reasoning:** The board already supports running→completed→reconciled state machine with persistence. Registering council dispatches there adds ~50ms overhead but prevents total session loss on context crash. The WAL pattern ensures no data loss on restart.
|
|
120
|
-
**trade_offs:** Gain: crash recovery for multi-minute council sessions. Lose: ~50ms registration overhead per council.
|
|
121
|
-
**risks:** Board persistence failure could block council start — implement with fire-and-forget error handling
|
|
122
|
-
**confidence:** High
|
|
123
|
-
**agreement_signals:** agree:@themis on persist-before-notify
|
|
124
|
-
**specific_claims:** 3
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Memory Context
|
|
128
|
-
If this agent used `memory_recall` or `memory_search`, include the relevant memory entries
|
|
129
|
-
used as context for the response.
|
|
130
|
-
|
|
131
|
-
<!-- Source: src/instructions/backend-standards.instructions.md -->
|
|
132
|
-
## Backend Development Standards
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
# Backend Development Standards (Hermes)
|
|
136
|
-
|
|
137
|
-
## Async/Await
|
|
138
|
-
- Use async/await for ALL I/O operations (database, external APIs, file operations)
|
|
139
|
-
- Never block on async operations
|
|
140
|
-
- Use `asyncio.gather()` for parallel operations
|
|
141
|
-
|
|
142
|
-
## Test-Driven Development
|
|
143
|
-
- RED: Write a failing test
|
|
144
|
-
- GREEN: Write minimal code to pass
|
|
145
|
-
- REFACTOR: Improve without breaking tests
|
|
146
|
-
|
|
147
|
-
## Type Safety
|
|
148
|
-
- Type hints on all function parameters
|
|
149
|
-
- Type hints on all return types
|
|
150
|
-
- Use Pydantic for request/response validation
|
|
151
|
-
|
|
152
|
-
## Code Organization
|
|
153
|
-
- Maximum 300 lines per file
|
|
154
|
-
- Separate: routes → services → models
|
|
155
|
-
- Docstrings on public functions (Google format)
|
|
156
|
-
|
|
157
|
-
## Error Handling
|
|
158
|
-
- Never silent failures (catch and log)
|
|
159
|
-
- Use appropriate HTTP status codes
|
|
160
|
-
- Return friendly error messages (no stack traces)
|
|
161
|
-
- Implement retry logic with exponential backoff
|
|
162
|
-
|
|
163
|
-
## Performance
|
|
164
|
-
- Avoid N+1 queries (use eager loading/joins)
|
|
165
|
-
- Implement pagination for list endpoints
|
|
166
|
-
- Cache frequently accessed data
|
|
167
|
-
- Monitor for async deadlocks
|
|
168
|
-
|
|
169
|
-
## Security
|
|
170
|
-
- Input validation on all endpoints
|
|
171
|
-
- CSRF protection
|
|
172
|
-
- Rate limiting for sensitive endpoints
|
|
173
|
-
- Sanitize logs (never log passwords/tokens)
|
|
174
|
-
|
|
175
|
-
<!-- Source: src/instructions/frontend-standards.instructions.md -->
|
|
176
|
-
## Frontend Development Standards
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
# Frontend Development Standards (Aphrodite)
|
|
180
|
-
|
|
181
|
-
## TypeScript
|
|
182
|
-
- Strict mode always (no `any` types)
|
|
183
|
-
- Props interfaces on all components
|
|
184
|
-
- Return type annotations on all functions
|
|
185
|
-
|
|
186
|
-
## Components
|
|
187
|
-
- Single Responsibility Principle
|
|
188
|
-
- Reusable and composable
|
|
189
|
-
- Max 300 lines per component
|
|
190
|
-
- Atomic Design pattern
|
|
191
|
-
|
|
192
|
-
## Accessibility
|
|
193
|
-
- ARIA labels on interactive elements
|
|
194
|
-
- Keyboard navigation support
|
|
195
|
-
- Color contrast WCAG AA
|
|
196
|
-
- Semantic HTML
|
|
197
|
-
|
|
198
|
-
## Responsive Design
|
|
199
|
-
- Mobile-first approach
|
|
200
|
-
- Breakpoints: 640px, 768px, 1024px, 1280px
|
|
201
|
-
- Test on multiple devices
|
|
202
|
-
|
|
203
|
-
## State Management
|
|
204
|
-
- Hooks (useState, useContext, useReducer)
|
|
205
|
-
- Centralized state for app-wide data
|
|
206
|
-
- Local state for component-specific needs
|
|
207
|
-
|
|
208
|
-
## Testing
|
|
209
|
-
- React Testing Library (no snapshot testing)
|
|
210
|
-
- Test behavior not implementation
|
|
211
|
-
- >80% coverage requirement
|
|
212
|
-
- Test user workflows
|
|
213
|
-
|
|
214
|
-
## Styling
|
|
215
|
-
- Tailwind CSS + custom CSS when needed
|
|
216
|
-
- Design tokens for colors/spacing
|
|
217
|
-
- Responsive classes
|
|
218
|
-
- No inline styles
|
|
219
|
-
|
|
220
|
-
<!-- Source: src/instructions/memory-protocol.instructions.md -->
|
|
221
|
-
## Memory Protocol
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
# 🧠 Memory Protocol — Universal Rules
|
|
225
|
-
|
|
226
|
-
These rules apply to ALL Pantheon agents. Agent-specific overrides are defined
|
|
227
|
-
in each agent's `## 🧠 Memory Protocol` section.
|
|
228
|
-
|
|
229
|
-
## Universal Rules
|
|
230
|
-
|
|
231
|
-
### 1. Pre-Work Read-Only Recall
|
|
232
|
-
**Call `memory_search()` at task start before any file reads.**
|
|
233
|
-
- Use domain-specific context matching your agent's focus area
|
|
234
|
-
- Single call per task, not per turn
|
|
235
|
-
- Agents have **read-only** memory access — only `memory_search()` is available
|
|
236
|
-
|
|
237
|
-
### 2. Auto-Store by Zeus on Subtask Summary
|
|
238
|
-
**`memory_store()` is called AUTOMATICALLY by Zeus when you return a subtask_summary.**
|
|
239
|
-
- Include a clear `summary` field in your return — no explicit `memory_store()` call needed
|
|
240
|
-
- This is the **ONLY** persistence path: agent → subtask_summary → Zeus → memory_store
|
|
241
|
-
- Zeus persists ALL agent returns (implementers and read-only agents alike)
|
|
242
|
-
|
|
243
|
-
### 3. Write-Ahead Log (WAL)
|
|
244
|
-
Before Zeus calls `memory_store()`, it writes a write-ahead log to:
|
|
245
|
-
```
|
|
246
|
-
.pantheon/memory-wal/<agent>/<timestamp>.json
|
|
247
|
-
```
|
|
248
|
-
- WAL format: `{ agent, phase, summary, files_changed, status, timestamp }`
|
|
249
|
-
- WAL is written **before** the store operation — if store crashes, WAL is recovered on next session start
|
|
250
|
-
- WAL files are ephemeral (auto-cleaned after 7 days)
|
|
251
|
-
|
|
252
|
-
### 4. Relevance Threshold
|
|
253
|
-
**Skip search results if relevance score < 0.3.**
|
|
254
|
-
- Prevents noise from unrelated past entries
|
|
255
|
-
- Applies to `memory_search()` results only
|
|
256
|
-
|
|
257
|
-
### 5. Permanent Documentation
|
|
258
|
-
**ADR-level decisions → delegate to `@mnemosyne`.**
|
|
259
|
-
- Use for: architecture decisions, significant trade-offs, pattern changes
|
|
260
|
-
- Not for: routine task summaries (handled by Auto-Store)
|
|
261
|
-
|
|
262
|
-
## Per-Agent Overrides
|
|
263
|
-
|
|
264
|
-
Each agent file defines overrides in its `## 🧠 Memory Protocol` section:
|
|
265
|
-
- Domain-specific `memory_search()` context string
|
|
266
|
-
- Read-only access via `memory_search()` only — no `memory_store` for subagents
|
|
267
|
-
- Agent-specific rules (session-end, sprint close, quick-index, etc.)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
## Delegation Cache
|
|
271
|
-
|
|
272
|
-
Para otimizar decisoes de delegacao e reduzir gasto de tokens:
|
|
273
|
-
|
|
274
|
-
1. **memory_search(task_prompt, top_k=2)** antes de aplicar a arvore de roteamento
|
|
275
|
-
2. Se score > 0.85 → reutiliza agente + background_mode do cache
|
|
276
|
-
3. Se score ≤ 0.85 → aplica regras estaticas e memory_store() com:
|
|
277
|
-
- key: deleg:<task_type>
|
|
278
|
-
- value: {agent, background, pattern}
|
|
279
|
-
- metadata: {type: "decision", score: N}
|
|
280
|
-
|
|
281
|
-
4. **kv_store("deleg:<pattern>", ...)** para padroes recorrentes de delegacao
|
|
282
|
-
5. **kv_get("deleg:<pattern>")** para reusar decisoes ja tomadas
|
|
283
|
-
|
|
284
|
-
Isso elimina ~300 tokens de reasoning por delegacao quando o cache acerta.
|
|
285
|
-
|
|
286
|
-
## Council Decisions Namespace
|
|
287
|
-
|
|
288
|
-
Council synthesis decisions are persisted in a dedicated `council_decisions` namespace for precedent fast-path retrieval:
|
|
289
|
-
|
|
290
|
-
### Write Path
|
|
291
|
-
After every `/pantheon` council synthesis completes, Zeus stores:
|
|
292
|
-
```
|
|
293
|
-
memory_store({
|
|
294
|
-
namespace: "council_decisions",
|
|
295
|
-
key: "council:<yyyy-mm-dd>:<slug>",
|
|
296
|
-
value: {
|
|
297
|
-
question: "original question",
|
|
298
|
-
specialists: ["@agent1", "@agent2"],
|
|
299
|
-
recommendation: "final recommendation",
|
|
300
|
-
confidence: "High|Medium|Low",
|
|
301
|
-
agreements: ["point1", "point2"],
|
|
302
|
-
divergences: [{"issue": "...", "resolution": "..."}],
|
|
303
|
-
response_rate: "X of Y",
|
|
304
|
-
themis_audit: "approved|issues",
|
|
305
|
-
precedent_used: false,
|
|
306
|
-
timestamp: "<ISO-8601>"
|
|
307
|
-
},
|
|
308
|
-
metadata: {
|
|
309
|
-
type: "council_decision",
|
|
310
|
-
specialist_count: N,
|
|
311
|
-
model_tier_used: "premium|default|fast"
|
|
312
|
-
}
|
|
313
|
-
})
|
|
314
|
-
```
|
|
315
|
-
`value` is JSON-serialized before storing (the MCP `memory_store.value` argument is a string).
|
|
316
|
-
|
|
317
|
-
### Read Path (Precedent Fast-Path)
|
|
318
|
-
Before dispatching a new council, Zeus runs:
|
|
319
|
-
```
|
|
320
|
-
memory_search(question, top_k=2, namespace="council_decisions")
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
Result interpretation:
|
|
324
|
-
| Score | Age | Action |
|
|
325
|
-
|-------|-----|--------|
|
|
326
|
-
| > 0.85 | < 30 days | Return precedent verbatim (note "⚠️ Decisão de [data] — reavaliar se contexto mudou") as fast-path answer. Skip council dispatch entirely. |
|
|
327
|
-
| > 0.85 | >= 30 days | Return with warning "Reavaliar se contexto mudou — decisão tem mais de 30 dias" + proceed with council |
|
|
328
|
-
| 0.5 - 0.85 | Any | Include as context for specialists but still dispatch council |
|
|
329
|
-
| < 0.5 | Any | Ignore, proceed with fresh council |
|
|
330
|
-
|
|
331
|
-
### TTL & Maintenance
|
|
332
|
-
- Council decisions are LONG-TERM (no TTL or TTL = 365 days)
|
|
333
|
-
- Stale decisions (age > 90 days) should be flagged but NOT deleted — they remain as historical record
|
|
334
|
-
- Purge only via explicit namespace cleanup when decisions are superseded by ADRs
|
|
335
|
-
|
|
336
|
-
### When NOT to Use
|
|
337
|
-
- Routine task summaries → use `default` namespace (auto-store by Zeus)
|
|
338
|
-
- Sprint/progress tracking → use `session` namespace
|
|
339
|
-
- ADR-level architecture decisions → delegate to @mnemosyne for permanent documentation
|
|
340
|
-
|
|
341
|
-
<!-- Source: src/instructions/yagni.instructions.md -->
|
|
342
|
-
## YAGNI Anti-overengineering
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
## YAGNI Principles
|
|
346
|
-
|
|
347
|
-
1. **Don't add abstractions before the third repetition** — Two similar pieces of code are a coincidence. Three are a pattern.
|
|
348
|
-
2. **Prefer duplication over the wrong abstraction** — A bad abstraction is worse than copy-paste.
|
|
349
|
-
3. **Solve today's problem, not tomorrow's** — You don't know what tomorrow looks like.
|
|
350
|
-
4. **If it's not tested, it doesn't exist** — Code without tests is not "done".
|
|
351
|
-
5. **The simplest working solution is the best** — Fancy patterns add cognitive load.
|
|
352
|
-
6. **Don't optimize prematurely** — Measure first, then optimize.
|
|
353
|
-
7. **Remove unused code immediately** — Dead code is debt.
|
|
354
|
-
8. **Prefer standard library over dependencies** — One less dependency = one less vulnerability.
|
|
355
|
-
9. **Avoid configuration systems until something needs to vary** — Hard-coded values are fine until you have at least 3 different values.
|
|
356
|
-
10. **Don't build for scale you don't have** — YAGNI applies to infrastructure too.
|
|
357
|
-
11. **Delete more than you add** — Every line of code is a liability.
|
|
358
|
-
12. **If you're not sure you need it, you don't need it** — Trust your gut.
|
|
359
|
-
|
|
360
|
-
When reviewing code, always ask: "Is this YAGNI? Could we solve this more simply?"
|
|
361
|
-
|
|
362
|
-
<!-- Source: src/instructions/zeus-anti-stall.instructions.md -->
|
|
363
|
-
## Zeus Anti-Stall
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
# 🛑 ANTI-STALL & STALL DETECTION
|
|
367
|
-
|
|
368
|
-
You MUST proactively detect and recover from stalled states. Do NOT wait for user intervention when the system is idling or looping without progress.
|
|
369
|
-
|
|
370
|
-
## Stall Detection Protocol
|
|
371
|
-
|
|
372
|
-
You MUST self-monitor for these stall conditions:
|
|
373
|
-
|
|
374
|
-
| Symptom | Detection Rule | Recovery Action |
|
|
375
|
-
|---------|---------------|-----------------|
|
|
376
|
-
| Silent loop | 3+ consecutive turns with no tool call AND no visible progress | Output `[STALL_DETECTED]` and re-read your task definition. If still stuck, escalate to user with: "I appear to be stuck on [task]. Options: (1) retry with different approach, (2) delegate to specialist, (3) simplify scope." |
|
|
377
|
-
| Delegation black hole | Agent dispatched but no response after 2x the timeout from routing.yml | Log the hang, cancel via `cancel_task`, then follow the fallback chain in `## ⏱️ Timeout & Retry Enforcement` |
|
|
378
|
-
| Circular delegation | Same specialist re-dispatched for same task 2+ times without progress | Break cycle: dispatch to different specialist OR escalate to user |
|
|
379
|
-
| Idle after completion | All background tasks completed but no synthesis/next step for 2+ turns | Force synthesis: summarize all completed results and propose next action |
|
|
380
|
-
| Context thrash | Re-reading same files repeatedly without new action | Stop re-reading. State: "Already have context on [file]. Proceeding with [action]." |
|
|
381
|
-
|
|
382
|
-
## Phase Reminder
|
|
383
|
-
|
|
384
|
-
After dispatching background specialists, you MUST:
|
|
385
|
-
1. DO NOT poll running jobs or consume their partial output
|
|
386
|
-
2. DO NOT advance dependent work until terminal results arrive
|
|
387
|
-
3. Continue orchestration ONLY on non-overlapping independent work
|
|
388
|
-
4. If nothing independent remains, briefly report what was launched and WAIT
|
|
389
|
-
|
|
390
|
-
Self-check every 3 turns: "Am I waiting on a delegate? Have I polled without need? Is there independent work I can do?"
|
|
391
|
-
|
|
392
|
-
## Delegate Retry Enhancement
|
|
393
|
-
|
|
394
|
-
When a delegation fails (timeout, empty response, error):
|
|
395
|
-
|
|
396
|
-
1. **FIRST:** Check if the error is a known pattern:
|
|
397
|
-
- "Agent not responding" → verify agent name matches routing.yml
|
|
398
|
-
- "Context exceeded" → reduce scope, split into smaller tasks
|
|
399
|
-
- "Permission denied" → verify agent has correct tools/permissions
|
|
400
|
-
|
|
401
|
-
2. **Retry ONCE** with rephrased prompt — add: "Previous attempt failed with: [error]. Adjusted approach: [what changed]."
|
|
402
|
-
|
|
403
|
-
3. **If retry also fails** → do NOT retry blindly; follow the fallback chain and escalation protocol in `## ⏱️ Timeout & Retry Enforcement`.
|
|
404
|
-
|
|
405
|
-
## Progress Checkpoint
|
|
406
|
-
|
|
407
|
-
On tasks expected to run > 5 turns:
|
|
408
|
-
- After turn 5: output `[CHECKPOINT] Completed so far: [summary]. Remaining: [list].`
|
|
409
|
-
- After turn 10: re-evaluate. If < 50% done, consider splitting or escalating.
|
|
410
|
-
- If 3 consecutive turns produce no tool calls: trigger Stall Detection Protocol (see above).
|
|
411
|
-
|
|
412
|
-
## Heartbeat & Checkpoint Integration
|
|
413
|
-
|
|
414
|
-
All session state lives in **pantheon-persistence** (namespace `checkpoint:<slug>`).
|
|
415
|
-
No file I/O, no checkpoint_session.py — TTL (4h) handles cleanup automatically.
|
|
416
|
-
|
|
417
|
-
### Heartbeat Check
|
|
418
|
-
- If `context_get(slug, "heartbeat")` returns a checkin older than 300s, log a stall warning and resume
|
|
419
|
-
- Write heartbeat after every anti-stall recovery action:
|
|
420
|
-
```
|
|
421
|
-
context_save(slug, "heartbeat", json({"status": "alive", "last_action": "...", "turn_count": N}))
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
### Checkpoint Auto-Save (Pré-Compactação)
|
|
425
|
-
Before ANY delegate dispatch, save a checkpoint:
|
|
426
|
-
```
|
|
427
|
-
context_save(slug, "phase:N", json({
|
|
428
|
-
"phase": N, "turn_count": N, "agent": "...", "summary": "..."
|
|
429
|
-
}), session_id=SESSION_ID)
|
|
430
|
-
```
|
|
431
|
-
All checkpoints auto-expire after 4h (TTL=14400).
|
|
432
|
-
|
|
433
|
-
### Gatilho de Pré-Compactação (Anti-perda de estado)
|
|
434
|
-
Antes da compactação nativa do OpenCode disparar (75-96% do context window),
|
|
435
|
-
o Zeus DEVE salvar o estado atual:
|
|
436
|
-
1. Capture session_id do primeiro `context_save` da sessão
|
|
437
|
-
2. Salve heartbeat + phase atual + tarefas pendentes
|
|
438
|
-
3. Só então permita que a compactação prossiga
|
|
439
|
-
```
|
|
440
|
-
# Ao iniciar sessão:
|
|
441
|
-
result = context_save(slug, "init", session_state)
|
|
442
|
-
SESSION_ID = result.session_id # ← guarde para toda a sessão
|
|
443
|
-
|
|
444
|
-
# Antes de CADA delegação:
|
|
445
|
-
context_save(slug, f"pre:{agent}", current_state, session_id=SESSION_ID)
|
|
446
|
-
|
|
447
|
-
# Após retorno do agente:
|
|
448
|
-
context_save(slug, f"post:{agent}", result_state, session_id=SESSION_ID)
|
|
449
|
-
```
|
|
450
|
-
Isso garante que o estado sobreviva à compactação — o "latest" pointer
|
|
451
|
-
sempre aponta para o checkpoint mais recente, mesmo após compactação.
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
### Context Retrieval
|
|
455
|
-
Next-phase agents retrieve previous context via:
|
|
456
|
-
```
|
|
457
|
-
context_get(slug, "latest") # most recent checkpoint
|
|
458
|
-
context_get(slug, "phase:3") # specific phase
|
|
459
|
-
context_list(slug) # all checkpoints
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
### Long-Session Progress
|
|
463
|
-
Every 5 turns during a long session, update STATUS.md with:
|
|
464
|
-
- Current phase
|
|
465
|
-
- Completed tasks
|
|
466
|
-
- Pending tasks
|
|
467
|
-
- Any blockers
|
|
468
|
-
|
|
469
|
-
<!-- Source: src/instructions/zeus-communication-rules.instructions.md -->
|
|
470
|
-
## Zeus Communication Rules
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
# 🗣️ COMMUNICATION RULES
|
|
474
|
-
|
|
475
|
-
These rules apply to Zeus and all agents in the system:
|
|
476
|
-
|
|
477
|
-
- **No Flattery**: Never start a response with compliments or affirmations ("Great question!", "Absolutely!", "Sure!"). Begin directly with the answer or action.
|
|
478
|
-
- **Honest Pushback**: If a request is technically unsound or will cause problems, say so clearly and explain why. Offer a better approach. Agreeing to avoid friction is worse than a useful correction.
|
|
479
|
-
- **Concise Execution**: Skip lengthy preambles. State what you're doing in one line, do it, report the outcome. Avoid verbose commentary around trivial steps.
|
|
480
|
-
- **No Padding**: Don't add filler sentences, summaries of what was just said, or redundant confirmations. Every sentence must carry information.
|
|
481
|
-
- **Uncertainty = Ask**: If requirements are ambiguous, ask one targeted question. Don't guess and implement the wrong thing.
|
|
482
|
-
|
|
483
|
-
<!-- Source: src/instructions/zeus-council-synthesis.instructions.md -->
|
|
484
|
-
## Zeus Council Synthesis
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
# 🏛️ INLINE COUNCIL SYNTHESIS — /pantheon
|
|
488
|
-
|
|
489
|
-
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.
|
|
490
|
-
|
|
491
|
-
## Trigger Patterns (detect ANY)
|
|
492
|
-
- Trade-off questions: "which is better?", "should we use X or Y?", "compare A and B"
|
|
493
|
-
- Architecture decisions with long-term impact
|
|
494
|
-
- Security/compliance choices
|
|
495
|
-
- Technology selection (databases, frameworks, providers, libraries)
|
|
496
|
-
- "Is this safe?", "trade-offs of...", "what are the risks?"
|
|
497
|
-
- Cost vs quality decisions
|
|
498
|
-
- Multi-stakeholder concerns (frontend + backend + infra)
|
|
499
|
-
|
|
500
|
-
```mermaid
|
|
501
|
-
---
|
|
502
|
-
config:
|
|
503
|
-
look: classic
|
|
504
|
-
theme: dark
|
|
505
|
-
---
|
|
506
|
-
sequenceDiagram
|
|
507
|
-
participant U as User
|
|
508
|
-
participant Z as Zeus
|
|
509
|
-
participant M as Memory (Precedent)
|
|
510
|
-
participant A as Apollo (Research)
|
|
511
|
-
participant B as BackgroundJobBoard
|
|
512
|
-
participant S1 as Specialist 1
|
|
513
|
-
participant S2 as Specialist 2
|
|
514
|
-
participant S3 as Specialist 3
|
|
515
|
-
participant W as Web Search
|
|
516
|
-
participant T as Themis (Audit + Moderator)
|
|
517
|
-
|
|
518
|
-
U->>Z: /pantheon [--research] question
|
|
519
|
-
Z->>M: memory_search(council_decisions)
|
|
520
|
-
alt Precedent found (score > 0.85)
|
|
521
|
-
M-->>Z: ⚠️ Cached decision
|
|
522
|
-
Z->>U: Fast-path precedent
|
|
523
|
-
else No precedent
|
|
524
|
-
opt --research flag
|
|
525
|
-
Z->>A: 30s pre-scan
|
|
526
|
-
A-->>Z: Context brief
|
|
527
|
-
end
|
|
528
|
-
Z->>B: registerLaunch({council session})
|
|
529
|
-
par Dispatch all specialists
|
|
530
|
-
Z->>S1: Domain query + shared context
|
|
531
|
-
Z->>S2: Domain query + shared context
|
|
532
|
-
Z->>S3: Domain query + shared context
|
|
533
|
-
end
|
|
534
|
-
par Collect responses
|
|
535
|
-
S1-->>Z: Structured response
|
|
536
|
-
S2-->>Z: Structured response
|
|
537
|
-
S3-->>Z: Structured response
|
|
538
|
-
end
|
|
539
|
-
Note over Z: Cross-validate confidence
|
|
540
|
-
alt Agreement rate < 50%
|
|
541
|
-
Z->>S1: Rebuttal round
|
|
542
|
-
Z->>S2: Rebuttal round
|
|
543
|
-
Z->>S3: Rebuttal round
|
|
544
|
-
S1-->>Z: Refined response
|
|
545
|
-
S2-->>Z: Refined response
|
|
546
|
-
S3-->>Z: Refined response
|
|
547
|
-
Note over Z: Ainda divergência?
|
|
548
|
-
alt Agreement rate STILL < 50%
|
|
549
|
-
Z->>W: browser_search() for each divergence point
|
|
550
|
-
W-->>Z: Evidence brief with sources
|
|
551
|
-
Z->>T: Dispatches as moderator
|
|
552
|
-
Note over T: Reviews evidence + specialist responses
|
|
553
|
-
T-->>Z: Moderator verdict
|
|
554
|
-
end
|
|
555
|
-
end
|
|
556
|
-
Z->>Z: Synthesize (with evidence if tie-broken)
|
|
557
|
-
Z->>T: Audit synthesis fidelity
|
|
558
|
-
T-->>Z: ✅ / ⚠️ Issues
|
|
559
|
-
Z->>M: Store decision
|
|
560
|
-
Z->>B: Mark reconciled
|
|
561
|
-
Z->>U: 🏛️ Council Synthesis
|
|
562
|
-
end
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
## Dispatch Sequence (9-Step Protocol)
|
|
566
|
-
|
|
567
|
-
### Step 0 — Precedent Fast-Path (Fase 1)
|
|
568
|
-
Run the precedent read path defined in `## Memory Protocol > Council Decisions Namespace` (`memory_search(query, top_k=2, namespace="council_decisions")`). If no precedent applies, proceed to Step 0b.
|
|
569
|
-
|
|
570
|
-
### Step 0b — Apollo Pre-Scan (Fase 2, --research flag)
|
|
571
|
-
If `/pantheon --research <question>`: dispatch @apollo with 30s timeout. Inject findings as `shared_context` into ALL specialist prompts. Skip if flag absent.
|
|
572
|
-
|
|
573
|
-
### Step 1 — Register on BackgroundJobBoard (Fase 1)
|
|
574
|
-
Before dispatching specialists:
|
|
575
|
-
```
|
|
576
|
-
board.registerLaunch({
|
|
577
|
-
taskID: "council:<uuid>",
|
|
578
|
-
parentSessionID: "<session-id>",
|
|
579
|
-
agent: "zeus",
|
|
580
|
-
description: "Council: <question>",
|
|
581
|
-
objective: "Synthesize specialist recommendations"
|
|
582
|
-
})
|
|
583
|
-
```
|
|
584
|
-
Enables crash recovery — if context is lost mid-synthesis, the board preserves session state.
|
|
585
|
-
|
|
586
|
-
### Step 2 — Select Specialists
|
|
587
|
-
Use domain-to-specialist mapping table (below). Max 3 specialists.
|
|
588
|
-
|
|
589
|
-
### Step 3 — Dispatch ALL task() calls in ONE message
|
|
590
|
-
Each specialist prompt MUST include:
|
|
591
|
-
- Structured output template (see Specialist Output Format below)
|
|
592
|
-
- `shared_context` if Apollo pre-scan was done
|
|
593
|
-
- Timeout per role: 120s for reviewers, 60s for explorers/implementers
|
|
594
|
-
|
|
595
|
-
### Step 4 — Collect Responses
|
|
596
|
-
Wait for all responses. Note TIMEOUT agents. Partial results OK only for read-only specialists (@apollo, @gaia).
|
|
597
|
-
|
|
598
|
-
### Step 5 — Confidence Cross-Validation (Fase 2)
|
|
599
|
-
For each specialist response, validate confidence claims:
|
|
600
|
-
|
|
601
|
-
| Reported | Minimum Required | Action |
|
|
602
|
-
|----------|-----------------|--------|
|
|
603
|
-
| High | ≥ 3 specific claims | If fewer → downgrade to Medium, annotate "(auto-downgraded from High: only N specific claims)" |
|
|
604
|
-
| Medium | ≥ 1 specific claim | Pass |
|
|
605
|
-
| Low | Any response | Pass |
|
|
606
|
-
|
|
607
|
-
"Specific claim" = statement with evidence, data point, or verifiable fact (not opinion).
|
|
608
|
-
|
|
609
|
-
### Step 6 — Divergence-Gated Rebuttal Round (Fase 2, conditional)
|
|
610
|
-
Calculate agreement rate = `min(agreements, divergences) / total_points` from structured `agreement_signals`. If < 50% agreement:
|
|
611
|
-
- Dispatch ONE rebuttal round: specialists see ALL other responses and refine their own
|
|
612
|
-
- Updated responses treated as final
|
|
613
|
-
- Hard cap: MAX 3 total rounds (initial + 2 rebuttals)
|
|
614
|
-
- Skip if any TIMEOUT occurred (can't rebuttal without all voices)
|
|
615
|
-
|
|
616
|
-
### Step 6b — Modo Desempate com Evidência (Fase 2, conditional)
|
|
617
|
-
|
|
618
|
-
If after Step 6 the agreement rate is STILL < 50% (rebuttal did not resolve divergence):
|
|
619
|
-
|
|
620
|
-
1. **Identify divergence points** — Parse all specialist responses (initial + rebuttal) and extract specific issues where positions differ
|
|
621
|
-
2. **Web research** — For EACH divergence point, Zeus calls `browser_search()` or `webfetch()` to find factual evidence:
|
|
622
|
-
- Benchmarks, documentation, GitHub issues, official sources
|
|
623
|
-
- At least 2 independent sources per point when possible
|
|
624
|
-
- Focus on factual data, not opinion
|
|
625
|
-
3. **Compile Evidence Brief** — Structure findings as:
|
|
626
|
-
```
|
|
627
|
-
## evidence_brief
|
|
628
|
-
**divergence_point_1:** <description>
|
|
629
|
-
**evidence_found:** <facts from web, max 3 sentences>
|
|
630
|
-
**sources:** [URL1, URL2]
|
|
631
|
-
|
|
632
|
-
**divergence_point_2:** ...
|
|
633
|
-
```
|
|
634
|
-
4. **Dispatch @themis as moderator** — Send ONE task with:
|
|
635
|
-
- All specialist responses (initial + rebuttal)
|
|
636
|
-
- The evidence brief
|
|
637
|
-
- 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."
|
|
638
|
-
5. **Themis returns moderator verdict** in this format:
|
|
639
|
-
```
|
|
640
|
-
## moderator_verdict
|
|
641
|
-
**divergence_points_analyzed:** <count>
|
|
642
|
-
**verdicts:**
|
|
643
|
-
- <point 1>: <decision> — evidence: <citation>
|
|
644
|
-
- <point 2>: <decision> — evidence: <citation>
|
|
645
|
-
**overall_direction:** <which approach is better supported by evidence>
|
|
646
|
-
**confidence:** High | Medium | Low
|
|
647
|
-
**unresolved:** <any points still unclear despite evidence>
|
|
648
|
-
```
|
|
649
|
-
6. **Zeus incorporates verdict** into synthesis (Step 7), showing which evidence supported which conclusion
|
|
650
|
-
|
|
651
|
-
**Rules:**
|
|
652
|
-
- Only triggers when agreement rate < 50% AFTER rebuttal round
|
|
653
|
-
- Skip if NO divergence points are web-researchable (purely subjective/opinion-based disagreements)
|
|
654
|
-
- Max 3 web searches per council (prevents runaway)
|
|
655
|
-
- If Themis confidence is Low or points remain unresolved, note this explicitly in synthesis
|
|
656
|
-
- Themis moderator role is SEPARATE from the Themis Audit Gate (Step 8) — they serve different functions
|
|
657
|
-
|
|
658
|
-
### Step 7 — Zeus Synthesize
|
|
659
|
-
Use structured `agreement_signals` to auto-detect agreements/divergences. Output synthesis template (see below).
|
|
660
|
-
|
|
661
|
-
### Step 8 — Themis Audit Gate (Fase 1)
|
|
662
|
-
Post-synthesis, dispatch @themis:
|
|
663
|
-
```
|
|
664
|
-
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.")
|
|
665
|
-
```
|
|
666
|
-
- If ✅ → proceed
|
|
667
|
-
- If issues → fix each issue before delivering to user
|
|
668
|
-
|
|
669
|
-
### Step 9 — Persist & Reconcile (Fase 1)
|
|
670
|
-
Persist the decision using the write path in `## Memory Protocol > Council Decisions Namespace`, then `board.markReconciled("<task-id>")`.
|
|
671
|
-
|
|
672
|
-
## Specialist Output Format (Fase 1 — machine-parseable structured fields)
|
|
673
|
-
|
|
674
|
-
Specialists MUST return the structured `## specialist_response` format (position, reasoning, trade_offs, risks, confidence, agreement_signals, specific_claims) defined in `## Agent Return Format > Council Specialist Response Format`.
|
|
675
|
-
|
|
676
|
-
## Domain-to-Specialist Mapping
|
|
677
|
-
|
|
678
|
-
| Domain | Specialists |
|
|
679
|
-
|--------|-------------|
|
|
680
|
-
| Architecture | hermes, demeter, themis, athena |
|
|
681
|
-
| Security | themis, hermes, prometheus, nyx |
|
|
682
|
-
| Database | demeter, hermes, prometheus |
|
|
683
|
-
| AI/RAG | hephaestus, nyx |
|
|
684
|
-
| Infrastructure | prometheus, hermes, themis |
|
|
685
|
-
| Frontend/UX | aphrodite, themis, hermes |
|
|
686
|
-
| Observability | nyx, hermes |
|
|
687
|
-
| General | athena, themis, hermes |
|
|
688
|
-
|
|
689
|
-
## Synthesis Output Template (enhanced)
|
|
690
|
-
|
|
691
|
-
```
|
|
692
|
-
## 🏛️ Council Synthesis
|
|
693
|
-
|
|
694
|
-
**Question:** <original question>
|
|
695
|
-
**Date:** <date>
|
|
696
|
-
**Response rate:** X of Y specialists responded
|
|
697
|
-
**Timed out:** @agent1, @agent2 (if any)
|
|
698
|
-
**Precedent used:** yes/no (which one, date)
|
|
699
|
-
**Research context:** <shared_context summary> (if --research)
|
|
700
|
-
|
|
701
|
-
### Specialist Perspectives
|
|
702
|
-
| Agent | Position | Trade-offs | Confidence |
|
|
703
|
-
|-------|----------|------------|------------|
|
|
704
|
-
| @agent1 | ... | ... | High/Med/Low |
|
|
705
|
-
|
|
706
|
-
### Agreements
|
|
707
|
-
- <what 2+ specialists agree on>
|
|
708
|
-
|
|
709
|
-
### Divergences
|
|
710
|
-
| Issue | Side A | Side B | Resolution |
|
|
711
|
-
|-------|--------|--------|------------|
|
|
712
|
-
|
|
713
|
-
### Evidence & Moderation (if tie-break activated)
|
|
714
|
-
**Divergence points researched:** <list>
|
|
715
|
-
**Evidence summary:** <key findings from web>
|
|
716
|
-
**Moderator verdict:** <Themis final determination>
|
|
717
|
-
**Sources:** <citations>
|
|
718
|
-
|
|
719
|
-
### Recommendation
|
|
720
|
-
<decisive conclusion>
|
|
721
|
-
|
|
722
|
-
### Audit Gate
|
|
723
|
-
**Status:** ✅ Themis approved | ⚠️ Issues corrected
|
|
724
|
-
|
|
725
|
-
### Decision Gate
|
|
726
|
-
**Confidence:** High/Medium/Low (adjusted for response rate)
|
|
727
|
-
```
|
|
728
|
-
|
|
729
|
-
## Themis Audit Gate Rules (Fase 1)
|
|
730
|
-
|
|
731
|
-
1. Every specialist mentioned in synthesis? → ✅
|
|
732
|
-
2. Divergences from raw responses preserved (not softened/hidden)? → ✅
|
|
733
|
-
3. No specialist attributed a position they didn't state? → ✅
|
|
734
|
-
4. Confidence claims match response specificity? → ✅
|
|
735
|
-
5. If any ❌, list specific issues for Zeus to fix before delivery
|
|
736
|
-
|
|
737
|
-
## Rebuttal Round Rules (Fase 2)
|
|
738
|
-
|
|
739
|
-
1. Only triggers when agreement rate < 50%
|
|
740
|
-
2. MAX 3 rounds total (including initial dispatch)
|
|
741
|
-
3. Skip if any TIMEOUT (can't rebuttal without all voices)
|
|
742
|
-
4. Each rebuttal round: specialist sees ALL other responses + current synthesis draft
|
|
743
|
-
5. Refined responses replace originals for the final synthesis
|
|
744
|
-
6. If agreement rate STILL < 50% after rebuttal → Step 6b (Modo Desempate com Evidência)
|
|
745
|
-
|
|
746
|
-
## Crash Recovery via BackgroundJobBoard (Fase 1)
|
|
747
|
-
|
|
748
|
-
If Zeus context crashes mid-council:
|
|
749
|
-
1. On restart, `board.recoverRunningJobs()` marks running jobs as error
|
|
750
|
-
2. Check `board.formatForPrompt()` for unreconciled terminal jobs
|
|
751
|
-
3. Re-dispatch council with same question, noting: "⚠️ Retry — previous council session crashed. Using same question."
|
|
752
|
-
|
|
753
|
-
## Performance Budget
|
|
754
|
-
|
|
755
|
-
| Step | Latency | Phase |
|
|
756
|
-
|------|---------|-------|
|
|
757
|
-
| Precedent fast-path | < 500ms | Fase 1 |
|
|
758
|
-
| Apollo pre-scan | +30s (optional, --research) | Fase 2 |
|
|
759
|
-
| Specialist dispatch | bounded by slowest (60-120s) | — |
|
|
760
|
-
| Rebuttal round | +60s (conditional, < 50% agreement) | Fase 2 |
|
|
761
|
-
| Web search (tie-break) | +15s (conditional, < 50% after rebuttal) | Fase 2 |
|
|
762
|
-
| Themis moderator | +15s (conditional, tie-break activated) | Fase 2 |
|
|
763
|
-
| Themis audit | +15s | Fase 1 |
|
|
764
|
-
| **Total worst case** (research + rebuttal + tie-break) | ~255s | — |
|
|
765
|
-
| **Total typical** (no research, no rebuttal, no tie-break) | ~45-90s | — |
|
|
766
|
-
|
|
767
|
-
> **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.
|
|
768
|
-
|
|
769
|
-
## Modo Desempate Rules (Fase 2)
|
|
770
|
-
|
|
771
|
-
1. Only triggers when agreement rate < 50% AFTER rebuttal round
|
|
772
|
-
2. If no divergence points are web-researchable (pure opinion disagreement), skip — Zeus synthesizes with lower confidence
|
|
773
|
-
3. Max 3 web searches per council invocation
|
|
774
|
-
4. Themis moderator role is DISTINCT from Themis audit gate:
|
|
775
|
-
- Moderator: resolves substantive disagreement between specialists (reads evidence, gives verdict)
|
|
776
|
-
- Audit gate: checks synthesis fidelity against raw responses (quality assurance)
|
|
777
|
-
Both run in the same council invocation, at different steps
|
|
778
|
-
5. If Themis moderator confidence is Low, mark as "unresolved tie" in the synthesis output
|
|
779
|
-
6. Evidence from web search must be cited with source URL or document reference — no anonymous claims
|
|
780
|
-
|
|
781
|
-
<!-- Source: src/instructions/zeus-timeout-retry.instructions.md -->
|
|
782
|
-
## Zeus Timeout & Retry
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
# ⏱️ TIMEOUT & RETRY ENFORCEMENT
|
|
786
|
-
|
|
787
|
-
When a delegated agent does not respond in time, enforce the timeout policy from `routing.yml`.
|
|
788
|
-
|
|
789
|
-
## Timeout Behavior by Agent Role
|
|
790
|
-
|
|
791
|
-
| Agent Role | Timeout | Retry Policy | Fallback Chain | Partial Results OK? | Reasoning Effort |
|
|
792
|
-
|------------|---------|-------------|----------|---------------------|------------------|
|
|
793
|
-
| Explorer (@apollo) | 60s | 2 retries, exp backoff | @athena (plan) → @hermes (impl) | ✅ Yes | low |
|
|
794
|
-
| Implementer (@hermes, @aphrodite, @demeter) | 180s | 3 retries, exp backoff | @talos (hotfix) → @athena (replan) | ❌ No | medium |
|
|
795
|
-
| Reviewer (@themis) | 120s | 3 retries, exp backoff | @zeus (escalate) → user | ❌ No | high |
|
|
796
|
-
| Infrastructure (@prometheus) | 300s | 3 retries, exp backoff | @hermes (config) → @zeus (escalate) | ❌ No | medium |
|
|
797
|
-
| Hotfix (@talos) | 30s | 2 retries, no backoff | @hermes (full fix) | ✅ Yes | low |
|
|
798
|
-
| Remote Sensing (@gaia) | 120s | 2 retries, exp backoff | @hermes (generic) | ✅ Yes | high |
|
|
799
|
-
|
|
800
|
-
## Retry Flow
|
|
801
|
-
|
|
802
|
-
```
|
|
803
|
-
Task dispatch → timeout elapsed → log timeout
|
|
804
|
-
├─ retry_count > 0 → retry with exponential backoff → decrement retry_count
|
|
805
|
-
│ └─ still failing? → retry again (up to retry_count limit)
|
|
806
|
-
│
|
|
807
|
-
├─ retries exhausted → FALLBACK CHAIN:
|
|
808
|
-
│ ├─ fallback[0] exists? → dispatch to fallback agent
|
|
809
|
-
│ │ └─ keep original task spec + context; add error context
|
|
810
|
-
│ ├─ fallback[1] exists? → dispatch to second fallback
|
|
811
|
-
│ └─ all fallbacks failed? → ESCALATE
|
|
812
|
-
│
|
|
813
|
-
├─ no fallbacks defined → return TIMEOUT error to user
|
|
814
|
-
│
|
|
815
|
-
└─ ESCALATE: "Agent X failed after N retries. Fallbacks Y, Z also failed.
|
|
816
|
-
Options: (a) try different agent, (b) simplify scope, (c) manual"
|
|
817
|
-
```
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
## Fallback Chain Definitions
|
|
822
|
-
|
|
823
|
-
Each fallback chain is evaluated left-to-right: if the first fallback fails, try the second, etc.
|
|
824
|
-
|
|
825
|
-
| Agent | Fallback[0] | Fallback[1] | Escalate To |
|
|
826
|
-
|-------|------------|------------|-------------|
|
|
827
|
-
| @apollo | @athena (plan scoped task) | @hermes (implement search) | @zeus |
|
|
828
|
-
| @hermes | @talos (minimal fix) | @athena (replan + simplify) | @zeus |
|
|
829
|
-
| @aphrodite | @talos (CSS/UX fix) | @hermes (generic fallback) | @zeus |
|
|
830
|
-
| @demeter | @hermes (generic backend) | @athena (replan schema) | @zeus |
|
|
831
|
-
| @themis | @zeus (direct escalation) | — | user |
|
|
832
|
-
| @prometheus | @hermes (config/deploy) | @zeus | user |
|
|
833
|
-
| @talos | @hermes (full implementation) | — | @zeus |
|
|
834
|
-
| @hephaestus | @nyx (observability debug) | @hermes (generic) | @zeus |
|
|
835
|
-
| @nyx | @hermes (generic) | — | @zeus |
|
|
836
|
-
| @iris | @zeus (manual override) | — | user |
|
|
837
|
-
| @mnemosyne | @zeus (manual) | — | user |
|
|
838
|
-
|
|
839
|
-
### Escalation Protocol
|
|
840
|
-
When ALL fallbacks fail:
|
|
841
|
-
1. Log the full failure chain: which agents were tried, what error each returned
|
|
842
|
-
2. Report to user: "Task [X] failed. Tried: [agent list]. Error: [summary]."
|
|
843
|
-
3. Offer options: (a) try different approach, (b) simplify scope, (c) manual fix
|
|
844
|
-
4. NEVER retry the same chain automatically — break the cycle
|
|
845
|
-
|
|
846
|
-
### Session Reuse Check
|
|
847
|
-
Before dispatching a task, check if a reusable session exists:
|
|
848
|
-
|
|
849
|
-
```
|
|
850
|
-
@hermes — continuing from previous session.
|
|
851
|
-
Files already explored: backend/routers/auth.py, backend/services/auth_service.py.
|
|
852
|
-
New task: add refresh token rotation.
|
|
853
|
-
```
|
|
854
|
-
|
|
855
|
-
Use `session_max` from routing.yml to determine how many sessions to keep per agent.
|
|
856
|
-
|
|
857
|
-
---
|
|
858
|
-
|
|
859
|
-
# 📦 SUBTASK DISPATCH (Lightweight Delegation)
|
|
860
|
-
|
|
861
|
-
Subtask is a bounded, low-risk delegation mode that **skips** the standard artifact lifecycle. Use it for focused work that doesn't need Themis review.
|
|
862
|
-
|
|
863
|
-
## When to Use Subtask vs Full Task
|
|
864
|
-
|
|
865
|
-
> **REGRA DE OURO:** Quando em dúvida, use full task. Subtask é para o que você tem 100% de certeza que é seguro pular revisão.
|
|
866
|
-
|
|
867
|
-
### Subtask Decision Tree (run BEFORE every delegation)
|
|
868
|
-
|
|
869
|
-
```
|
|
870
|
-
□ Scope: ≤2 files AND ≤10 lines changed? [YES→continue | NO→full task]
|
|
871
|
-
□ Risk: No schema change, no security impact? [YES→continue | NO→full task]
|
|
872
|
-
□ Auth: No authentication/authorization logic? [YES→continue | NO→full task]
|
|
873
|
-
□ Data: No data loss risk, no migration? [YES→continue | NO→full task]
|
|
874
|
-
□ Review: Output does NOT feed into Themis review? [YES→continue | NO→full task]
|
|
875
|
-
|
|
876
|
-
ALL YES → subtask (skip artifact + Themis)
|
|
877
|
-
ANY NO → full task (IMPL artifact + Themis review mandatory)
|
|
878
|
-
```
|
|
879
|
-
|
|
880
|
-
### Comparison Table
|
|
881
|
-
|
|
882
|
-
| Aspect | Subtask | Full Task |
|
|
883
|
-
|--------|---------|-----------|
|
|
884
|
-
| Scope | Single file, <10 lines, read-only | Feature, multi-file, schema change |
|
|
885
|
-
| Risk | Low (no security/data implications) | Any risk level |
|
|
886
|
-
| Artifact | ❌ No IMPL artifact | ✅ IMPL artifact required |
|
|
887
|
-
| Themis review | ❌ None | ✅ Mandatory |
|
|
888
|
-
| Use case | Apollo discovery, Talos hotfix, bounded fix | Feature implementation, migration, API change |
|
|
889
|
-
|
|
890
|
-
### Concrete Examples
|
|
891
|
-
|
|
892
|
-
| Task | Scope | Risk | Subtask? | Why |
|
|
893
|
-
|------|-------|------|----------|-----|
|
|
894
|
-
| Fix typo in CSS class | 1 file, 1 line | None | ✅ | Bounded, no security impact |
|
|
895
|
-
| Add error handling to existing endpoint | 1 file, 5 lines | Low | ✅ | No schema change |
|
|
896
|
-
| Implement login endpoint | 2+ files, 50+ lines | High (auth) | ❌ | Security-critical, needs Themis |
|
|
897
|
-
| Database migration | 1 file, 15 lines | High (data) | ❌ | Data loss risk, needs rollback |
|
|
898
|
-
| Apollo codebase search | 0 files | None | ✅ | Read-only investigation |
|
|
899
|
-
| Update README | 1 file, 3 lines | None | ✅ | Documentation only |
|
|
900
|
-
|
|
901
|
-
### Safety Rules
|
|
902
|
-
1. **Bounded scope** — single file or read-only investigation
|
|
903
|
-
2. **Low risk** — no security implications, no data loss, no breaking changes
|
|
904
|
-
3. **No Themis dependency** — output doesn't feed into a phase that requires review
|
|
905
|
-
|
|
906
|
-
## Subtask Return Format
|
|
907
|
-
Return the standard `## subtask_summary` defined in `## Agent Return Format` (files_changed, summary, tests, coverage, tokens, status, blockers).
|
|
908
|
-
|
|
909
|
-
## Timeout Parcial (Partial Results)
|
|
910
|
-
|
|
911
|
-
Only agents marked ✅ in the Timeout Behavior table above may return partial results: @apollo (partial file list, e.g. "found 7 of 12 files before timeout"), @gaia (partial literature findings) and @talos (confirm progress if a hotfix times out). Never for implementers or reviewers — they must complete or fail. When dispatching with partial-OK, set the expectation: `@apollo Search for auth files. Timeout parcial OK — return whatever you have.`
|
|
912
|
-
|
|
913
|
-
---
|
|
914
|
-
|
|
915
|
-
# 📊 TIMEOUT TRACKING
|
|
916
|
-
|
|
917
|
-
Track in-flight delegations against the Timeout Behavior table above. Log timeouts to `/memories/session/timeout-log.md` for later analysis.
|
|
36
|
+
<!-- pantheon:generated:end — user content outside this region is preserved verbatim -->
|