pantheon-opencode 1.6.1 → 1.6.2-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 (115) hide show
  1. package/AGENTS.global.md +11 -11
  2. package/AGENTS.md +2 -2
  3. package/CHANGELOG.md +29 -0
  4. package/README.md +100 -19
  5. package/README.pt-BR.md +27 -11
  6. package/bin/pantheon-init.mjs +106 -19
  7. package/package.json +3 -2
  8. package/plugin.json +1 -1
  9. package/pyproject.toml +1 -1
  10. package/scripts/build-agents-md.mjs +1 -1
  11. package/scripts/doctor.mjs +213 -45
  12. package/scripts/install/agents-md.mjs +2 -1
  13. package/scripts/install/config-migration.mjs +344 -393
  14. package/scripts/install/config-paths.mjs +15 -0
  15. package/scripts/install/mcp-permissions.mjs +164 -0
  16. package/scripts/install/opencode-version.mjs +31 -13
  17. package/scripts/install/opencode-wildcard.mjs +106 -0
  18. package/scripts/install/opencode.mjs +240 -69
  19. package/scripts/install/plan-artifact.mjs +12 -1
  20. package/scripts/install/plugin.mjs +17 -1
  21. package/scripts/install/v2-capabilities.mjs +5 -6
  22. package/scripts/package-evidence.mjs +1 -0
  23. package/scripts/sandbox-env.sh +174 -0
  24. package/scripts/setup-v2-config.mjs +1703 -0
  25. package/scripts/setup.mjs +415 -0
  26. package/scripts/sync-tui.mjs +9 -1
  27. package/scripts/test-opencode-v2-sandbox.sh +438 -151
  28. package/scripts/update-skills-lock.mjs +30 -0
  29. package/skills-lock.json +10 -10
  30. package/src/agents/aphrodite.md +5 -2
  31. package/src/agents/apollo.md +5 -0
  32. package/src/agents/athena.md +6 -1
  33. package/src/agents/demeter.md +5 -1
  34. package/src/agents/gaia.md +4 -0
  35. package/src/agents/hephaestus.md +6 -1
  36. package/src/agents/hermes.md +6 -3
  37. package/src/agents/iris.md +5 -1
  38. package/src/agents/mnemosyne.md +20 -50
  39. package/src/agents/nyx.md +5 -1
  40. package/src/agents/prometheus.md +4 -0
  41. package/src/agents/talos.md +4 -0
  42. package/src/agents/themis.md +4 -0
  43. package/src/agents/zeus.md +9 -3
  44. package/src/instructions/agent-return-format.instructions.md +1 -1
  45. package/src/instructions/memory-protocol.instructions.md +3 -3
  46. package/src/instructions/test-economy.instructions.md +6 -6
  47. package/src/mcp/pantheon_vision.py +37 -36
  48. package/src/pantheon/cost-command.ts +30 -133
  49. package/src/pantheon/model-pricing.ts +1 -536
  50. package/src/pantheon/v2-vision.ts +34 -29
  51. package/src/pantheon/vision.ts +43 -10
  52. package/src/plugin-v2.ts +30 -53
  53. package/src/plugins/tui/THIRD_PARTY_NOTICES.md +24 -0
  54. package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js +749 -0
  55. package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js.map +1 -0
  56. package/src/plugins/tui/dist/quota-adapters.d.ts +89 -0
  57. package/src/plugins/tui/dist/quota-adapters.d.ts.map +1 -0
  58. package/src/plugins/tui/dist/quota-adapters.js +1142 -0
  59. package/src/plugins/tui/dist/quota-adapters.js.map +1 -0
  60. package/src/plugins/tui/dist/quota-cli.d.ts +17 -0
  61. package/src/plugins/tui/dist/quota-cli.d.ts.map +1 -0
  62. package/src/plugins/tui/dist/quota-cli.js +184 -0
  63. package/src/plugins/tui/dist/quota-cli.js.map +1 -0
  64. package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js +684 -0
  65. package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js.map +1 -0
  66. package/src/plugins/tui/dist/server-v2.d.ts +14 -0
  67. package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
  68. package/src/plugins/tui/dist/server-v2.js +796 -0
  69. package/src/plugins/tui/dist/server-v2.js.map +1 -0
  70. package/src/plugins/tui/dist/tui-v2.d.ts +375 -53
  71. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  72. package/src/plugins/tui/dist/tui-v2.js +5876 -530
  73. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  74. package/src/plugins/tui/dist/tui.js +1 -1
  75. package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js +118 -0
  76. package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js.map +1 -0
  77. package/src/plugins/tui/dist/usage-history-worker.js +25 -0
  78. package/src/plugins/tui/dist/usage-history-worker.js.map +1 -0
  79. package/src/plugins/tui/index-v2.ts +3 -6
  80. package/src/plugins/tui/package-lock.json +17 -2
  81. package/src/plugins/tui/package.json +6 -3
  82. package/src/plugins/tui/src/context-gauge.ts +59 -0
  83. package/src/plugins/tui/src/cost-data.ts +607 -0
  84. package/src/plugins/tui/src/go-key-diagnostic-ui.ts +100 -0
  85. package/src/plugins/tui/src/go-key-diagnostic.ts +125 -0
  86. package/src/plugins/tui/src/index-v2.tsx +231 -240
  87. package/src/plugins/tui/src/model-pricing.ts +536 -0
  88. package/src/plugins/tui/src/model-usage-limits.ts +4 -0
  89. package/src/plugins/tui/src/quota-adapters.ts +1598 -0
  90. package/src/plugins/tui/src/quota-cli.ts +237 -0
  91. package/src/plugins/tui/src/quota-rpc.ts +373 -0
  92. package/src/plugins/tui/src/quota-v2-model.ts +1032 -0
  93. package/src/plugins/tui/src/quota-v2.tsx +1238 -0
  94. package/src/plugins/tui/src/server-v2.ts +985 -0
  95. package/src/plugins/tui/src/sidebar-width.ts +129 -0
  96. package/src/plugins/tui/src/usage-history-contract.ts +217 -0
  97. package/src/plugins/tui/src/usage-history-validation.ts +104 -0
  98. package/src/plugins/tui/src/usage-history-view.tsx +236 -0
  99. package/src/plugins/tui/src/usage-history-worker.ts +25 -0
  100. package/src/plugins/tui/src/usage-view-model.ts +272 -0
  101. package/src/plugins/tui/tsconfig.typecheck.json +6 -1
  102. package/src/plugins/tui/tsdown.config.ts +44 -5
  103. package/src/routing.yml +72 -13
  104. package/src/skills/README.md +4 -0
  105. package/src/skills/agent-coordination/SKILL.md +0 -3
  106. package/src/skills/artifact-management/SKILL.md +0 -3
  107. package/src/skills/auto-continue/SKILL.md +0 -3
  108. package/src/skills/code-review-checklist/SKILL.md +0 -3
  109. package/src/skills/context-compression/SKILL.md +0 -3
  110. package/src/skills/memory-bank/SKILL.md +6 -28
  111. package/src/skills/session-goal/SKILL.md +0 -3
  112. package/src/skills/simplify/SKILL.md +5 -4
  113. package/src/skills/tdd-with-agents/SKILL.md +0 -3
  114. package/src/skills/visual-review-pipeline/SKILL.md +0 -1
  115. package/src/pantheon/memory-context.ts +0 -1017
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { createHash } from 'node:crypto'
4
+ import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'
5
+ import { join, relative } from 'node:path'
6
+ import { fileURLToPath } from 'node:url'
7
+
8
+ const ROOT = join(fileURLToPath(new URL('.', import.meta.url)), '..')
9
+ const SKILLS_DIR = join(ROOT, 'src', 'skills')
10
+ const LOCK_PATH = join(ROOT, 'skills-lock.json')
11
+
12
+ /** Rebuild the sorted SHA-256 inventory for every canonical skill file. */
13
+ function updateSkillsLock() {
14
+ const skillFiles = readdirSync(SKILLS_DIR, { withFileTypes: true })
15
+ .filter((entry) => entry.isDirectory())
16
+ .map((entry) => join(SKILLS_DIR, entry.name, 'SKILL.md'))
17
+ .filter((path) => existsSync(path))
18
+ .sort()
19
+
20
+ const lock = Object.fromEntries(
21
+ skillFiles.map((path) => [
22
+ relative(ROOT, path).split('\\').join('/'),
23
+ createHash('sha256').update(readFileSync(path)).digest('hex'),
24
+ ]),
25
+ )
26
+ writeFileSync(LOCK_PATH, `${JSON.stringify(lock, null, 2)}\n`)
27
+ process.stdout.write(`Updated ${Object.keys(lock).length} skill digests in skills-lock.json\n`)
28
+ }
29
+
30
+ updateSkillsLock()
package/skills-lock.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
- "src/skills/agent-coordination/SKILL.md": "d4bd70c18bc5726ea6784fe0a9c514446ca313e4c3ba4d658a0ff6658001aece",
3
- "src/skills/artifact-management/SKILL.md": "24dc1ca4660246ef37c3d3a5b246b7f63e3739f0ef741ed0a2e21d9abd3e9165",
4
- "src/skills/auto-continue/SKILL.md": "3fd4167b2e015510aec428098d27bb15854ba239c4dc7a064177d62e2353af86",
2
+ "src/skills/agent-coordination/SKILL.md": "ffa4cfc9c778dd9619665010de32d82d49ae5bb803c985dc99417eb6fc7c3d1c",
3
+ "src/skills/artifact-management/SKILL.md": "55446fbd0e13f9097d091b9773c37910409b70e26df5781bde8d903ff89a07fd",
4
+ "src/skills/auto-continue/SKILL.md": "090f61bfa1a394f5146e838c63e7e9d58f47a1f49bc84927e5cdfc07eaa4cc33",
5
5
  "src/skills/clonedeps/SKILL.md": "3e0b43cf96da98c83699dc48db3fd58fbfda84b9022bb70d3747875c81c3e124",
6
- "src/skills/code-review-checklist/SKILL.md": "6445513ab880efdb1005861ae13cb9a215f80b9d260f6278499f60771e07858c",
6
+ "src/skills/code-review-checklist/SKILL.md": "cbaffb89045e1bbb7c3c905248f953ec3faa2c1d4679bcd5320df99798df2f98",
7
7
  "src/skills/codemap/SKILL.md": "d21b3fa66b931b29dcf1ec0f0fcf1ec28514642a9f33f96e4b2901a0be74c72d",
8
- "src/skills/context-compression/SKILL.md": "346ed8697b8db42cc49403ee3dd38f9b775fe93cb55395d73c81b55cc77442d6",
8
+ "src/skills/context-compression/SKILL.md": "4d8368309ec72fefac69ad5cddd43650647d0bc684b6f8bf3cacc004edb56ef5",
9
9
  "src/skills/git-workflow-and-versioning/SKILL.md": "685a94041f1b4ce2a430301f517b89102055696267c369a7e8fb191606659276",
10
10
  "src/skills/incremental-implementation/SKILL.md": "7065ddb45da3c6b6751de07f290e92e6cb072e949a2e3aaae13ee7762f0a70fc",
11
11
  "src/skills/loop-engineering/SKILL.md": "f804e545821b9cca8fe0ec517307ed902446f28c2ca8ff9194c0f987cf7229e3",
12
- "src/skills/memory-bank/SKILL.md": "28bffa0f18cac99488d21563a544c1ade4319053621a6d846c2d7d623ffd79ba",
12
+ "src/skills/memory-bank/SKILL.md": "6c27623e5588b7ba44fbd0ea88e5061ed36894e1c7cbc88e50f003c2b463d9ff",
13
13
  "src/skills/reflect/SKILL.md": "4c7608c2a55cb8a50ac90fc0e2446bdf25e7914b1748cb7731c311d13c29dfdd",
14
14
  "src/skills/security-hardening/SKILL.md": "6d637e122421f7bc3b751f04854ad343a5a5d35249458bc8939233138fd3f20d",
15
- "src/skills/session-goal/SKILL.md": "08d2e3876e330207eebba065345b51e585d5363b596b7b71132dbf40b077efc4",
16
- "src/skills/simplify/SKILL.md": "aa739e9f75962a77d6574557d674ea01b5aea95e580b721d66c058753161b053",
15
+ "src/skills/session-goal/SKILL.md": "2911157c8e020f62ca015a73a46f5427f41da71c83e624d6a1cecf7d64c64aea",
16
+ "src/skills/simplify/SKILL.md": "1f3c06f4f856cbc8cdefcfe7fd260ad7382a441d8d9d9162671b17dc33aa6edd",
17
17
  "src/skills/spec-driven-development/SKILL.md": "ccfbc0c32116a1d144f5c12a4187c053322ed31625a622a58c59739a57a86743",
18
- "src/skills/tdd-with-agents/SKILL.md": "9d20607ea34fc3e02c7e3ef5186b103d84196bd9a13aaadd55a44f41339125da",
18
+ "src/skills/tdd-with-agents/SKILL.md": "be976bced6934233ed04778e84e939a5bd4e18805984c1d7c25852690060b34e",
19
19
  "src/skills/verification-planning/SKILL.md": "14186446ef51e1ba2c87b337e8d5f86e566d805156ab21fba2a75f8c4a99df3f",
20
- "src/skills/visual-review-pipeline/SKILL.md": "f6e65ff75a9325c38e0e9dde8e87f09b873e14e490936ef48aa80201bb68fe10",
20
+ "src/skills/visual-review-pipeline/SKILL.md": "a630b4f2a5e7ba8df55993684f6c33c615b27b50e8c11ec256bed641c31a9253",
21
21
  "src/skills/worktrees/SKILL.md": "9cf2b036e90d9ff7c6deb786ad7bab2cb78d6bf39166a67d5cbeafc29f593c6e"
22
22
  }
@@ -16,10 +16,13 @@ permission:
16
16
  "*": deny
17
17
  temperature: 0.3
18
18
  skills:
19
+ - incremental-implementation
20
+ - loop-engineering
21
+ - reflect
22
+ - simplify
19
23
  - tdd-with-agents
20
24
  - visual-review-pipeline
21
- - file-prompts
22
- - incremental-implementation
25
+ - worktrees
23
26
  mcp_tools:
24
27
  pantheon-resources: all
25
28
  pantheon-memory: [memory_search]
@@ -19,6 +19,11 @@ permission:
19
19
  temperature: 0.1
20
20
  skills:
21
21
  - auto-continue
22
+ - codemap
23
+ - loop-engineering
24
+ - reflect
25
+ - simplify
26
+ - worktrees
22
27
  mcp_tools:
23
28
  pantheon-resources: all
24
29
  pantheon-memory: [memory_search, code_query, code_neighbors]
@@ -10,8 +10,13 @@ mcp_tools:
10
10
  pantheon-resources: all
11
11
  pantheon-memory: [memory_search, code_query, code_neighbors]
12
12
  skills:
13
- - spec-driven-development
13
+ - loop-engineering
14
14
  - memory-bank
15
+ - reflect
16
+ - simplify
17
+ - spec-driven-development
18
+ - verification-planning
19
+ - worktrees
15
20
  permission:
16
21
  edit: deny
17
22
  hashline_edit: deny
@@ -13,8 +13,12 @@ permission:
13
13
  "*": deny
14
14
  temperature: 0.2
15
15
  skills:
16
- - tdd-with-agents
17
16
  - incremental-implementation
17
+ - loop-engineering
18
+ - reflect
19
+ - simplify
20
+ - tdd-with-agents
21
+ - worktrees
18
22
  mcp_tools:
19
23
  pantheon-resources: all
20
24
  pantheon-memory: [memory_search]
@@ -18,6 +18,10 @@ permission:
18
18
  temperature: 0.2
19
19
  skills:
20
20
  - auto-continue
21
+ - loop-engineering
22
+ - reflect
23
+ - simplify
24
+ - worktrees
21
25
  mcp_tools:
22
26
  pantheon-resources: all
23
27
  pantheon-memory: [memory_recall]
@@ -13,8 +13,13 @@ permission:
13
13
  "*": deny
14
14
  temperature: 0.3
15
15
  skills:
16
- - tdd-with-agents
17
16
  - auto-continue
17
+ - clonedeps
18
+ - loop-engineering
19
+ - reflect
20
+ - simplify
21
+ - tdd-with-agents
22
+ - worktrees
18
23
  mcp_tools:
19
24
  pantheon-resources: all
20
25
  pantheon-memory: [memory_search]
@@ -12,11 +12,14 @@ mcp_tools:
12
12
  pantheon-code-mode: [execute_code_script]
13
13
  temperature: 0.3
14
14
  skills:
15
- - tdd-with-agents
16
- - file-prompts
17
- - streaming-patterns
15
+ - clonedeps
18
16
  - git-workflow-and-versioning
19
17
  - incremental-implementation
18
+ - loop-engineering
19
+ - reflect
20
+ - simplify
21
+ - tdd-with-agents
22
+ - worktrees
20
23
  permission:
21
24
  bash: allow
22
25
  read: allow
@@ -16,8 +16,12 @@ permission:
16
16
  "*": deny
17
17
  temperature: 0.2
18
18
  skills:
19
- - git-workflow-and-versioning
20
19
  - artifact-management
20
+ - git-workflow-and-versioning
21
+ - loop-engineering
22
+ - reflect
23
+ - simplify
24
+ - worktrees
21
25
  mcp_tools:
22
26
  pantheon-resources: all
23
27
  pantheon-memory: [memory_recall]
@@ -18,9 +18,13 @@ mcp_tools:
18
18
  pantheon-code-mode: [execute_code_script]
19
19
  skills:
20
20
  - artifact-management
21
- - memory-bank
22
21
  - context-compression
22
+ - loop-engineering
23
+ - memory-bank
24
+ - reflect
23
25
  - session-goal
26
+ - simplify
27
+ - worktrees
24
28
  permission:
25
29
  bash: deny
26
30
  read: allow
@@ -73,52 +77,16 @@ If asked to edit code, refuse and redirect to the appropriate implementation age
73
77
  ## TOOLS NOT AVAILABLE
74
78
  - bash - forbidden
75
79
 
76
- ## Context Compression Handler (Level 2)
77
-
78
- Mnemosyne executes the expanded compression pipeline. When Zeus delegates compression:
79
-
80
- ### Compression Pipeline
81
- 1. **Receive**: Zeus sends batch with:
82
- - Subtask_summaries with priority scores (CRITICAL/HIGH/MEDIUM/LOW)
83
- - Semantic summaries for CRITICAL/HIGH entries
84
- - Cross-references to add (endpoints, tables, decisions)
85
- - IMPL/REVIEW artifacts to archive
86
- - Next phase agent info
87
-
88
- 2. **Privacy check**: Never store secrets, credentials, or tokens in durable memory. The current `memory_store` handler stores submitted values and metadata; automatic regex scrubbing/redaction is not guaranteed. Omit sensitive content or redact it before storing.
89
-
90
- 3. **Write ZZ artifact**: Create `.pantheon/memory-bank/.tmp/ZZ-phase{N}-context.md` with:
91
- - From/To agent info
92
- - Budget allocated/used
93
- - CRITICAL entries (expanded 3-line summaries)
94
- - HIGH entries (2-line summaries)
95
- - MEDIUM entries (1-line table rows)
96
- - Cross-references
97
-
98
- 4. **Update 01-active-context.md**: Append compressed entries to `## Completed Phases` section
99
- - CRITICAL: expanded (3 lines + summary)
100
- - HIGH: standard (2 lines)
101
- - MEDIUM: 1-line | LOW: 0.5-line (filename only)
102
- - Apply budget allocation (priority-greedy)
103
-
104
- 5. **Archive IMPL/REVIEW**: Append to `02-progress-log.md` (same as Level 1)
105
-
106
- 6. **Update Cross-References**:
107
- - Append new entries to `_xref/index.md`
108
- - Increment `_xref/_next_id.json`
109
-
110
- 7. **Optional durable memory**: Only when explicitly requested and the result is reusable across sessions, store one concise top-level decision/fact. Do not index every compressed entry, phase result, or artifact.
111
-
112
- 8. **Report**: Return the compression summary and any unresolved items; do not report memory-index counts unless an explicit store was requested.
113
-
114
- ### Write Protocol
115
- - Atomic write: .tmp → fsync → validate → rename
116
- - Secret handling: omit or manually redact secrets before durable storage; do not rely on automatic MCP scrubbing.
80
+ ## Context and Checkpoint Guidance
117
81
 
118
- ### Safety
119
- - NEVER compress ADR notes, active PLAN, NEEDS_REVISION/FAILED reviews
120
- - NEVER write over existing entries (idempotency by date+phase+agent hash)
121
- - NEVER delete _xref/ entries (append-only)
82
+ OpenCode's native compaction owns summarizing the active conversation. Do not
83
+ run a second phase-scoring, indexing, or transcript-copy pipeline. Use
84
+ `context_save` only for a concise checkpoint when the user requests one or the
85
+ task is expected to resume in another session; use `context_get` when resuming.
86
+ Keep the objective, current phase, completed work, next step, decisions,
87
+ blockers, and uncertain external outcomes. Do not save routine phase summaries,
88
+ tool logs, transcripts, or secrets. Durable `memory_store` follows the explicit
89
+ request policy below and remains separate from session checkpoints.
122
90
 
123
91
  ## Recall Handler (Level 3)
124
92
 
@@ -139,7 +107,9 @@ Mnemosyne recalls stored entries with the `memory_search` MCP tool:
139
107
  ```
140
108
 
141
109
  **Integration with compress_context:**
142
- Do not store each compressed entry automatically. Persist only one concise, reusable outcome when explicitly requested.
110
+ Native OpenCode compaction owns the active conversation. Do not create a Memory
111
+ Bank artifact or durable entry for each compacted phase. Persist a reusable
112
+ outcome only under the explicit memory-store policy.
143
113
 
144
114
  **Integration with Close sprint:**
145
115
  When `Close sprint` is called, do not create a durable-memory copy of temporary artifacts unless explicitly requested.
@@ -157,8 +127,8 @@ Use this only when the user or Zeus explicitly asks to preserve a reusable resul
157
127
 
158
128
  `pantheon-memory` stores durable SQLite entries with no entry TTL. Its search is
159
129
  FTS5/BM25 lexical matching only, with no semantic/vector fallback. Never store
160
- secrets, credentials, or tokens: the MCP stores submitted values and metadata
161
- without guaranteed automatic scrubbing.
130
+ secrets, credentials, or tokens: automatic regex scrubbing/redaction is not guaranteed.
131
+ The MCP stores submitted values and metadata.
162
132
 
163
133
  **Command:** `@mnemosyne Store <concise reusable result>`
164
134
 
@@ -172,7 +142,7 @@ without guaranteed automatic scrubbing.
172
142
  - Continue through explicitly requested memory-bank tasks
173
143
  - Do not start Quick-index or persistence operations automatically
174
144
  - Stop before destructive memory operations (delete, cleanup, compress with force)
175
- - For context compression pipeline: auto-continue through all 8 steps
145
+ - Native context compaction does not trigger a separate memory workflow
176
146
  - For Sprint close: auto-continue through final index → wipe .tmp/ → update progress
177
147
  - Partial results OK — memory operations are transactional and safe to interrupt
178
148
 
package/src/agents/nyx.md CHANGED
@@ -14,8 +14,12 @@ permission:
14
14
  "*": deny
15
15
  temperature: 0.1
16
16
  skills:
17
- - security-hardening
18
17
  - auto-continue
18
+ - loop-engineering
19
+ - reflect
20
+ - security-hardening
21
+ - simplify
22
+ - worktrees
19
23
  mcp_tools:
20
24
  pantheon-resources: all
21
25
  pantheon-memory: [memory_search]
@@ -15,6 +15,10 @@ temperature: 0.2
15
15
  skills:
16
16
  - git-workflow-and-versioning
17
17
  - incremental-implementation
18
+ - loop-engineering
19
+ - reflect
20
+ - simplify
21
+ - worktrees
18
22
  mcp_tools:
19
23
  pantheon-resources: all
20
24
  pantheon-memory: [memory_search]
@@ -12,6 +12,10 @@ permission:
12
12
  temperature: 0.3
13
13
  skills:
14
14
  - incremental-implementation
15
+ - loop-engineering
16
+ - reflect
17
+ - simplify
18
+ - worktrees
15
19
  mcp_tools:
16
20
  pantheon-resources: all
17
21
  pantheon-memory: [memory_recall]
@@ -14,8 +14,12 @@ permission:
14
14
  temperature: 0.1
15
15
  skills:
16
16
  - code-review-checklist
17
+ - loop-engineering
18
+ - reflect
17
19
  - security-hardening
20
+ - simplify
18
21
  - tdd-with-agents
22
+ - worktrees
19
23
  mcp_tools:
20
24
  pantheon-resources: all
21
25
  pantheon-memory: [memory_search]
@@ -18,11 +18,17 @@ mcp_tools:
18
18
  pantheon-vision: [vision_describe]
19
19
  skills:
20
20
  - agent-coordination
21
- - session-goal
22
21
  - artifact-management
23
- - context-compression
24
22
  - auto-continue
23
+ - codemap
24
+ - context-compression
25
25
  - incremental-implementation
26
+ - loop-engineering
27
+ - reflect
28
+ - session-goal
29
+ - simplify
30
+ - verification-planning
31
+ - worktrees
26
32
 
27
33
  ---
28
34
 
@@ -69,7 +75,7 @@ Zeus nunca toca no código. Use o menor fluxo que preserve segurança: encaminhe
69
75
 
70
76
  **Gates proporcionais** (via ferramenta root `question`, se visível):
71
77
  - Tarefa delimitada, reversível, de baixa incerteza e não sensível/sem mudança material em API visível ao usuário: não force planejamento nem aprovação de plano; se delegar, encaminhe uma vez ao especialista correto, que inspeciona o contexto necessário, altera, verifica o comportamento e resume.
72
- - Planejamento e discovery são sob demanda; council apenas quando o usuário invocar `/pantheon` ou uma decisão material realmente exigir perspectivas distintas. Nunca dispare council para correção pequena.
78
+ - Para um entregável delimitado, delegue uma vez ao especialista final; ele pode reunir os fatos necessários. Use Apollo à parte apenas se a pesquisa for o entregável ou bloquear a escolha do especialista. Planejamento e council ficam sob demanda; nunca dispare council para correção pequena.
73
79
  - Escopo amplo/material, alta incerteza, mudança de API visível ao usuário, auth/segurança, dados/schema/migração e operações destrutivas mantêm os gates de planejamento, revisão e aprovação aplicáveis; trabalho auth/segurança e dados/schema mantém revisão Themis.
74
80
  - Mantenha os agentes especializados disponíveis sob demanda; não remova uma especialidade com base em uma única tarefa ou observação de overhead.
75
81
  - Commit, push, merge, deploy de produção, alteração global, operação destrutiva e ampliação de permissões nunca são automáticos.
@@ -6,7 +6,7 @@ agents: ["*"]
6
6
 
7
7
  # Agent Return Format
8
8
 
9
- Implementation agents (Hermes, Aphrodite, Demeter, Hephaestus, Prometheus) MUST return results to Zeus in this format:
9
+ All agents check each result against the request and evidence; remove unrelated work, generic filler, unsupported claims, and unnecessary complexity; state uncertainty and preserve safety constraints. Implementation agents (Hermes, Aphrodite, Demeter, Hephaestus, Prometheus) MUST return results to Zeus in this format:
10
10
 
11
11
  ## subtask_summary
12
12
  **files_changed:** [list of file paths, one per line]
@@ -12,6 +12,6 @@ agents: ["*"]
12
12
  - Use a targeted query (`top_k=2`) and ignore weak matches; missing or irrelevant results never block current work.
13
13
 
14
14
  ### Persistence
15
- - Use only tools granted in the active session: Zeus has `memory_search` and temporary `context_save`/`context_get` checkpoints but no durable writes; Mnemosyne has `memory_store` and other durable tools.
16
- - Store at most one concise, reusable top-level result; never persist routine child summaries, phase updates, test logs, or temporary state. Confirm a successful write before claiming persistence. Never store secrets, credentials, or tokens; `memory_store` does not guarantee redaction, so omit or redact sensitive content first.
17
- - If no write tool is available or the write did not succeed, say the information was not persisted; never imply automatic storage or recovery. Add ADRs to the memory bank only when explicitly requested.
15
+ - Use only granted tools: Zeus has `memory_search` and temporary `context_save/get` checkpoints, but no durable writes; Mnemosyne has `memory_store` and other durable tools.
16
+ - Let native OpenCode compaction summarize active context. Use `context_save/get` only for cross-session resume; keep the goal, phase, progress, next step, decisions, blockers, and uncertain outcomes — no transcripts or routine logs.
17
+ - Store at most one concise, reusable top-level result only on explicit request. Never persist child summaries, test logs, or temporary state. Never store secrets, credentials, or tokens; confirm writes and state failures. Create ADRs only on request.
@@ -3,10 +3,10 @@ description: "Test economy — write smaller, focused suites; heavy install/E2E
3
3
  name: "Test Economy"
4
4
  ---
5
5
 
6
- Write the smallest test that proves the behavior: one behavior → one focused test; never duplicate coverage across suites or files.
6
+ Write one focused test per behavior; do not duplicate coverage.
7
7
 
8
- - No E2E, full-install, or network-dependent tests unless the change alters that end-to-end path; prefer unit or integration tests.
9
- - No assertions on copy/format strings, and none that only restate the implementation ("test the test").
10
- - Heavy or slow suites (real install/E2E) MUST be opt-in via a separate tier, never per edit or phase; respect a per-phase time budget and reserve the full suites for release gates.
11
- - Fixing a bug: one targeted regression test, not a broad new suite.
12
- - This economy rule does NOT weaken stronger gates: auth, security, data-integrity, and required coverage thresholds stay mandatory.
8
+ - Prefer unit/integration checks; use E2E, install, or network tests only when a change affects that path.
9
+ - Avoid assertions on copy/formatting or tests that merely restate the implementation.
10
+ - Default to focused tests; run the full suite only for scope, risk, or CI/release gates. Bug fixes need one regression test unless existing coverage catches them.
11
+ - Keep slow install/E2E suites opt-in, never per edit or phase; reserve them for release gates.
12
+ - Test economy does NOT weaken stronger gates: auth, security, data-integrity, and required coverage.
@@ -15,7 +15,6 @@ import json
15
15
  import logging
16
16
  import mimetypes
17
17
  import os
18
- import re
19
18
  import sqlite3
20
19
  import struct
21
20
  import sys
@@ -71,13 +70,8 @@ OPENCODE_ENDPOINT = "https://opencode.ai/zen/v1/chat/completions"
71
70
  # elsewhere.
72
71
  SESSION_HEADER = "x-opencode-session"
73
72
  _ZEN_ENDPOINT_PREFIX = "https://opencode.ai/zen/"
74
- # A session id is an opaque OpenCode token. Only the characters real ids use
75
- # (`ses_...`) plus the separators existing callers already pass are accepted;
76
- # the length is bounded. Anything else — empty, whitespace, control characters,
77
- # quotes, CR/LF — is rejected instead of being copied into the header, where a
78
- # CRLF would split it and let a caller inject extra headers/requests.
79
- _SESSION_ID_MAX_LENGTH = 128
80
- _SESSION_ID_PATTERN = re.compile(r"[A-Za-z0-9._:-]+")
73
+ # Keep in sync with src/pantheon/session-guard.ts: OpenCode accepts IDs that
74
+ # start with "ses". Do not add a narrower local format or length constraint.
81
75
  _ALLOWED_MIME_TYPES = {"image/png", "image/jpeg", "image/webp", "image/gif"}
82
76
  _EXTENSION_MIME_TYPES = {
83
77
  ".png": "image/png",
@@ -297,22 +291,19 @@ def _is_zen_endpoint(endpoint: str) -> bool:
297
291
 
298
292
 
299
293
  def _validated_session_id(value: object) -> str | None:
300
- """Return a session id safe to send in the Zen header, or None.
294
+ """Return a host-valid session id, following the shared ``ses`` contract."""
295
+ return value if isinstance(value, str) and value.startswith("ses") else None
301
296
 
302
- The value arrives from a tool parameter the plugin forwards (a local MCP
303
- process is not handed a session id by the host), so it is untrusted input:
304
- only a trimmed, bounded, token-shaped value is accepted. An empty or
305
- whitespace-only string, a control character, a quote, or an embedded
306
- CR/LF yields None so the header is simply omitted — never copied verbatim.
307
- """
308
- if not isinstance(value, str):
309
- return None
310
- candidate = value.strip()
311
- if not candidate or len(candidate) > _SESSION_ID_MAX_LENGTH:
312
- return None
313
- if _SESSION_ID_PATTERN.fullmatch(candidate) is None:
314
- return None
315
- return candidate
297
+
298
+ def _require_session_id(value: object) -> str:
299
+ """Return a valid session id or fail before any Zen-bound work."""
300
+ session_id = _validated_session_id(value)
301
+ if session_id is None:
302
+ raise VisionError(
303
+ "A valid OpenCode session id is required for Zen Vision; "
304
+ "retry from an active OpenCode session."
305
+ )
306
+ return session_id
316
307
 
317
308
 
318
309
  def _strip_provider_prefix(model: str) -> str:
@@ -637,13 +628,11 @@ async def _gateway(
637
628
  ) -> str:
638
629
  """Send one multimodal request to the selected OpenCode gateway.
639
630
 
640
- ``session_id`` (when present and valid — see ``_validated_session_id``) is
641
- sent as the ``x-opencode-session`` header — and ONLY for a Zen endpoint,
642
- which rejects the request with HTTP 400 ``MissingSessionID`` otherwise. An
643
- unusable value (empty, whitespace, control characters, CR/LF, quotes) is
644
- dropped rather than copied into the header. It is never logged and never
645
- sent to a non-Zen host.
631
+ A valid ``session_id`` is required before auth lookup or POST. It is sent as
632
+ ``x-opencode-session`` only for a Zen endpoint, and is never logged or sent
633
+ to a non-Zen host.
646
634
  """
635
+ safe_session_id = _require_session_id(session_id)
647
636
  key, endpoint = _resolve_auth()
648
637
  if not key:
649
638
  # Missing credential is FATAL here (unlike the graceful describe/ocr
@@ -680,8 +669,7 @@ async def _gateway(
680
669
  "Authorization": f"Bearer {key}",
681
670
  "Content-Type": "application/json",
682
671
  }
683
- safe_session_id = _validated_session_id(session_id)
684
- if safe_session_id is not None and _is_zen_endpoint(endpoint):
672
+ if _is_zen_endpoint(endpoint):
685
673
  headers[SESSION_HEADER] = safe_session_id
686
674
  try:
687
675
  async with httpx.AsyncClient(timeout=REQUEST_TIMEOUT_SECONDS) as client:
@@ -786,15 +774,21 @@ async def vision_describe(
786
774
  through the tool call because a local MCP process is not handed one by the
787
775
  host. It is sent only to a Zen endpoint and never logged.
788
776
  """
777
+ key, _endpoint = _resolve_auth()
778
+ session = None
779
+ if key:
780
+ try:
781
+ session = _require_session_id(session_id)
782
+ except Exception as exc:
783
+ return _error_message(exc)
789
784
  try:
790
785
  image = await _prepare_input(path)
791
786
  except Exception as exc:
792
787
  return _error_message(exc)
793
- key, _endpoint = _resolve_auth()
794
788
  if not key:
795
789
  return _local_vision_text(image)
796
790
  try:
797
- return await _gateway(image, prompt or _DESCRIBE_PROMPT, session_id=session_id)
791
+ return await _gateway(image, prompt or _DESCRIBE_PROMPT, session_id=session)
798
792
  except Exception as exc:
799
793
  return _error_message(exc)
800
794
 
@@ -807,15 +801,21 @@ async def vision_ocr(path: str, session_id: str | None = None) -> str:
807
801
  when no gateway credential is configured. ``session_id`` reaches the Zen
808
802
  gateway as the ``x-opencode-session`` header (see ``vision_describe``).
809
803
  """
804
+ key, _endpoint = _resolve_auth()
805
+ session = None
806
+ if key:
807
+ try:
808
+ session = _require_session_id(session_id)
809
+ except Exception as exc:
810
+ return _error_message(exc)
810
811
  try:
811
812
  image = await _prepare_input(path)
812
813
  except Exception as exc:
813
814
  return _error_message(exc)
814
- key, _endpoint = _resolve_auth()
815
815
  if not key:
816
816
  return _local_vision_text(image)
817
817
  try:
818
- return await _gateway(image, _OCR_PROMPT, session_id=session_id)
818
+ return await _gateway(image, _OCR_PROMPT, session_id=session)
819
819
  except Exception as exc:
820
820
  return _error_message(exc)
821
821
 
@@ -830,9 +830,10 @@ async def vision_analyze(path: str, session_id: str | None = None) -> str:
830
830
  (see ``vision_describe``).
831
831
  """
832
832
  try:
833
+ session = _require_session_id(session_id)
833
834
  image = await _prepare_input(path)
834
835
  content = await _gateway(
835
- image, _ANALYZE_PROMPT, structured=True, session_id=session_id
836
+ image, _ANALYZE_PROMPT, structured=True, session_id=session
836
837
  )
837
838
  parsed = _parse_json_object(content)
838
839
  if parsed is None: