opencodekit 0.0.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 (123) hide show
  1. package/README.md +258 -0
  2. package/dist/index.js +3391 -0
  3. package/dist/template/.opencode/.env.example +193 -0
  4. package/dist/template/.opencode/AGENTS.md +214 -0
  5. package/dist/template/.opencode/README.md +269 -0
  6. package/dist/template/.opencode/agent/build.md +75 -0
  7. package/dist/template/.opencode/agent/explore.md +66 -0
  8. package/dist/template/.opencode/agent/planner.md +83 -0
  9. package/dist/template/.opencode/agent/review.md +90 -0
  10. package/dist/template/.opencode/agent/rush.md +85 -0
  11. package/dist/template/.opencode/agent/scout.md +93 -0
  12. package/dist/template/.opencode/command/analyze-project.md +39 -0
  13. package/dist/template/.opencode/command/brainstorm.md +11 -0
  14. package/dist/template/.opencode/command/commit.md +11 -0
  15. package/dist/template/.opencode/command/create.md +118 -0
  16. package/dist/template/.opencode/command/design.md +15 -0
  17. package/dist/template/.opencode/command/finish.md +233 -0
  18. package/dist/template/.opencode/command/fix-ci.md +20 -0
  19. package/dist/template/.opencode/command/fix-types.md +10 -0
  20. package/dist/template/.opencode/command/fix-ui.md +22 -0
  21. package/dist/template/.opencode/command/fix.md +22 -0
  22. package/dist/template/.opencode/command/handoff.md +146 -0
  23. package/dist/template/.opencode/command/implement.md +167 -0
  24. package/dist/template/.opencode/command/import-plan.md +188 -0
  25. package/dist/template/.opencode/command/integration-test.md +36 -0
  26. package/dist/template/.opencode/command/issue.md +41 -0
  27. package/dist/template/.opencode/command/plan.md +158 -0
  28. package/dist/template/.opencode/command/pr.md +36 -0
  29. package/dist/template/.opencode/command/quick-build.md +13 -0
  30. package/dist/template/.opencode/command/research-and-implement.md +21 -0
  31. package/dist/template/.opencode/command/research-ui.md +32 -0
  32. package/dist/template/.opencode/command/research.md +153 -0
  33. package/dist/template/.opencode/command/resume.md +127 -0
  34. package/dist/template/.opencode/command/review-codebase.md +13 -0
  35. package/dist/template/.opencode/command/skill-create.md +29 -0
  36. package/dist/template/.opencode/command/skill-optimize.md +28 -0
  37. package/dist/template/.opencode/command/status.md +109 -0
  38. package/dist/template/.opencode/command/ui-review.md +28 -0
  39. package/dist/template/.opencode/dcp.jsonc +34 -0
  40. package/dist/template/.opencode/memory/README.md +128 -0
  41. package/dist/template/.opencode/memory/_templates/handoff.md +33 -0
  42. package/dist/template/.opencode/memory/_templates/research.md +29 -0
  43. package/dist/template/.opencode/memory/_templates/task-prd.md +43 -0
  44. package/dist/template/.opencode/memory/_templates/task-review.md +73 -0
  45. package/dist/template/.opencode/memory/_templates/task-spec.md +71 -0
  46. package/dist/template/.opencode/memory/design-guidelines.md +281 -0
  47. package/dist/template/.opencode/memory/handoffs/README.md +83 -0
  48. package/dist/template/.opencode/opencode.json +469 -0
  49. package/dist/template/.opencode/package.json +23 -0
  50. package/dist/template/.opencode/pickle-thinker.jsonc +11 -0
  51. package/dist/template/.opencode/plugin/README.md +162 -0
  52. package/dist/template/.opencode/plugin/notification.ts +88 -0
  53. package/dist/template/.opencode/plugin/sessions.ts +434 -0
  54. package/dist/template/.opencode/plugin/superpowers.ts +332 -0
  55. package/dist/template/.opencode/plugin/tsconfig.json +15 -0
  56. package/dist/template/.opencode/superpowers/.claude/settings.local.json +141 -0
  57. package/dist/template/.opencode/superpowers/.claude-plugin/marketplace.json +20 -0
  58. package/dist/template/.opencode/superpowers/.claude-plugin/plugin.json +13 -0
  59. package/dist/template/.opencode/superpowers/.codex/INSTALL.md +35 -0
  60. package/dist/template/.opencode/superpowers/.codex/superpowers-bootstrap.md +33 -0
  61. package/dist/template/.opencode/superpowers/.codex/superpowers-codex +267 -0
  62. package/dist/template/.opencode/superpowers/.github/FUNDING.yml +3 -0
  63. package/dist/template/.opencode/superpowers/.opencode/INSTALL.md +135 -0
  64. package/dist/template/.opencode/superpowers/.opencode/plugin/superpowers.js +215 -0
  65. package/dist/template/.opencode/superpowers/LICENSE +21 -0
  66. package/dist/template/.opencode/superpowers/README.md +165 -0
  67. package/dist/template/.opencode/superpowers/RELEASE-NOTES.md +493 -0
  68. package/dist/template/.opencode/superpowers/agents/code-reviewer.md +48 -0
  69. package/dist/template/.opencode/superpowers/commands/brainstorm.md +5 -0
  70. package/dist/template/.opencode/superpowers/commands/execute-plan.md +5 -0
  71. package/dist/template/.opencode/superpowers/commands/write-plan.md +5 -0
  72. package/dist/template/.opencode/superpowers/docs/README.codex.md +153 -0
  73. package/dist/template/.opencode/superpowers/docs/README.opencode.md +234 -0
  74. package/dist/template/.opencode/superpowers/docs/plans/2025-11-22-opencode-support-design.md +294 -0
  75. package/dist/template/.opencode/superpowers/docs/plans/2025-11-22-opencode-support-implementation.md +1095 -0
  76. package/dist/template/.opencode/superpowers/hooks/hooks.json +15 -0
  77. package/dist/template/.opencode/superpowers/hooks/session-start.sh +34 -0
  78. package/dist/template/.opencode/superpowers/lib/skills-core.js +208 -0
  79. package/dist/template/.opencode/superpowers/skills/brainstorming/SKILL.md +54 -0
  80. package/dist/template/.opencode/superpowers/skills/condition-based-waiting/SKILL.md +120 -0
  81. package/dist/template/.opencode/superpowers/skills/condition-based-waiting/example.ts +158 -0
  82. package/dist/template/.opencode/superpowers/skills/defense-in-depth/SKILL.md +127 -0
  83. package/dist/template/.opencode/superpowers/skills/dispatching-parallel-agents/SKILL.md +180 -0
  84. package/dist/template/.opencode/superpowers/skills/executing-plans/SKILL.md +76 -0
  85. package/dist/template/.opencode/superpowers/skills/finishing-a-development-branch/SKILL.md +200 -0
  86. package/dist/template/.opencode/superpowers/skills/frontend-aesthetics/SKILL.md +137 -0
  87. package/dist/template/.opencode/superpowers/skills/gemini-large-context/SKILL.md +205 -0
  88. package/dist/template/.opencode/superpowers/skills/receiving-code-review/SKILL.md +209 -0
  89. package/dist/template/.opencode/superpowers/skills/requesting-code-review/SKILL.md +105 -0
  90. package/dist/template/.opencode/superpowers/skills/requesting-code-review/code-reviewer.md +146 -0
  91. package/dist/template/.opencode/superpowers/skills/root-cause-tracing/SKILL.md +174 -0
  92. package/dist/template/.opencode/superpowers/skills/root-cause-tracing/find-polluter.sh +63 -0
  93. package/dist/template/.opencode/superpowers/skills/sharing-skills/SKILL.md +194 -0
  94. package/dist/template/.opencode/superpowers/skills/subagent-driven-development/SKILL.md +189 -0
  95. package/dist/template/.opencode/superpowers/skills/systematic-debugging/CREATION-LOG.md +119 -0
  96. package/dist/template/.opencode/superpowers/skills/systematic-debugging/SKILL.md +295 -0
  97. package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-academic.md +14 -0
  98. package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-pressure-1.md +58 -0
  99. package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-pressure-2.md +68 -0
  100. package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-pressure-3.md +69 -0
  101. package/dist/template/.opencode/superpowers/skills/test-driven-development/SKILL.md +364 -0
  102. package/dist/template/.opencode/superpowers/skills/testing-anti-patterns/SKILL.md +302 -0
  103. package/dist/template/.opencode/superpowers/skills/testing-skills-with-subagents/SKILL.md +387 -0
  104. package/dist/template/.opencode/superpowers/skills/testing-skills-with-subagents/examples/CLAUDE_MD_TESTING.md +189 -0
  105. package/dist/template/.opencode/superpowers/skills/ui-ux-research/SKILL.md +191 -0
  106. package/dist/template/.opencode/superpowers/skills/using-git-worktrees/SKILL.md +213 -0
  107. package/dist/template/.opencode/superpowers/skills/using-superpowers/SKILL.md +101 -0
  108. package/dist/template/.opencode/superpowers/skills/verification-before-completion/SKILL.md +139 -0
  109. package/dist/template/.opencode/superpowers/skills/writing-plans/SKILL.md +116 -0
  110. package/dist/template/.opencode/superpowers/skills/writing-skills/SKILL.md +622 -0
  111. package/dist/template/.opencode/superpowers/skills/writing-skills/anthropic-best-practices.md +1150 -0
  112. package/dist/template/.opencode/superpowers/skills/writing-skills/graphviz-conventions.dot +172 -0
  113. package/dist/template/.opencode/superpowers/skills/writing-skills/persuasion-principles.md +187 -0
  114. package/dist/template/.opencode/superpowers/tests/opencode/run-tests.sh +165 -0
  115. package/dist/template/.opencode/superpowers/tests/opencode/setup.sh +73 -0
  116. package/dist/template/.opencode/superpowers/tests/opencode/test-plugin-loading.sh +81 -0
  117. package/dist/template/.opencode/superpowers/tests/opencode/test-priority.sh +198 -0
  118. package/dist/template/.opencode/superpowers/tests/opencode/test-skills-core.sh +440 -0
  119. package/dist/template/.opencode/superpowers/tests/opencode/test-tools.sh +104 -0
  120. package/dist/template/.opencode/tool/memory-read.ts +66 -0
  121. package/dist/template/.opencode/tool/memory-update.ts +61 -0
  122. package/dist/template/.opencode/tsconfig.json +21 -0
  123. package/package.json +52 -0
@@ -0,0 +1,193 @@
1
+ # OpenCodeKit - Environment Variables Template
2
+ # ============================================================================
3
+ # Copy this file to .env and fill in your actual values
4
+ # Location: .opencode/.env (project-specific) or ~/.config/opencode/.env (global)
5
+ # ============================================================================
6
+
7
+ # Configure bash command timeout (default: 120000ms = 2 minutes)
8
+ OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS=300000
9
+ export OPENCODE_DISABLE_AUTOCOMPACT=0 # Disable broken compaction
10
+ export OPENCODE_DISABLE_PRUNE=0 # Disable potentially buggy pruning
11
+ export OPENCODE_EXPERIMENTAL_TURN_SUMMARY=1
12
+ export OPENCODE_ENABLE_EXPERIMENTAL_MODELS=1
13
+ export OPENCODE_EXPERIMENTAL_EXA=1
14
+
15
+ # =============================================================================
16
+ # MCP SERVICES (Remote APIs)
17
+ # =============================================================================
18
+
19
+ # Context7 - Up-to-date library documentation from 37.6k+ libraries
20
+ # GitHub: https://github.com/upstash/context7
21
+ # Get API key: https://context7.com
22
+ CONTEXT7_API_KEY=your_context7_api_key_here
23
+
24
+ # Exa - Advanced web search and code context from 3.3k repos
25
+ # GitHub: https://github.com/exa-labs/exa-mcp-server
26
+ # Get API key: https://exa.ai
27
+ EXA_API_KEY=your_exa_api_key_here
28
+
29
+ # GitLab Knowledge Graph (gkg) - Local codebase semantic search
30
+ # Documentation: https://gitlab-org.gitlab.io/rust/knowledge-graph/
31
+ # Install: https://gitlab-org.gitlab.io/rust/knowledge-graph/getting-started/install/
32
+ # Note: Runs locally on http://localhost:27495/mcp (no API key needed)
33
+
34
+ # GitHub Grep (gh_grep) - Search 1M+ public GitHub repositories
35
+ # GitHub: https://github.com/Shachlan/grep.app-mcp
36
+ # Note: Public service at https://mcp.grep.app (no API key needed)
37
+
38
+ # =============================================================================
39
+ # BACKLOG.MD MCP (Task Management)
40
+ # =============================================================================
41
+ # Markdown-native task manager with git-based project board
42
+ # GitHub: https://github.com/MrLesk/Backlog.md (4k+ stars)
43
+ # Install: npm install -g backlog-md
44
+ # Note: Runs locally, no API key needed (enabled by default)
45
+
46
+ # =============================================================================
47
+ # MCP CODE-MODE (Optional - for Python code execution)
48
+ # =============================================================================
49
+ # GitHub: https://github.com/draphonix/mcp-code-mode
50
+ # Enable in opencode.json: "code-mode": { "enabled": true }
51
+
52
+ # OpenAI API (for code-mode LLM)
53
+ # Get API key: https://platform.openai.com/api-keys
54
+ # OPENAI_API_KEY=your_openai_api_key_here
55
+
56
+ # Google Gemini API (alternative for code-mode)
57
+ # Get API key: https://aistudio.google.com/apikey
58
+ # GEMINI_API_KEY=your_gemini_api_key_here
59
+
60
+ # =============================================================================
61
+ # FIGMA MCP (Optional - for Figma integration)
62
+ # =============================================================================
63
+ # Framelink MCP for Figma - Extract layout info and design tokens
64
+ # GitHub: https://github.com/GLips/Figma-Context-MCP (11.9k+ stars)
65
+ # Enable in opencode.json: "Framelink MCP for Figma": { "enabled": true }
66
+ # Get API key: Figma -> Settings -> Personal Access Tokens
67
+
68
+ # FIGMA_API_KEY=your_figma_api_key_here
69
+
70
+ # =============================================================================
71
+ # AI MULTIMODAL SKILL (Optional - for media processing with Gemini)
72
+ # =============================================================================
73
+ # Used by: @.opencode/skills/stack/ai-multimodal/
74
+ # Same as GEMINI_API_KEY above if already set
75
+
76
+ # GEMINI_API_KEY=your_gemini_api_key_here
77
+
78
+ # Optional: Use Vertex AI instead of AI Studio
79
+ # GEMINI_USE_VERTEX=true
80
+ # VERTEX_PROJECT_ID=your-gcp-project-id
81
+ # VERTEX_LOCATION=us-central1
82
+
83
+ # =============================================================================
84
+ # DEVOPS SKILL (Optional - for cloud deployments)
85
+ # =============================================================================
86
+ # Used by: @.opencode/skills/core/devops/
87
+
88
+ # Cloudflare (Workers, R2, D1, Pages)
89
+ # Get from: https://dash.cloudflare.com
90
+ # CLOUDFLARE_API_TOKEN=your_cloudflare_api_token_here
91
+ # CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id_here
92
+
93
+ # Google Cloud Platform
94
+ # Download service account key: IAM & Admin -> Service Accounts -> Create Key
95
+ # GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json
96
+ # GCP_PROJECT_ID=your-project-id
97
+ # GCP_REGION=us-central1
98
+
99
+ # Docker Registry (optional)
100
+ # DOCKER_USERNAME=your_docker_username
101
+ # DOCKER_PASSWORD=your_docker_password
102
+
103
+ # =============================================================================
104
+ # CUSTOM MCP SERVERS (Add your own)
105
+ # =============================================================================
106
+ # Add any environment variables your custom MCP servers need here
107
+ # Example:
108
+ # MY_CUSTOM_API_KEY=your_custom_api_key_here
109
+
110
+ # =============================================================================
111
+ # SECURITY NOTES
112
+ # =============================================================================
113
+ # 1. NEVER commit .env files to version control
114
+ # 2. Add .env to .gitignore (already included in template)
115
+ # 3. Use different credentials for dev/staging/production
116
+ # 4. Rotate API keys regularly
117
+ # 5. Use least-privilege principle for all tokens
118
+ # 6. Keep .env.example in version control (with placeholder values only)
119
+
120
+ # =============================================================================
121
+ # PRIORITY & PRECEDENCE
122
+ # =============================================================================
123
+ # Environment variables are loaded in this order (first found wins):
124
+ # 1. Project-specific: .opencode/.env (takes precedence)
125
+ # 2. Global config: ~/.config/opencode/.env (fallback)
126
+ # 3. System environment: export CONTEXT7_API_KEY=... (lowest priority)
127
+
128
+ # =============================================================================
129
+ # REQUIRED vs OPTIONAL
130
+ # =============================================================================
131
+ # REQUIRED (for core MCP functionality):
132
+ # - CONTEXT7_API_KEY (library docs)
133
+ # - EXA_API_KEY (web search + code context)
134
+
135
+ # LOCAL MCP SERVERS (no API key needed):
136
+ # - gkg (GitLab Knowledge Graph) - Install first, runs on localhost:27495
137
+ # - backlog (Backlog.md) - Install via npm, runs locally
138
+ # - gh_grep (GitHub Grep) - Public service, no install needed
139
+
140
+ # OPTIONAL (enable specific features):
141
+ # - OPENAI_API_KEY or GEMINI_API_KEY (code-mode execution)
142
+ # - FIGMA_API_KEY (Figma integration)
143
+ # - CLOUDFLARE_* (cloud deployments)
144
+ # - GCP_* (Google Cloud deployments)
145
+
146
+ # =============================================================================
147
+ # GETTING STARTED (Minimal Setup)
148
+ # =============================================================================
149
+ # 1. Copy this file:
150
+ # cp .opencode/.env.example .opencode/.env
151
+ #
152
+ # 2. Add required keys (minimum):
153
+ # CONTEXT7_API_KEY=...
154
+ # EXA_API_KEY=...
155
+ #
156
+ # 3. Verify .env is in .gitignore:
157
+ # grep ".env" .gitignore
158
+ #
159
+ # 4. Test configuration:
160
+ # opencode # Should load without errors
161
+
162
+ # =============================================================================
163
+ # TROUBLESHOOTING
164
+ # =============================================================================
165
+ # "API key not found" errors:
166
+ # - Check .env file location (.opencode/.env or ~/.config/opencode/.env)
167
+ # - Verify no typos in variable names (case-sensitive)
168
+ # - Ensure .env file has no quotes around values (CONTEXT7_API_KEY=abc not "abc")
169
+ # - Restart OpenCode after adding new variables
170
+
171
+ # "MCP server failed to start":
172
+ # - Check MCP server is enabled in opencode.json
173
+ # - Verify command path exists (e.g., python, npx)
174
+ # - Check server-specific logs in ~/.config/opencode/logs/
175
+
176
+ # =============================================================================
177
+ # RESOURCES
178
+ # =============================================================================
179
+ # OpenCode Documentation: https://opencode.ai/docs
180
+
181
+ # MCP Services:
182
+ # - Context7: https://context7.com (API key) | https://github.com/upstash/context7
183
+ # - Exa: https://exa.ai (API key) | https://github.com/exa-labs/exa-mcp-server
184
+ # - GitLab Knowledge Graph: https://gitlab-org.gitlab.io/rust/knowledge-graph/
185
+ # - GitHub Grep: https://github.com/Shachlan/grep.app-mcp
186
+ # - Backlog.md: https://github.com/MrLesk/Backlog.md
187
+ # - MCP Code Mode: https://github.com/draphonix/mcp-code-mode
188
+ # - Figma Context MCP: https://github.com/GLips/Figma-Context-MCP
189
+
190
+ # Other APIs:
191
+ # - Gemini API: https://aistudio.google.com/apikey
192
+ # - OpenAI API: https://platform.openai.com/api-keys
193
+ # - Cloudflare: https://dash.cloudflare.com
@@ -0,0 +1,214 @@
1
+ # OpenCode Global Rules
2
+
3
+ ## Priority Hierarchy
4
+
5
+ 1. Security constraints (always first)
6
+ 2. Anti-hallucination rule (overrides all except security)
7
+ 3. Delegation rules (check before tool calls)
8
+ 4. Skills check (`find_skills` → `use_skill`)
9
+ 5. User explicit requests
10
+ 6. Base prompt behaviors
11
+ 7. Global rules (this file)
12
+ 8. Project conventions (nested AGENTS.md files)
13
+
14
+ ## Delegation
15
+
16
+ **Check before any tool call. Delegate if task involves search or research.**
17
+
18
+ | Task Type | Delegate To | Trigger Words |
19
+ | ----------------- | ----------- | ---------------------------------------------------- |
20
+ | Code search | @explore | find, where is, search, how does X work, locate |
21
+ | External research | @scout | research, compare, docs for, API for, best practices |
22
+ | Code review/debug | @review | review, audit, debug, why broken, root cause |
23
+ | Architecture | @planner | design, architect, plan, structure, phases |
24
+
25
+ **Execute directly**: Single-file edits, explicit commands, answering from loaded context.
26
+
27
+ ## Anti-Hallucination
28
+
29
+ - **Major features**: Check task exists (`bd show <id>`)
30
+ - **Bug fixes/edits**: Proceed directly; document clearly
31
+ - **Before commit**: Close task with reason (`bd close <id> --reason "..."`)
32
+ - **Find work**: Use `bd ready` for unblocked tasks
33
+
34
+ ## Universal Standards
35
+
36
+ ### Communication
37
+
38
+ - Under 4 lines for typical responses
39
+ - Brief preamble before big tool calls
40
+ - No explanation summaries unless asked
41
+ - Use `file:line_number` format for code references
42
+ - No emojis unless explicitly requested
43
+ - Keep going until query resolved; don't ask to continue
44
+
45
+ ### Execution
46
+
47
+ - Batch independent tool calls (parallel)
48
+ - Verify with tools; don't assume
49
+ - Obey project AGENTS.md files (nested takes precedence)
50
+ - Prioritize technical accuracy; disagree when necessary
51
+
52
+ ### Planning
53
+
54
+ - TodoWrite BEFORE work; mark completed immediately
55
+ - Verify assumptions with tools
56
+
57
+ ### Security
58
+
59
+ - Defensive security only
60
+ - Refuse credential harvesting
61
+ - Allow security analysis, detection rules, vulnerability explanations
62
+
63
+ ## Tool Priority
64
+
65
+ **GKG tools → Built-in tools**
66
+
67
+ | Priority | Tools | Use For |
68
+ | -------- | --------------------------------- | -------------------------------- |
69
+ | 1 | `gkg_search_codebase_definitions` | Find symbols by name |
70
+ | 1 | `gkg_get_references` | Find all usages |
71
+ | 1 | `gkg_repo_map` | API-level overview |
72
+ | 2 | `grep`, `glob` | Pattern matching, file discovery |
73
+ | 2 | `read`, `edit`, `write` | File operations |
74
+
75
+ **Rule**: Always `read` before `edit` to verify content.
76
+
77
+ ## Research Tools
78
+
79
+ | Tool | Use For | Performance Notes |
80
+ | ------------------------------------------- | ------------------------------------------------------ | ---------------------------------- |
81
+ | `augment-context-engine_codebase-retrieval` | Codebase understanding, architecture analysis | ~74s avg, 200K context, 67% CCEval |
82
+ | `context7` | Library docs (try first) | Fast, external APIs |
83
+ | `websearch` | Docs not in Context7, recent releases, troubleshooting | General web search |
84
+ | `codesearch` | Real implementation patterns from GitHub | Public repo examples |
85
+ | `webfetch` | Specific URL user provided | Direct URL fetch |
86
+
87
+ **Augment Context Engine Best Practices**:
88
+
89
+ - **When to use**: Complex queries like "How does authentication work?", "What's the architecture?", "Where is X implemented?"
90
+ - **When NOT to use**: Simple lookups ("find function foo"), specific file reads, known symbol references
91
+
92
+ ## Error Handling
93
+
94
+ - **Transient** (network, timeout): Retry 2x with backoff
95
+ - **Rate limit**: Stop, report to user
96
+ - **Logic error**: Change strategy, don't repeat
97
+
98
+ ## Memory System
99
+
100
+ ```
101
+ .opencode/memory/
102
+ _templates/ # Task templates
103
+ handoffs/ # Phase transitions
104
+ research/ # Research findings
105
+ ```
106
+
107
+ - `memory-read` - Load previous context
108
+ - `memory-update` - Save learnings
109
+ - Task tracking uses Beads (`bd` CLI)
110
+
111
+ ## Session Management
112
+
113
+ **Philosophy**: Short sessions (<150k tokens) beat long bloated ones. Agents get worse with too much context. Cost is exponential.
114
+
115
+ ### Session Tools
116
+
117
+ **`list_sessions`** - Discover available sessions before reading
118
+
119
+ ```
120
+ list_sessions(limit=10, project="current") # Current project
121
+ list_sessions(since="today") # Today's sessions
122
+ list_sessions(project="all", since="yesterday") # Cross-project
123
+ ```
124
+
125
+ **`read_session`** - Pull context from previous session
126
+
127
+ ```
128
+ read_session("last") # Most recent
129
+ read_session("2 ago", project="current") # 2nd most recent
130
+ read_session("today") # Today's first session
131
+ read_session("ses_abc123", focus="file changes") # Specific aspect
132
+ ```
133
+
134
+ ### When to Start New Session
135
+
136
+ - Completing distinct task from `bd ready`
137
+ - Token usage approaching 150k
138
+ - Switching phases (implementation → review → testing)
139
+ - After handoff (`/handoff <bead-id>`)
140
+
141
+ ### Session Workflow Pattern
142
+
143
+ ```
144
+ Session 1: Implement feature X (80k tokens)
145
+ ↓ close, update memory
146
+ Session 2: list_sessions() → read_session("last") → Refactor (60k tokens)
147
+
148
+ Session 3: read_session("previous") → Add tests (90k tokens)
149
+
150
+ Session 4: read_session refs → Final review (100k tokens)
151
+ ```
152
+
153
+ **Result**: 4 fresh contexts vs 1 degraded 330k context. Better performance, lower cost.
154
+
155
+ ### Context Transfer
156
+
157
+ Use all three:
158
+
159
+ 1. `read_session("last")` - Previous session work
160
+ 2. Git state - `git diff`, `git log` - Code changes
161
+ 3. Memory files - `.opencode/memory/*` - Persistent context
162
+ 4. Beads - `bd show <id>` - Task specs
163
+
164
+ **Don't**: Carry everything forward. Extract what's needed, discard the rest.
165
+
166
+ ## Beads Usage
167
+
168
+ **Session start**: `bd doctor --fix` then `bd ready`
169
+ **Session end**: Complete one bead fully before starting next
170
+ **Weekly**: `bd cleanup --older-than 7d` then `bd sync`
171
+
172
+ **Philosophy**: Beads is execution, not planning. Plan elsewhere, track in Beads.
173
+
174
+ ## Skills System
175
+
176
+ Use `find_skills` → `use_skill` when:
177
+
178
+ | Situation | Skill |
179
+ | -------------------------- | ----------------------------------- |
180
+ | Creating something new | `brainstorming` |
181
+ | Bug or unexpected behavior | `systematic-debugging` |
182
+ | Implementing feature | `test-driven-development` |
183
+ | Before commit/done | `verification-before-completion` |
184
+ | Complex multi-step work | `writing-plans` → `executing-plans` |
185
+ | Finished implementation | `requesting-code-review` |
186
+ | Building UI | `frontend-aesthetics` |
187
+ | UI/UX with images | `ui-ux-research` |
188
+ | Large codebase research | `gemini-large-context` |
189
+
190
+ Skip for simple questions, quick edits, or conversations.
191
+
192
+ ## Gemini CLI (Large Context)
193
+
194
+ Use when analysis needs >100KB context or image analysis.
195
+
196
+ ```bash
197
+ # Codebase analysis
198
+ gemini -p "@src/ [your question]"
199
+
200
+ # Image analysis (interactive)
201
+ gemini
202
+ @mockup.png Analyze this UI design
203
+ ```
204
+
205
+ **Default**: `gemini-2.5-pro` (1M tokens)
206
+ **Fast**: `gemini-2.5-flash` with `-m gemini-2.5-flash`
207
+
208
+ ## Core Constraints
209
+
210
+ - No sudo
211
+ - POSIX compatible (macOS/Linux)
212
+ - Manual verification for config changes
213
+ - No auto-documentation without request
214
+ - Use absolute paths
@@ -0,0 +1,269 @@
1
+ # OpenCodeKit Template - Configuration Guide
2
+
3
+ **Project-specific OpenCode configuration and custom extensions.**
4
+
5
+ ---
6
+
7
+ ## Quick Start
8
+
9
+ ### 1. Environment Setup
10
+
11
+ ```bash
12
+ # Copy environment template
13
+ cp .opencode/.env.example .opencode/.env
14
+
15
+ # Add required API keys (minimum)
16
+ # Edit .opencode/.env and add:
17
+ CONTEXT7_API_KEY=your_context7_api_key_here
18
+ EXA_API_KEY=your_exa_api_key_here
19
+ ```
20
+
21
+ ### 2. Verify Configuration
22
+
23
+ ```bash
24
+ # Start OpenCode (should load without errors)
25
+ opencode
26
+
27
+ # Test MCP services
28
+ # In OpenCode chat: "search context7 for Next.js documentation"
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Directory Structure
34
+
35
+ ```
36
+ .opencode/
37
+ ├── .env.example # Environment variables template (COPY TO .env)
38
+ ├── README.md # This file
39
+ ├── opencode.json # OpenCode configuration
40
+ ├── AGENTS.md # Global agent rules
41
+ ├── INTEGRATION_OVERVIEW.md # Architecture docs
42
+
43
+ ├── agent/ # Custom agents (5 total)
44
+ ├── command/ # Custom commands (26 workflows)
45
+ ├── superpowers/skills/ # Domain expertise (16 skills)
46
+ ├── tool/ # Custom MCP tools
47
+ └── memory/ # Persistent context
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Required Environment Variables
53
+
54
+ **Minimum setup (.opencode/.env):**
55
+
56
+ ```bash
57
+ # Required for core functionality
58
+ CONTEXT7_API_KEY=your_context7_api_key_here # Library docs
59
+ EXA_API_KEY=your_exa_api_key_here # Web search
60
+ ```
61
+
62
+ **Optional (enable specific features):**
63
+
64
+ ```bash
65
+ # Figma integration
66
+ FIGMA_API_KEY=your_figma_api_key_here
67
+
68
+ # Cloud deployments (devops skill)
69
+ CLOUDFLARE_API_TOKEN=your_token_here
70
+ CLOUDFLARE_ACCOUNT_ID=your_account_id_here
71
+ GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
72
+ ```
73
+
74
+ **Get API keys:**
75
+
76
+ - Context7: https://context7.com
77
+ - Exa: https://exa.ai
78
+ - Figma: https://www.figma.com/developers/api#access-tokens
79
+
80
+ ---
81
+
82
+ ## Agent System (5 Custom + 2 Built-in)
83
+
84
+ **Primary Agents:**
85
+
86
+ - **@build** - Main orchestrator (Claude Opus 4.5) - handles 70% of work
87
+ - **@rush** - Fast agent (GLM-4.6) - same capabilities, faster
88
+
89
+ **Subagents:**
90
+
91
+ - **@planner** - Architecture, multi-phase coordination
92
+ - **@scout** - External research (library docs + GitHub patterns)
93
+ - **@review** - Code review + debugging + security audit
94
+
95
+ **Built-in (OpenCode):**
96
+
97
+ - **@explore** - Fast codebase search
98
+ - **@general** - Simple tasks and fallback
99
+
100
+ ---
101
+
102
+ ## Custom Commands (26 workflows)
103
+
104
+ **Invoke with `/` prefix:**
105
+
106
+ - `/commit` - Intelligent git commits
107
+ - `/pr` - Create pull requests
108
+ - `/design` - Thoughtful design with brainstorming
109
+ - `/fix` - Systematic debugging
110
+ - `/research` - Deep documentation search
111
+ - `/review-codebase` - Comprehensive audit
112
+
113
+ **See:** `.opencode/command/` for all commands
114
+
115
+ ---
116
+
117
+ ## Skills System (16 skills)
118
+
119
+ **Core:** brainstorming, writing-plans, executing-plans, verification-before-completion
120
+ **Code:** requesting-code-review, receiving-code-review, root-cause-tracing
121
+ **Advanced:** gemini-large-context, subagent-driven-development, dispatching-parallel-agents
122
+
123
+ **Note:** Skills load via `use_skill()` in commands
124
+
125
+ ---
126
+
127
+ ## Memory System (2-Layer Architecture)
128
+
129
+ ```
130
+ Memory (Permanent) → Beads (Multi-session) → Git (Audit Trail)
131
+ .opencode/memory/ .beads/artifacts/ .git/
132
+ ```
133
+
134
+ **Memory:** Permanent knowledge, decisions, learnings
135
+ **Beads:** Multi-session tasks with spec/research/plan/review artifacts
136
+ **Git:** Automatic execution history
137
+
138
+ **See:** `INTEGRATION_OVERVIEW.md` for complete architecture
139
+
140
+ ---
141
+
142
+ ## MCP Services
143
+
144
+ **Enabled by default (5 total):**
145
+
146
+ 1. **context7** - Up-to-date library documentation (37.6k+ libraries)
147
+ - Requires: CONTEXT7_API_KEY
148
+ - GitHub: https://github.com/upstash/context7
149
+
150
+ 2. **exa** - Web search + code context (3.3k+ repos)
151
+ - Requires: EXA_API_KEY
152
+ - GitHub: https://github.com/exa-labs/exa-mcp-server
153
+
154
+ 3. **gh_grep** - Search 1M+ public GitHub repositories
155
+ - No API key needed (public service)
156
+ - GitHub: https://github.com/Shachlan/grep.app-mcp
157
+
158
+ 4. **gkg** - GitLab Knowledge Graph (local codebase semantic search)
159
+ - No API key needed (runs locally on port 27495)
160
+ - Docs: https://gitlab-org.gitlab.io/rust/knowledge-graph/
161
+ - Install: Follow https://gitlab-org.gitlab.io/rust/knowledge-graph/getting-started/install/
162
+
163
+ **Optional (disabled by default):**
164
+
165
+ 5. **Framelink MCP for Figma** - Extract Figma layouts and design tokens
166
+ - Requires: FIGMA_API_KEY
167
+ - GitHub: https://github.com/GLips/Figma-Context-MCP (11.9k+ stars)
168
+ - Enable: Set `"Framelink MCP for Figma": { "enabled": true }` in opencode.json
169
+
170
+ ---
171
+
172
+ ## Getting Started Examples
173
+
174
+ ### Simple Task
175
+
176
+ ```
177
+ User: "Find all TypeScript files"
178
+ @build: [executes directly]
179
+ Result: 42 files found
180
+ ```
181
+
182
+ ### Research Task
183
+
184
+ ```
185
+ User: "Research Next.js 14 App Router"
186
+ @build → @scout (docs + GitHub patterns)
187
+ Result: Comprehensive research doc
188
+ ```
189
+
190
+ ### Complex Feature
191
+
192
+ ```
193
+ User: "Build auth system"
194
+ @build → @planner (4 phases)
195
+ @planner → @review (security audit)
196
+ Result: Secure auth with tests
197
+ ```
198
+
199
+ ### Using Commands
200
+
201
+ ```
202
+ User: "/design implement dashboard"
203
+ @build: [loads brainstorming skill]
204
+ Result: Dashboard with shadcn/ui
205
+ ```
206
+
207
+ ---
208
+
209
+ ## Troubleshooting
210
+
211
+ **"API key not found":**
212
+
213
+ - Check .env location (.opencode/.env or ~/.config/opencode/.env)
214
+ - No quotes around values (CONTEXT7_API_KEY=abc not "abc")
215
+ - Restart OpenCode after changes
216
+
217
+ **"MCP server failed":**
218
+
219
+ - Check enabled: true in opencode.json
220
+ - Verify command path (python, npx in PATH)
221
+ - Check logs: ~/.config/opencode/logs/
222
+
223
+ **"Skills not loading":**
224
+
225
+ - Skills load via commands with `use_skill()`
226
+ - Use /design to load brainstorming
227
+ - Use /fix to load debugging skills
228
+
229
+ ---
230
+
231
+ ## Best Practices
232
+
233
+ **Environment:**
234
+
235
+ - Use .opencode/.env for project keys
236
+ - Use ~/.config/opencode/.env for global keys
237
+ - Never commit .env files
238
+ - Rotate API keys regularly
239
+
240
+ **Memory:**
241
+
242
+ - Update memory after major phases
243
+ - Document decisions in architecture notes
244
+ - Log blockers in research findings
245
+ - Keep research organized (YYYY-MM-DD-topic.md)
246
+
247
+ **Delegation:**
248
+
249
+ - Use @build for 70% of work
250
+ - Delegate to @planner for 3+ phases
251
+ - Use @review before deployment (code review + security)
252
+ - Use @scout for library docs + GitHub patterns
253
+ - Use @explore for codebase search
254
+
255
+ ---
256
+
257
+ ## Resources
258
+
259
+ - **OpenCode Docs:** https://opencode.ai/docs
260
+ - **Context7 API:** https://context7.com
261
+ - **Exa API:** https://exa.ai
262
+ - **Skills Documentation:** `superpowers/skills/`
263
+ - **Architecture Guide:** `INTEGRATION_OVERVIEW.md`
264
+
265
+ ---
266
+
267
+ **OpenCodeKit Template v2.2**
268
+ **Architecture:** Two-Layer (Memory + Beads + Git)
269
+ **Last Updated:** December 4, 2025