Repository navigation
Expand file tree
/
Copy pathcodegg.example.jsonc
More file actions
executable file
·411 lines (383 loc) · 16.1 KB
/
Copy pathcodegg.example.jsonc
File metadata and controls
executable file
·411 lines (383 loc) · 16.1 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
{
// Full annotated example of a CodeGG configuration file.
//
// Every block below parses against the current schema and is checked by
// `codegg validate --config codegg.example.jsonc`. Several keys are
// untagged enums whose accepted shapes are easy to get wrong, so the
// exact types are noted inline.
//
// Discovery order (crates/codegg-config/src/paths.rs):
// CODEGG_TUI_CONFIG -> system -> global -> project (upward walk).
// Unknown keys are ignored rather than rejected, so a typo is silent.
"$schema": "https://opencode.ai/schema/config.json",
"version": "1",
"log_level": "info",
// Command risk classifiers are advisory by default. Omit
// deny_critical_commands for review behavior; setting it to true opts into
// a best-effort invocation text denial (not OS containment).
"security": {
"enabled": true,
"mode": "ambient",
"gates": {
"ask_on_high_risk_command": true
}
},
// Optional semantic model routing. Select "virtual:code" to run a bounded
// selector decision; concrete model selections bypass this policy. CodeGG
// applies only a route compatible with the already-selected connection.
"model_routers": {
"virtual:code": {
"selector_model": "openai/gpt-4o-mini",
"default_model": "openai/gpt-4o-mini",
// Retained for shared policy/fingerprint compatibility. CodeGG does not
// maintain an EggPool-style local affinity cache.
"sticky": false,
"routes": {
"fast": {
"model": "openai/gpt-4o-mini",
"description": "short implementation task"
}
}
}
},
// Default model. Accepts "provider/model-id" or a bare "model-id".
"model": "anthropic/claude-sonnet-4-20250514",
// Optional cheaper model for background/summarization work.
"small_model": "anthropic/claude-haiku-4-20250514",
"username": "your-username",
// Session sharing: one of "manual", "auto", "disabled".
"share": "disabled",
// Accepted for backward compatibility but INERT: no production code path
// reads it and nothing schedules an upgrade automatically.
// `codegg upgrade` runs only on explicit user invocation.
// Accepted shapes are a boolean or a string (untagged enum).
"autoupdate": false,
// HTTP/WebSocket server. Only reachable when built with the `server`
// Cargo feature.
"server": {
"port": 3000,
"hostname": "127.0.0.1",
"mdns": false,
"mdns_domain": "opencode.local",
"cors_origins": ["https://opencode.ai"],
"tool_timeout_seconds": 120,
"max_parallel_tools": 5
},
"model_profile": {
"openai/gpt-5": {
"task_state_policy": {
"mode": "explicit_todo",
"update_frequency": "milestones_and_task_switches",
"max_total_items": 10,
"expose_completed_items": "summary_only",
"allow_model_todo_read": true,
"allow_model_todo_write": true,
"require_single_in_progress": true,
"require_blocker_reason": false,
"inject_after_tool_calls": 5,
"inject_on_resume": true,
"inject_after_compaction": true,
"subagent_todo_access": "none"
}
},
// What a model accepts on the reasoning dimensions (ADR-0050). The four
// dimensions are independent and each carries its own status:
// supported | unsupported | unknown | mixed | conflicting
// "unknown" means nobody has published a contract for that dimension,
// which is NOT the same claim as "unsupported" (the model refuses this).
//
// An operator override is authoritative but narrowing-only: it may remove
// an option the adapter baseline allows, never add one. The label set is
// an open, provider-scoped string set - one vendor's ladder is not
// another's - so a vendor label is never fabricated or snapped.
//
// "always_reasons: true" means the model has no off switch, so
// "disable_status" may not be "supported".
"minimax/minimax-m3.1": {
"reasoning_capability": {
"effort_status": "supported",
"accepted_effort_labels": ["low", "medium", "high", "xhigh", "max"],
"disable_status": "unsupported",
"budget_status": "unknown",
"always_reasons_status": "supported",
"always_reasons": true
}
}
},
"provider": {
// Each provider below independently checks its config block and then its
// conventional env var (e.g. ANTHROPIC_API_KEY), so declaring one here
// does not disable env-var credentials for the others.
"anthropic": {
"auth": { "type": "api_key", "env": "ANTHROPIC_API_KEY" },
"base_url": "https://api.anthropic.com",
// `timeout` is an untagged enum: integer MILLISECONDS, or a boolean.
// A duration string such as "60s" is rejected and invalidates the file.
"timeout": 60000,
"whitelist": ["claude-sonnet-4-20250514", "claude-opus-4-20250514"]
},
"openai": {
"auth": { "type": "api_key", "env": "OPENAI_API_KEY" },
"base_url": "https://api.openai.com/v1",
"timeout": 30000,
"options": {
"max_retries": 3
}
},
"google": {
"auth": { "type": "api_key", "env": "GOOGLE_API_KEY" },
"timeout": 45000
},
"openrouter": {
"auth": { "type": "api_key", "env": "OPENROUTER_API_KEY" },
"base_url": "https://openrouter.ai/api/v1"
},
"opencode_zen": {
"auth": { "type": "api_key", "env": "OPENCODE_ZEN_API_KEY" },
"base_url": "https://opencode.ai/zen/v1"
// Optional. Models are discovered from the provider's /models
// endpoint, and discovery is always attempted. This block is
// ADDITIVE: it augments the discovered catalog, never replaces
// it and never suppresses discovery. Declare a model here only
// when the provider's endpoint does not serve one.
// "models": {
// "minimax-m2.5-free": {
// "context_window": 200000,
// "max_output_tokens": 64000,
// "supports_tools": true
// }
// }
},
"xai": {
"auth": { "type": "api_key", "env": "XAI_API_KEY" }
}
},
// Provider auth modes
//
// Each `provider.<id>.auth` block uses one of:
//
// { "type": "api_key", "env": "VENDOR_API_KEY" } - read from env (default fallback {VENDOR}_API_KEY)
// { "type": "api_key", "value": "sk-..." } - inline (avoid; prefer env or store)
// { "type": "api_key", "encrypted_value": "v2:..." } - encrypted at rest
// { "type": "stored", "account_id": "default" } - resolve from user credential store
// (stored `BearerToken` records resolve only
// for `ApiKeyOrBearer` providers: mistral,
// groq, deepinfra, cerebras, cohere,
// together, perplexity, xai, venice,
// opencode_go, generalcompute; all other
// built-ins reject bearer with typed
// Unsupported; expired records fail as
// Expired before network)
// { "type": "external_command", "command": "...", "args": ["..."], "timeout_ms": 5000 }
// - parsed; the synchronous resolver and
// ExternalCommandProvider::fetch both
// return AuthError::Unsupported until
// async timeout plumbing is in place
// { "type": "oauth_device", "client_id": "...", "auth_url": "...", "token_url": "..." }
// - typed but not yet implemented
// { "type": "none" } - explicit no-auth marker
//
// Legacy: the original `api_key` and `encrypted_api_key` fields on the
// provider object are still honored as a fallback. They are read by
// `AuthResolver` (single resolution path), not by the registration
// helper directly.
//
// Stored credentials live in <config_dir>/codegg/credentials.json (for
// example ~/.config/codegg/credentials.json on Linux, or
// ~/Library/Application Support/codegg/credentials.json on macOS). They do
// NOT require any environment variable: the first protected write creates
// and persists a CodeGG-managed key at <config_dir>/codegg/master.key.
// CODEGG_MASTER_KEY, CODEGG_ENCRYPTION_KEY and OPENCODE_ENCRYPTION_KEY are
// optional higher-precedence overrides for deployments that manage key
// material externally. If existing ciphertext was created with an external
// key and that key is later unavailable, CodeGG fails closed rather than
// replacing it.
//
// Manage the store with `codegg auth status`, `codegg auth set-key <provider>`
// (reads the key from stdin), and `codegg auth logout <provider>`. The CLI
// validates provider and account ids (`[A-Za-z0-9_-]`, with `*` allowed for
// `logout` only) and never echoes key material.
// MCP servers are keyed DIRECTLY under `mcp` - there is no `servers` wrapper.
// Also manageable from the CLI: `codegg mcp add|list|remove|enable|debug`.
"mcp": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
"env": {}
}
},
// Permissions are declared PER TOOL, not as allow/deny lists. Each value is
// an untagged enum: either an action string, or an object whose values are
// all strings.
"permission": {
// How long to wait for you to answer an approval request. Omit this key
// to wait indefinitely: the dialog stays up and the turn stays parked
// until you decide. Set it only if unattended runs must fail closed on
// their own -- a request that goes unanswered is then denied, and the
// denial is recorded distinctly from a user "no".
// "approval_timeout_secs": 900,
"read": "allow",
"glob": "allow",
"grep": "allow",
"bash": "ask",
"edit": "ask",
// Bash patterns are global, not per-rule.
//
// `_ask` escalates to an approval prompt. It shapes the operator's
// decision; it is NOT a boundary — a pattern match constrains the
// invocation, not the program, so `sh -c '…'` and an absolute path still
// pass. Use `bash_deny_patterns` or the sandbox profile for containment.
// Built-in escalation signals already cover pipe-to-shell, redirects to a
// block device, inline interpreters, and chmod/chown to system paths.
"bash_allow_patterns": ["git status", "git diff", "git log"],
"bash_ask_patterns": ["terraform apply", "kubectl delete"],
"bash_deny_patterns": ["rm -rf", "git push --force"],
"tools": {
"webfetch": "allow"
}
},
"compaction": {
"enabled": true,
"auto": true,
"prune": false,
"max_tokens": 200000,
"threshold": 0.8,
"reserved": 10000
},
// Additional skill locations, on top of the automatically discovered
// .codegg/skills, .agents/skills, .opencode/skills and .claude/skills roots.
"skills": {
"enabled": true,
"paths": ["./docs/skills"]
},
// The daemon-owned scratch retention policy. The daemon keeps one
// disposable scratch tree per session; scratch contents are disposable by
// contract, so a tree is reclaimed once its session has been idle longer
// than the retention window. Every value below is the built-in default,
// and every one of them is clamped upward at its floor: `retention_days`
// below 1, `sweep_interval_minutes` below 5, and `orphan_grace_hours`
// below 1. Setting `enabled` to false stops the sweep entirely; the
// event-driven reclaimers are unaffected either way.
"scratch": {
"enabled": true,
"retention_days": 14,
"sweep_interval_minutes": 360,
"orphan_grace_hours": 24
},
// Raw model shell selection is only used on Windows. PowerShell is the
// default; choose cmd explicitly when the command needs cmd syntax.
"shell": {
"windows_shell": "powershell"
},
// Custom slash commands. `template` is REQUIRED (a natural-language
// instruction); `command`/`args` are the executable and are only used when
// `runtime` is "process".
"commands": {
"test": {
"template": "Run the project test suite and summarize failures",
"description": "Project test suite",
"agent": "build",
"runtime": "process",
"command": "npm",
"args": ["test"],
"timeout_ms": 120000
}
},
// Per-tool enable/disable switches.
"tools": {
"bash": true,
"read": true,
"edit": true,
"glob": true,
"grep": true,
"apply_patch": true,
"multiedit": true,
"webfetch": true,
"question": true
},
// Formatters are keyed DIRECTLY by file extension - there is no `rules`
// wrapper.
"formatter": {
"rs": {
"command": ["rustfmt", "$FILE"],
"disabled": false
},
"ts": {
"command": ["prettier", "--write", "$FILE"],
"disabled": false
}
},
// LSP servers are keyed DIRECTLY by builtin server id - there is no
// `servers` wrapper, and the key is the server id (not a language name):
// rust-analyzer, gopls, pyright, typescript-language-server, clangd, ...
// Each active rule requires `command` as an ARRAY of strings; the executable
// and its flags both belong in that array, and there is no `args` field.
// Run `codegg doctor lsp` to see which servers are active in your setup.
"lsp": {
"rust-analyzer": {
"command": ["rust-analyzer"]
},
"typescript-language-server": {
"command": ["typescript-language-server", "--stdio"]
}
},
"watcher": {
"ignore": ["**/target/**", "**/node_modules/**"],
"debounce_duration_ms": 500
},
// WASM plugin manifests, as paths. Each entry is a string (or a
// [path, options] pair), NOT an object.
"plugin": [
"./plugins/custom.wasm"
],
// Experimental flags. Each one gates an unstable feature; check
// `codegg doctor lsp` for the current value of an individual gate.
"experimental": {
"batch_tool": true,
"lsp_tool": true
},
"theme": {
"name": "cyber-red",
// Custom theme directories must be listed explicitly; nothing is scanned
// from the platform config directory implicitly.
"directories": ["./themes"]
},
// Keybind overrides: "<modifiers>+<key>" -> action.
// Modifiers are ctrl|control, shift, alt; the key is enter, esc, tab,
// backspace, delete, left, right, up, down, home, end, pageup, pagedown,
// space, or a single character. Action values are snake_case names from the
// ActionKey enum (send, newline, cancel, clear_session, new_session,
// toggle_sidebar, switch_agent, select_model, navigate_up, ...).
// An unparseable key or an unknown action is silently ignored.
"keybinds": {
"ctrl+enter": "send",
"ctrl+l": "clear_session",
"ctrl+p": "switch_agent"
},
// Saved side-panel hotkeys: digit -> panel type. Assign these in the TUI
// (press Shift+S in Normal mode to open the panel manager, move to a panel,
// then press a digit); the TUI writes them here for you.
// Recalled with Ctrl+1 .. Ctrl+0 (0 is the tenth slot, after 1-9).
// Ctrl rather than Cmd because terminals do not deliver a Cmd modifier.
// Panel values: sessions, chat, terminal, help. An unrecognised value or
// a non-digit key is dropped on load rather than failing startup.
"panel_hotkeys": {
"1": "chat",
"2": "terminal"
},
// Which edge the side panel is docked to: "right" (the default), "left",
// or "bottom" (a full-width row under the input box). The panel manager's
// layout strip writes this for you when you press `p`.
//
// This moves the directionals with it. With the panel on the left,
// Shift+H enters it and Shift+L comes back; under the buffer it is
// Shift+J and Shift+K. The two remaining directions keep cycling which
// panel is loaded.
//
// An unrecognised value falls back to "right" rather than failing startup.
"panel_placement": "right",
"instructions": [
"Always write tests before committing code",
"Use meaningful commit messages"
]
}