cd /news/ai-agents/opencode-token-saver-setup-wizard-oh… Β· home β€Ί topics β€Ί ai-agents β€Ί article
[ARTICLE Β· art-174522] src=gist.github.com β†— pub= topic=ai-agents verified=true sentiment=↑ positive

OpenCode Token-Saver Setup Wizard (oh-my-opencode-slim + DCP + Caveman + MCP/Skills hygiene)

A developer published a setup wizard for OpenCode that combines oh-my-opencode-slim tiered multi-agent routing, the @tarquinen/opencode-dcp dynamic context pruning plugin, the caveman token-compression tool, and @chenlongapps/opencode-token-usage for live visibility, aiming to cut token burn and eliminate 300K–600K context bloat. The wizard instructs an AI agent to detect the user's existing config and available provider/model IDs, propose a two- or three-tier model split (frontier models for orchestrator/oracle/designer/arbiter, cheap fast models for explorer/fixer/validator), back up configs before merging, and verify the setup afterward. It also offers a manual eight-step path taking roughly ten minutes.

recommendation

Route repo search, mechanical edits and log parsing to cheap fast models while reserving frontier models for orchestration and review, and set DCP context budgets around 100K–180K to cap bloat.

more in playbook: Controlling LLM cost
by read13 min views5 publishedNov 23, 2026

Goal: Cut OpenCode token burn and stop 300K–600K context bloat without losing engineering quality.

Stack: oh-my-opencode-slim (tiered multi-agent routing) + @tarquinen/opencode-dcp (smart dynamic context pruning) + caveman (output/input token compression) + @chenlongapps/opencode-token-usage (live visibility).

You can use this file in two ways:

  1. Automated Wizard (Recommended): Open OpenCode in any folder and paste:
Read opencode-token-saver-wizard.md and walk me through setting this up interactively. First detect the providers and models I already use or have access to, recommend the best tiered model split from my available models so I can choose, ask my preferences, back up my existing config files, merge changes safely without deleting my providers/keys, and verify the final setup.
  1. Manual Step-by-Step: Follow Steps 0 through 8 below (~10 minutes).

Instructions for AI Agents Running This Wizard(click to expand)

When a user asks you to run this wizard:

  1. Inspect config & discover available models first: - Detect the user's OpenCode config directory (~/.config/opencode/ on macOS/Linux,%USERPROFILE%\.config\opencode\ or%APPDATA%\opencode\ on Windows, or$OPENCODE_CONFIG_DIR if set) and read existingopencode.json ,oh-my-opencode-slim.jsonc ,dcp.jsonc , andAGENTS.md if present.
  • Note what the user currently uses (model ,small_model , configuredprovider entries, existing agent presets, and auth plugins).
  • Run opencode models (or check OpenCode's available models tool) to list theexact provider/model IDs the user actually has access to. Never guess or invent model IDs.
  1. Detect the user's OpenCode config directory (
  2. Propose personalized model tiers & ask intake questions before writing anything: - Using ONLY models discovered in Step 1, show the user their currently active model(s) alongside concrete recommended pairings :
    • Option 1 (Recommended β€” 2-Tier Split): Best availableFrontier model fororchestrator ,oracle ,designer ,arbiter + best availableFast/Cheap model (Flash / Mini / Haiku / Hydrogen / DeepSeek Flash / etc.) forexplorer ,fixer ,validator , andsmall_model .
    • Option 2 (3-Tier Split, if 3+ tiers available): Frontier fororchestrator /oracle /arbiter , Mid-tier forfixer /designer , Ultra-fast/cheap forexplorer /validator .
    • Option 3 (Custom per-agent): Let the user pick exact models from their discovered list for each role.
  • Ask the user to pick their model split (prefer interactive choice/question UI when available, placing (Recommended) first) plus these 4 preferences:
    • DCP context budget:**Tight (60K–110K) ,Balanced (100K–180K, recommended) , orHeavy (120K–220K)** ?
    • Caveman compression:**Lightweight skill + AGENTS.md (zero proxy),Full Caveman CLI (also compresses large tool outputs), orSkip** ?
    • MCP audit: Any globally enabled MCP servers to disable or move to project-only configs?
    • *(Optional)*Global skills/tools/instructions audit: Should I inspect<config-dir>/skills/ ,AGENTS.md ,instructions , and per-agentskills /mcps grants to trim turn-1 baseline bloat?
  1. Using ONLY models discovered in Step 1, show the user their currently active model(s) alongside
  2. Back up before modifying: Copy existing config files to*.bak before editing.
  3. Merge, never clobber: Preserve existingprovider , API keys, auth plugins, and unrelated MCPs/instructions inopencode.json .
  4. Confirm restart: Tell the user to restart OpenCode and run the Step 8 verification checks.
Layer Tool / Plugin What It Fixes
Tiered Model Routing oh-my-opencode-slim +alvin/validator +capybearista/arbiter Stops burning your frontier model on repo search, mechanical edits, and raw test/build logs.
Smart Context Pruning @tarquinen/opencode-dcp Auto-prunes stale/duplicate tool outputs and nudges selective range compression around 100K–180K instead of waiting for emergency compaction.
Token Compression caveman (@caveman-ai/cli or skill +AGENTS.md ) Cuts response prose ~65–75% (and optionally shrinks large logs/JSON/test outputs) while keeping code, commands, and errors exact.
Token Visibility @chenlongapps/opencode-token-usage Shows token burn live so context creep never sneaks up on you.

Find your global OpenCode config directory:

OS Default Config Directory
macOS / Linux ~/.config/opencode/
Windows %USERPROFILE%\.config\opencode\ (or%APPDATA%\opencode\ )
Custom $OPENCODE_CONFIG_DIR (takes priority if set)

Back up existing files before touching anything:

macOS / Linux (Bash/Zsh):

CFG="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}"
mkdir -p "$CFG"
for f in opencode.json oh-my-opencode-slim.jsonc dcp.jsonc AGENTS.md; do
  [ -f "$CFG/$f" ] && cp "$CFG/$f" "$CFG/$f.bak"
done

Windows (PowerShell):

$cfg = if ($env:OPENCODE_CONFIG_DIR) { $env:OPENCODE_CONFIG_DIR } else { Join-Path $HOME ".config\opencode" }
New-Item -ItemType Directory -Force -Path $cfg | Out-Null
foreach ($f in @("opencode.json", "oh-my-opencode-slim.jsonc", "dcp.jsonc", "AGENTS.md")) {
  $p = Join-Path $cfg $f
  if (Test-Path $p) { Copy-Item $p "$p.bak" -Force }
}

Instead of running one expensive model (or max reasoning effort) for every shell command and file search, split your agents into tiers using the models you already have access to.

Run this in your terminal to see every exact provider/model ID enabled on your machine:

opencode models

Check your existing opencode.json too β€” whatever you currently use under "model" is usually your starting anchor for Tier 1 (Frontier) or Mid-Tier.

Role Agent(s) Tier Recommended Effort ( variant ) Why
Planning & Delegation orchestrator Tier 1 β€” Frontier high Good decomposition prevents wasted retry loops.
Architecture / Hard Bugs oracle Tier 1 β€” Frontier high Escalation only; rarely called.
UI / UX designer Tier 1 β€” Frontier high Visual/layout judgment needs a strong model.
Code Review arbiter Tier 1 β€” Frontier high Read-only merge/correctness gate.
Scoped Implementation fixer Tier 2 β€” Fast*(or Mid-Tier)* high orxhigh Executes clear specs from Orchestrator cheaply.
Codebase Search & Docs explorer Tier 2 β€” Fast / Cheap high High-volume read-only recon; fast models excel here.
Tests, Lint & Builds validator Tier 2 β€” Fast / Cheap medium Runs noisy commands, keeps full logs on disk, returns concise failure excerpts.

Pick the row that matches the provider(s) you already pay for or have configured in opencode models (mixing providers across tiers works natively in oh-my-opencode-slim):

What You Have Access To Recommended BIG_MODEL (Tier 1) Recommended SMALL_MODEL (Tier 2) Optional 3-Tier Tweak
Google Gemini Top reasoning Gemini (e.g. google/gemini-4-neon or your highest Pro/reasoning ID) Fast Gemini (e.g. google/gemini-4-hydrogen / Flash tier) Keep fixer onxhigh effort
Anthropic Claude Strongest Opus or Sonnet you have access to Haiku (for explorer /validator ) or Sonnet (if Opus is Tier 1) Opus β†’ orchestrator /oracle , Sonnet β†’fixer /designer , Haiku β†’explorer /validator
OpenAI Top flagship coding/reasoning model Mini / fast coding tier Use medium effort onvalidator
OpenCode Go / DeepSeek / Open Weights Strongest reasoning model in your catalog Fast / Flash variant (e.g. DeepSeek Flash tier) Drop validator frommax β†’medium
Mixed ("Frankenstein")(Best cost/quality) Your favorite frontier model (Claude / Gemini / OpenAI) Your cheapest fast provider (OpenCode Go / DeepSeek Flash / Gemini Flash / Haiku) Huge savings if you already have both a Pro/API frontier key and OpenCode Go

Selection Rule if Your Model Names Differ: From your opencode models output, pick your smartest coding model as BIG_MODEL and a 3x–10x cheaper fast model (typically labeled Flash, Mini, Haiku, Light, or Fast) as SMALL_MODEL.

Avoid the Max trap: Do not leave routine build/verify/test loops running on max reasoning effort. Reserve high/ xhigh for planning and bug fixes, and keep validator on medium.

Run these commands in your terminal:

bunx oh-my-opencode-slim@latest install

opencode plugin add @tarquinen/opencode-dcp@latest

opencode plugin add @chenlongapps/opencode-token-usage

Now open your opencode.json and merge the following fields (keep your existing provider, API keys, and mcp entries intact):

{
  "$schema": "https://opencode.ai/config.json",
  "default_agent": "orchestrator",
  "model": "REPLACE_WITH_BIG_MODEL",
  "small_model": "REPLACE_WITH_SMALL_MODEL",
  "plugins": [
    "@chenlongapps/opencode-token-usage",
    "@tarquinen/opencode-dcp",
    "oh-my-opencode-slim"
  ]
}

Create or update <config-dir>/oh-my-opencode-slim.jsonc. Replace REPLACE_WITH_BIG_MODEL and REPLACE_WITH_SMALL_MODEL with your chosen IDs from Step 1:

{
  "$schema": "https://unpkg.com/oh-my-opencode-slim@latest/oh-my-opencode-slim.schema.json",
  "preset": "token-saver",
  "setDefaultAgent": true,
  "multiplexer": {
    "type": "none"
  },
  // List noisy or redundant MCP servers here so agents don't load unused tool schemas
  "disabled_mcps": [],
  "presets": {
    "token-saver": {
      "orchestrator": {
        "model": "REPLACE_WITH_BIG_MODEL",
        "variant": "high",
        "skills": ["*"]
      },
      "oracle": {
        "model": "REPLACE_WITH_BIG_MODEL",
        "variant": "high",
        "skills": ["simplify"]
      },
      "explorer": {
        "model": "REPLACE_WITH_SMALL_MODEL",
        "variant": "high",
        "skills": []
      },
      "designer": {
        "model": "REPLACE_WITH_BIG_MODEL",
        "variant": "high",
        "skills": []
      },
      "fixer": {
        "model": "REPLACE_WITH_SMALL_MODEL",
        "variant": "xhigh",
        "skills": []
      },
      "validator": {
        "model": "REPLACE_WITH_SMALL_MODEL",
        "variant": "medium"
      },
      "arbiter": {
        "model": "REPLACE_WITH_BIG_MODEL",
        "variant": "high"
      },
      "marketplace": {
        "agents_add": [
          "alvin/validator",
          "capybearista/arbiter"
        ]
      }
    }
  }
}

Build logs, compiler errors, and pytest/vitest suites are one of the fastest ways to blow up a context window. alvin/validator runs checks in an isolated child session on your cheap model, keeps raw logs on disk, and returns only exact commands, exit codes, and concise failure excerpts to your Orchestrator.

Create <config-dir>/dcp.jsonc.

DCP works differently from blunt emergency auto-compaction:

  • Deduplication: Drops repeated identical tool calls, keeping only the latest result.
  • Error purging: Strips bulky inputs from old errored tool calls while preserving the error message.
  • Selective compress tool: Instead of waiting until 95% full and wiping the whole session, DCP nudges the model once a work phase closes so stale spans collapse into dense technical summaries while recent turns stay verbatim.
{
  "$schema": "https://raw.githubusercontent.com/Opencode-DCP/opencode-dynamic-context-pruning/master/dcp.schema.json",
  "enabled": true,
  "autoUpdate": true,
  "debug": false,
  "pruneNotification": "minimal",
  "pruneNotificationType": "toast",
  "commands": {
    "enabled": true,
    "protectedTools": []
  },
  "manualMode": {
    "enabled": false,
    "automaticStrategies": true
  },
  // Never prune the most recent 6 turns so active edits stay verbatim
  "turnProtection": {
    "enabled": true,
    "turns": 6
  },
  "compress": {
    "minContextLimit": 100000,
    "maxContextLimit": 180000,
    "nudgeFrequency": 8,
    "iterationNudgeThreshold": 25,
    "nudgeForce": "soft",
    "protectUserMessages": true
  }
}
Profile minContextLimit maxContextLimit Best For
Tight / Quota-Conscious 60000 110000 128K–200K models or strict subscription rate limits
Balanced (Recommended) 100000 180000 200K–1M models; keeps quality high and prevents runaway cost
Heavy Multi-File Sessions 120000 220000 Large architecture refactors needing wide active context

Prompt Cache Note: Pruning modifies earlier messages, which invalidates provider prompt-cache prefixes from the pruned point forward. Keep nudgeForce: "soft" and turnProtection.turns: 6 so DCP compresses at natural phase boundaries rather than busting cache every 2 turns.

Watch protectUserMessages: true: It guarantees your instructions are never summarized away, which is great β€” just avoid pasting 50KB raw log files directly into chat messages (save logs to a file and reference the path instead).

  • /dcp β€” Open the DCP status/stats panel and toggle manual mode.
  • /dcp-compress [focus] β€” Trigger an immediate targeted compression pass (e.g.,/dcp-compress finished auth exploration ).

(Optional note: DCP's maintainers also publish Sleev as a cross-agent proxy successor (npm i -g sleev), if you want similar pruning across Claude Code, Codex, and OpenCode simultaneously.)

Caveman strips conversational filler, articles, and fluff from responses while keeping code, commands, paths, and error strings character-for-character exact.

Pick one of the two options below:

Installs the full suite (terse output + shrinks large logs/JSON/CSV/test outputs before the model reads them). Requires Node.js 22.13+:

npx @caveman-ai/cli@latest

Follow the interactive prompt to select OpenCode. Check status anytime with caveman status, or turn off individual features (e.g. caveman off browse).

If you only want compressed prose with zero background proxy:

npx skills add JuliusBrussee/caveman -g

Then add this block to <config-dir>/AGENTS.md so terse mode starts automatically in every session:

<!-- caveman-begin -->
Respond terse like smart caveman. All technical substance stay. Only fluff die.

Rules:
- Drop: articles (a/an/the), filler (just/really/basically), pleasantries, hedging
- Fragments OK. Short synonyms. Technical terms exact. Code unchanged.
- Pattern: [thing] [action] [reason]. [next step].
- Not: "Sure! I'd be happy to help you with that."
- Yes: "Bug in auth middleware. Fix:"

Switch level: /caveman lite|full|ultra|wenyan
Stop: "stop caveman" or "normal mode"

Auto-Clarity: drop caveman for security warnings, irreversible actions, user confused. Resume after.

Boundaries: code/commits/PRs written normal.
<!-- caveman-end -->
Command Effect
/caveman lite Full sentences, zero filler (best if full caveman feels too clipped)
/caveman Default ( full ): drops articles, fragments OK, ~65–75% fewer prose tokens
/caveman ultra Extreme compression with abbreviations and arrows
stop caveman Return to normal prose anytime

Bonus: Caveman also includes cavecrew subagents (cavecrew-investigator, cavecrew-builder, cavecrew-reviewer) that return compressed summaries back to the parent session.

Every active MCP server injects tool schemas into your prompt on turn 1. Having 100+ MCP tools enabled globally can silently burn 20K–80K tokens before you even type a message.

Quick hygiene checklist:

  1. Audit mcp in global opencode.json: Set"enabled": false on any MCP server you do not use in most projects.
  2. Move niche MCPs to project configs: Put project-specific MCPs inside<repo>/.opencode/opencode.json instead of global config.
  3. Prefer CLI tools over always-on doc MCPs: If a library tool has a lightweight CLI (e.g.,npx ctx7@latest instead of an always-oncontext7 MCP server), disable the MCP inoh-my-opencode-slim.jsonc via"disabled_mcps": ["context7"] and invoke the CLI only when needed.

Even before your first message, OpenCode loads a turn-1 baseline: system tools + active MCP schemas + global skill descriptions + AGENTS.md + files in opencode.json's "instructions" array. Across dozens of forgotten skills and rules, that baseline quietly reaches 30K–80K+ tokens on every single session and subagent spawn.

Run a quick 3-minute trim:

macOS / Linux:

CFG="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}"
ls -1 "$CFG/skills" 2>/dev/null
wc -l "$CFG/AGENTS.md" 2>/dev/null

Windows (PowerShell):

$cfg = if ($env:OPENCODE_CONFIG_DIR) { $env:OPENCODE_CONFIG_DIR } else { Join-Path $HOME ".config\opencode" }
Get-ChildItem (Join-Path $cfg "skills") -Directory -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name
if (Test-Path (Join-Path $cfg "AGENTS.md")) { (Get-Content (Join-Path $cfg "AGENTS.md") | Measure-Object -Line).Lines }
Bloat Source Where to Check How to Trim
Unused / duplicate global skills <config-dir>/skills/ Delete one-off or overlapping skills; move repo-specific skills to <repo>/.opencode/skills/ .
Per-agent skill grants oh-my-opencode-slim.jsonc (skills ) Keep subagents ( explorer ,fixer ,designer ,validator ,arbiter ) at"skills": [] unless a specialist explicitly needs one. Exclude heavy skills onorchestrator with["*", "!heavy-skill"] .
Per-agent MCP / tool access oh-my-opencode-slim.jsonc (mcps ,disabled_mcps ) Restrict MCPs per agent (e.g., "mcps": [] onfixer /validator ) so worker subagents never load browser/docs/external tool schemas they don't need.
Verbose AGENTS.md & instructions <config-dir>/AGENTS.md +opencode.json (instructions ) Keep global rules under ~150 lines. Move stack-specific conventions into project AGENTS.md . If using Caveman, run/caveman-compress <file> to shrink bulky memory/rule files while keeping a backup.

Rule of thumb: Every global skill description and always-on instruction file is a permanent tax on every turn of every session. Global = truly universal; everything else belongs in the repo's .opencode/ folder.

Restart OpenCode so plugins, marketplace agents, and dcp.jsonc take effect, then run these 5 quick checks:

  • Orchestrator is default: New session starts inorchestrator mode (check agent indicator in UI/TUI).
  • Tiered delegation works: Ask"Find where our config or entrypoint is defined" β†’ confirm Orchestrator delegates to@explorer on yoursmall model , not your frontier model.
  • Validator & Arbiter loaded: Run a small test/build ask β†’ confirm@validator is available and returns concise output rather than raw full logs.
  • DCP is active: Type/dcp β†’ confirm the DCP panel opens withenabled: true and your100k / 180k limits.
  • Token usage & compression active: Confirm token usage displays, and (if Caveman is enabled) replies are terse while code blocks remain normal.
  1. Close loops, then compress: After finishing an investigation or feature slice, run/dcp-compress (or let DCP compress it) before starting the next slice.
  2. Fresh session per unrelated task: Don't drag a 150K session from Feature A into Feature B. Start fresh with a 5-line handoff note if needed.
  3. Keep logs in files, not chat: Redirect verbose test/build output to a file or let@validator run it β€” never paste 1,000-line stack traces into user prompts.
  4. Match effort to task: High/xhigh effort for architecture and tricky fixes; medium effort for linting, builds, and routine verification.
── more in #ai-agents 4 stories Β· sorted by recency
── more on @opencode 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/opencode-token-saver…] indexed:0 read:13min 2026-11-23 Β· β€”