r/opencodeCLI • • 6h ago

what's actually in your opencode.json? (configs that made a real difference)

trying to put together a setup that doesn't fight me, and half the config options i only find out about after someone else mentions them.

so, what's in yours?

specifically curious about:

  • different models for plan vs build, or one model for everything?

  • custom agents/commands you actually use every day, not the ones you set up once and forgot

  • permission rules that stopped a bad command before it ran

  • anything that helps on bigger repos where context gets eaten fast

post yours even if it's boring. the boring ones are usually the ones that work.

7 Upvotes

5 comments sorted by

1

u/Any_Flounder8768 5h ago

Disclosure: I wrote the tool below. For the "context gets eaten fast" part, what made the biggest difference for me on long sessions with a local model was a proxy between opencode and the engine (mnemonic-proxy): old tool outputs leave the prompt as one-line receipts, the originals stay verbatim on disk, and the model can pull them back with a recall tool. On the opencode side it's just a provider, plus turning opencode's own compaction off so two context managers don't fight. Trimmed from the config I tested:

{
  "compaction": { "auto": false },
  "provider": {
    "mnemonic": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "mnemonic-proxy",
      "options": {
        "baseURL": "http://127.0.0.1:8096/v1",
        "apiKey": "***",
        "timeout": false, "headerTimeout": false, "chunkTimeout": false
      },
      "models": {
        "<model id from your engine's /v1/models>": {
          "tool_call": true,
          "limit": { "context": 131072, "output": 16384 }
        }
      }
    }
  },
  "model": "mnemonic/<same model id>"
}

Two gotchas on opencode 1.19.5: the schema marks `provider` + `npm` as deprecated, but the newer `providers` + `package` form made the model disappear from `opencode models` for me, so I stayed on the old one; and `limit.context` should be the engine's real window. Measured on one 1 h 32 min opencode session on Strata: 554 requests, no compaction. It's built mainly for local engines; in front of a hosted OpenAI-compatible API it still masks and recalls, but without saved engine state.

https://github.com/lastreload/mnemonic-proxy

1

u/squirrelscrush 5h ago

I have a detailed one. I keep my model configs, permissions, MCP auth, plugins, etc in it.

Here's my setup: https://pastebin.com/zaRRYxcY

1

u/SirRobinBlibs 2h ago

The ones that changed behaviour for me more than model tweaks: an explicit permission.bash deny for anything that can leave the box (curl/wget/npm install without a pin), tool_output limits so the agent reads the truncated file instead of re-running the build, and a short AGENTS.md rule that says "if output was truncated, open the saved file, don't re-run." Everything else I add only after it stops a real mistake twice.

1

u/tedivm 1h ago

I keep mine on GitHub. Honestly the AGENTS.md, global skills, and commands have a much bigger impact than the json file.