pantheon-opencode 1.6.0-beta.1 → 1.6.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/AGENTS.global.md +182 -0
  2. package/AGENTS.md +10 -891
  3. package/CHANGELOG.md +326 -0
  4. package/README.md +496 -32
  5. package/README.pt-BR.md +285 -20
  6. package/bin/pantheon-init.mjs +26 -3
  7. package/commands/pantheon-audit.md +7 -1
  8. package/commands/pantheon-consolidate.md +1 -1
  9. package/commands/pantheon-deepwork.md +14 -3
  10. package/commands/pantheon-focus.md +17 -0
  11. package/commands/pantheon-vision.md +61 -12
  12. package/package.json +21 -14
  13. package/plugin.json +2 -2
  14. package/pyproject.toml +8 -6
  15. package/scripts/build-agents-md.mjs +374 -56
  16. package/scripts/changelog-merge.mjs +161 -0
  17. package/scripts/{code_mode_server.py → code_mode.py} +3 -3
  18. package/scripts/cost.mjs +244 -41
  19. package/scripts/doctor.mjs +151 -1
  20. package/scripts/install/agents-md.mjs +4 -4
  21. package/scripts/install/config-migration.mjs +317 -4
  22. package/scripts/install/health-check.mjs +21 -19
  23. package/scripts/install/interactive.mjs +1 -1
  24. package/scripts/install/opencode-version.mjs +246 -4
  25. package/scripts/install/opencode.mjs +627 -179
  26. package/scripts/install/plugin.mjs +43 -9
  27. package/scripts/install/shared.mjs +120 -12
  28. package/scripts/install/vision-prompt.mjs +161 -0
  29. package/scripts/install-mcp.mjs +28 -9
  30. package/scripts/{mcp_persistence_server.py → mcp_persistence.py} +2 -2
  31. package/{src/mcp/mcp_resources_server.py → scripts/mcp_resources.py} +2 -2
  32. package/scripts/{memory_mcp_server.py → memory_mcp.py} +2 -2
  33. package/scripts/probe-context-rehydrate.mjs +8 -2
  34. package/scripts/probe-pantheon-cost.mjs +71 -15
  35. package/scripts/run-node-tests.mjs +189 -0
  36. package/scripts/sync-artifacts.mjs +26 -13
  37. package/scripts/sync-tui.mjs +24 -3
  38. package/scripts/test-opencode-v2-sandbox.sh +180 -26
  39. package/scripts/validate-routing.mjs +3 -3
  40. package/scripts/validate-sandbox-install.mjs +138 -0
  41. package/scripts/versioning.mjs +13 -1
  42. package/scripts/vision-status.mjs +682 -0
  43. package/skills-lock.json +8 -8
  44. package/src/agents/aphrodite.md +20 -37
  45. package/src/agents/apollo.md +7 -3
  46. package/src/agents/athena.md +63 -35
  47. package/src/agents/demeter.md +8 -28
  48. package/src/agents/gaia.md +1 -1
  49. package/src/agents/hephaestus.md +10 -21
  50. package/src/agents/hermes.md +15 -38
  51. package/src/agents/iris.md +1 -1
  52. package/src/agents/mnemosyne.md +18 -54
  53. package/src/agents/nyx.md +1 -1
  54. package/src/agents/prometheus.md +16 -20
  55. package/src/agents/talos.md +10 -2
  56. package/src/agents/themis.md +5 -5
  57. package/src/agents/zeus.md +99 -129
  58. package/src/instructions/agent-return-format.instructions.md +18 -3
  59. package/src/instructions/backend-standards.instructions.md +2 -0
  60. package/src/instructions/frontend-standards.instructions.md +3 -1
  61. package/src/instructions/memory-protocol.instructions.md +11 -110
  62. package/src/instructions/zeus-anti-stall.instructions.md +14 -61
  63. package/src/instructions/zeus-communication-rules.instructions.md +0 -1
  64. package/src/instructions/zeus-council-synthesis.instructions.md +32 -260
  65. package/src/instructions/zeus-memory-operations.instructions.md +26 -0
  66. package/src/instructions/zeus-timeout-retry.instructions.md +40 -87
  67. package/src/mcp/{code_mode_server.py → code_mode.py} +3 -3
  68. package/src/mcp/eval_store.py +2 -2
  69. package/src/mcp/{mcp_persistence_server.py → mcp_persistence.py} +2 -2
  70. package/{scripts/mcp_resources_server.py → src/mcp/mcp_resources.py} +2 -2
  71. package/src/mcp/{memory_mcp_server.py → memory_mcp.py} +2 -2
  72. package/src/mcp/{pantheon_vision_server.py → pantheon_vision.py} +286 -42
  73. package/src/mcp/requirements-mcp.txt +6 -4
  74. package/src/mcp/requirements-vision.txt +2 -2
  75. package/src/pantheon/cost-command.ts +399 -101
  76. package/src/pantheon/delegation-enforce.ts +10 -1
  77. package/src/pantheon/presets.d.mts +0 -8
  78. package/src/pantheon/presets.mjs +5 -32
  79. package/src/pantheon/v2-bounded-read.ts +640 -0
  80. package/src/pantheon/v2-delegation-enforce.ts +214 -0
  81. package/src/pantheon/v2-execute-after.ts +186 -0
  82. package/src/pantheon/v2-tools.ts +429 -0
  83. package/src/pantheon/v2-unsupported.d.mts +11 -0
  84. package/src/pantheon/v2-unsupported.mjs +90 -0
  85. package/src/pantheon/v2-vision.ts +622 -0
  86. package/src/pantheon/vision-local.ts +531 -0
  87. package/src/pantheon/vision.ts +1160 -115
  88. package/src/plugin-v2.ts +1145 -219
  89. package/src/plugin.ts +12 -9
  90. package/src/plugins/tui/dist/server.d.ts +1 -2
  91. package/src/plugins/tui/dist/server.d.ts.map +1 -1
  92. package/src/plugins/tui/dist/tui-v2.d.ts +154 -0
  93. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -0
  94. package/src/plugins/tui/dist/tui-v2.js +659 -0
  95. package/src/plugins/tui/dist/tui-v2.js.map +1 -0
  96. package/src/plugins/tui/dist/tui.d.ts +85 -82
  97. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  98. package/src/plugins/tui/dist/tui.js +72 -59
  99. package/src/plugins/tui/index-v2.ts +6 -0
  100. package/src/plugins/tui/package-lock.json +5516 -1353
  101. package/src/plugins/tui/package.json +22 -12
  102. package/src/plugins/tui/src/index-v2.tsx +734 -0
  103. package/src/plugins/tui/src/index.tsx +106 -85
  104. package/src/plugins/tui/src/opencode-v2.d.ts +13 -0
  105. package/src/plugins/tui/tsconfig.build.json +5 -0
  106. package/src/plugins/tui/tsconfig.typecheck.json +5 -0
  107. package/src/plugins/tui/tsdown.config.ts +22 -2
  108. package/src/plugins/tui/tui-v2.ts +2 -0
  109. package/src/plugins/tui/tui.ts +3 -0
  110. package/src/routing.yml +11 -21
  111. package/src/skills/README.md +3 -3
  112. package/src/skills/agent-coordination/SKILL.md +7 -2
  113. package/src/skills/artifact-management/SKILL.md +12 -5
  114. package/src/skills/auto-continue/SKILL.md +39 -30
  115. package/src/skills/code-review-checklist/SKILL.md +5 -5
  116. package/src/skills/context-compression/SKILL.md +26 -879
  117. package/src/skills/session-goal/SKILL.md +14 -5
  118. package/src/skills/spec-driven-development/SKILL.md +3 -1
  119. package/src/skills/tdd-with-agents/SKILL.md +18 -10
  120. package/opencode.json +0 -58
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: "Zeus-only council memory procedures"
3
+ name: "Zeus Memory Operations"
4
+ agents: [zeus]
5
+ fallback: shared
6
+ ---
7
+
8
+ # Zeus Memory Operations
9
+
10
+ ## Routing
11
+
12
+ Reuse relevant memory already present in the request or task context. If prior project history matters and no result is present, Zeus may do one targeted search and pass useful hits with the delegation. Do not search on every turn or add KV/cache calls to ordinary dispatches.
13
+
14
+ ## Council Decisions
15
+
16
+ Before a council, search separately from the task-level lookup only when a past council decision could affect the recommendation:
17
+ `memory_search(query=question, top_k=2, namespace="council_decisions")`.
18
+ Use a recent, directly matching decision only after checking current context;
19
+ otherwise treat it as background, never as authority to skip a needed review.
20
+
21
+ Persist only reusable, material decisions. Use
22
+ `key="council:<yyyy-mm-dd>:<slug>"`; JSON-stringify both `value` and
23
+ `metadata` for `memory_store(namespace="council_decisions", ...)`. Keep the
24
+ record concise: question, recommendation, specialists, confidence, unresolved
25
+ trade-off, and timestamp. Do not store routine subtask summaries or status
26
+ updates. Use the memory bank for ADRs only when explicitly requested.
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  description: "Timeout enforcement, retry policies, subtask dispatch, and timeout tracking for Zeus"
3
3
  name: "Zeus Timeout & Retry"
4
- applyTo: "agents/zeus.agent.md"
4
+ agents: [zeus]
5
+ fallback: shared
5
6
  ---
6
7
 
7
8
  # ⏱️ TIMEOUT & RETRY ENFORCEMENT
@@ -10,123 +11,75 @@ When a delegated agent does not respond in time, enforce the timeout policy from
10
11
 
11
12
  ## Timeout Behavior by Agent Role
12
13
 
13
- | Agent Role | Timeout | Retry Policy | Fallback Chain | Partial Results OK? | Reasoning Effort |
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
+ | Agent Role | Timeout | Retry Policy | Partial Results OK? | Reasoning Effort |
15
+ |------------|---------|--------------|---------------------|------------------|
16
+ | Explorer (@apollo) | 60s | 1 retry | ✅ Yes | low |
17
+ | Implementer (@hermes, @aphrodite, @demeter) | 180s | 1 retry | ❌ No | medium |
18
+ | Reviewer (@themis) | 120s | 1 retry | ❌ No | high |
19
+ | Infrastructure (@prometheus) | 300s | 1 retry | ❌ No | medium |
20
+ | Hotfix (@talos) | 30s | 1 retry | ✅ Yes | low |
21
+ | Remote Sensing (@gaia) | 120s | 1 retry | ✅ Yes | high |
21
22
 
22
23
  ## Retry Flow
23
24
 
24
25
  ```
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"
26
+ Initial attempt → timeout/failure → log it → make at most one retry
27
+ └─ retry fails → try fallback agents left-to-right with original task/context
28
+ └─ all fallbacks fail (or none exist) → report the chain and escalate
39
29
  ```
30
+ `background_delegation.retry_count: 1` means one retry after the initial attempt, not one total attempt. Never restart an exhausted chain automatically.
40
31
 
41
-
32
+ 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.
33
+ 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.
42
34
 
43
35
  ## Fallback Chain Definitions
44
36
 
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 |
37
+ `routing.yml` → `fallback_chains` is the canonical agent-by-agent mapping. Evaluate
38
+ the configured chain left-to-right; if an agent has no configured chain, stop
39
+ and escalate rather than guessing a fallback. Each listed fallback may be tried
40
+ at most once, and an exhausted chain is never restarted automatically.
60
41
 
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
42
+ ### Refusal Is a Routing Error
67
43
 
68
- ### Session Reuse Check
69
- Before dispatching a task, check if a reusable session exists:
44
+ For a domain/scope refusal, do not retry with a rephrased prompt. Correct the
45
+ route once only when the right specialist is clear; otherwise stop and ask.
46
+ Record one `DelegationCacheDecision` telemetry item for the corrected route,
47
+ including `reroute_from`, `reroute_to`, and `delegation_id` when available.
70
48
 
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
- ```
49
+ ### Escalation Protocol
50
+ 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.
76
51
 
77
- Use `session_max` from routing.yml to determine how many sessions to keep per agent.
52
+ ### Session Reuse Check
53
+ Check for a reusable session before dispatch and obey `session_max` in `routing.yml`.
78
54
 
79
55
  ---
80
56
 
81
57
  # 📦 SUBTASK DISPATCH (Lightweight Delegation)
82
58
 
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.
59
+ 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.
84
60
 
85
61
  ## When to Use Subtask vs Full Task
86
62
 
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.
63
+ 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.
88
64
 
89
65
  ### Subtask Decision Tree (run BEFORE every delegation)
90
66
 
91
67
  ```
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
68
+ □ Is the scope clear, bounded, and reversible? [YES→continue | NO→clarify/plan]
69
+ □ Does it avoid auth/security, data/schema, and destructive risk? [YES→continue | NO→full review/gates]
70
+ □ Is there no required Themis/audit handoff for this change? [YES→continue | NO→preserve that review]
103
71
 
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 |
72
+ ALL YES → direct/lightweight execution; no routine plan or artifact
73
+ ANY NO → add only the planning, artifact, specialist review, and approval gates the risk requires
74
+ ```
122
75
 
123
76
  ### Safety Rules
124
- 1. **Bounded scope** — single file or read-only investigation
77
+ 1. **Bounded scope** — can be a small multi-file change or a read-only investigation
125
78
  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
79
+ 3. **No required Themis dependency** — sensitive/material output retains its review gate
127
80
 
128
81
  ## Subtask Return Format
129
- Return the standard `## subtask_summary` defined in `## Agent Return Format` (files_changed, summary, tests, coverage, tokens, status, blockers).
82
+ Return the required `## subtask_summary` fields defined in `## Agent Return Format`; include `memory_context` when memory was used.
130
83
 
131
84
  ## Timeout Parcial (Partial Results)
132
85
 
@@ -5,12 +5,12 @@ Provides a confined execution environment for orchestration scripts
5
5
  via MCP tools and resources.
6
6
 
7
7
  Usage:
8
- python scripts/code_mode_server.py
8
+ python scripts/code_mode.py
9
9
 
10
10
  Or via MCP client (stdio transport):
11
11
  pantheon-code-mode:
12
12
  command: python
13
- args: ["scripts/code_mode_server.py"]
13
+ args: ["scripts/code_mode.py"]
14
14
  """
15
15
 
16
16
  from __future__ import annotations
@@ -36,7 +36,7 @@ from typing import Any
36
36
 
37
37
  import yaml
38
38
  from _pantheon_paths import pantheon_home, pantheon_project
39
- from mcp.server.fastmcp import FastMCP
39
+ from fastmcp import FastMCP
40
40
 
41
41
  # ── Constants ─────────────────────────────────────────────────────────────────
42
42
  ALLOWED_EXTENSIONS: frozenset[str] = frozenset({".sh", ".py"})
@@ -2,7 +2,7 @@
2
2
  """Plugin eval certification storage — ``plugin_eval`` memory namespace.
3
3
 
4
4
  Thin stdlib-only wrapper around the memory SQLite DB (same schema as
5
- ``src/mcp/memory_mcp_server.py``) for plugin-eval certification results.
5
+ ``src/mcp/memory_mcp.py``) for plugin-eval certification results.
6
6
 
7
7
  Namespace: ``plugin_eval``
8
8
  Key format: ``eval:<name>:<date>`` (e.g. ``eval:tdd-with-agents:2026-08-21``)
@@ -30,7 +30,7 @@ from typing import Any
30
30
 
31
31
  NAMESPACE = "plugin_eval"
32
32
 
33
- # Minimal schema — matches memory_mcp_server.SCHEMA_SQL for the memories
33
+ # Minimal schema — matches memory_mcp.SCHEMA_SQL for the memories
34
34
  # table (vec/FTS tables are initialized by the memory MCP server on first
35
35
  # run; eval entries remain readable via list/recall regardless).
36
36
  _SCHEMA_SQL = """
@@ -5,7 +5,7 @@ Key-Value store with FTS5 full-text search, TTL-based expiration,
5
5
  and namespace isolation. Uses SQLite with zero external dependencies.
6
6
 
7
7
  Usage:
8
- python scripts/mcp_persistence_server.py
8
+ python scripts/mcp_persistence.py
9
9
  """
10
10
 
11
11
  from __future__ import annotations
@@ -25,7 +25,7 @@ from pathlib import Path
25
25
  from typing import Annotated
26
26
 
27
27
  from _pantheon_paths import pantheon_home, pantheon_project
28
- from mcp.server.fastmcp import FastMCP
28
+ from fastmcp import FastMCP
29
29
  from pydantic import Field
30
30
 
31
31
  # ── Schema ──────────────────────────────────────────────────────────────────────
@@ -7,7 +7,7 @@ Provides MCP resources for the Pantheon agent framework:
7
7
  plans/status, memory-bank files
8
8
 
9
9
  Usage:
10
- python scripts/mcp_resources_server.py
10
+ python scripts/mcp_resources.py
11
11
  """
12
12
 
13
13
  from __future__ import annotations
@@ -19,7 +19,7 @@ from typing import Any
19
19
  import yaml
20
20
  from _pantheon_paths import has_symlink_component, pantheon_home, pantheon_project
21
21
  from eval_store import get_latest_eval, list_evals
22
- from mcp.server.fastmcp import FastMCP
22
+ from fastmcp import FastMCP
23
23
 
24
24
  # ── Path Resolution ──────────────────────────────────────────────────────────
25
25
  _PANTHEON_HOME: Path = pantheon_home()
@@ -19,7 +19,7 @@ Tools:
19
19
  memory_stats — DB statistics
20
20
 
21
21
  Usage:
22
- python scripts/memory_mcp_server.py
22
+ python scripts/memory_mcp.py
23
23
  """
24
24
 
25
25
  from __future__ import annotations
@@ -34,7 +34,7 @@ from pathlib import Path
34
34
  from typing import Annotated, Any
35
35
 
36
36
  from _pantheon_paths import pantheon_home
37
- from mcp.server.fastmcp import FastMCP
37
+ from fastmcp import FastMCP
38
38
  from pydantic import BeforeValidator, Field
39
39
 
40
40
  try: