pantheon-opencode 1.0.0

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 (128) hide show
  1. package/AGENTS.md +37 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1013 -0
  4. package/bin/pantheon-init.mjs +183 -0
  5. package/commands/pantheon-audit.md +25 -0
  6. package/commands/pantheon-bg.md +10 -0
  7. package/commands/pantheon-consolidate.md +11 -0
  8. package/commands/pantheon-deepwork.md +128 -0
  9. package/commands/pantheon-doc.md +10 -0
  10. package/commands/pantheon-focus.md +9 -0
  11. package/commands/pantheon-forget.md +58 -0
  12. package/commands/pantheon-hash.md +11 -0
  13. package/commands/pantheon-optimize.md +79 -0
  14. package/commands/pantheon-remember.md +44 -0
  15. package/commands/pantheon-search.md +48 -0
  16. package/commands/pantheon-status.md +71 -0
  17. package/commands/pantheon-todo.md +11 -0
  18. package/commands/pantheon.md +49 -0
  19. package/docs/AGENT-MCP.md +194 -0
  20. package/docs/ARCHITECTURE.md +384 -0
  21. package/docs/BRANCH-PROTECTION.md +142 -0
  22. package/docs/INDEX.md +81 -0
  23. package/docs/INSTALLATION.md +217 -0
  24. package/docs/MCP.md +238 -0
  25. package/docs/MEMORY.md +471 -0
  26. package/docs/MIGRATION-MEMORY-BANK.md +139 -0
  27. package/docs/PLATFORMS.md +5 -0
  28. package/docs/QUICKSTART.md +49 -0
  29. package/docs/README.md +18 -0
  30. package/docs/RELEASING.md +256 -0
  31. package/docs/SETUP.md +5 -0
  32. package/docs/UPGRADING.md +41 -0
  33. package/docs/mcp-recommendations.md +439 -0
  34. package/docs/mcp-tools.md +156 -0
  35. package/docs/mcp-user-guide.md +204 -0
  36. package/docs/persistence-mcp.md +111 -0
  37. package/package.json +72 -0
  38. package/pantheon.schema.json +158 -0
  39. package/scripts/__init__.py +0 -0
  40. package/scripts/_pantheon_paths.py +68 -0
  41. package/scripts/check-version-consistency.sh +23 -0
  42. package/scripts/code_mode_server.py +202 -0
  43. package/scripts/doctor.mjs +763 -0
  44. package/scripts/generate-prompts.sh +222 -0
  45. package/scripts/generate-routing-docs.mjs +104 -0
  46. package/scripts/hash_verify.py +192 -0
  47. package/scripts/init-pantheon-mcp.sh +118 -0
  48. package/scripts/install/agents-md.mjs +214 -0
  49. package/scripts/install/health-check.mjs +196 -0
  50. package/scripts/install/migrate.mjs +209 -0
  51. package/scripts/install/opencode.mjs +645 -0
  52. package/scripts/install/shared.mjs +655 -0
  53. package/scripts/install/venv.mjs +116 -0
  54. package/scripts/install-mcp.mjs +885 -0
  55. package/scripts/install.mjs +26 -0
  56. package/scripts/manifest.mjs +622 -0
  57. package/scripts/mcp_persistence_server.py +459 -0
  58. package/scripts/mcp_resources_server.py +206 -0
  59. package/scripts/memory_cache.py +78 -0
  60. package/scripts/memory_mcp_server.py +605 -0
  61. package/scripts/paths.py +64 -0
  62. package/scripts/prune_context.py +72 -0
  63. package/scripts/release-bundle.mjs +109 -0
  64. package/scripts/scrub-secrets.py +282 -0
  65. package/scripts/scrub_secrets.py +281 -0
  66. package/scripts/test-context-compression.sh +166 -0
  67. package/scripts/themis_heuristic_scan.py +287 -0
  68. package/scripts/todo_enforcer.py +242 -0
  69. package/scripts/uninstall.mjs +1057 -0
  70. package/scripts/validate-routing.mjs +160 -0
  71. package/scripts/validate_agent_frontmatter.py +226 -0
  72. package/scripts/versioning.mjs +254 -0
  73. package/skills-lock.json +16 -0
  74. package/src/agents/aphrodite.md +162 -0
  75. package/src/agents/apollo.md +109 -0
  76. package/src/agents/athena.md +226 -0
  77. package/src/agents/demeter.md +146 -0
  78. package/src/agents/gaia.md +82 -0
  79. package/src/agents/hephaestus.md +105 -0
  80. package/src/agents/hermes.md +302 -0
  81. package/src/agents/iris.md +99 -0
  82. package/src/agents/mnemosyne.md +226 -0
  83. package/src/agents/nyx.md +87 -0
  84. package/src/agents/prometheus.md +199 -0
  85. package/src/agents/talos.md +93 -0
  86. package/src/agents/themis.md +187 -0
  87. package/src/agents/zeus.md +209 -0
  88. package/src/instructions/agent-return-format.instructions.md +26 -0
  89. package/src/instructions/backend-standards.instructions.md +45 -0
  90. package/src/instructions/documentation-standards.instructions.md +53 -0
  91. package/src/instructions/frontend-standards.instructions.md +46 -0
  92. package/src/instructions/memory-protocol.instructions.md +67 -0
  93. package/src/instructions/yagni.instructions.md +21 -0
  94. package/src/instructions/zeus-anti-stall.instructions.md +72 -0
  95. package/src/instructions/zeus-communication-rules.instructions.md +15 -0
  96. package/src/instructions/zeus-council-synthesis.instructions.md +105 -0
  97. package/src/instructions/zeus-timeout-retry.instructions.md +127 -0
  98. package/src/mcp/_pantheon_paths.py +67 -0
  99. package/src/mcp/code_mode_server.py +202 -0
  100. package/src/mcp/init-pantheon-mcp.sh +118 -0
  101. package/src/mcp/install-mcp.mjs +885 -0
  102. package/src/mcp/mcp_persistence_server.py +458 -0
  103. package/src/mcp/mcp_resources_server.py +205 -0
  104. package/src/mcp/memory_mcp_server.py +604 -0
  105. package/src/mcp/requirements-mcp-core.txt +5 -0
  106. package/src/mcp/requirements-mcp.txt +5 -0
  107. package/src/plugin.ts +19 -0
  108. package/src/plugins/tui/dist/tui.js +143 -0
  109. package/src/plugins/tui/dist/tui.tsx +144 -0
  110. package/src/plugins/tui/package.json +32 -0
  111. package/src/plugins/tui/src/index.tsx +144 -0
  112. package/src/plugins/tui/tsdown.config.ts +22 -0
  113. package/src/routing.yml +499 -0
  114. package/src/skills/README.md +230 -0
  115. package/src/skills/agent-coordination/SKILL.md +95 -0
  116. package/src/skills/artifact-management/SKILL.md +118 -0
  117. package/src/skills/auto-continue/SKILL.md +280 -0
  118. package/src/skills/code-review-checklist/SKILL.md +139 -0
  119. package/src/skills/context-compression/SKILL.md +861 -0
  120. package/src/skills/git-workflow-and-versioning/SKILL.md +32 -0
  121. package/src/skills/incremental-implementation/SKILL.md +27 -0
  122. package/src/skills/memory-bank/SKILL.md +165 -0
  123. package/src/skills/orchestration-workflow/SKILL.md +311 -0
  124. package/src/skills/security-hardening/SKILL.md +36 -0
  125. package/src/skills/session-goal/SKILL.md +138 -0
  126. package/src/skills/spec-driven-development/SKILL.md +23 -0
  127. package/src/skills/tdd-with-agents/SKILL.md +170 -0
  128. package/src/skills/visual-review-pipeline/SKILL.md +200 -0
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: spec-driven-development
3
+ description: "Define requirements via spec-first before any code — PRD, edge cases, acceptance criteria"
4
+ ---
5
+
6
+ # Spec-Driven Development
7
+
8
+ **Não escreva código sem entender o problema primeiro.**
9
+
10
+ ## Workflow
11
+ 1. **Interview** — Extraia requisitos com perguntas iterativas (o usuário nunca sabe exatamente o que quer)
12
+ 2. **PRD** — Escreva um documento de requisitos: objetivo, personas, fluxos, regras de negócio, critérios de aceitação
13
+ 3. **Edge Cases** — Mapeie entradas inválidas, concorrência, falhas de API, estados vazios
14
+ 4. **Technical Spec** — Decisões de arquitetura: componentes, dados, API contracts, deploy
15
+ 5. **Approval** — Apresente ao usuário antes de codar. "É isso mesmo?"
16
+
17
+ ## Anti-patterns
18
+ - ❌ Pular direto pra implementação
19
+ - ❌ Assumir que entendeu sem confirmar
20
+ - ❌ Spec muito detalhada (5+ páginas) — mantenha enxuta
21
+
22
+ ## Output
23
+ `spec.md` no diretório raiz ou no `.pantheon/deepwork/<feature>/` — usado como input pro /plan.
@@ -0,0 +1,170 @@
1
+ ---
2
+ name: tdd-with-agents
3
+ description: "TDD enforcement with RED→GREEN→REFACTOR cycle and advanced testing patterns. Use for test-driven development across all layers."
4
+ context: fork
5
+ globs: []
6
+ alwaysApply: false
7
+ ---
8
+
9
+ # TDD with Agents
10
+
11
+ Enforce RED → GREEN → REFACTOR cycle across all implementation agents. Includes advanced testing patterns for E2E, load, mutation, and contract testing.
12
+
13
+ ---
14
+
15
+ ## Core Principle
16
+
17
+ > **Write the test FIRST. Watch it fail. Write minimal code to pass. Refactor with confidence.**
18
+
19
+ ---
20
+
21
+ ## TDD Cycle (RED → GREEN → REFACTOR)
22
+
23
+ ### RED — Write Failing Test
24
+ - Write test for the behavior you want
25
+ - Run it → **must fail** (confirms test works)
26
+ - Test should be specific: one assertion per test
27
+
28
+ ### GREEN — Make It Pass
29
+ - Write **minimal** code to pass the test
30
+ - No extra features, no premature optimization
31
+ - If it feels hard → design problem; refactor test
32
+
33
+ ### REFACTOR — Improve Without Breaking
34
+ - Clean up code while tests stay green
35
+ - Extract functions, rename, remove duplication
36
+ - Tests are your safety net
37
+
38
+ ---
39
+
40
+ ## Testing by Layer
41
+
42
+ ### Backend (Hermes)
43
+ ```python
44
+ # Unit: service logic
45
+ def test_calculate_discount_applies_percentage():
46
+ result = calculate_discount(100, 10)
47
+ assert result == 90.0
48
+
49
+ # Integration: API endpoint
50
+ def test_get_user_returns_404_for_missing():
51
+ response = client.get("/users/nonexistent")
52
+ assert response.status_code == 404
53
+
54
+ # Database: repository
55
+ def test_user_repository_saves_and_retrieves():
56
+ repo.save(User(id="1", name="Test"))
57
+ assert repo.find("1").name == "Test"
58
+ ```
59
+
60
+ ### Frontend (Aphrodite)
61
+ ```typescript
62
+ // Test behavior, not implementation
63
+ test('shows error message on invalid form', async () => {
64
+ render(<LoginForm />)
65
+ await userEvent.click(screen.getByText('Submit'))
66
+ expect(screen.getByText('Email is required')).toBeInTheDocument()
67
+ })
68
+ ```
69
+
70
+ ### Database (Demeter)
71
+ ```python
72
+ def test_migration_creates_users_table():
73
+ alembic upgrade(head)
74
+ assert inspector.has_table('users')
75
+
76
+ def test_migration_rollback_drops_table():
77
+ alembic upgrade(head)
78
+ alembic downgrade(-1)
79
+ assert not inspector.has_table('users')
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Advanced Testing Patterns
85
+
86
+ ### E2E Testing (Playwright)
87
+ ```typescript
88
+ test('user can complete full signup flow', async ({ page }) => {
89
+ await page.goto('/signup')
90
+ await page.fill('[name="email"]', 'test@example.com')
91
+ await page.fill('[name="password"]', 'secure123')
92
+ await page.click('button[type="submit"]')
93
+ await expect(page.locator('.welcome-banner')).toBeVisible()
94
+ })
95
+ ```
96
+
97
+ ### Load Testing (k6/Locust)
98
+ ```javascript
99
+ // k6 script
100
+ export const options = { vus: 50, duration: '30s' }
101
+ export default function () {
102
+ http.get('http://localhost:8000/api/users')
103
+ }
104
+ ```
105
+
106
+ ### Contract Testing (Pact)
107
+ ```python
108
+ # Provider verifies consumer contract
109
+ @pact.verify_provider
110
+ def test_provider_satisfies_consumer_contract():
111
+ # Verify all interactions from pact file
112
+ pass
113
+ ```
114
+
115
+ ### Mutation Testing
116
+ - Mutate source code (change `>` to `<`, remove conditions)
117
+ - Run tests → should fail (mutation killed)
118
+ - If tests pass → test is weak; improve it
119
+
120
+ ### Visual Regression
121
+ ```typescript
122
+ test('homepage looks the same', async ({ page }) => {
123
+ await page.goto('/')
124
+ await expect(page).toHaveScreenshot('homepage.png')
125
+ })
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Coverage Rules
131
+
132
+ - **Minimum: 80%** for all code
133
+ - **Critical paths: 100%** (auth, payments, data integrity)
134
+ - **No snapshot testing** — test behavior, not output shape
135
+ - **Test edge cases**: empty input, null, boundary values, errors
136
+
137
+ ---
138
+
139
+ ## Agent Responsibilities
140
+
141
+ | Agent | Tests |
142
+ |-------|-------|
143
+ | **Hermes** | Unit + integration for FastAPI endpoints, services, middleware |
144
+ | **Aphrodite** | Component behavior tests with React Testing Library |
145
+ | **Demeter** | Migration upgrade/downgrade, query correctness |
146
+ | **Themis** | Verifies coverage ≥80%, edge cases tested, error conditions |
147
+
148
+ ---
149
+
150
+ ## Workflow
151
+
152
+ ```
153
+ 1. Zeus/Athena defines feature with testable acceptance criteria
154
+ 2. Hermes writes failing test (RED)
155
+ 3. Hermes implements minimal code (GREEN)
156
+ 4. Hermes refactors (REFACTOR)
157
+ 5. Aphrodite writes frontend tests in parallel
158
+ 6. Themis reviews: coverage, edge cases, correctness
159
+ 7. If coverage <80% → NEEDS_REVISION
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Anti-Patterns
165
+
166
+ - ❌ Writing code before test
167
+ - ❌ Testing implementation details (private methods, internal state)
168
+ - ❌ Mocking everything (test real behavior where possible)
169
+ - ❌ Skipping RED step (test must fail first)
170
+ - ❌ Ignoring flaky tests (fix or delete)
@@ -0,0 +1,200 @@
1
+ ---
2
+ name: visual-review-pipeline
3
+ description: "Automated visual review pipeline — Playwright screenshots, self-analysis, fix loop, escalation. Used by Aphrodite for UI verification."
4
+ applyTo: "agents/{aphrodite,zeus}.agent.md"
5
+ ---
6
+
7
+ # Visual Review Pipeline
8
+
9
+ Automated visual review: Aphrodite captures screenshots via Playwright MCP → Self-analyzes for visual issues → Addresses findings in a loop.
10
+
11
+ ## Overview
12
+
13
+ This pipeline establishes a formal workflow for detecting and resolving visual regressions and design issues. It enforces structured JSON output, iteration limits, and escalation criteria to prevent infinite fix loops.
14
+
15
+ ### Pipeline Flow
16
+
17
+ ```
18
+ Aphrodite implements UI
19
+
20
+ Playwright screenshot (browser/screenshotPage)
21
+
22
+ Aphrodite self-analyzes (layout, contrast, responsive, accessibility)
23
+
24
+ ├─ verdict: pass → proceed to Themis review
25
+ ├─ verdict: fail + iteration < 3 → fix → re-capture
26
+ └─ verdict: fail + iteration = 3 → Zeus escalation
27
+ ```
28
+
29
+ ## Workflow Steps
30
+
31
+ ### Step 1: Capture
32
+ Aphrodite uses Playwright MCP to capture screenshots.
33
+ - Navigate to target URL or render component
34
+ - Capture full-page screenshot via `browser/screenshotPage`
35
+ - Capture viewport-specific screenshots for responsive checks
36
+ - Name files descriptively: `screenshot-iteration-N-component.png`
37
+
38
+ ### Step 2: Analyze
39
+ Aphrodite self-analyzes screenshots visually.
40
+ - Examine screenshot(s) for visual issues
41
+ - Identify problems in layout, contrast, responsive behavior, and accessibility
42
+ - Return findings in the structured JSON schema (below)
43
+ - Include iteration number in findings
44
+ - Mark issues with `pass_if_fixed` IDs
45
+
46
+ ### Step 3: Fix
47
+ Aphrodite addresses each finding from self-analysis.
48
+ - Triage findings by severity (critical → high → medium → low)
49
+ - Fix each issue in component code
50
+ - Commit changes with descriptive message
51
+ - Re-capture screenshot for next iteration
52
+
53
+ ### Step 4: Loop
54
+ Repeat Steps 1-3 for up to **3 iterations**.
55
+ - Each iteration must fix at least one `pass_if_fixed` issue
56
+ - Track iteration count in findings object
57
+ - If no progress detected (zero fixes applied), escalate immediately
58
+ - Compare before/after screenshots to verify fixes
59
+
60
+ ### Step 5: Escalate
61
+ Zeus intervenes if issues persist after 3 iterations.
62
+ - **Trigger:** 3 iterations exhausted or zero-progress detected
63
+ - **Action:** Zeus coordinates manual review or architectural decision
64
+
65
+ ## JSON Schema
66
+
67
+ Aphrodite must return findings in this exact structure:
68
+
69
+ ```json
70
+ {
71
+ "verdict": "pass | fail | warn",
72
+ "iteration": 1,
73
+ "max_iterations": 3,
74
+ "issues": [
75
+ {
76
+ "id": "VIS-001",
77
+ "category": "layout",
78
+ "severity": "high",
79
+ "description": "Sidebar overflows on viewport width < 768px",
80
+ "screenshot_region": "left-panel at x:0,y:0 width:300px",
81
+ "recommendation": "Add responsive breakpoint to collapse sidebar below 768px"
82
+ }
83
+ ],
84
+ "summary": "One-line summary of overall visual state",
85
+ "pass_if_fixed": ["VIS-001", "VIS-002"]
86
+ }
87
+ ```
88
+
89
+ ### Field Definitions
90
+
91
+ | Field | Type | Description |
92
+ |-------|------|-------------|
93
+ | `verdict` | enum | `pass` = no issues, `fail` = blocking, `warn` = non-blocking |
94
+ | `iteration` | int | Current iteration number (1-3) |
95
+ | `max_iterations` | int | Always 3 |
96
+ | `issues` | array | List of visual issues found |
97
+ | `issues[].id` | string | Unique ID in format `VIS-NNN` |
98
+ | `issues[].category` | enum | Issue category (see Categories) |
99
+ | `issues[].severity` | enum | Severity level (see Severity) |
100
+ | `issues[].description` | string | Clear description of the issue |
101
+ | `issues[].screenshot_region` | string | Bounding box or region reference |
102
+ | `issues[].recommendation` | string | Suggested fix |
103
+ | `summary` | string | One-line overall assessment |
104
+ | `pass_if_fixed` | string[] | Issue IDs that must be resolved to pass |
105
+
106
+ ## Categories
107
+
108
+ | Category | Description | Examples |
109
+ |----------|-------------|---------|
110
+ | `layout` | Positioning, alignment, overflow | Element misplaced, container overflow, z-index issues |
111
+ | `contrast` | Color contrast, visibility | Text hard to read, low contrast ratio |
112
+ | `responsive` | Mobile/tablet behavior | Elements break at specific breakpoints |
113
+ | `missing_element` | Expected element not rendered | Button not visible, icon missing |
114
+ | `typography` | Font, size, weight, spacing | Wrong font family, text truncation |
115
+ | `spacing` | Margins, padding, gaps | Uneven spacing, cramped elements |
116
+ | `accessibility` | ARIA, focus states, keyboard nav | Missing alt text, no focus ring |
117
+
118
+ ## Severity Levels
119
+
120
+ | Level | Description | Action Required |
121
+ |-------|-------------|-----------------|
122
+ | `critical` | Blocks user interaction or content | Must fix before merge |
123
+ | `high` | Significant visual regression | Must fix before merge |
124
+ | `medium` | Noticeable but not blocking | Fix in current sprint |
125
+ | `low` | Minor polish item | Backlog, fix when convenient |
126
+
127
+ ## Iteration Rules
128
+
129
+ 1. **Minimum progress:** Each iteration fixes at least one `pass_if_fixed` issue
130
+ 2. **No regression:** Fixes must not introduce new issues
131
+ 3. **Track state:** Include iteration count in findings JSON
132
+ 4. **Early exit:** If `verdict` is `pass`, stop iterating
133
+ 5. **Immediate escalation:** If zero issues fixed in an iteration, escalate to Zeus
134
+
135
+ ### Progress Detection
136
+ ```
137
+ Iteration N:
138
+ - Compare pass_if_fixed list to previous iteration
139
+ - If any ID removed from pass_if_fixed → progress detected
140
+ - If pass_if_fixed unchanged → zero progress → escalate
141
+ ```
142
+
143
+ ## Escalation Criteria
144
+
145
+ Zeus must be invoked when:
146
+ 1. **3 iterations exhausted** — issues cannot be resolved within the pipeline
147
+ 2. **Backend/data dependency** — issue requires API changes, data model updates, or backend fixes
148
+ 3. **Architectural issue** — problem stems from component architecture, not CSS/styling
149
+ 4. **Zero progress** — no `pass_if_fixed` issues resolved in an iteration
150
+ 5. **Conflicting fixes** — resolving one issue introduces another
151
+
152
+ **Escalation format:**
153
+ ```
154
+ @zeus Visual review escalation: [component] failed after [N] iterations.
155
+ Remaining issues: [list of unresolved pass_if_fixed IDs]
156
+ Root cause: [backend | architectural | conflicting]
157
+ ```
158
+
159
+ ## MCP Requirements
160
+
161
+ ### Playwright MCP (Required)
162
+ - Use `browser/screenshotPage` for full-page captures
163
+ - Use `browser/snapshot` for accessibility tree context
164
+ - Fallback: If Playwright MCP is unavailable, skip with warning:
165
+ ```
166
+ ⚠️ Playwright MCP unavailable — visual review skipped.
167
+ Install Playwright MCP server to enable visual review pipeline.
168
+ ```
169
+ For UI implementation review, Aphrodite self-reviews.
170
+
171
+ ## Integration Points
172
+
173
+ - **Code Review (Themis):** Visual review runs as part of frontend code review; findings feed into Themis's verdict.
174
+ - **Artifact Protocol:** Visual review findings can attach to `IMPL-` artifacts. Escalation decisions documented in `_notes/`.
175
+ - **Memory Bank:** Recurring visual issues documented in `01-active-context.md`. Architectural visual decisions recorded as `_notes/NOTE000X-*.md`.
176
+
177
+ ## Example Workflow
178
+
179
+ ```
180
+ 1. Aphrodite captures screenshot of LoginButton
181
+ → screenshot-iteration-1-login-button.png
182
+
183
+ 2. Self-analysis returns:
184
+ {
185
+ "verdict": "fail", "iteration": 1,
186
+ "issues": [{
187
+ "id": "VIS-001", "category": "contrast", "severity": "high",
188
+ "description": "White text on light blue bg, contrast ratio 2.1:1",
189
+ "recommendation": "Darken background to #1a56db"
190
+ }],
191
+ "pass_if_fixed": ["VIS-001"]
192
+ }
193
+
194
+ 3. Fix contrast, re-capture → screenshot-iteration-2-login-button.png
195
+
196
+ 4. Re-analysis: { "verdict": "pass", "iteration": 2, "issues": [],
197
+ "summary": "All visual issues resolved", "pass_if_fixed": [] }
198
+
199
+ 5. Pipeline complete — 2 iterations, all issues fixed.
200
+ ```