pantheon-opencode 1.6.0-beta.5 → 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.
- package/AGENTS.md +27 -820
- package/CHANGELOG.md +130 -0
- package/README.md +205 -30
- package/README.pt-BR.md +47 -23
- package/package.json +10 -5
- package/plugin.json +1 -1
- package/pyproject.toml +3 -1
- package/scripts/build-agents-md.mjs +162 -28
- package/scripts/doctor.mjs +104 -22
- package/scripts/install/agents-md.mjs +2 -2
- package/scripts/install/config-migration.mjs +154 -7
- package/scripts/install/opencode.mjs +202 -40
- package/scripts/install/shared.mjs +115 -7
- package/scripts/install/strings.mjs +8 -0
- package/scripts/probe-pantheon-cost.mjs +16 -3
- package/scripts/run-node-tests.mjs +189 -0
- package/scripts/sync-artifacts.mjs +2 -2
- package/scripts/test-opencode-v2-sandbox.sh +820 -86
- package/skills-lock.json +6 -5
- package/src/agents/aphrodite.md +17 -28
- package/src/agents/athena.md +1 -0
- package/src/agents/demeter.md +8 -18
- package/src/agents/hephaestus.md +10 -11
- package/src/agents/hermes.md +15 -30
- package/src/agents/iris.md +1 -0
- package/src/agents/nyx.md +1 -0
- package/src/agents/prometheus.md +16 -10
- package/src/agents/talos.md +4 -1
- package/src/agents/themis.md +5 -3
- package/src/agents/zeus.md +17 -280
- package/src/instructions/agent-return-format.instructions.md +4 -50
- 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 +12 -121
- package/src/instructions/zeus-anti-stall.instructions.md +8 -111
- package/src/instructions/zeus-communication-rules.instructions.md +0 -1
- package/src/instructions/zeus-memory-operations.instructions.md +26 -0
- package/src/instructions/zeus-timeout-retry.instructions.md +9 -130
- package/src/pantheon/secret-scanner.ts +489 -0
- package/src/pantheon/v2-delegation-enforce.ts +86 -0
- package/src/pantheon/v2-execute-after.ts +186 -0
- package/src/pantheon/v2-unsupported.mjs +0 -23
- package/src/plugin-v2.ts +254 -102
- package/src/plugins/pantheon-hooks.ts +82 -35
- package/src/plugins/tui/README.md +14 -0
- package/src/plugins/tui/dist/tui.d.ts +11 -8
- package/src/plugins/tui/dist/tui.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui.js +102 -62
- package/src/plugins/tui/package-lock.json +30 -33
- package/src/plugins/tui/package.json +5 -1
- package/src/plugins/tui/src/index.tsx +163 -107
- package/src/plugins/tui/tsdown.config.ts +17 -0
- package/src/routing.yml +12 -9
- package/src/skills/README.md +9 -4
- package/src/skills/agent-coordination/SKILL.md +13 -83
- package/src/skills/artifact-management/SKILL.md +12 -5
- package/src/skills/auto-continue/SKILL.md +38 -28
- package/src/skills/code-review-checklist/SKILL.md +5 -5
- package/src/skills/council-synthesis/SKILL.md +29 -0
- package/src/skills/tdd-with-agents/SKILL.md +18 -10
- package/scripts/hooks/scan-secrets.sh +0 -97
- package/src/instructions/zeus-council-synthesis.instructions.md +0 -299
|
@@ -1,116 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "
|
|
2
|
+
description: "Minimal stall recovery and progress guidance for Zeus"
|
|
3
3
|
name: "Zeus Anti-Stall"
|
|
4
|
-
|
|
4
|
+
agents: [zeus]
|
|
5
|
+
fallback: shared
|
|
5
6
|
---
|
|
6
7
|
|
|
7
|
-
#
|
|
8
|
+
# Stall recovery
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
You MUST self-monitor for these stall conditions:
|
|
14
|
-
|
|
15
|
-
| Symptom | Detection Rule | Recovery Action |
|
|
16
|
-
|---------|---------------|-----------------|
|
|
17
|
-
| Silent loop | 3+ consecutive turns with no tool call AND no visible progress | Output `[STALL_DETECTED]` and re-read your task definition. If still stuck, escalate to user with: "I appear to be stuck on [task]. Options: (1) retry with different approach, (2) delegate to specialist, (3) simplify scope." |
|
|
18
|
-
| Delegation black hole | Agent dispatched but no response after 2x the timeout from routing.yml | Log the hang, cancel via `cancel_task`, then follow the fallback chain in `## ⏱️ Timeout & Retry Enforcement` |
|
|
19
|
-
| Circular delegation | Same specialist re-dispatched for same task 2+ times without progress | Break cycle: dispatch to different specialist OR escalate to user |
|
|
20
|
-
| Idle after completion | All background tasks completed but no synthesis/next step for 2+ turns | Force synthesis: summarize all completed results and propose next action |
|
|
21
|
-
| Context thrash | Re-reading same files repeatedly without new action | Stop re-reading. State: "Already have context on [file]. Proceeding with [action]." |
|
|
22
|
-
|
|
23
|
-
## Phase Reminder
|
|
24
|
-
|
|
25
|
-
After dispatching background specialists, you MUST:
|
|
26
|
-
1. DO NOT poll running jobs or consume their partial output
|
|
27
|
-
2. DO NOT advance dependent work until terminal results arrive
|
|
28
|
-
3. Continue orchestration ONLY on non-overlapping independent work
|
|
29
|
-
4. If nothing independent remains, briefly report what was launched and WAIT
|
|
30
|
-
|
|
31
|
-
Self-check every 3 turns: "Am I waiting on a delegate? Have I polled without need? Is there independent work I can do?"
|
|
32
|
-
|
|
33
|
-
## Delegate Retry Enhancement
|
|
34
|
-
|
|
35
|
-
When a delegation fails (timeout, empty response, error):
|
|
36
|
-
|
|
37
|
-
1. **FIRST:** Check if the error is a known pattern:
|
|
38
|
-
- "Agent not responding" → verify agent name matches routing.yml
|
|
39
|
-
- "Context exceeded" → reduce scope, split into smaller tasks
|
|
40
|
-
- "Permission denied" → verify agent has correct tools/permissions
|
|
41
|
-
|
|
42
|
-
2. **Retry ONCE** with rephrased prompt — add: "Previous attempt failed with: [error]. Adjusted approach: [what changed]."
|
|
43
|
-
|
|
44
|
-
3. **If retry also fails** → do NOT retry blindly; follow the fallback chain and escalation protocol in `## ⏱️ Timeout & Retry Enforcement`.
|
|
45
|
-
|
|
46
|
-
## Progress Checkpoint
|
|
47
|
-
|
|
48
|
-
On tasks expected to run > 5 turns:
|
|
49
|
-
- After turn 5: output `[CHECKPOINT] Completed so far: [summary]. Remaining: [list].`
|
|
50
|
-
- After turn 10: re-evaluate. If < 50% done, consider splitting or escalating.
|
|
51
|
-
- If 3 consecutive turns produce no tool calls: trigger Stall Detection Protocol (see above).
|
|
52
|
-
|
|
53
|
-
## Heartbeat & Checkpoint Integration
|
|
54
|
-
|
|
55
|
-
All session state lives in **pantheon-persistence** (namespace `checkpoint:<slug>`).
|
|
56
|
-
No file I/O, no checkpoint_session.py — TTL (4h) handles cleanup automatically.
|
|
57
|
-
|
|
58
|
-
### Heartbeat Check
|
|
59
|
-
- If `context_get(slug, "heartbeat")` returns a checkin older than 300s, log a stall warning and resume
|
|
60
|
-
- Write heartbeat after every anti-stall recovery action:
|
|
61
|
-
```
|
|
62
|
-
context_save(slug, "heartbeat", json({"status": "alive", "last_action": "...", "turn_count": N}))
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Checkpoint Auto-Save (Pré-Compactação)
|
|
66
|
-
Before ANY delegate dispatch, save a checkpoint:
|
|
67
|
-
```
|
|
68
|
-
context_save(slug, "phase:N", json({
|
|
69
|
-
"phase": {"current": N, "total": M, "name": "..."},
|
|
70
|
-
"turn_count": N, "agent": "...", "summary": "..."
|
|
71
|
-
}), session_id=SESSION_ID)
|
|
72
|
-
```
|
|
73
|
-
**`content.phase` must be an OBJECT, not a bare number.** `{"phase": 1}` is rejected with
|
|
74
|
-
`context_save: content.phase must be an object (got number)`. The server reads `current`
|
|
75
|
-
and `total` (non-negative ints) and `name` (string, max 256 **bytes** — the guard
|
|
76
|
-
measures `len(value.encode())`, so multi-byte characters count as more than one). That
|
|
77
|
-
set is not closed: any other key inside `phase` is accepted and ignored, never an
|
|
78
|
-
error. The `"phase:N"` slot KEY above is unrelated to `content.phase` and stays a plain
|
|
79
|
-
string.
|
|
80
|
-
All checkpoints auto-expire after 4h (TTL=14400).
|
|
81
|
-
|
|
82
|
-
### Gatilho de Pré-Compactação (Anti-perda de estado)
|
|
83
|
-
Antes da compactação nativa do OpenCode disparar (75-96% do context window),
|
|
84
|
-
o Zeus DEVE salvar o estado atual:
|
|
85
|
-
1. Capture session_id do primeiro `context_save` da sessão
|
|
86
|
-
2. Salve heartbeat + phase atual + tarefas pendentes
|
|
87
|
-
3. Só então permita que a compactação prossiga
|
|
88
|
-
```
|
|
89
|
-
# Ao iniciar sessão:
|
|
90
|
-
result = context_save(slug, "init", session_state)
|
|
91
|
-
SESSION_ID = result.session_id # ← guarde para toda a sessão
|
|
92
|
-
|
|
93
|
-
# Antes de CADA delegação:
|
|
94
|
-
context_save(slug, f"pre:{agent}", current_state, session_id=SESSION_ID)
|
|
95
|
-
|
|
96
|
-
# Após retorno do agente:
|
|
97
|
-
context_save(slug, f"post:{agent}", result_state, session_id=SESSION_ID)
|
|
98
|
-
```
|
|
99
|
-
Isso garante que o estado sobreviva à compactação — o "latest" pointer
|
|
100
|
-
sempre aponta para o checkpoint mais recente, mesmo após compactação.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
### Context Retrieval
|
|
104
|
-
Next-phase agents retrieve previous context via:
|
|
105
|
-
```
|
|
106
|
-
context_get(slug, "latest") # most recent checkpoint
|
|
107
|
-
context_get(slug, "phase:3") # specific phase
|
|
108
|
-
context_list(slug) # all checkpoints
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Long-Session Progress
|
|
112
|
-
Every 5 turns during a long session, update STATUS.md with:
|
|
113
|
-
- Current phase
|
|
114
|
-
- Completed tasks
|
|
115
|
-
- Pending tasks
|
|
116
|
-
- Any blockers
|
|
10
|
+
- For a known background task, wait only on its returned task ID; do not poll or start dependent work before it completes.
|
|
11
|
+
- For transient dispatch failures, use the single retry and fallback policy in `Zeus Timeout & Retry`. A refusal or failed check is information to act on, not a reason to repeat the same attempt.
|
|
12
|
+
- If the same task makes no progress after one corrected route, stop and report the blocker or ask one focused question. Do not invent task IDs, session APIs, or recovery state.
|
|
13
|
+
- Use progress checkpoints only for work expected to span more than five turns. State what is complete, what remains, and any blocker; do not create a status file for bounded work.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Zeus-only council memory procedures"
|
|
3
|
+
name: "Zeus Memory Operations"
|
|
4
|
+
agents: [zeus]
|
|
5
|
+
fallback: shared
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Zeus Memory Operations
|
|
9
|
+
|
|
10
|
+
## Routing
|
|
11
|
+
|
|
12
|
+
Use the task-start memory result for context and static agent descriptions for routing. Do not add KV/cache calls to ordinary dispatches.
|
|
13
|
+
|
|
14
|
+
## Council Decisions
|
|
15
|
+
|
|
16
|
+
Before a council, search separately from the required task-start search:
|
|
17
|
+
`memory_search(query=question, top_k=2, namespace="council_decisions")`.
|
|
18
|
+
Use a recent, directly matching decision only after checking current context;
|
|
19
|
+
otherwise treat it as background, never as authority to skip a needed review.
|
|
20
|
+
|
|
21
|
+
Persist only reusable, material decisions. Use
|
|
22
|
+
`key="council:<yyyy-mm-dd>:<slug>"`; JSON-stringify both `value` and
|
|
23
|
+
`metadata` for `memory_store(namespace="council_decisions", ...)`. Keep the
|
|
24
|
+
record concise: question, recommendation, specialists, confidence, unresolved
|
|
25
|
+
trade-off, and timestamp. Use `default` for routine summaries and @mnemosyne
|
|
26
|
+
for ADRs.
|
|
@@ -1,139 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "
|
|
2
|
+
description: "Bounded retries and lightweight subtask routing for Zeus"
|
|
3
3
|
name: "Zeus Timeout & Retry"
|
|
4
|
-
|
|
4
|
+
agents: [zeus]
|
|
5
|
+
fallback: shared
|
|
5
6
|
---
|
|
6
7
|
|
|
7
|
-
#
|
|
8
|
+
# Bounded delegation
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Use the native `task()` result as the source of truth. Do not simulate per-agent timers, poll without a known background task ID, or check for reusable sessions through APIs that are not available. `routing.yml` defines the concurrency limit, retry count, and canonical fallback chains.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
For a transient dispatch failure (timeout, crash, or empty response), retry that agent once. If it fails again, follow its configured fallback chain left-to-right once; if none is configured or the chain is exhausted, report what failed and stop. Never retry a refusal, failed test, validation, or migration as though it were a dispatch error. Do not restart an exhausted chain.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|------------|---------|-------------|----------|---------------------|------------------|
|
|
15
|
-
| Explorer (@apollo) | 60s | 2 retries, exp backoff | @athena (plan) → @hermes (impl) | ✅ Yes | low |
|
|
16
|
-
| Implementer (@hermes, @aphrodite, @demeter) | 180s | 3 retries, exp backoff | @talos (hotfix) → @athena (replan) | ❌ No | medium |
|
|
17
|
-
| Reviewer (@themis) | 120s | 3 retries, exp backoff | @zeus (escalate) → user | ❌ No | high |
|
|
18
|
-
| Infrastructure (@prometheus) | 300s | 3 retries, exp backoff | @hermes (config) → @zeus (escalate) | ❌ No | medium |
|
|
19
|
-
| Hotfix (@talos) | 30s | 2 retries, no backoff | @hermes (full fix) | ✅ Yes | low |
|
|
20
|
-
| Remote Sensing (@gaia) | 120s | 2 retries, exp backoff | @hermes (generic) | ✅ Yes | high |
|
|
14
|
+
Fallbacks for auth/security/data/schema work must preserve specialist competence, Themis review, and human approval. Full-auto does not bypass these gates.
|
|
21
15
|
|
|
22
|
-
##
|
|
16
|
+
## Lightweight subtask
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
Task dispatch → timeout elapsed → log timeout
|
|
26
|
-
├─ retry_count > 0 → retry with exponential backoff → decrement retry_count
|
|
27
|
-
│ └─ still failing? → retry again (up to retry_count limit)
|
|
28
|
-
│
|
|
29
|
-
├─ retries exhausted → FALLBACK CHAIN:
|
|
30
|
-
│ ├─ fallback[0] exists? → dispatch to fallback agent
|
|
31
|
-
│ │ └─ keep original task spec + context; add error context
|
|
32
|
-
│ ├─ fallback[1] exists? → dispatch to second fallback
|
|
33
|
-
│ └─ all fallbacks failed? → ESCALATE
|
|
34
|
-
│
|
|
35
|
-
├─ no fallbacks defined → return TIMEOUT error to user
|
|
36
|
-
│
|
|
37
|
-
└─ ESCALATE: "Agent X failed after N retries. Fallbacks Y, Z also failed.
|
|
38
|
-
Options: (a) try different agent, (b) simplify scope, (c) manual"
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Fallback Chain Definitions
|
|
44
|
-
|
|
45
|
-
Each fallback chain is evaluated left-to-right: if the first fallback fails, try the second, etc.
|
|
46
|
-
|
|
47
|
-
| Agent | Fallback[0] | Fallback[1] | Escalate To |
|
|
48
|
-
|-------|------------|------------|-------------|
|
|
49
|
-
| @apollo | @athena (plan scoped task) | @hermes (implement search) | @zeus |
|
|
50
|
-
| @hermes | @talos (minimal fix) | @athena (replan + simplify) | @zeus |
|
|
51
|
-
| @aphrodite | @talos (CSS/UX fix) | @hermes (generic fallback) | @zeus |
|
|
52
|
-
| @demeter | @hermes (generic backend) | @athena (replan schema) | @zeus |
|
|
53
|
-
| @themis | @zeus (direct escalation) | — | user |
|
|
54
|
-
| @prometheus | @hermes (config/deploy) | @zeus | user |
|
|
55
|
-
| @talos | @hermes (full implementation) | — | @zeus |
|
|
56
|
-
| @hephaestus | @nyx (observability debug) | @hermes (generic) | @zeus |
|
|
57
|
-
| @nyx | @hermes (generic) | — | @zeus |
|
|
58
|
-
| @iris | @zeus (manual override) | — | user |
|
|
59
|
-
| @mnemosyne | @zeus (manual) | — | user |
|
|
60
|
-
|
|
61
|
-
### Escalation Protocol
|
|
62
|
-
When ALL fallbacks fail:
|
|
63
|
-
1. Log the full failure chain: which agents were tried, what error each returned
|
|
64
|
-
2. Report to user: "Task [X] failed. Tried: [agent list]. Error: [summary]."
|
|
65
|
-
3. Offer options: (a) try different approach, (b) simplify scope, (c) manual fix
|
|
66
|
-
4. NEVER retry the same chain automatically — break the cycle
|
|
67
|
-
|
|
68
|
-
### Session Reuse Check
|
|
69
|
-
Before dispatching a task, check if a reusable session exists:
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
@hermes — continuing from previous session.
|
|
73
|
-
Files already explored: backend/routers/auth.py, backend/services/auth_service.py.
|
|
74
|
-
New task: add refresh token rotation.
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Use `session_max` from routing.yml to determine how many sessions to keep per agent.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
# 📦 SUBTASK DISPATCH (Lightweight Delegation)
|
|
82
|
-
|
|
83
|
-
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.
|
|
84
|
-
|
|
85
|
-
## When to Use Subtask vs Full Task
|
|
86
|
-
|
|
87
|
-
> **REGRA DE OURO:** Quando em dúvida, use full task. Subtask é para o que você tem 100% de certeza que é seguro pular revisão.
|
|
88
|
-
|
|
89
|
-
### Subtask Decision Tree (run BEFORE every delegation)
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
□ Scope: ≤2 files AND ≤10 lines changed? [YES→continue | NO→full task]
|
|
93
|
-
□ Risk: No schema change, no security impact? [YES→continue | NO→full task]
|
|
94
|
-
□ Auth: No authentication/authorization logic? [YES→continue | NO→full task]
|
|
95
|
-
□ Data: No data loss risk, no migration? [YES→continue | NO→full task]
|
|
96
|
-
□ Review: Output does NOT feed into Themis review? [YES→continue | NO→full task]
|
|
97
|
-
|
|
98
|
-
ALL YES → subtask (skip artifact + Themis)
|
|
99
|
-
ANY NO → full task (IMPL artifact + Themis review mandatory)
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Comparison Table
|
|
103
|
-
|
|
104
|
-
| Aspect | Subtask | Full Task |
|
|
105
|
-
|--------|---------|-----------|
|
|
106
|
-
| Scope | Single file, <10 lines, read-only | Feature, multi-file, schema change |
|
|
107
|
-
| Risk | Low (no security/data implications) | Any risk level |
|
|
108
|
-
| Artifact | ❌ No IMPL artifact | ✅ IMPL artifact required |
|
|
109
|
-
| Themis review | ❌ None | ✅ Mandatory |
|
|
110
|
-
| Use case | Apollo discovery, Talos hotfix, bounded fix | Feature implementation, migration, API change |
|
|
111
|
-
|
|
112
|
-
### Concrete Examples
|
|
113
|
-
|
|
114
|
-
| Task | Scope | Risk | Subtask? | Why |
|
|
115
|
-
|------|-------|------|----------|-----|
|
|
116
|
-
| Fix typo in CSS class | 1 file, 1 line | None | ✅ | Bounded, no security impact |
|
|
117
|
-
| Add error handling to existing endpoint | 1 file, 5 lines | Low | ✅ | No schema change |
|
|
118
|
-
| Implement login endpoint | 2+ files, 50+ lines | High (auth) | ❌ | Security-critical, needs Themis |
|
|
119
|
-
| Database migration | 1 file, 15 lines | High (data) | ❌ | Data loss risk, needs rollback |
|
|
120
|
-
| Apollo codebase search | 0 files | None | ✅ | Read-only investigation |
|
|
121
|
-
| Update README | 1 file, 3 lines | None | ✅ | Documentation only |
|
|
122
|
-
|
|
123
|
-
### Safety Rules
|
|
124
|
-
1. **Bounded scope** — single file or read-only investigation
|
|
125
|
-
2. **Low risk** — no security implications, no data loss, no breaking changes
|
|
126
|
-
3. **No Themis dependency** — output doesn't feed into a phase that requires review
|
|
127
|
-
|
|
128
|
-
## Subtask Return Format
|
|
129
|
-
Return the standard `## subtask_summary` defined in `## Agent Return Format` (files_changed, summary, tests, coverage, tokens, status, blockers).
|
|
130
|
-
|
|
131
|
-
## Timeout Parcial (Partial Results)
|
|
132
|
-
|
|
133
|
-
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.`
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
# 📊 TIMEOUT TRACKING
|
|
138
|
-
|
|
139
|
-
Track in-flight delegations against the Timeout Behavior table above. Log timeouts to `/memories/session/timeout-log.md` for later analysis.
|
|
18
|
+
For clear, bounded, reversible, low-risk work, dispatch directly to one specialist. Skip routine plan/artifact phases and discovery; ask the specialist to inspect only relevant context, make the change, run focused verification, and return `subtask_summary`. Add planning, artifacts, Themis review, or approval only when scope or risk requires them.
|