pantheon-opencode 2.1.6 → 2.2.0-beta.2

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 (63) hide show
  1. package/AGENTS.global.md +2 -2
  2. package/AGENTS.md +1 -1
  3. package/CHANGELOG.md +64 -0
  4. package/README.md +13 -9
  5. package/README.pt-BR.md +13 -9
  6. package/bin/pantheon-init.mjs +1 -1
  7. package/commands/pantheon-audit.md +4 -5
  8. package/commands/pantheon-model.md +1 -2
  9. package/package.json +8 -2
  10. package/plugin.json +1 -1
  11. package/prompts/dynamic/agora-generated.txt +2 -2
  12. package/prompts/dynamic/orchestrate-generated.txt +4 -4
  13. package/prompts/sketch.prompt.md +1 -1
  14. package/pyproject.toml +1 -1
  15. package/scripts/build-agents-md.mjs +73 -12
  16. package/scripts/build-plugin.mjs +3 -1
  17. package/scripts/hooks/format-multi-language.sh +30 -29
  18. package/scripts/install-mcp.mjs +55 -27
  19. package/scripts/prune.mjs +124 -2
  20. package/scripts/setup.mjs +1 -1
  21. package/scripts/themis_heuristic_scan.py +3 -5
  22. package/skills-lock.json +1 -1
  23. package/src/agents/aphrodite.md +1 -1
  24. package/src/agents/athena.md +6 -14
  25. package/src/agents/demeter.md +1 -1
  26. package/src/agents/hermes.md +3 -2
  27. package/src/agents/iris.md +4 -6
  28. package/src/agents/prometheus.md +3 -7
  29. package/src/agents/roster.json +567 -0
  30. package/src/agents/zeus.md +3 -0
  31. package/src/instructions/agent-return-format.instructions.md +1 -1
  32. package/src/instructions/zeus-anti-stall.instructions.md +11 -35
  33. package/src/instructions/zeus-council-synthesis.instructions.md +17 -49
  34. package/src/instructions/zeus-timeout-retry.instructions.md +12 -80
  35. package/src/mcp/mcp_codemap_module.py +6 -5
  36. package/src/mcp/pantheon-mcp-server.mjs +875 -0
  37. package/src/pantheon/agent-forge-tool.ts +316 -0
  38. package/src/pantheon/auto-permissions.ts +31 -1
  39. package/src/pantheon/codemap-tools.ts +525 -0
  40. package/src/pantheon/deepwork/plan-tracker.ts +63 -2
  41. package/src/pantheon/execute-after.ts +21 -0
  42. package/src/pantheon/hook-engine.ts +2 -1
  43. package/src/pantheon/native-memory-tools.ts +686 -0
  44. package/src/pantheon/presets.mjs +15 -0
  45. package/src/pantheon/step-ledger.ts +259 -0
  46. package/src/pantheon/swe-eval-harness.ts +211 -0
  47. package/src/pantheon/tools.ts +62 -7
  48. package/src/plugin/index.js +2091 -136
  49. package/src/plugin/index.ts +1 -14
  50. package/src/plugin.ts +167 -10
  51. package/src/plugins/tui/dist/tui.d.ts +66 -0
  52. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  53. package/src/plugins/tui/dist/tui.js +1259 -367
  54. package/src/plugins/tui/dist/tui.js.map +1 -1
  55. package/src/plugins/tui/package-lock.json +2 -2
  56. package/src/plugins/tui/package.json +1 -1
  57. package/src/plugins/tui/src/index.tsx +632 -71
  58. package/src/plugins/tui/src/pantheon-settings.tsx +78 -14
  59. package/src/plugins/tui/src/quota-state.ts +190 -0
  60. package/src/plugins/tui/src/tui-prefs.ts +169 -12
  61. package/src/routing.yml +3 -0
  62. package/src/skills/auto-continue/references/auto-continue-details.md +2 -31
  63. /package/scripts/{setup-v2-config.mjs → setup-config.mjs} +0 -0
@@ -14,6 +14,8 @@ permission:
14
14
  pantheon_jev_decide: allow
15
15
  pantheon_skill_search: allow
16
16
  pantheon_deepwork: allow
17
+ pantheon_agent_forge: allow
18
+ pantheon_step_ledger: allow
17
19
  question: allow
18
20
  todowrite: allow
19
21
  todoread: allow
@@ -110,6 +112,7 @@ These rules are economic, measured against the 2026-11-05 usage audit. They appl
110
112
  - **pantheon-persistence** (`context_save`): milestones only (phases, complex tasks, handoffs). Maximum 3 saves per session. Always name the checkpoint. never re-save the same key unless state genuinely changed.
111
113
  - **pantheon-vision** (`vision_describe`): One pass per image; forward results in prompt to specialists.
112
114
  - **pantheon_deepwork**: Structured Deepwork plans (.pantheon/deepwork/<slug>/plan.json, journal.ndjson, PLAN.md). Synchronize canonical state, verify fail-first acceptance criteria, and use OpenCode native `question` tool for Gate 1 approval.
115
+ - **pantheon_agent_forge**: Create, inspect, or remove custom project-specific domain specialists under `.opencode/agents/<name>.md` (with least-privilege tool grants, MCP governance ladder, and sliced TDD rules) whenever the user requests a specialized agent.
113
116
 
114
117
  ## Local advisory routing before native delegation
115
118
 
@@ -22,7 +22,7 @@ For investigation agents (Apollo, Athena), return structured findings: key findi
22
22
 
23
23
  ### Athena Plan Handoff
24
24
 
25
- When Zeus delegates Athena through the root `subagent` dispatch, its final task result MUST contain the complete Markdown plan (not a summary, artifact path, or approval question): goal, scope and assumptions, phases, affected files or areas, dependencies, verification, risks, open questions, acceptance criteria — unknowns marked, never guessed. This supersedes the structured-findings format. Athena must not call `agent/askQuestions`, pause for user input, or ask for approval in the child session. Zeus publishes the full plan before approval UI, never bundling them; if order is not guaranteed, Zeus asks in plain text afterwards. For Open Questions or decisions needed, Zeus prompts via the native `question` tool with structured options and marked recommended defaults, never leaving inert text bullets. Direct Athena invocations show the complete plan before requesting approval.
25
+ When Zeus delegates Athena through the root `subagent` dispatch, its final task result MUST contain the complete Markdown plan (not a summary, artifact path, or approval question): goal, scope and assumptions, phases, affected files or areas, dependencies, verification, risks, open questions, acceptance criteria — unknowns marked, never guessed. This supersedes the structured-findings format. Athena must not call `question`, pause for user input, or ask for approval in the child session. Zeus publishes the full plan before approval UI, never bundling them; if order is not guaranteed, Zeus asks in plain text afterwards. For Open Questions or decisions needed, Zeus prompts via the native `question` tool with structured options and marked recommended defaults, never leaving inert text bullets. Direct Athena invocations show the complete plan before requesting approval.
26
26
 
27
27
  ## Council Specialist Response Format
28
28
 
@@ -7,55 +7,31 @@ fallback: shared
7
7
 
8
8
  # ANTI-STALL & STALL DETECTION
9
9
 
10
- You MUST proactively detect and recover from stalled states. Do NOT wait for user intervention when the system is idling or looping without progress.
10
+ Proactively detect and recover from stalled states without waiting for user intervention.
11
11
 
12
12
  ## Stall Detection Protocol
13
13
 
14
- You MUST self-monitor for these stall conditions:
15
-
16
14
  | Symptom | Detection Rule | Recovery Action |
17
15
  |---------|---------------|-----------------|
18
- | Silent loop | 3+ consecutive turns with no tool call AND no visible progress | Output `[STALL_DETECTED]` and re-read your task definition. If still stuck, escalate to user with: "I appear to be stuck on [task]. Options: (1) retry with different approach, (2) delegate to specialist, (3) simplify scope." |
19
- | Delegation black hole | No result or host completion notification after the applicable timeout | Stop dependent work; do not call an unavailable cancel/status tool. Follow `## Timeout & Retry Enforcement`, report uncertainty, and retry/reroute only under that policy |
20
- | Circular delegation | Same specialist re-dispatched for same task 2+ times without progress | Break cycle: dispatch to different specialist OR escalate to user |
21
- | Idle after completion | All background tasks completed but no synthesis/next step for 2+ turns | Force synthesis: summarize all completed results and propose next action |
22
- | Context thrash | Re-reading same files repeatedly without new action | Stop re-reading. State: "Already have context on [file]. Proceeding with [action]." |
23
-
24
- ## Phase Reminder
25
-
26
- Use the root `subagent` dispatch observed in the Beta 10 runtime; `task()` is host/API terminology, and the exact signature/background options depend on the active runtime. Prefer synchronous delegation unless the visible schema supports background and the host exposes a way to observe completion. For asynchronous work:
27
- 1. Do not invoke `task_status`, `cancel_task`, or board methods unless a corresponding tool is actually exposed (none was exposed in the reported Beta 10 root catalog).
28
- 2. Do not advance dependent work until a result or host-provided completion notification arrives.
29
- 3. Continue orchestration only on non-overlapping independent work.
30
- 4. If nothing independent remains, briefly report what was dispatched and wait for host notification; do not claim job tracking or recovery.
31
-
32
- Self-check every 3 turns: "Am I waiting on a delegate? Have I polled without need? Is there independent work I can do?"
16
+ | Silent loop | 3+ consecutive turns with no tool call AND no visible progress | Output `[STALL_DETECTED]`, re-read task, or escalate with 3 concrete options |
17
+ | Delegation black hole | No result or host completion notification after timeout | Stop dependent work; follow `## Timeout & Retry Enforcement` |
18
+ | Circular delegation | Same specialist re-dispatched for same task 2+ times without progress | Dispatch to different specialist OR escalate to user |
19
+ | Idle after completion | Background tasks completed but no synthesis/next step for 2+ turns | Summarize completed results and propose next action |
20
+ | Context thrash | Re-reading same files repeatedly without new action | Stop re-reading and proceed with action |
33
21
 
34
- ## Delegate Retry Enhancement
22
+ ## Phase Reminder & Delegate Retry
35
23
 
36
- When a delegation has a transient dispatch failure (timeout, crash, or empty
37
- response), check known causes first and allow at most one corrected retry per
38
- agent/task. Do not retry a scope refusal or a failed test/validation; reroute
39
- only when the correct specialist is clear, otherwise diagnose or escalate.
40
- After a transient retry fails, follow the canonical fallback chain once and
41
- escalate rather than restarting it. See `## Timeout & Retry Enforcement`.
24
+ Prefer synchronous `subagent` delegation unless background completion is observable through the host. Do not invoke `task_status`, `cancel_task`, or board methods unless exposed; do not advance dependent work until a result arrives; continue only on non-overlapping independent work.
25
+ When a delegation has a transient dispatch failure (timeout, crash, or empty response), check known causes first and allow at most one corrected retry per agent/task. Do not retry a scope refusal or a failed test/validation; reroute only when the correct specialist is clear, otherwise diagnose or escalate.
42
26
 
43
27
  ## Progress Checkpoint
44
28
 
45
29
  For long-running or multi-phase tasks expected to run > 5 turns only:
46
30
  - After turn 5: output `[CHECKPOINT] Completed so far: [summary]. Remaining: [list].`
47
- - After turn 10: re-evaluate. If < 50% done, consider splitting or escalating.
48
- - If 3 consecutive turns produce no tool calls: trigger Stall Detection Protocol (see above).
31
+ - After turn 10: re-evaluate; if < 50% done, consider splitting or escalating.
49
32
 
50
33
  ## Heartbeat & Checkpoint Integration
51
34
 
52
35
  Use checkpoints only for long-running or multi-phase work when `context_save` and `context_get` are available. Never add persistence calls for a bounded task.
53
-
54
- ### Checkpoint / Pre-Compaction
55
- Checkpoint only when context loss is plausible and both checkpoint tools are present. Save once at a meaningful boundary using `content=JSON.stringify(state)` and an explicit session ID; `state` must be an object with object-valued `phase`/`goal`/`delegations`/`heartbeat` fields and an array `tail`, and omit an unset `goal`. A successful save needs no immediate read. Checkpoints expire after 4h.
56
-
57
- ### Context Retrieval
36
+ Save once at a meaningful boundary using `content=JSON.stringify(state)` and an explicit session ID; `state` must be an object with object-valued `phase`/`goal`/`delegations`/`heartbeat` fields and an array `tail`, and omit an unset `goal`. A successful save needs no immediate read. Checkpoints expire after 4h.
58
37
  Read a checkpoint only when resuming a workflow with a known session ID. Do not retrieve it after every dispatch; carry ordinary handoffs in the task context.
59
-
60
- ### Long-Session Progress
61
- For long-lived multi-phase work, update an existing/requested progress record every 5 turns with completed and pending work and blockers. Do not create STATUS.md for a bounded task.
@@ -7,36 +7,25 @@ fallback: shared
7
7
 
8
8
  # INLINE COUNCIL SYNTHESIS — /pantheon
9
9
 
10
- Use an inline specialist council for material trade-offs, architecture/security choices, technology selection, cost/quality decisions, or multi-stakeholder questions. Do not use it for ordinary implementation tasks.
10
+ Use an inline specialist council for material trade-offs, architecture/security choices, technology selection, or multi-stakeholder questions. Do not use it for ordinary implementation tasks.
11
11
 
12
12
  ## Dispatch and Synthesis
13
13
 
14
- 1. **Precedent:** Run the separate `council_decisions` search defined in `## Memory Protocol`. Apply its age/score rules; if no fast-path decision applies, continue.
15
- 2. **Research (optional):** For `/pantheon --research <question>`, ask @apollo for a 30s pre-scan with a concise brief (question, bounded search scope, relevant inputs, constraints, and expected findings format); pass only relevant findings as `shared_context` to each specialist.
16
- 3. **Select and dispatch:** Choose at most 3 agents using the domain map below. Every dispatch—including Apollo discovery, specialist rounds, and Themis audit—gets a concise brief with objective, bounded scope/acceptance, relevant context only, constraints/safety gates, role-specific deliverable, and verification. Keep `shared_context` minimal, non-sensitive, and untrusted; never paste unrelated conversation or secrets. The host may independently inherit conversation transcript, which the brief does not control. Dispatch through the root `subagent` tool observed in the Beta 10 runtime. `task()` is host/API terminology; signature, background mode, and parallel dispatch depend on the active runtime schema. Keep first-round prompts independent: do not include other specialists' responses. Dispatch in parallel when the observed tool/runtime supports it; synchronous or sequential dispatch is also valid if each first-round prompt excludes prior first-round responses. Specialists therefore cannot know actual peer positions in the first round: do not ask them to guess, signal agreement/disagreement, or refer to themselves/peers speculatively. First-round `agreement_signals` must be omitted or set to `none`.
17
- 4. **Collect:** Use returned subagent results or host-provided completion notifications. Do not call `task_status` or claim job tracking/recovery when unavailable. Note timeouts and missing responses explicitly. Partial responses are acceptable only from read-only @apollo or @gaia.
18
- 5. **Validate confidence:** High requires at least 3 verifiable claims; otherwise downgrade to Medium and state why. Medium requires at least 1 claim; Low needs no minimum. Opinions alone are not specific claims. Assess the claims and evidence actually present in each response; a self-reported `specific_claims` count is advisory, not evidence or proof of confidence.
19
- 6. **Resolve divergence:** After all initial responses arrive, Zeus groups their actual substantive positions by issue and derives agreement from those positions, not from speculative or self-reported `agreement_signals`. For each comparable issue, compare every unordered pair of specialists who provided a comparable substantive position on that issue. A pair agrees only when its substantive positions are compatible; every pair whose positions are not aligned counts as divergent. For an issue with `n` specialists providing comparable positions, include `n*(n-1)/2` pairs in `total_comparable_pairs`; sum this across included issues. Exclude issues with fewer than two comparable positions and state that they were excluded. Calculate `agreement_rate = agreeing_pairs / total_comparable_pairs`: unanimity is 100%, all pairs in divergence is 0%, and non-aligned pairs are divergences. If the denominator is zero, the rate is indeterminate/has no basis; never substitute an artificial zero or trigger rebuttal from an undefined rate.
20
-
21
- **Assertive Arbitration & Autonomy:** When divergence occurs, Zeus avoids unnecessary subagent debate rounds by arbitrating decisively:
22
- - **Domain Authority Precedence:** Technical domain owners carry decisive authority on their core specialty when backed by verifiable claims:
23
- - *Security / Auth / Audit:* `@themis` has veto power. If an approach weakens authorization or auditability, Themis's position wins unconditionally.
24
- - *Database / Transactions / Schema:* `@demeter` has primary authority over schemas, transaction boundaries, and query performance.
25
- - *Frontend / UX / A11y:* `@aphrodite` has primary authority over UI ergonomics, responsiveness, and accessibility compliance.
26
- - *Infrastructure / Deployment / CI:* `@prometheus` has primary authority over containers, pipelines, and runtime resource limits.
27
- - *API / Network / Protocols:* `@hermes` has primary authority over contract conformity and transport semantics.
28
- - *Architecture / System Boundaries:* `@athena` has primary authority over modularity and long-term maintainability.
29
- If the divergence falls within the core specialty of a specialist with verifiable claims (High/Medium confidence), Zeus arbitrates in favor of that Domain Authority immediately.
30
- - **JEV Multi-Criteria Arbitration (`pantheon_jev_decide`):** When trade-offs span multiple competing domains without a single owner (e.g. Athena's modularity vs Prometheus's operational simplicity), Zeus invokes `pantheon_jev_decide` (mode: `order` or `score`) or evaluates the multi-criteria candidate matrix to score and rank options deterministically in ONE call.
31
- - **Targeted Rebuttal Fallback:** Below 50%, and only if no agent timed out and neither Domain Authority nor JEV arbitration can resolve an unverified factual contradiction (e.g., mutually exclusive claims about runtime behavior that cannot be verified locally), run one rebuttal round with all responses and the current synthesis draft. In that round, signals may refer only to peer responses visible in the rebuttal prompt; treat revised responses as final and recompute the rate from their actual positions. If the defined rate remains below 50%, research factual divergence points with official docs, benchmarks, or issues (max 3 searches; seek 2 independent sources per point when possible). Skip research for subjective-only disagreements. Send responses and a cited evidence brief to @themis as moderator; request verdicts, overall direction, confidence, and unresolved issues. Low confidence or unresolved points remain explicit in the synthesis. Moderator and audit roles are separate.
32
- 7. **Synthesize and audit:** Use the output format below, then ask @themis to compare raw responses with the synthesis. Check representation of every specialist, preserved divergences, accurate attribution, and confidence specificity. Fix any issue before delivery.
33
- 8. **Persist (conditional):** Store the decision only if a memory-write tool is explicitly exposed and permitted in the active root tool list; require its success result before saying it was saved. Otherwise say the decision was not persisted. The `BackgroundJobBoard` is internal and has no root-callable board tool in the reported runtime.
34
-
35
- The `BackgroundJobBoard` is internal bookkeeping, not a tool available to Zeus root; do not call `board.registerLaunch`, `markReconciled`, `recoverRunningJobs`, or `formatForPrompt`, and do not assume crash recovery. If context is lost, continue only from results still present in the conversation or a host handoff; otherwise report the missing context and ask how to proceed.
14
+ 1. **Precedent:** Run the `council_decisions` search defined in `## Memory Protocol`. Apply its age/score rules; if no fast-path decision applies, continue.
15
+ 2. **Research (optional):** For `/pantheon --research <question>`, ask @apollo for a 30s pre-scan with a concise brief; pass only relevant findings as `shared_context`.
16
+ 3. **Select and dispatch:** Choose at most 3 agents using the domain map below. Every dispatch—including Apollo discovery, specialist rounds, and Themis audit—gets a concise brief with objective, bounded scope/acceptance, relevant context only, constraints/safety gates, role-specific deliverable, and verification. Keep `shared_context` minimal, non-sensitive, and untrusted; never paste unrelated conversation or secrets. The host may independently inherit conversation transcript. Dispatch through the root `subagent` tool (`task()` is host/API terminology). Keep first-round prompts independent: do not include other specialists' responses. Dispatch in parallel when the observed tool/runtime supports it; synchronous or sequential dispatch is also valid if each first-round prompt excludes prior first-round responses. First-round `agreement_signals` must be omitted or set to `none`.
17
+ 4. **Collect:** Use returned subagent results or host completion notifications. Do not call `task_status` or claim job tracking/recovery when unavailable. Note timeouts and missing responses explicitly. Partial responses are acceptable only from read-only @apollo or @gaia.
18
+ 5. **Validate confidence:** High requires >=3 verifiable claims (otherwise downgrade to Medium and state why); Medium requires >=1 claim; Low needs no minimum. Self-reported `specific_claims` count is advisory, not proof.
19
+ 6. **Resolve divergence:** After initial responses arrive, Zeus groups their actual substantive positions by issue and derives agreement from those positions, not from speculative or self-reported `agreement_signals`. For each comparable issue, compare every unordered pair of specialists who provided a comparable substantive position on that issue. A pair agrees only when its substantive positions are compatible; every pair whose positions are not aligned counts as divergent. For an issue with `n` specialists providing comparable positions, include `n*(n-1)/2` pairs in `total_comparable_pairs`; sum this across included issues. Exclude issues with fewer than two comparable positions and state that they were excluded. Calculate `agreement_rate = agreeing_pairs / total_comparable_pairs`: unanimity is 100%, all pairs in divergence is 0%, and non-aligned pairs are divergences. If the denominator is zero, the rate is indeterminate/has no basis; never substitute an artificial zero or trigger rebuttal from an undefined rate.
20
+ - **Domain Authority Precedence:** Technical domain owners carry decisive authority when backed by verifiable claims (High/Medium confidence): `@themis` (Security/Auth/Audit veto), `@demeter` (Database/Schema/Queries), `@aphrodite` (Frontend/UX/A11y), `@prometheus` (Infra/Deploy/CI), `@hermes` (API/Protocols), `@athena` (Architecture/Modularity).
21
+ - **JEV Multi-Criteria Arbitration (`pantheon_jev_decide`):** When trade-offs span competing domains without a single owner, invoke `pantheon_jev_decide` (`order` or `score`) in ONE call.
22
+ - **Targeted Rebuttal Fallback:** Below 50%, and only if no agent timed out and neither Domain Authority nor JEV arbitration resolves an unverified factual contradiction, run one rebuttal round with all responses and the synthesis draft. If the defined rate remains below 50%, research factual divergence points (max 3 searches) and send responses + cited evidence brief to @themis as moderator. Moderator and audit roles are separate.
23
+ 7. **Synthesize and audit:** Use the output format below, then ask @themis to compare raw responses with the synthesis (representation, preserved divergences, attribution, confidence).
24
+ 8. **Persist (conditional):** Store the decision only if a memory-write tool is explicitly exposed and permitted in the active root tool list; require its success result before saying it was saved. `BackgroundJobBoard` is internal bookkeeping with no root-callable tool.
36
25
 
37
26
  ## Specialist Response Format
38
27
 
39
- Require `## specialist_response` from `## Agent Return Format`. The first round must not prompt specialists to infer other agents' views; agreement signals are omitted or `none` until actual peer responses are visible.
28
+ Require `## specialist_response` from `## Agent Return Format`. First-round agreement signals remain omitted or `none`.
40
29
 
41
30
  ## Domain Map
42
31
 
@@ -62,7 +51,7 @@ Require `## specialist_response` from `## Agent Return Format`. The first round
62
51
  ### Specialist Perspectives
63
52
  | Specialist | Domain Authority | Substantive Position | Trade-offs | Confidence |
64
53
  | :--- | :--- | :--- | :--- | :---: |
65
- | **@[agent]** | [Domain, e.g. Security / Auth] | [Core recommendation] | [Pros & Cons] | **[High / Med / Low]** |
54
+ | **@[agent]** | [Domain] | [Core recommendation] | [Pros & Cons] | **[High / Med / Low]** |
66
55
 
67
56
  ### Agreements
68
57
  - [Key consensus point shared across specialists]
@@ -72,30 +61,9 @@ Require `## specialist_response` from `## Agent Return Format`. The first round
72
61
  | :--- | :--- | :--- |
73
62
  | [Contested point] | **@[agentA]**: [Position A]<br/>**@[agentB]**: [Position B] | **Resolved via [Domain Authority / Jev Decision]**: [Outcome] |
74
63
 
75
- ```mermaid
76
- flowchart TD
77
- Q["Contested Issue"] --> A["@[agentA]: Position A"]
78
- Q --> B["@[agentB]: Position B"]
79
- A & B --> Arb{"Domain Authority & Jev Score"}
80
- Arb --> Dec["Arbitrated Decision: [Outcome]"]
81
- ```
82
-
83
- ### Evidence & Moderation (when used)
84
- Research points, evidence, moderator verdict, cited sources, unresolved issues
85
-
86
- ### Recommendation
87
- Decisive conclusion and immediate actionable next steps
88
-
89
- ### Immediate Action Checklist
90
- - [ ] **@[specialistA]**: [Concrete implementation task]
91
- - [ ] **@[specialistB]**: [Verification or interface task]
64
+ ### Recommendation & Action Checklist
65
+ - [ ] **@[specialistA]**: [Concrete task]
92
66
  - [ ] **@themis**: [Audit gate verification]
93
-
94
- ### Audit Gate
95
- Themis approved, or issues corrected
96
-
97
- ### Decision Gate
98
- Confidence adjusted for response rate
99
67
  ```
100
68
 
101
- Initial agreement signals remain omitted/`none`; consensus and agreements are derived by Zeus from compared substantive positions and presented in the synthesis. Preserve actual specialist timeout or unresolved-tie details in the response. The user invokes this flow with `/pantheon <question>`; `--research` enables the Apollo pre-scan.
69
+ Initial agreement signals remain omitted/`none`; consensus and agreements are derived by Zeus from compared substantive positions and presented in the synthesis. Preserve actual specialist timeout or unresolved-tie details in the response.
@@ -8,13 +8,7 @@ fallback: shared
8
8
  # TIMEOUT & RETRY ENFORCEMENT
9
9
 
10
10
  When a delegated agent does not respond in time, enforce the timeout policy from `routing.yml`.
11
-
12
- Use the root `subagent` dispatch observed in the Beta 10 runtime. `task()` is
13
- host/API terminology; the active runtime determines the callable schema and any
14
- background options. Do not assume root `task_status`, `cancel_task`, or board
15
- tracking/recovery tools. Prefer synchronous dispatch unless background completion
16
- is observable through the host, and keep any retry list in the current context
17
- only; do not claim persistent job tracking.
11
+ Use the root `subagent` dispatch (`task()` is host/API terminology). Do not assume root `task_status`, `cancel_task`, or board tracking/recovery tools. Prefer synchronous dispatch unless background completion is observable through the host, and keep any retry list in the current context only; do not claim persistent job tracking.
18
12
 
19
13
  ## Timeout Behavior by Agent Role
20
14
 
@@ -29,90 +23,28 @@ only; do not claim persistent job tracking.
29
23
 
30
24
  ## Retry Flow
31
25
 
32
- ```
33
- Initial attempt → timeout/failure → log it → make at most one retry
34
- └─ retry fails → try fallback agents left-to-right with original task/context
35
- └─ all fallbacks fail (or none exist) → report the chain and escalate
36
- ```
37
- `background_delegation.retry_count: 1` means one retry after the initial attempt, not one total attempt. Never restart an exhausted chain automatically.
26
+ `background_delegation.retry_count: 1` means one retry after the initial attempt, not one total attempt. If the retry fails, try fallback agents left-to-right with original task/context; if all fallbacks fail (or none exist), report the chain and escalate. Never retry the same chain automatically.
38
27
 
39
- Apply the retry only to a transient dispatch failure (timeout, crash, or empty response). A failed test, validation, or migration is a result to diagnose, not a reason to repeat the same command or agent blindly. Track agents already tried: each agent may be retried at most once and each listed fallback may be tried at most once. For auth/security/data/schema work, a fallback must preserve specialist competence, Themis review, and human approval; otherwise stop and escalate. Never let full-auto bypass these gates.
28
+ Apply the retry only to a transient dispatch failure (timeout, crash, or empty response). A failed test, validation, or migration is a result to diagnose, not a reason to repeat the same command or agent blindly. For auth/security/data/schema work, a fallback must preserve specialist competence, Themis review, and human approval; otherwise stop and escalate. Never let full-auto bypass these gates.
40
29
  An agent refusal or scope-boundary response is not a transient failure: do not retry it with a rephrased prompt. Correct the route once if the right specialist is clear; otherwise stop and ask.
41
30
 
42
31
  ## Fallback Chain Definitions
43
32
 
44
- `routing.yml` → `fallback_chains` is the canonical agent-by-agent mapping. Evaluate
45
- the configured chain left-to-right; if an agent has no configured chain, stop
46
- and escalate rather than guessing a fallback. Each listed fallback may be tried
47
- at most once, and an exhausted chain is never restarted automatically.
48
-
49
- ### Refusal Is a Routing Error
50
-
51
- For a domain/scope refusal, do not retry with a rephrased prompt. Correct the
52
- route once only when the right specialist is clear; otherwise stop and ask.
53
- Record one `DelegationCacheDecision` telemetry item only when telemetry recording
54
- is actually exposed; otherwise keep the corrected route in the current handoff
55
- and do not claim telemetry was persisted. Include `reroute_from`, `reroute_to`,
56
- and `delegation_id` when available.
57
-
58
- ### Escalation Protocol
59
- When all fallbacks fail, report the tried agents and errors, offer a different approach/simpler scope/manual fix, and stop. Never retry the same chain automatically.
60
-
61
- ### Session Reuse Check
62
- Reuse a prior specialist session only when the active host exposes that capability;
63
- otherwise dispatch through `subagent` with necessary context. Treat `session_max`
64
- as policy context, not as a claim that Zeus can enumerate sessions.
33
+ `routing.yml` → `fallback_chains` is the canonical agent-by-agent mapping. Evaluate the configured chain left-to-right; if an agent has no configured chain, stop and escalate rather than guessing a fallback.
34
+ For a domain/scope refusal, do not retry with a rephrased prompt; record one `DelegationCacheDecision` telemetry item only when telemetry recording is actually exposed (`reroute_from`, `reroute_to`, `delegation_id`).
35
+ Reuse a prior specialist session only when the active host exposes that capability; otherwise dispatch through `subagent` with necessary context.
65
36
 
66
37
  ---
67
38
 
68
39
  # SUBTASK DISPATCH (Lightweight Delegation)
69
40
 
70
- Subtask is a bounded, low-risk delegation mode that **skips** the standard artifact lifecycle. Choose it by risk and need for review, not by a fixed file/line count.
71
-
72
- ## When to Use Subtask vs Full Task
73
-
74
- Use the lightest path that safely meets the request. A multi-file but bounded low-risk change does not automatically need a plan/artifact phase.
75
-
76
- Assess complexity qualitatively from uncertainty, specialist expertise, dependencies,
77
- risk, and how the result can be verified—not from a fixed file or line count. Keep
78
- self-contained work inline when no specialist is needed; use one correct specialist
79
- for one bounded expertise-specific task; Zeus may make separate root dispatches for
80
- independent fronts. Keep dependent work ordered and preserve planning, review,
81
- artifact, and approval gates when the risk requires them.
82
-
83
- ### Subtask Decision Tree (run BEFORE every delegation)
41
+ Subtask is a bounded, low-risk delegation mode that **skips** the standard artifact lifecycle. Assess complexity qualitatively from uncertainty, specialist expertise, dependencies, risk, and how the result can be verified—not from a fixed file or line count. Keep self-contained work inline when no specialist is needed; use one correct specialist for one bounded expertise-specific task; Zeus may make separate root dispatches for independent fronts. Keep dependent work ordered and preserve planning, review, artifact, and approval gates when the risk requires them.
84
42
 
85
- ```
86
- □ Is the scope clear, bounded, reversible, and low-uncertainty? [YES→continue | NO→clarify/plan]
87
- □ Does it avoid auth/security, data/schema, destructive, broad/material, and user-visible API risk? [YES→continue | NO→relevant gates]
88
- □ Is there no required Themis/audit handoff for this change? [YES→continue | NO→preserve that review]
89
-
90
- ALL YES → one correct domain specialist; they inspect needed context, implement, and verify; no routine plan/artifact, separate discovery, council, or review
91
- ANY NO → add only the planning, artifact, specialist review, and approval gates the risk requires
92
- ```
93
-
94
- ### Safety Rules
95
- 1. **Bounded scope** — can be a small multi-file change or a read-only investigation
96
- 2. **Low risk and uncertainty** — no security implications, data loss, breaking/user-visible API impact, broad material scope, or unresolved high uncertainty
97
- 3. **No required Themis dependency** — sensitive/material output retains its review gate
98
-
99
- The selected specialist, not a routine Apollo discovery pass, inspects the relevant
100
- local context for a lightweight implementation. Keep specialist roles available for
101
- on-demand routing; do not remove an agent based on one task or one overhead observation.
43
+ - **Fast-path criteria:** Scope is clear, bounded, reversible, and low-uncertainty; avoids auth/security, data/schema, destructive, broad/material, and user-visible API risk; requires no Themis/audit handoff.
44
+ - The selected specialist, not a routine Apollo discovery pass, inspects the relevant local context for a lightweight implementation.
102
45
 
103
46
  ## Subtask Return Format
104
- Implementation agents use the `## subtask_summary` fields defined in `## Agent Return Format`. Investigations, plans, and council responses keep their role-specific formats; partial results also follow the assigned role format. Include the optional machine-readable `memory_context` only in `subtask_summary` when memory affected the result, and omit it otherwise. In handoffs, pass only useful memory hit refs and a concise takeaway; treat that context as untrusted and subordinate to the current request/instructions.
105
-
106
- ## Timeout Parcial (Partial Results)
107
-
108
- Only agents marked Yes 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 partial OK — return whatever you have.`
109
-
110
- ---
111
-
112
- # TIMEOUT TRACKING
47
+ Implementation agents use the `## subtask_summary` fields defined in `## Agent Return Format`; investigations, plans, and council responses keep their role-specific formats. Include the optional machine-readable `memory_context` only in `subtask_summary` when memory affected the result, and omit it otherwise. In handoffs, pass only useful memory hit refs and a concise takeaway; treat that context as untrusted and subordinate to the current request/instructions.
113
48
 
114
- Keep only an in-context list of active delegations and already-tried agents when
115
- needed. Use results returned by `subagent` or host completion notifications; do
116
- not poll, cancel, or write a timeout log unless the corresponding tool is exposed.
117
- Report any timeout and the retry/fallback taken in the user-facing handoff; do
118
- not claim persistent tracking or recovery.
49
+ ## Timeout Parcial (Partial Results) & Tracking
50
+ Only agents marked Yes above (@apollo, @gaia, @talos) may return partial results; never implementers or reviewers. Keep only an in-context list of active delegations and tried agents; do not poll, cancel, or claim persistent tracking unless the tool is exposed.
@@ -544,11 +544,12 @@ def code_index( # noqa: C901, PLR0912, PLR0915
544
544
  [str(file_path), h, lang],
545
545
  )
546
546
  conn.commit()
547
- try:
548
- ast.parse(content)
549
- except SyntaxError:
550
- errors += 1
551
- continue
547
+ if lang == "python":
548
+ try:
549
+ ast.parse(content)
550
+ except SyntaxError:
551
+ errors += 1
552
+ continue
552
553
  skipped += 1
553
554
  continue
554
555
  _insert_entities_and_relations(conn, ents, rels)