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

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 (58) hide show
  1. package/AGENTS.md +27 -820
  2. package/CHANGELOG.md +116 -0
  3. package/README.md +132 -39
  4. package/README.pt-BR.md +47 -23
  5. package/package.json +6 -1
  6. package/plugin.json +1 -1
  7. package/pyproject.toml +3 -1
  8. package/scripts/build-agents-md.mjs +162 -28
  9. package/scripts/doctor.mjs +104 -22
  10. package/scripts/install/agents-md.mjs +2 -2
  11. package/scripts/install/config-migration.mjs +154 -7
  12. package/scripts/install/opencode.mjs +202 -40
  13. package/scripts/install/shared.mjs +115 -7
  14. package/scripts/install/strings.mjs +8 -0
  15. package/scripts/probe-pantheon-cost.mjs +16 -3
  16. package/scripts/sync-artifacts.mjs +2 -2
  17. package/scripts/test-opencode-v2-sandbox.sh +820 -86
  18. package/skills-lock.json +6 -5
  19. package/src/agents/aphrodite.md +17 -28
  20. package/src/agents/demeter.md +8 -18
  21. package/src/agents/hephaestus.md +10 -11
  22. package/src/agents/hermes.md +15 -30
  23. package/src/agents/prometheus.md +16 -10
  24. package/src/agents/talos.md +4 -1
  25. package/src/agents/themis.md +4 -3
  26. package/src/agents/zeus.md +16 -280
  27. package/src/instructions/agent-return-format.instructions.md +4 -50
  28. package/src/instructions/backend-standards.instructions.md +2 -0
  29. package/src/instructions/frontend-standards.instructions.md +3 -1
  30. package/src/instructions/memory-protocol.instructions.md +12 -121
  31. package/src/instructions/zeus-anti-stall.instructions.md +8 -111
  32. package/src/instructions/zeus-communication-rules.instructions.md +0 -1
  33. package/src/instructions/zeus-memory-operations.instructions.md +26 -0
  34. package/src/instructions/zeus-timeout-retry.instructions.md +9 -130
  35. package/src/pantheon/secret-scanner.ts +489 -0
  36. package/src/pantheon/v2-delegation-enforce.ts +86 -0
  37. package/src/pantheon/v2-execute-after.ts +186 -0
  38. package/src/pantheon/v2-unsupported.mjs +0 -23
  39. package/src/plugin-v2.ts +254 -102
  40. package/src/plugins/pantheon-hooks.ts +82 -35
  41. package/src/plugins/tui/README.md +14 -0
  42. package/src/plugins/tui/dist/tui.d.ts +11 -8
  43. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  44. package/src/plugins/tui/dist/tui.js +102 -62
  45. package/src/plugins/tui/package-lock.json +30 -33
  46. package/src/plugins/tui/package.json +5 -1
  47. package/src/plugins/tui/src/index.tsx +163 -107
  48. package/src/plugins/tui/tsdown.config.ts +17 -0
  49. package/src/routing.yml +12 -9
  50. package/src/skills/README.md +9 -4
  51. package/src/skills/agent-coordination/SKILL.md +13 -83
  52. package/src/skills/artifact-management/SKILL.md +12 -5
  53. package/src/skills/auto-continue/SKILL.md +37 -27
  54. package/src/skills/code-review-checklist/SKILL.md +5 -5
  55. package/src/skills/council-synthesis/SKILL.md +29 -0
  56. package/src/skills/tdd-with-agents/SKILL.md +18 -10
  57. package/scripts/hooks/scan-secrets.sh +0 -97
  58. package/src/instructions/zeus-council-synthesis.instructions.md +0 -299
@@ -18,16 +18,16 @@ Disciplined automatic continuation through multi-step tasks. Eliminates unnecess
18
18
 
19
19
  ---
20
20
 
21
- ## Mandatory Gates (ALWAYS STOP)
21
+ ## Risk-Proportional Gates
22
22
 
23
23
  | Gate | Trigger | What happens |
24
24
  |---|---|---|
25
- | **GATE 0 β€” Agora Gate** | Agora outputs `AWAITING_APPROVAL` OR `## πŸ›οΈ Agora Council` synthesis block appears | **HARD STOP.** Do not call any tool, do not continue any todo, do not suggest next steps. Wait for user to type: APPROVE / REQUEST CHANGES / DISCARD. "ok", "yes", "sure", "continue" are NOT valid. |
26
- | **GATE 1 β€” Plan Approval** | Athena generates a plan | User confirms scope before code is written |
27
- | **GATE 2 β€” Phase Review** | Themis reviews implementation | User sees changes before next phase |
28
- | **GATE 3 β€” Git Commit** | After each phase is approved | User controls git history; no auto-commit |
25
+ | **GATE 0 β€” Explicit Council** | User explicitly invokes council and it returns `AWAITING_APPROVAL` | Stop and follow the approval the council requests; do not launch a council automatically for ordinary implementation. |
26
+ | **GATE 1 β€” Plan Approval** | A plan was requested or scope/risk makes planning necessary | Ask before implementation only when the plan introduces a material choice or risk; omit this gate for a bounded, clear fix. |
27
+ | **GATE 2 β€” Risk Review** | Auth/security, data/schema/migration, API contract, production configuration, or other material risk | Themis review and human approval before sensitive or irreversible action. For a trivial, isolated, reversible edit, provide a concise result instead of manufacturing a review phase. |
28
+ | **GATE 3 β€” Git / External Action** | Commit, push, merge, production deploy, destructive operation, global configuration, or broad permission change | Always stop for explicit human approval. Full-auto never authorizes these actions by implication. |
29
29
 
30
- > **Agora is always GATE 0**: any response containing `AWAITING_APPROVAL` or a `## πŸ›οΈ Agora Council` block overrides all auto-continue rules.
30
+ An explicit `AWAITING_APPROVAL` from an invoked council remains a hard stop. Authentication/security and data/schema changes retain their review and approval gates even in full-auto.
31
31
 
32
32
  ---
33
33
 
@@ -36,7 +36,7 @@ Disciplined automatic continuation through multi-step tasks. Eliminates unnecess
36
36
  **Continue automatically when:**
37
37
  - Next todo is a direct consequence of the current one
38
38
  - Action is reversible (file edits, tests, linting)
39
- - Scope is within the approved plan
39
+ - Scope is within the user's explicitly authorized task (a prior plan is not required for a small clear fix)
40
40
  - No new ambiguity has emerged
41
41
 
42
42
  **Stop and ask when:**
@@ -44,6 +44,11 @@ Disciplined automatic continuation through multi-step tasks. Eliminates unnecess
44
44
  - An unexpected error changes the approach
45
45
  - A dependency is missing or broken
46
46
  - Remaining context is too thin to carry the task through β€” write an explicit handoff instead
47
+ - The task reaches a sensitive gate in the table above; full-auto does not override it
48
+
49
+ ### Full-auto Authorization
50
+
51
+ Full-auto may continue only within a task and scope the user explicitly authorized. It may run reversible edits and proportionate verification; it must stop for auth/security, data/schema changes with risk, destructive or global changes, broad permissions, deploy, push, or merge. Never infer permission to expand the scope from a full-auto request.
47
52
 
48
53
  ---
49
54
 
@@ -52,12 +57,12 @@ Disciplined automatic continuation through multi-step tasks. Eliminates unnecess
52
57
  ## Implementation Pattern
53
58
 
54
59
  ```
55
- 1. Create todos for all steps at start
60
+ 1. Create todos only for multi-step work; a one-step fix needs no todo ceremony
56
61
  2. Mark first todo in_progress
57
62
  3. Complete work β†’ mark completed immediately
58
63
  4. Mark next todo in_progress β†’ repeat
59
64
  5. Do NOT ask "should I continue?" between clear steps
60
- 6. Stop at Gate 1, 2, or 3
65
+ 6. Stop at any applicable risk gate; do not require a plan/review gate for a low-risk edit
61
66
  7. After gate approval, resume with next todo
62
67
  ```
63
68
 
@@ -89,9 +94,9 @@ Phase N complete. Summary:
89
94
 
90
95
  ### Cooldown Rules
91
96
  1. **Between parallel waves (no dependency):** No cooldown needed β€” wave results are independent
92
- 2. **Between sequential waves (with dependency):** Always run cooldown β€” dependencies may have changed context
93
- 3. **After Themis review (GATE 2):** Cooldown is mandatory β€” review findings may change the plan
94
- 4. **Session reuse check:** Before starting next phase, check if a specialist session from a previous phase can be reused (see session-goal skill)
97
+ 2. **Between sequential phases:** Summarize when dependencies or risk changed; skip ceremony for one-step work
98
+ 3. **After required Themis review:** Reassess findings before continuing
99
+ 4. **Session reuse check:** Reuse a prior specialist session only when it reduces real context duplication
95
100
 
96
101
  ### Abbreviated Cooldown
97
102
  When auto-continuing between sequential non-gated phases, the cooldown is abbreviated to one line:
@@ -160,22 +165,27 @@ Should I now run the migration tests? [waiting]
160
165
 
161
166
  ## Session Heartbeat & Checkpoints
162
167
 
163
- Session state is **not** file-based. It lives in **pantheon-persistence** under the
164
- `checkpoint:<slug>` namespace and is cleaned up automatically by a 4h TTL.
168
+ Use checkpoints only when `context_save` and `context_get` are explicitly present
169
+ in the active session's tool list. Standalone OpenCode V2 agent profiles do not
170
+ currently grant these tools; in that case, do not attempt a checkpoint or guess
171
+ a session ID. Carry forward the phase and remaining tasks in the normal task
172
+ handoff instead.
165
173
 
166
- Write state with `context_save(slug=slug, key=key, content=JSON.stringify(state), session_id=...)` and read it back with
174
+ When the tools are available, write state with `context_save(slug=slug, key=key, content=JSON.stringify(state), session_id=...)` and read it back with
167
175
  `context_get(slug=slug, key="latest", session_id=...)`. Capture `session_id` from the first `context_save`
168
176
  of the session and reuse it for the rest of the session, so the `latest` pointer survives
169
- compaction.
177
+ compaction. `state` must be an object β€” never pass a bare string as `content`: its
178
+ `goal`/`phase`/`delegations`/`heartbeat` values are objects and `tail` is an array.
179
+ `goal` is optional; when unset, omit the key rather than passing a string placeholder.
170
180
 
171
181
  ### Heartbeat Check
172
- - If `context_get(slug=slug, key="heartbeat", session_id=...)` returns a checkin older than 300s, log a stall warning and resume
173
- - Write a heartbeat after every anti-stall recovery action
182
+ - When checkpoint tools are available, an old heartbeat (>300s) is a stall signal; log it before resuming.
183
+ - Write a heartbeat after anti-stall recovery only when the current session exposes the checkpoint tools.
174
184
 
175
185
  ### Checkpoint Rules
176
- 1. Save a checkpoint before **every** delegate dispatch and after every agent returns
177
- 2. Include current phase, turn count, and remaining tasks
178
- 3. On resume: `context_get(slug=slug, key="latest", session_id=...)` restores the most recent checkpoint
186
+ 1. Save checkpoints for long-running/multi-phase work, context-loss risk, or substantive parallel work β€” not a one-off command or bounded fix, and only when the tools are available
187
+ 2. Include current phase and remaining tasks when a checkpoint is warranted
188
+ 3. On resume, read the latest checkpoint only with a known session ID; otherwise request the missing handoff context.
179
189
 
180
190
  > Do not create `heartbeat.json`, `checkpoint-<N>.json`, or `session.json` under
181
191
  > `.pantheon/deepwork/`. That file-based mechanism is retired β€” TTL handles cleanup, and reading
@@ -189,10 +199,10 @@ Configurable gates for different platforms and risk levels:
189
199
 
190
200
  | Gate | Default | Auto-Approval Condition |
191
201
  |------|---------|------------------------|
192
- | GATE 0 β€” Council/Plan | Always Ask | N/A β€” always requires human |
193
- | GATE 1 β€” Plan Approval | Always Ask | Plan matches acceptance criteria + no risks flagged |
194
- | GATE 2 β€” Themis Review | Ask by Default | Auto-approve if: Themis APPROVED + no CRITICAL/HIGH issues + coverage β‰₯80% |
195
- | GATE 3 β€” Git Commit | Never Auto | N/A β€” always manual |
202
+ | Council | Only when explicitly invoked | Never auto-start a council for ordinary implementation |
203
+ | Plan approval | Only for requested or risk-required plans | Skip for bounded, clear work |
204
+ | Themis review | Required for sensitive/material changes | May omit for trivial isolated edits; never auto-bypass required findings |
205
+ | Git / external actions | Never Auto | Commit, push, merge, deploy, destructive/global changes require explicit approval |
196
206
  | Deploy | Always Ask | N/A β€” always requires human |
197
207
  | Destructive DB Ops | Always Ask | N/A β€” always requires human |
198
208
 
@@ -205,8 +215,8 @@ auto-continue:
205
215
  idle_stall: 120 # seconds before stall detection
206
216
  idle_pause: 300 # seconds before auto-pause
207
217
  gates:
208
- plan_approval: always_ask
209
- themis_review: auto_approve_if_clean
218
+ plan_approval: when_required_by_scope_or_risk
219
+ themis_review: required_for_sensitive_or_material_changes
210
220
  git_commit: never_auto
211
221
  deploy: always_ask
212
222
  destructive_ops: always_ask
@@ -52,11 +52,11 @@ biome check --write --unsafe <files>
52
52
  - [ ] Proper file sizes (<300 lines)
53
53
 
54
54
  ### Testing
55
- - [ ] Unit tests written
56
- - [ ] Coverage β‰₯80%
57
- - [ ] Integration tests for workflows
58
- - [ ] Edge cases tested
59
- - [ ] Error conditions tested
55
+ - [ ] Tests cover the changed behavior where meaningful; documentation/format-only changes do not need invented tests
56
+ - [ ] Apply an explicit repository coverage threshold only when measurable and relevant to the changed code
57
+ - [ ] Integration tests where the change crosses workflow boundaries
58
+ - [ ] Relevant edge cases tested for the changed behavior/risk
59
+ - [ ] Relevant error conditions tested
60
60
 
61
61
  ### Security (OWASP Top 10)
62
62
  - [ ] Input validation present
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: council-synthesis
3
+ description: "Structured multi-agent council for explicit /pantheon requests and material decisions needing distinct perspectives. Load only when a council is actually needed."
4
+ ---
5
+
6
+ # Council synthesis β€” `/pantheon`
7
+
8
+ Use only when the user invokes `/pantheon` or a material decision genuinely needs distinct specialist views. Ordinary implementation, explanation, and bounded fixes do not need a council.
9
+
10
+ ## Run one useful round
11
+
12
+ 1. Search `council_decisions` for a directly relevant precedent. Reuse a fresh, matching decision with a warning to re-check current context; otherwise treat it as context, not authority.
13
+ 2. Select two specialists by default. Add a third only when the question spans a separate domain; include @themis when security, correctness, or a material quality gate requires review.
14
+ 3. Ask each specialist the same focused question and request a position, evidence, trade-offs, key risks, and confidence. Dispatch independent work together only when native background delegation is enabled; otherwise use normal `task()` calls.
15
+ 4. Synthesize after one response round. State agreements, real disagreements, missing responses, and uncertainty. Do not run a routine rebuttal, duplicate moderator/audit pass, or repeat the panel. Check a disputed factual claim only when it could change the recommendation; ask one focused follow-up if evidence remains insufficient.
16
+ 5. Give the user a concise recommendation with the main trade-off and any unresolved risk. Cite external research when used. Preserve human approval and Themis gates for sensitive or irreversible actions.
17
+ 6. Persist only a reusable, material decision in `council_decisions`; do not store routine opinions or user-specific details without a need.
18
+
19
+ ## Specialist response
20
+
21
+ ```text
22
+ position: one sentence answering the question
23
+ evidence: the key facts or reasoning (2–4 sentences)
24
+ trade-offs: one concrete gain and loss
25
+ risks: up to 3
26
+ confidence: High | Medium | Low
27
+ ```
28
+
29
+ Use High only with multiple verifiable facts, Medium with some evidence, and Low for mainly judgment-based conclusions. Do not invent consensus or confidence.
@@ -8,13 +8,21 @@ alwaysApply: false
8
8
 
9
9
  # TDD with Agents
10
10
 
11
- Enforce RED β†’ GREEN β†’ REFACTOR cycle across all implementation agents. Includes advanced testing patterns for E2E, load, mutation, and contract testing.
11
+ Use RED β†’ GREEN β†’ REFACTOR for behavior-changing implementation where a meaningful test can express the change. Keep verification proportional to the changed surface and risk; advanced testing patterns are reserved for changes that warrant them.
12
12
 
13
13
  ---
14
14
 
15
15
  ## Core Principle
16
16
 
17
- > **Write the test FIRST. Watch it fail. Write minimal code to pass. Refactor with confidence.**
17
+ > **For testable behavior changes, write the focused test first, observe RED, implement minimally, then refactor.**
18
+
19
+ ## Proportional TDD
20
+
21
+ - Use the complete RED β†’ GREEN β†’ REFACTOR cycle for new or changed behavior when a focused test is practical. Include a focused regression check for bug fixes.
22
+ - For typo, formatting, documentation-only, or otherwise non-behavioral edits, do not invent a test; inspect the diff and run the narrowest relevant validation.
23
+ - Run targeted tests for a small change. Run broader suites when the changed surface, integration boundaries, or risk make them useful; do not run the whole suite solely because one line changed.
24
+ - If a relevant existing test already captures the behavior, use it instead of adding a duplicate. If no automated check can express the change, report the manual or static verification performed.
25
+ - Auth, security, payment, data-integrity, and schema/migration changes retain focused RED/GREEN tests, required regression coverage, and Themis review. Do not weaken a project-specific required safety gate.
18
26
 
19
27
  ---
20
28
 
@@ -112,12 +120,12 @@ def test_provider_satisfies_consumer_contract():
112
120
  pass
113
121
  ```
114
122
 
115
- ### Mutation Testing
123
+ ### Mutation Testing (high-risk/critical logic only)
116
124
  - Mutate source code (change `>` to `<`, remove conditions)
117
125
  - Run tests β†’ should fail (mutation killed)
118
126
  - If tests pass β†’ test is weak; improve it
119
127
 
120
- ### Visual Regression
128
+ ### Visual Regression (visual behavior only)
121
129
  ```typescript
122
130
  test('homepage looks the same', async ({ page }) => {
123
131
  await page.goto('/')
@@ -129,8 +137,8 @@ test('homepage looks the same', async ({ page }) => {
129
137
 
130
138
  ## Coverage Rules
131
139
 
132
- - **Minimum: 80%** for all code
133
- - **Critical paths: 100%** (auth, payments, data integrity)
140
+ - Follow a repository's explicit coverage threshold when the changed code is in its measurement scope; do not manufacture a coverage target for docs, formatting, or a tiny isolated edit.
141
+ - **Critical paths:** preserve project-required coverage and tests for auth, payments, and data integrity.
134
142
  - **No snapshot testing** β€” test behavior, not output shape
135
143
  - **Test edge cases**: empty input, null, boundary values, errors
136
144
 
@@ -143,20 +151,20 @@ test('homepage looks the same', async ({ page }) => {
143
151
  | **Hermes** | Unit + integration for FastAPI endpoints, services, middleware |
144
152
  | **Aphrodite** | Component behavior tests with React Testing Library |
145
153
  | **Demeter** | Migration upgrade/downgrade, query correctness |
146
- | **Themis** | Verifies coverage β‰₯80%, edge cases tested, error conditions |
154
+ | **Themis** | Reviews the changed surface, relevant edge/error cases, and applicable repository coverage requirements; always review sensitive/material changes |
147
155
 
148
156
  ---
149
157
 
150
158
  ## Workflow
151
159
 
152
160
  ```
153
- 1. Zeus/Athena defines feature with testable acceptance criteria
161
+ 1. Use a plan/spec only when scope, risk, or ambiguity warrants it; a bounded fix may proceed directly
154
162
  2. Hermes writes failing test (RED)
155
163
  3. Hermes implements minimal code (GREEN)
156
164
  4. Hermes refactors (REFACTOR)
157
165
  5. Aphrodite writes frontend tests in parallel
158
- 6. Themis reviews: coverage, edge cases, correctness
159
- 7. If coverage <80% β†’ NEEDS_REVISION
166
+ 6. Themis reviews sensitive or material changes, checking changed behavior and applicable quality gates
167
+ 7. Escalate unmet repository or safety-critical test requirements; do not fail a micro-edit against an unrelated global coverage figure
160
168
  ```
161
169
 
162
170
  ---
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env bash
2
- # scan-secrets.sh β€” Pantheon PreToolUse Secret Scanning Hook
3
- # Detects hardcoded secrets in tool input. Logs ALWAYS (masked); the exit
4
- # code drives the plugin's hybrid blocking (see pantheon-hooks.ts):
5
- #
6
- # exit 0 β€” no match.
7
- # exit 1 β€” LOW_CONFIDENCE match only (header/KEY NAMES such as the Bifrost header
8
- # alone, api_key=/password=/secret= without a recognizable token
9
- # value). Advisory: the plugin logs + toasts, does NOT block.
10
- # exit 2 β€” HIGH_CONFIDENCE match (real token formats: sk-bf-<token>,
11
- # AKIA..., ghp_..., glpat-..., sk_live_/sk_test_..., xox[baprs]-...,
12
- # Bearer <token>, JWT). The plugin BLOCKS the tool call (throws
13
- # after logging β€” the only deliberate throw in the plugin).
14
- #
15
- # Matches are always MASKED (first 4 + last 4 chars for len>8, else "****")
16
- # before being echoed β€” the hook trail must never contain a raw secret value.
17
- set -euo pipefail
18
-
19
- HIGH_CONFIDENCE_PATTERNS=(
20
- "AKIA[0-9A-Z]{16}"
21
- "gh[pousr]_[A-Za-z0-9_]{36,}"
22
- "glpat-[A-Za-z0-9_\\-]{20}"
23
- "sk-[a-zA-Z0-9]{20,}"
24
- "sk_live_[a-zA-Z0-9]{20,}"
25
- "sk_test_[a-zA-Z0-9]{20,}"
26
- "xox[baprs]-[0-9]{10,13}-[0-9]{10,13}-[a-zA-Z0-9]{24}"
27
- "bearer\\s+[a-zA-Z0-9_\\-\\.]{20,}"
28
- "eyJ[A-Za-z0-9_-]*\\.eyJ[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]*"
29
- )
30
-
31
- LOW_CONFIDENCE_PATTERNS=(
32
- # KEY/header NAMES without a recognizable token value β€” high false-positive
33
- # rate (e.g. the Bifrost header alone, api_key=longvalue, password="x", secret="y"):
34
- # advisory only, never blocks.
35
- "[a-zA-Z0-9_-]*api[_-]?key[a-zA-Z0-9_-]*\\s*[:=]\\s*[\"']?[a-zA-Z0-9_\\-]{16,}[\"']?"
36
- "[a-zA-Z0-9_-]*password[a-zA-Z0-9_-]*\\s*[:=]\\s*[\"'][^\"']{8,}[\"']"
37
- "[a-zA-Z0-9_-]*secret[a-zA-Z0-9_-]*\\s*[:=]\\s*[\"'][^\"']{8,}[\"']"
38
- )
39
-
40
- # Keep provider-specific markers assembled so this scanner is not self-matched
41
- # by the repository secret test.
42
- BIFROST_HEADER="x""-bf-""vk"
43
- BIFROST_TOKEN_PREFIX="sk""-bf-"
44
- HIGH_CONFIDENCE_PATTERNS+=("${BIFROST_TOKEN_PREFIX}[A-Za-z0-9_-]{8,}")
45
- LOW_CONFIDENCE_PATTERNS+=("$BIFROST_HEADER")
46
-
47
- # Mask a matched secret for safe logging: first 4 + last 4 chars (len > 8),
48
- # else fully hidden β€” short matches must not be reconstructable by
49
- # concatenating the visible slices.
50
- mask_secret() {
51
- local match="$1"
52
- if [[ ${#match} -le 8 ]]; then
53
- echo "****"
54
- else
55
- echo "${match:0:4}****${match: -4}"
56
- fi
57
- }
58
-
59
- INPUT="${1:-${TOOL_INPUT:-}}"
60
- if [[ -z "$INPUT" ]] && [[ ! -t 0 ]]; then
61
- INPUT=$(cat)
62
- fi
63
-
64
- if [[ -z "$INPUT" ]]; then
65
- exit 0
66
- fi
67
-
68
- FOUND_HIGH=0
69
- FOUND_LOW=0
70
-
71
- for pattern in "${HIGH_CONFIDENCE_PATTERNS[@]}"; do
72
- if echo "$INPUT" | grep -iqE "$pattern"; then
73
- MATCH=$(echo "$INPUT" | grep -ioE "$pattern" | head -1)
74
- echo "[SECRET SCAN] High-confidence secret detected: $(mask_secret "$MATCH") (pattern: $pattern)" >&2
75
- FOUND_HIGH=1
76
- fi
77
- done
78
-
79
- for pattern in "${LOW_CONFIDENCE_PATTERNS[@]}"; do
80
- if echo "$INPUT" | grep -iqE "$pattern"; then
81
- MATCH=$(echo "$INPUT" | grep -ioE "$pattern" | head -1)
82
- echo "[SECRET SCAN] Potential secret detected (low confidence): $(mask_secret "$MATCH") (pattern: $pattern)" >&2
83
- FOUND_LOW=1
84
- fi
85
- done
86
-
87
- if [[ $FOUND_HIGH -eq 1 ]]; then
88
- echo "[SECRET SCAN] High-confidence hardcoded secret detected. Tool call will be BLOCKED." >&2
89
- exit 2
90
- fi
91
-
92
- if [[ $FOUND_LOW -eq 1 ]]; then
93
- echo "[SECRET SCAN] Possible secret detected. Remove it and use environment variables or a vault." >&2
94
- exit 1
95
- fi
96
-
97
- exit 0
@@ -1,299 +0,0 @@
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"
3
- name: "Zeus Council Synthesis"
4
- applyTo: "agents/zeus.agent.md"
5
- ---
6
-
7
- # πŸ›οΈ INLINE COUNCIL SYNTHESIS β€” /pantheon
8
-
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
-
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)
19
-
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):
139
-
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]
151
-
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
170
-
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
177
-
178
- ### Step 7 β€” Zeus Synthesize
179
- Use structured `agreement_signals` to auto-detect agreements/divergences. Output synthesis template (see below).
180
-
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 |
201
- | Security | themis, hermes, prometheus, nyx |
202
- | Database | demeter, hermes, prometheus |
203
- | AI/RAG | hephaestus, nyx |
204
- | Infrastructure | prometheus, hermes, themis |
205
- | Frontend/UX | aphrodite, themis, hermes |
206
- | Observability | nyx, hermes |
207
- | General | athena, themis, hermes |
208
-
209
- ## Synthesis Output Template (enhanced)
210
-
211
- ```
212
- ## πŸ›οΈ 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)
220
-
221
- ### Specialist Perspectives
222
- | Agent | Position | Trade-offs | Confidence |
223
- |-------|----------|------------|------------|
224
- | @agent1 | ... | ... | High/Med/Low |
225
-
226
- ### Agreements
227
- - <what 2+ specialists agree on>
228
-
229
- ### Divergences
230
- | Issue | Side A | Side B | Resolution |
231
- |-------|--------|--------|------------|
232
-
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>
238
-
239
- ### Recommendation
240
- <decisive conclusion>
241
-
242
- ### Audit Gate
243
- **Status:** βœ… Themis approved | ⚠️ Issues corrected
244
-
245
- ### Decision Gate
246
- **Confidence:** High/Medium/Low (adjusted for response rate)
247
- ```
248
-
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