Lean OpenCode setup for day-to-day coding: a locally built opencode binary, a tmux-aware launcher, repo-specific agents, and a small skill set for planning, implementation, review, backlog work, and worktree hygiene.
opencode.jsoncis the active config: plugins, MCP servers, permissions, agent defaults, and LSPs.opencode.example.jsoncis the template if you want to fork or trim the stack.opc.shis the preferred launcher.opc-up.shrebuilds and refreshes the local toolchain.agents/defines the repo's primary agents and subagents.skills/holds reusable workflows the agents can load on demand.
- OpenCode CLI built locally to
~/.local/bin/opencode tmuxfor session and window management- Worktrunk (
wt) for branch and worktree flow backlog.mdMCP for task tracking
@tarquinen/opencode-dcp@latestopentmux
context7- library docs lookuptauri- Tauri app automationwebsearch- Exa-backed web and code searcheslint- ESLint MCPbacklog- Backlog.md MCPplaywright- headless Chromium browser automation
typescript-language-serverpyright-langserveroxlintdocker-langserverremark-language-serverbiome lsp-proxy
Install the tools this config expects:
These examples are Linux-first. If you are on macOS, use Homebrew equivalents where appropriate.
# Bun
curl -fsSL https://bun.sh/install | bash
# tmux
sudo apt install tmux
# backlog.md
bun add -g backlog.md
# opentmux
npm install -g opentmux
# Worktrunk
brew tap bkrausz/tap && brew install worktrunkInstall the OpenCode CLI from source:
git clone -b beta https://github.com/anomalyco/opencode.git ~/opencode
cd ~/opencode
bun install
bun packages/opencode/script/build.ts --single
install -m 755 ~/opencode/packages/opencode/dist/opencode-*/bin/opencode ~/.local/bin/opencodeOptional but expected by the active config:
- Chromium at
/usr/bin/chromiumfor Playwright MCP
git clone <repo-url> ~/.config/opencode
cd ~/.config/opencodeReuse is under the MIT License. If you plan to contribute, keep it lean and follow CONTRIBUTING.md.
opencode.jsonc is the active config and is meant to be created locally from the template:
cp opencode.example.jsonc opencode.jsoncCreate ~/.config/opencode/.mcp-secrets.env for MCP servers that source env vars:
CONTEXT7_API_KEY=your_key_here
EXA_API_KEY=your_key_herealias opc='~/.config/opencode/opc.sh'
alias opc-up='~/.config/opencode/opc-up.sh'Reload your shell:
source ~/.bashrc
# or
source ~/.zshrcopcWhat it does:
- disables OpenCode autoupdate for the session
- launches
~/.local/bin/opencode - finds the next free port starting at
4096 - uses tmux sessions named from
OPC_SESSION_PREFIX(default:opencode) - stores the original working directory as tmux option
@opc_context_root - opens a new tmux window if already inside a live tmux client
- otherwise creates and attaches a new tmux session, then falls back to direct launch if tmux fails
From an interactive shell on the default branch, opc checks Worktrunk state and prompts you to:
- work on the default branch
- switch to an existing
trunk/*branch - create a new trunk worktree (recommended)
Useful variants:
OPC_DEBUG=1 opc
OPC_SESSION_PREFIX=myproj opc
opc -- <extra opencode args>opc-upWhat it does:
- updates the source repo at
${OPC_UP_REPO:-~/opencode} - hard-resets that repo to its configured upstream branch when one exists (otherwise falls back to the remote default branch) and removes untracked files there
- runs
bun install - provisions a cached helper Python with
setuptoolsfor node-gyp if the system Python lacksdistutils - rebuilds the single-file OpenCode binary
- installs the result to
~/.local/bin/opencode - updates
backlog.md - updates
opentmuxif it is installed globally - upgrades Worktrunk if it is installed via Homebrew
- refreshes
wt config shell install
Important: opc-up is intentionally destructive inside ${OPC_UP_REPO}. It discards local changes in the OpenCode source checkout it manages.
Built-in build and plan agents are disabled in this config; Brokkr and Mimir cover those roles.
| Agent | Role |
|---|---|
Brokkr - Orchestrator |
Default agent; orchestrates implementation by specialty, runs independent lanes in parallel when safe, verifies diff plus tests or build before done, commits only when asked |
Mimir - Planner |
Research, architecture, and parallel-aware task creation only; absolutely no code implementation |
compaction |
Context compression and preservation |
| Agent | Role |
|---|---|
backend |
Server-side logic and data layer |
blogger |
Docs, guides, tutorials, README rewrites, and editorial cleanup |
explore |
Read-only codebase exploration |
frontend |
UI logic, state, and accessibility |
general |
General-purpose multi-step work |
reviewer-a |
Structured reviewer A |
reviewer-b |
Structured reviewer B |
small |
Small edits and git ops |
webui |
Browser UI and Rust/Tauri frontend visual work |
| Skill | Purpose |
|---|---|
frontend-design |
High-quality production frontend design |
interface-design |
Deliberate dashboard, SaaS, and tool interface design |
peer-review |
Parallel review orchestration across reviewer-a and reviewer-b |
prune-worktrees |
Safe Worktrunk cleanup and pruning |
report-loc |
SCC-only codebase LoC and language breakdown |
save-work |
End-of-session commit, push, PR, and merge workflow |
tasks-create |
Create backlog tasks against the canonical default-branch backlog |
tasks-do |
Execute an existing backlog task end-to-end |
- Launch normal sessions with
opc, not rawopencode, so tmux and worktree behavior stay consistent. - When starting from the default branch, prefer switching to or creating a
trunk/*worktree unless you intentionally want base-branch work. - Treat
opencode.jsoncas the active source of truth;opencode.example.jsoncis only a template. - Brokkr should usually delegate through
task, break implementation into lanes, launch independent subagents in parallel when safe, route docs writing and rewrites toblogger, and verify the diff plus tests or build before calling work done. - Mimir is for research, architecture, and
/tasks-createplanning only; it must not implement code, and it should create task graphs that preserve safe parallel execution with real dependencies only.
- Single task: name one task and
tasks-doshould do only that task. - Task range: name the range and
tasks-doshould do only that range. - Keyword task set: name the keyword(s) and
tasks-doshould do only the related matching tasks. - Pause or stop: say so explicitly and
tasks-doshould pause and update the backlog task.
Examples:
do task-333
do task-333 through task-340
work the auth tasks
pause task-333
stop after task-333 and update the backlog
- Shared backlog writes must resolve to the canonical default-branch backlog; branch-local backlog drift is unsupported.
tasks-createonly writes to the canonical default-branch backlog onmainormaster; if the write target is branch-local, it should refuse.tasks-createshould model multi-task work as a DAG, identify parallel lanes and the critical path, and add dependencies only when a real blocker or prerequisite exists.tasks-domust read the task first, work only the named scope, move active work toIn Progress, automatically continue task-to-task in continuous mode without asking for approval between ready tasks, run ready independent work in parallel when safe, pause on blockers or explicit stop requests, and always update the backlog task after done or pause.tasks-doacts as the foreman: subagents may implement lanes, but Brokkr keeps ownership of coordination, verification, synthesis, and backlog updates.- Never invent task IDs or dependency IDs.
- Use real dependencies to encode execution order for multi-task plans.
This repo uses exactly:
BacklogTo DoIn ProgressDone
Rules:
- do not invent
BlockedorCancelled - keep blockers in task notes while leaving the real status intact
- archive invalid, duplicate, superseded, or abandoned tasks instead of marking them
Done
smallis the subagent for small edits and git operations.- Push only when explicitly requested unless you are intentionally running the
save-workworkflow. - Use
save-workfor the end-of-session save, push, PR, and merge flow. - Use
prune-worktreesfor safe cleanup, and run it from the main worktree context rather than a secondary worktree. - Never force-push as part of the normal workflow.
~/.config/opencode/
├── .mcp-secrets.env
├── agents/
├── biome.json
├── dcp.jsonc
├── opentmux.json
├── skills/
├── opencode.jsonc
├── opencode.example.jsonc
├── opc.sh
├── opc-up.sh
├── themes/
├── tui.json
└── README.md
- Start in the repo you want to work in.
- Run
opc. - If you are on the default branch, create or switch to a
trunk/*worktree when prompted. - Use
Mimirortasks-createfor planning. - Use
Brokkrfor implementation orchestration. - Use
tasks-dofor an existing backlog item. - Use
save-workto finish cleanly. - Use
prune-worktreeslater from the main worktree when merged branches are safe to remove.