-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopencode.jsonc
More file actions
211 lines (211 loc) · 7.92 KB
/
opencode.jsonc
File metadata and controls
211 lines (211 loc) · 7.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
{
"$schema": "https://opencode.ai/config.json",
// =========================================================================
// MODEL + PROVIDER
// =========================================================================
// Cloud (default): ollama provider -> https://ollama.com/v1
// Local: local provider -> http://localhost:11434/v1
//
// IMPORTANT for local: Ollama defaults context to 4096 tokens which is too
// small for agentic coding. Create custom model variants first:
//
// ollama pull <model>
// ollama run <model>
// >>> /set parameter num_ctx 32768
// >>> /save <model>-32k
// >>> /bye
//
// 32k minimum, 64k+ recommended. Without this, tool calling will silently fail.
"provider": {
"local": {
"npm": "@ai-sdk/openai-compatible",
"name": "Ollama Local",
"options": {
"baseURL": "http://localhost:11434/v1",
"timeout": 600000,
},
"models": {
"qwen3-coder:latest": {
"name": "Qwen3 Coder (Local)",
},
"glm-4.7-flash:latest": {
"name": "GLM 4.7 Flash (Local)",
},
},
},
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"name": "Ollama Cloud",
"options": {
"baseURL": "https://ollama.com/v1",
"timeout": 600000,
},
"models": {
"qwen3-coder-next": {
"name": "Qwen3 Coder Next",
},
"glm-5": {
"name": "GLM 5",
},
"glm-4.7": {
"name": "GLM 4.7",
},
},
},
},
"enabled_providers": ["local", "ollama"],
// =========================================================================
// INSTRUCTIONS
// =========================================================================
// NOTE: AGENTS.md is a duplicate of CLAUDE.md — only load one to save context.
"instructions": ["CLAUDE.md", "CONTRIBUTING.md", ".claude/rules/*.md"],
// =========================================================================
// PERMISSIONS (yolo mode - auto-approve everything)
// =========================================================================
"permission": "allow",
// =========================================================================
// FORMATTERS
// =========================================================================
"formatter": {
"custom-prettier": {
"command": ["pnpm", "exec", "prettier", "--write", "$FILE"],
"extensions": [".ts", ".tsx", ".js", ".jsx", ".json", ".css", ".md", ".mdx"],
},
},
// =========================================================================
// MCP SERVERS
// =========================================================================
"mcp": {
"context7": {
"type": "local",
"command": ["npx", "-y", "@upstash/context7-mcp@latest"],
"enabled": true,
},
"gh_grep": {
"type": "remote",
"url": "https://mcp.grep.app",
"enabled": true,
},
},
// =========================================================================
// AGENTS
// =========================================================================
// GLM-5: reasoning, planning, complex tasks (744B total, 40B active)
// Qwen3-Coder-Next: agentic coding, tool calling (80B total, 3B active)
// GLM-4.7: lightweight tasks (30B MoE, 3B active)
"agent": {
// -- Built-in agent overrides --
// Planning uses GLM-5 for deep reasoning
"plan": {
"model": "ollama/glm-5",
"permission": {
"edit": "deny",
"bash": {
"*": "deny",
"git log *": "allow",
"git diff *": "allow",
"git diff-tree *": "allow",
"git show *": "allow",
"git status *": "allow",
"cat *": "allow",
"find *": "allow",
"grep *": "allow",
"ls *": "allow",
},
},
},
// Background agents use GLM-4.7 for speed
"title": {
"model": "ollama/glm-4.7",
},
"compaction": {
"model": "ollama/glm-4.7",
},
"summary": {
"model": "ollama/glm-4.7",
},
// Coding agents use Qwen3-Coder-Next (optimized for agentic coding)
"explore": {
"model": "ollama/qwen3-coder-next",
},
"general": {
"model": "ollama/qwen3-coder-next",
},
// -- Custom subagents --
// Code reviewer uses Qwen3-Coder-Next for code analysis
"reviewer": {
"mode": "subagent",
"model": "ollama/qwen3-coder-next",
"description": "Reviews code for best practices, security, and TypeScript patterns. Invoke with @reviewer.",
"prompt": "You are a senior code reviewer for a TypeScript/Node.js/Hono/Next.js project. Focus on security, performance, type safety, and maintainability. Never modify files directly.",
"color": "#FF5733",
"permission": {
"edit": "deny",
"bash": "deny",
"read": "allow",
"grep": "allow",
"glob": "allow",
"list": "allow",
},
},
},
// =========================================================================
// COMMANDS (maps your Claude Code skills)
// =========================================================================
"command": {
"commit": {
"template": "Review the staged changes with `git diff --cached` and write a conventional commit message. Use the format: type(scope): description. Types: feat, fix, docs, style, refactor, test, chore. Keep the first line under 72 chars.",
"description": "Generate a conventional commit message",
"agent": "build",
},
"pr": {
"template": "Review all changes on the current branch vs main with `git diff main...HEAD`. Generate a PR description with: Summary, Changes (grouped by area), Testing Notes, and any Breaking Changes.",
"description": "Generate a PR description",
"agent": "build",
},
"bug": {
"template": "Investigate and fix the following bug: $ARGUMENTS\n\nSteps:\n1. Understand the bug report\n2. Find the relevant code\n3. Identify root cause\n4. Implement a fix\n5. Verify the fix doesn't break existing tests",
"description": "Investigate and fix a bug",
},
"feature": {
"template": "Implement the following feature: $ARGUMENTS\n\nSteps:\n1. Understand the requirements\n2. Plan the implementation (use Plan mode first)\n3. Implement the changes\n4. Add/update tests\n5. Update any relevant documentation",
"description": "Implement a new feature",
},
"rfc": {
"template": "Create a technical RFC for: $ARGUMENTS\n\nInclude:\n- Problem statement\n- Proposed solution with architecture\n- Alternatives considered\n- Migration plan (if applicable)\n- Open questions\n\nWrite it as a markdown file in .plans/",
"description": "Create a technical RFC document",
},
"setup": {
"template": "Analyze this project's structure, dependencies, and configuration. Provide a comprehensive overview including:\n- Tech stack and architecture\n- Key directories and their purposes\n- Development workflow (build, test, deploy)\n- Environment setup requirements",
"description": "Analyze and explain the project setup",
},
},
// =========================================================================
// COMPACTION (aggressive - OSS models have smaller context windows)
// =========================================================================
"compaction": {
"auto": true,
"prune": true,
"reserved": 6000,
},
// =========================================================================
// WATCHER
// =========================================================================
"watcher": {
"ignore": [
"node_modules/**",
"dist/**",
".git/**",
".next/**",
".turbo/**",
"coverage/**",
".vercel/**",
"*.log",
],
},
// =========================================================================
// MISC
// =========================================================================
"share": "manual",
"autoupdate": true,
}