pantheon-opencode 2.0.0-beta.5 → 2.0.0-rc.1

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 +6 -1
  2. package/AGENTS.md +1 -1
  3. package/CHANGELOG.md +67 -0
  4. package/README.md +169 -510
  5. package/README.pt-BR.md +177 -149
  6. package/bin/pantheon-init.mjs +1 -1
  7. package/commands/pantheon-deepwork.md +6 -1
  8. package/commands/pantheon.md +10 -5
  9. package/package.json +1 -1
  10. package/plugin.json +2 -2
  11. package/prompts/orchestrate-with-zeus.prompt.md +82 -290
  12. package/prompts/subtask.prompt.md +1 -1
  13. package/pyproject.toml +1 -1
  14. package/scripts/doctor.mjs +27 -11
  15. package/scripts/hooks/format-multi-language.sh +30 -48
  16. package/scripts/install/opencode.mjs +13 -1
  17. package/scripts/jev-live-probe.mjs +1 -1
  18. package/scripts/release-gates.mjs +19 -5
  19. package/scripts/skill-search.mjs +66 -7
  20. package/scripts/test-opencode-sandbox.sh +44 -15
  21. package/scripts/update.mjs +9 -2
  22. package/skills-lock.json +5 -3
  23. package/src/agents/aphrodite.md +2 -0
  24. package/src/agents/apollo.md +8 -206
  25. package/src/agents/athena.md +25 -29
  26. package/src/agents/hermes.md +3 -1
  27. package/src/agents/mnemosyne.md +1 -1
  28. package/src/agents/nyx.md +1 -1
  29. package/src/agents/prometheus.md +0 -203
  30. package/src/agents/talos.md +2 -0
  31. package/src/agents/themis.md +8 -3
  32. package/src/agents/zeus.md +18 -12
  33. package/src/instructions/memory-protocol.instructions.md +4 -0
  34. package/src/instructions/test-economy.instructions.md +1 -0
  35. package/src/instructions/zeus-council-synthesis.instructions.md +13 -1
  36. package/src/pantheon/goal-loop-config.ts +55 -0
  37. package/src/pantheon/native-vision.ts +9 -5
  38. package/src/pantheon/pantheon-decision-catalog.ts +8 -0
  39. package/src/pantheon/skill-search-tool.ts +193 -0
  40. package/src/pantheon/tools.ts +2 -0
  41. package/src/pantheon/vision.ts +14 -1
  42. package/src/plugin.ts +39 -7
  43. package/src/plugins/tui/dist/tui.d.ts +12 -2
  44. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  45. package/src/plugins/tui/dist/tui.js +1399 -365
  46. package/src/plugins/tui/dist/tui.js.map +1 -1
  47. package/src/plugins/tui/package-lock.json +2 -2
  48. package/src/plugins/tui/package.json +1 -1
  49. package/src/plugins/tui/src/autonomy-state.ts +149 -0
  50. package/src/plugins/tui/src/context-gauge.ts +64 -5
  51. package/src/plugins/tui/src/decision-router-state.ts +175 -6
  52. package/src/plugins/tui/src/index.tsx +25 -3
  53. package/src/plugins/tui/src/pantheon-settings-state.ts +99 -0
  54. package/src/plugins/tui/src/pantheon-settings.tsx +647 -103
  55. package/src/plugins/tui/src/tui-prefs.ts +161 -9
  56. package/src/plugins/tui/src/update-status.ts +27 -8
  57. package/src/routing.yml +9 -0
  58. package/src/skills/README.md +35 -25
  59. package/src/skills/fast-path-execution/SKILL.md +54 -0
  60. package/src/skills/prompt-refinery/SKILL.md +53 -37
  61. package/src/skills/tdd-with-agents/SKILL.md +22 -10
  62. package/src/skills/test-slicing/SKILL.md +56 -0
  63. package/src/skills/verification-planning/SKILL.md +4 -3
@@ -5,56 +5,72 @@ description: "Turn a vague multi-concern request into a usable brief — interna
5
5
 
6
6
  # Prompt Refinery
7
7
 
8
- > **A vague request executes expensively and wrong. Tier 1 refines it INTERNALLY (the user sees the work begin); Tier 2 — only via `>>` — shows the full contract for confirmation.**
8
+ Turn ambiguous or multi-concern prompts into crisp, verifiable engineering briefs. Emulates Claude Code and ChatGPT Agent prompt architectures: zero-overhead pass-through by default, lean internal structuring for vague requests, and full visual contract only via `>>`.
9
+
10
+ ```mermaid
11
+ flowchart LR
12
+ In["User Request"] --> Eval{"Clarity & Scope?"}
13
+ Eval -->|"Clear & Bounded"| T0["Tier 0: Direct Execution<br/>(0 token overhead)"]
14
+ Eval -->|"Vague / Implicit"| T1["Tier 1: Silent Lean Extraction<br/>(< 8 lines, internal only)"]
15
+ Eval -->|"Prefix >>"| T2["Tier 2: Visual Contract<br/>(User confirmation)"]
16
+ ```
9
17
 
10
18
  ---
11
19
 
12
- ## When this fires — TRÊS NÍVEIS
13
-
14
- | Nível | Gatilho | O que acontece |
15
- |---|---|---|
16
- | **0 — Passa intacto** | Pedido claro e delimitado ("corrija o typo do README"), cumprimentos e conversa fiada (o `__SKIP__` do prompt-enhancer) | Executa direto, zero token de refinamento |
17
- | **1 — Ajuste mínimo INTERNO (automático)** | O sinal determinístico dispara | Reescreve o prompt **silenciosamente, para uso próprio**: PT corrigido, estrutura leve, expansão do implícito, lacunas viram escolhas com default declarado. SEM apresentar contrato, SEM pedir aprovação — o usuário vê o trabalho começar. Limite: o essencial (~10-15 linhas internas); escopo pode ser generoso quando o pedido pede |
18
- | **2 — Contrato completo** | **SOMENTE prefixo `>>`** | As seis seções inteiras apresentadas ao usuário para confirmar-ou-ajustar (a ÚNICA via com aprovação explícita) |
20
+ ## The Three Tiers
19
21
 
20
- O modelo ativo da sessão faz os dois níveis sem problema — o custo é controlado pelo LIMITE de saída de cada nível, não por trocar de modelo. Nível 1 nunca vira nível 2 sem o prefixo.
22
+ | Tier | Trigger | Behavior | Output Format |
23
+ |---|---|---|---|
24
+ | **0 — Pass-through** | Clear, bounded task ("fix typo in README", "run tests") | Executes immediately with zero refinement overhead | Direct execution |
25
+ | **1 — Silent Lean (Default)** | Unbounded scope, missing units/constraints, multi-concern | Silently extracts intent, slices, and defaults for own execution | Internal brief (< 8 lines) |
26
+ | **2 — Visual Contract** | **Prefix `>>` ONLY** | Presents full visual contract to user for explicit approval | Structured Markdown table & gates |
21
27
 
22
28
  ---
23
29
 
24
- ## The contract shape — tiers and caps
25
-
26
- **NÍVEL 1 — Ajuste mínimo INTERNO (o default do sinal determinístico):** reescrita para uso próprio, SEM apresentar ao usuário. O essencial + o que o pedido pedir (o escopo mínimo não é um aperto: expanda o implícito, estime o que falta com default declarado). Exemplo de saída aceitável:
30
+ ## Tier 1: Silent Lean Extraction (Internal Default)
27
31
 
32
+ Execute silently in session context. Never show to the user; begin work immediately:
28
33
  ```
29
- Objetivo: publicar deploys pendentes e liberar espaço nos VPS sem perder dados.
30
- Fatias: 1) identificar pendências vs produção 2) deploy por serviço 3) limpeza segura de disco.
31
- Aceite: lista de SHAs por serviço; espaço antes/depois; nada persistente apagado.
32
- Perguntas: quais VPS? (default: os que rodam estes serviços) | limpeza destrutiva? (default: não).
34
+ Target: [Single sentence: action verb + concrete outcome]
35
+ Slices: 1) [Slice A] 2) [Slice B] (2-4 independently testable steps)
36
+ Negative Constraints: [What NOT to touch or break; no new external deps]
37
+ Verification: [Exact test or lint command]
38
+ Defaults: [Assumed parameters, e.g. active branch, default ports]
33
39
  ```
34
40
 
35
- **NÍVEL 2 — Contrato completo (SOMENTE com o prefixo `>>`):** as seis seções abaixo, inteiras, apresentadas ao usuário para confirmar-ou-ajustar.
41
+ ---
42
+
43
+ ## Tier 2: Visual Contract (Prefix `>>` Only)
36
44
 
37
- Produce ALL of the following sections, filling from the request and marking real gaps as open questions — never invent requirements silently:
45
+ Presented to user for confirmation before starting:
38
46
 
39
- 1. **Objetivo do projeto** — one paragraph: what changes and why.
40
- 2. **Escopo em fatias numeradas** — each slice independently verifiable (audit/corrections; architecture/IA; nomenclature/statistics; UI/UX; …). Slices the user did not ask for go under "fora de escopo", not here.
41
- 3. **Critérios de aceite por fatia** — testable statements ("toda moeda passa por Decimal; nenhum float em valor monetário"), not vibes.
42
- 4. **Entregáveis esperados** — the concrete artifacts (report, route map, dictionary, implementation).
43
- 5. **Perguntas abertas** — the gaps that change the plan, with your recommended default for each so silence means "proceed with the default".
44
- 6. **Glossário/nomenclatura proposta** — when the domain has ambiguous terms, propose the canonical names up front.
47
+ ```markdown
48
+ ### Proposed Scope & Execution Plan
49
+
50
+ | Slice | Focus Area | Target Files | Verification Gate |
51
+ |---|---|---|---|
52
+ | 1. Model / Schema | Data structure | `src/models/...` | Unit tests / migrations |
53
+ | 2. Implementation | Core business logic | `src/services/...` | Sliced test command |
54
+ | 3. Integration | E2E & lint check | `tests/...` | Full gate / `ruff` / `biome` |
55
+
56
+ - **In Scope:** [Concrete additions or changes]
57
+ - **Out of Scope & Negative Constraints:** [Explicit exclusions; files/systems not to touch]
58
+ - **Acceptance Criteria:**
59
+ - [ ] Observable completion condition
60
+ - [ ] Test verification passes cleanly
61
+ - **Open Questions (with Recommended Defaults):**
62
+ - [Question]? *(Default: [Recommended choice] — proceed if no objections)*
63
+ ```
45
64
 
46
65
  ---
47
66
 
48
- ## Operating rules
49
-
50
- - **Tier 1 é INTERNO**: o ajuste mínimo acontece na cabeça do agente — o usuário vê o trabalho começar, não o reescrito. Aprovação explícita só existe no Tier 2 (`>>`).
51
- - **Domain mapping stays the ladder's**: after confirmation, slices route through the normal discovery ladder (local selector → Jev → specialist dispatch). The contract is the SPEC, not the dispatcher.
52
- - **Preserve the user's language** (a PT-BR request refines into PT-BR).
53
- - **Falha = fail-open**: qualquer erro no rewrite e o prompt ORIGINAL segue — nunca bloqueia.
54
- - **Nudge self-cancel cheap** (do claude-code-prompt-improver): perguntas abertas com "se isso não se aplicar ao seu caso, ignore" — o nudge barato se anula sozinho quando o palpite erra.
55
- - **Perguntas pela tool `question` nativa** (NUNCA Jev — decisão de paid/free; não prosa solta): uma lacuna que BLOQUEIA a execução vira uma pergunta com opções e o default recomendado. Lacuna não-bloqueante vira escolha com default declarado e segue.
56
- - **`extra_instructions` do projeto**: convenções do projeto (stack, hosts de deploy, domínios como cupons ML/AliExpress) têm PRIORIDADE sobre os defaults recomendados — leia o AGENTS.md do projeto antes de propor defaults.
57
- - **Referências**: `omkarxpatel/prompt-enhancer` (prefixo opt-in, cap de saída, fail-open) e `severity1/claude-code-prompt-improver` (nudges self-cancel, clarificação com opções) — os dois designs que este skill incorpora.
58
- - **Modelo**: o rewrite roda no modelo ativo da sessão; o controle de custo é o CAP de cada nível (interno ~10-15 linhas; completo = as seis seções) — quando houver modelo free/rápido no preset ativo (ex.: mimo-v2.5-free, deepseek-v4-flash-free), prefira-o via routing para o turno de rewrite.
59
- - **One refinement turn.** The rewrite is a single planning pass on the session model — no extra provider call, no Jev needed for the rewrite itself (decision models answer typed scalars, they do not write prose).
60
- - **Cost honesty**: the refinement costs roughly one planning turn (~1–4K tokens each way). The expensive thing is executing a mis-specified request; this skill buys that back.
67
+ ## Operating Rules
68
+
69
+ 1. **Tier 1 is Silent & Fast:** The agent extracts structure internally. The user sees execution start immediately, never an intermediate confirmation dialog.
70
+ 2. **Tier 2 Requires `>>`:** Only explicit `>>` prefix requests trigger user-visible contract confirmation.
71
+ 3. **Language Consistency:** Always preserve the user's language (PT-BR requests produce PT-BR briefs).
72
+ 4. **Fail-Open:** Any error during refinement falls back to the original prompt without blocking.
73
+ 5. **Ambiguity Resolution:**
74
+ - With decision router active, use `pantheon_jev_decide` (mode: `choice`) for non-trivial architectural trade-offs.
75
+ - Fall back to native `question` tool with options and marked defaults if Jev is off or unavailable.
76
+ - Non-blocking gaps use sensible declared defaults.
@@ -23,6 +23,18 @@ Use RED → GREEN → REFACTOR for behavior-changing implementation where a mean
23
23
 
24
24
  ---
25
25
 
26
+ ## Batched Suite Implementation vs Micro-Iterative TDD
27
+
28
+ - **Single Bug / Regression:** Use strict micro-iterative RED -> GREEN -> REFACTOR (write 1 test, confirm RED, write fix, confirm GREEN).
29
+ - **Complete Feature Suites / Multi-Endpoint Modules:** Do NOT repeat a 3-turn RED-wait-GREEN loop for every single function (which causes turn explosion and sluggishness). Instead:
30
+ 1. Author the cohesive test specification covering the new contract/suite.
31
+ 2. Implement the module components satisfying that contract.
32
+ 3. Run the targeted test slice ONCE via `test-slicing` (< 100ms).
33
+ 4. Iterate only on assertions that fail.
34
+ - **Lint-First Fast Gate:** Run static syntax/lint checks (`biome check`, `ruff check`) before launching test runners. Fixing typos and missing imports at the lint gate saves up to 80% of test turnaround time.
35
+
36
+ ---
37
+
26
38
  ## TDD Cycle (RED → GREEN → REFACTOR)
27
39
 
28
40
  ### RED — Write Failing Test
@@ -55,23 +67,23 @@ Use RED → GREEN → REFACTOR for behavior-changing implementation where a mean
55
67
 
56
68
  ```
57
69
  1. Use a plan/spec only when scope, risk, or ambiguity warrants it; a bounded fix may proceed directly
58
- 2. Hermes writes failing test (RED)
59
- 3. Hermes implements minimal code (GREEN)
60
- 4. Hermes refactors (REFACTOR)
61
- 5. Aphrodite writes frontend tests in parallel
70
+ 2. Author test specification (RED)
71
+ 3. Implement minimal code (GREEN)
72
+ 4. Refactor and optimize (REFACTOR)
73
+ 5. Run targeted test slice via test-slicing (< 100ms)
62
74
  6. Themis reviews sensitive or material changes, checking changed behavior and applicable quality gates
63
- 7. Escalate unmet repository or safety-critical test requirements; do not fail a micro-edit against an unrelated global coverage figure
75
+ 7. Escalate unmet repository or safety-critical test requirements
64
76
  ```
65
77
 
66
78
  ---
67
79
 
68
80
  ## Anti-Patterns
69
81
 
70
- - ❌ Writing code before test
71
- - ❌ Testing implementation details (private methods, internal state)
72
- - ❌ Mocking everything (test real behavior where possible)
73
- - ❌ Skipping RED step (test must fail first)
74
- - ❌ Ignoring flaky tests (fix or delete)
82
+ - Proibido: escrever codigo de producao sem teste correspondente
83
+ - Anti-pattern: testar detalhes de implementacao privada ou acoplamento excessivo
84
+ - Anti-pattern: mocking excessivo de I/O em vez de testes de integracao direta
85
+ - Anti-pattern: ignorar falhas de teste sem diagnosticar o diff
86
+ - Anti-pattern: executar a suite inteira para mudancas locais delimitadas
75
87
 
76
88
  ---
77
89
 
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: test-slicing
3
+ description: "Targeted test execution — map changed files directly to their narrow test slice instead of running full suites."
4
+ ---
5
+
6
+ # Test Slicing
7
+
8
+ > **Never run the entire repository test suite for an isolated micro-edit. Map modified files directly to their narrow test slice to save time, tokens, and context window.**
9
+
10
+ ---
11
+
12
+ ## When to Use
13
+
14
+ - Verifying bug fixes, refactors, or feature additions touching <= 3 files.
15
+ - Running focused checks during TDD (RED → GREEN → REFACTOR).
16
+ - CI-like broad suites (`npm test`, `pytest`) are reserved exclusively for:
17
+ - User explicitly asks to run full test suite.
18
+ - Final pre-release or pre-PR validation.
19
+ - Changes affecting core cross-cutting infrastructure, migrations, or auth.
20
+
21
+ ---
22
+
23
+ ## Slicing Rules by Ecosystem
24
+
25
+ | Runtime / Framework | Changed Source File | Sliced Test Command |
26
+ |---|---|---|
27
+ | **Node.js (Built-in test runner)** | `src/foo.ts` / `src/foo.js` | `node --test tests/foo.test.mjs` (or `npm test -- tests/foo.test.mjs`) |
28
+ | **Vitest** | `src/components/Button.tsx` | `npx vitest run src/components/Button.test.tsx` |
29
+ | **Jest** | `src/utils/calc.ts` | `npx jest src/utils/calc.test.ts` |
30
+ | **Pytest** | `src/service/auth.py` | `pytest tests/test_auth.py -k <test_func>` |
31
+ | **Playwright / E2E** | `src/pages/login.tsx` | Run single spec file only when UI contract changes |
32
+
33
+ ---
34
+
35
+ ## Lint-First Fast Gate (< 50ms)
36
+
37
+ Before launching the test runner (which requires 1–5s of process bootstrapping and environment initialization), run a static syntax/linter check on the modified file:
38
+ - **Python:** `ruff check <file>` (~20ms)
39
+ - **TypeScript / JavaScript:** `npx biome check <file>` (~30ms) or `tsc --noEmit`
40
+
41
+ Catching syntax errors, missing imports, and broken brackets at the lint gate saves up to 80% of test loop latency and avoids test runner crashes.
42
+
43
+ ---
44
+
45
+ ## Execution Guardrails
46
+
47
+ 1. **Timeout Budget:** A sliced check must complete in < 10 seconds. If a test hangs or takes > 30s, abort immediately and check background task/locks.
48
+ 2. **Failure Isolation:** When a test fails in the slice:
49
+ - Read the exact assertion failure and stack trace.
50
+ - Do NOT run unrelated test suites hoping for clues.
51
+ - Fix the targeted failure and re-run only the failing slice.
52
+ 3. **No Flaky Re-runs:** Do not blindly re-run the same failing test in a loop without inspecting code or diffs.
53
+ 4. **Token Economy:** Pass flags that suppress noise:
54
+ - Node: `node --test tests/foo.test.mjs` (clean output).
55
+ - Pytest: `pytest tests/test_foo.py -q --tb=short`.
56
+ - Jest/Vitest: `--bail --silent`.
@@ -47,6 +47,7 @@ Before making non-trivial changes, plan how you'll verify correctness. Define th
47
47
  | High | 5+ files, schema/API changes | Full plan + rollback test |
48
48
 
49
49
  ## Rules
50
- - Verification plan must be approved by @themis before implementation
51
- - Low risk: inline verification (1-2 lines in the task description)
52
- - Escalate to @athena if verification plan reveals unknown scope
50
+ - **Fast-Track (Low Risk, 1–2 files)**: Self-contained inline verification (1–2 lines). **Zero pre-implementation approval or delegation needed** — run the targeted test and proceed directly.
51
+ - **Medium Risk (3–5 files)**: Focused verification plan executed directly by the specialist. Run focused tests for changed paths; Themis review occurs after implementation only if behavioral ambiguity exists.
52
+ - **Deep-Track / High Risk (5+ files, Auth, Schema/DB, Payments)**: Verification plan must be approved by @themis before implementation.
53
+ - Escalate to @athena if verification planning reveals unknown scope.