r/opencodeCLI • • 20d 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.

9 Upvotes

10 comments sorted by

1

u/Any_Flounder8768 20d 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/FallElectronic3774 16d ago

Disabling opencode's compaction when something upstream already manages context is the part people get wrong — two managers fighting over the same window produces exactly the "model forgot the file" behavior that looks like a model problem.

One thing I'd add: a receipt/recall scheme still needs the model to know the receipt is a pointer. Without a rule telling it "if the output was truncated, call recall instead of re-running the command," it will just re-run the command. The proxy makes recall possible; the prompt makes it likely.

Also worth flagging on the config: timeout: false is right for a local engine, but if anyone copies this in front of a hosted endpoint, a hung request then never fails and the session stalls with no error.

1

u/Any_Flounder8768 16d ago

Thanks, excellent observations. (Translated using AI; the tool and the response are my own.)

Compaction: 👍

Receipt as a reference: the proxy already handles this part. Each receipt indicates where the original can be found ("Exact text: recall id=…"), and the description of the `recall` tool instructs the model to use it rather than guessing or re-running commands. Therefore, this information is conveyed via the proxy, and I don’t believe a specific rule in `AGENTS.md` is necessary. The receipt also addresses the flip side: to get the current state of a file, one must re-read it or re-run the command, as the archived text may be outdated. In the `opencode` session I analyzed, the model invoked `recall` 44 times.

Timeout: You’re right! I’ve added a note to the documentation and credited you. ☺️

1

u/SirRobinBlibs 20d 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/FallElectronic3774 16d ago

The deny-list for things that can leave the box is the highest-value line in most configs, but it's worth knowing its limit: permission.bash matches the command string, so curl blocked still leaves python -c "import urllib.request...", git push, or a package's postinstall script. The deny list stops the obvious path; the actual boundary is network egress at the container level.

"Everything else I add only after it stops a real mistake twice" is a better rule than any specific entry. Most configs are full of rules that were added once, never verified, and now cost tokens every turn.

1

u/SirRobinBlibs 16d ago

yeah, fair, the deny list is a speed bump for the obvious command, not a fence. python -c or a postinstall script walks right past a string match. if the box can't reach the network except through an allowlisted proxy, the bash rules go back to being what they're good at, catching honest mistakes early.

1

u/tedivm 20d ago

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

1

u/FallElectronic3774 16d ago

Agreed, and the split is useful: the json is plumbing — providers, auth, permissions, MCP registration — and the AGENTS.md/skills/commands are behavior. Plumbing changes rarely and breaks loudly when wrong. Behavior changes constantly and breaks quietly.

The one json thing that does change behavior: permission entries. Those are the only part of the file that's enforced rather than suggested, which is why they belong there and not in prose.

1

u/squirrelscrush 20d 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