Production-oriented global OpenCode config with:
- multi-agent teamwork (
worker,worker-impl,worker-impl-backup,worker-review) - continuity-aware fallback workflow
- local custom tools for handoff, frontend briefs, and clean-code checks
- local safety/compaction hooks
- optional plugin profiles for different use cases
- Default agent =
workerfor plan → delegate → verify workflows - Primary coder =
worker-implusingopenrouter/deepseek/deepseek-v3.2 - Cheap fallback coder =
worker-impl-backupusingopencode-go/glm-5 - Reviewer =
worker-reviewusingopenai/gpt-5.4 - SEO-aware frontend workflow integrated directly into frontend commands
- Error Resilience (Skip & Continue) prevents token-drain from dead-end errors like bad images
- Parallel Tool Calling for multi-file high speed analysis
- Custom tools loaded from
~/.config/opencode/tools/ - Local plugin hooks loaded from
~/.config/opencode/plugins/ - Public-safe / local-secret split so you can publish the repo without leaking keys
When using the /frontend command, the config routes work through SEO-focused instructions and review prompts:
workeris prompted to load theseo-optimizerskill for public-facing page work.worker-impl&buildpreserve semantic HTML (h1→h2), descriptivealttext, and image dimensions to reduce CLS risk.worker-reviewis prompted to flag critical SEO gaps during review (metadata, Open Graph tags, schema, heading hierarchy).- Playwright MCP can be used to verify the final Rendered DOM when a JS framework may alter metadata at runtime.
AI agents can easily burn millions of tokens in endless loops. This config reduces that risk:
- Graceful Image Failure: If an image is broken or unsupported, the agent logs
[SKIP: <reason>]and continues work immediately instead of halting and repeatedly trying to read it. - Max 1 Retry: Faulty MCP Tool calls are limited to 1 retry.
- Context Continuity:
workflow_handoffgives agents a compact, structured packet so fallback and continuation do not restart from scratch. - Secret File Protection: Blocks access to
.env, credentials, SSH keys, and other sensitive files. - Interactive Command Blocking: Prevents agents from running
vim,ssh,npm init, and other interactive commands that would hang. - Dangerous Command Prevention: Blocks
rm -rf, force pushes, and other destructive operations without confirmation. - Configuration Doctor:
bun run doctorvalidates config integrity, checks references, detects runtime drift, and checks for obvious secret leakage patterns.
git clone https://github.com/huynhanh48/opencode-config ~/.config/opencode
cd ~/.config/opencode && bun install- clones this repo into your global OpenCode config directory
- installs dependencies needed by local plugins and local custom tools
- keeps optional npm ecosystem plugins out of the default install path unless you opt into a profile
- uses Bun as the canonical dependency and lockfile workflow
- keeps
opencode.local.example.jsoncminimal so fresh installs start with fewer failure points
This repo is split into three config layers:
opencode.public.jsonc→ tracked public-safe source of truthopencode.local.jsonc→ ignored local override file for secrets and personal pluginsopencode.jsonc→ generated runtime config used by OpenCode
This keeps GitHub safe while still letting you use local secrets and local plugin choices.
cp opencode.local.example.jsonc opencode.local.jsoncThis repo does not ship a real API key.
Edit opencode.local.jsonc and set your key:
bun run apply-local-configOptional quick health check:
bun run doctorPublic-repo safety check without reading local overrides:
OPENCODE_DOCTOR_SKIP_LOCAL=1 bun run doctorLocal plugins and local custom tools are loaded at startup.
You should see or be able to use:
- primary agent:
worker - hidden subagents:
worker-implworker-impl-backupworker-review
- custom tools:
workflow_handofffrontend_briefclean_code_guard
This repo is split into:
- core config → stable defaults that should work for most users
- local tools → reusable agent capabilities
- local plugin hooks → safety, compaction continuity, guardrails
- profiles → optional ecosystem plugin bundles by use case
The goal is to keep the base config:
- powerful
- professional
- easy to fork
- low-hallucination
- minimal in default dependencies
~/.config/opencode/
├── README.md
├── opencode.jsonc
├── opencode.public.jsonc
├── opencode.local.example.jsonc
├── tui.json
├── AGENTS.md
├── instructions.md
├── package.json
├── .gitignore
├── scripts/
│ ├── config-utils.mjs
│ ├── sync-config.mjs
│ ├── reset-config.mjs
│ ├── apply-local-config.mjs
│ └── apply-profile.mjs
├── prompts/
│ ├── build.txt
│ ├── worker.txt
│ ├── worker-impl.txt
│ ├── worker-impl-backup.txt
│ └── worker-review.txt
├── instructions/
│ ├── agent-routing.md
│ ├── code-quality.md
│ ├── frontend-design.md
│ └── teamwork-continuation.md
├── tools/
│ ├── workflow_handoff.ts
│ ├── frontend_brief.ts
│ └── clean_code_guard.ts
├── plugins/
│ └── teamwork.ts
├── profiles/
│ ├── README.md
│ ├── core.jsonc
│ ├── context-efficiency.jsonc
│ ├── typescript.jsonc
│ ├── security.jsonc
│ ├── observability.jsonc
│ ├── orchestration.jsonc
│ ├── memory-productivity.jsonc
│ ├── sandbox.jsonc
│ ├── research-web.jsonc
│ └── quality-of-life.jsonc
└── skills/
Local-only runtime layering:
~/.config/opencode/
├── opencode.public.jsonc # tracked public-safe config
├── opencode.local.example.jsonc # tracked example for local overrides
├── opencode.local.jsonc # ignored local overrides with secrets
└── opencode.jsonc # generated runtime config
| Agent | Role | Model |
|---|---|---|
worker |
orchestrator / planner / delegator | openai/gpt-5.4 |
worker-impl |
primary implementation | openrouter/deepseek/deepseek-v3.2 |
worker-impl-backup |
cheap fallback implementation | opencode-go/glm-5 |
worker-review |
read-only review | openai/gpt-5.4 |
build |
direct implementation agent | openai/gpt-5.4 |
plan |
analysis-only planner | openai/gpt-5.4 |
This config does not rely on true engine-level automatic model switching between unrelated model IDs.
Instead, it uses a workflow fallback:
workerdelegates toworker-impl- if implementation hits context/model/tool limits, a structured handoff is created
workerdelegates continuation toworker-impl-backup
This is more explicit, more debuggable, and safer for long-running sessions.
Creates a structured continuation packet containing:
- objective
- acceptance criteria
- active files
- completed work
- remaining work
- blockers
- verification state
- next step
Locks a design frame before frontend implementation:
- purpose
- audience
- tone
- visual direction
- memorable idea
- constraints
Returns a compact checklist to reduce:
- unnecessary LOC
- duplicated logic
- over-abstraction
- unsafe shortening / code golf
plugins/teamwork.ts currently handles:
.envaccess protection forread/edit/write- interactive bash guard for commands likely to hang or require TTY input
- dangerous bash guard for destructive shell patterns
- extra compaction context so continuation summaries preserve teamwork state
Profiles are optional config snippets under profiles/.
They are not auto-enabled.
Use them when you want to extend the base config.
OpenCode does not automatically inspect profiles/ and choose one for you at runtime.
If you want to use a profile, you must merge its plugin list into your effective config, usually through opencode.local.jsonc.
This repo also ships a helper command so you do not need to merge by hand.
bun run apply-profile observabilityThis merges the selected profile into opencode.local.jsonc and regenerates opencode.jsonc.
List profiles with:
bun run apply-profile --listIf profiles/observability.jsonc contains:
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"opencode-helicone-session",
"opencode-sentry-monitor"
]
}then you manually copy the plugin names into opencode.local.jsonc:
{
"plugin": [
"opencode-helicone-session",
"opencode-sentry-monitor"
]
}You can also combine multiple profiles by merging their plugin arrays yourself, or by running bun run apply-profile multiple times.
| Profile | Purpose |
|---|---|
core.jsonc |
baseline profile with no extra npm plugins |
context-efficiency.jsonc |
placeholder profile for future verified context plugins |
typescript.jsonc |
TypeScript/Svelte-focused enhancement |
security.jsonc |
redaction/security-oriented plugins |
observability.jsonc |
monitor agent behavior and sessions |
orchestration.jsonc |
advanced orchestration/background agents |
memory-productivity.jsonc |
persistent memory + productivity tracking |
sandbox.jsonc |
sandboxes, devcontainers, worktrees |
research-web.jsonc |
web search / crawl workflows |
quality-of-life.jsonc |
notifications and markdown cleanup |
See profiles/README.md for details.
This repo only enables verified-safe defaults in the main config.
- The base config uses local tools and local plugin hooks by default.
- Optional profiles contain only plugins that were checked against npm at verification time.
- If an ecosystem item exists as a GitHub/community plugin but is not installable from npm, it is not enabled by default here.
context7— documentation lookupplaywright— browser automation / UI verification
- custom
tailwindcsslanguage server - built-in TypeScript / ESLint / Pyright support from OpenCode ecosystem
prettieruv
This config optimizes for:
- clean code over noisy code
- shorter code when readability improves
- no code golf
- explicit delegation over opaque automation
- continuity-aware teamwork
- targeted context retrieval over dumping entire codebases
- docs-first behavior when APIs are uncertain
- do not commit real API keys into
opencode.public.jsonc - keep secrets inside
opencode.local.jsonc - run
bun run reset-configbefore committing if your local runtime config contains overrides - keep
node_modules/out of git - local plugin/tools need
bun install - npm plugins declared in
pluginare resolved by OpenCode at startup - ecosystem listing does not always guarantee npm availability; this repo keeps the default path conservative to avoid install failures
bun run sync-config # rebuild opencode.jsonc from public + local
bun run apply-local-config # validate local overrides exist, then rebuild runtime config
bun run apply-profile NAME # merge a profile into opencode.local.jsonc and rebuild runtime config
bun run doctor # validate config integrity, references, runtime drift, and public-safe state
bun run reset-config # restore opencode.jsonc to the public-safe baseThis repo uses Bun as the canonical package manager for local plugin/tool dependencies.
- use
bun install - commit
bun.lock - ignore
package-lock.json
After installing:
- copy
opencode.local.example.jsonctoopencode.local.jsonc - add your Context7 key
- run
bun run apply-local-config - start OpenCode
- run a simple task with
worker - test a frontend task using
frontend - test a long task and verify fallback/handoff behavior
Use, fork, and adapt freely for your own OpenCode setup.
{ "mcp": { "context7": { "headers": { "CONTEXT7_API_KEY": "YOUR_CONTEXT7_API_KEY" } } } }