r/opencode • u/previaegg • 12d ago
Trying to improve OpenCode's efficiency
I've been testing OpenCode and Pi with locally hosted qwen3.8-27b and I'm looking for advice on improving OpenCode's efficiency.
I prefer OpenCode, particularly its interface and ecosystem, and I'd really like to keep using it, but in my testing Pi has been noticeably more efficient at getting coding tasks done.
My setup:
- Model: Qwen3.8-27B (Q6_K_XL)
- Inference: llama.cpp
- Hardware: RTX 4080 SUPER + RTX 4070 Ti SUPER (32GB combined)
- Tasks: Real coding tasks in repos including multi-file changes, tool use, and test-driven iteration
The main issue isn't raw inference speed. It's how efficiently the agent uses its tokens and tools to complete a task.
Here's one example... I've been testing both harnesses using the same coding task in a TypeScript repo. Using OpenCode, the model spends a lot of time reasoning about the implementation ("but wait..."), revisiting decisions ("actually..."), and sometimes going through context compaction without making corresponding progress. With Pi, the same underlying model has generally been more willing to move from analysis into tool calls and implementation.
In both cases the model can do the work. The question I'm running into is why the harness seems to make such a difference in how efficiently it gets there.
If you've optimized OpenCode for local models (particularly qwen3.8-27b, which is known to overthink):
- Have you found prompt or agent configurations that reduce unnecessary reasoning and encourage more direct tool use?
- Have you simplified OpenCode's tool definitions or system prompt to improve local-model performance?
- Have you found any compaction or context management behaviors that could produce more over-thinking than with other harnesses?
- Have you found any other settings or modifications worth testing to get OpenCode invoke the model more efficiently from an over-thinking perspective?
I'm not looking to argue that one harness is better than the other. I want to keep using OpenCode but improve it's use of this model.
I appreciate your thoughts!
--
Edit for grammar.
8
u/DagothUrLovesGroza 12d ago
I thought about doing something similar, but honestly it is probably a waste of time. OC, at its core, is built for big cloud models. As time passes, more and more features will be tuned purely for those big cloud models with huge context windows.
As a rule of thumb, with locally hosted models you should always use Pi, purely because it is so minimalistic.
4
u/learning-to-programm 12d ago
That's nota sentence I thought I'd hear. Pi's ecosystem is much more robust and creative, imo. And I think that's by design, as it is supposed to be tweaked to each person's liking. Take a look at the pi packages page, the pi agent subreddit, or for anything you find lacking just google Pi [thing].
But anyway, I and other people have also seen the same thing - that smaller models tend to run better on Pi (and allegedly Hermes too) than on OpenCode. Some say it's due to lack of bloat.
And coincidentally, I also got your exact symptoms: LLM thinking nonstop, reading the sane files over and over, and compacting before it's done barely any work. Mostly with a 33B model (Agnes 2.5). In Pi the same model performed much better and was actually half competent.
Now, I haven't tried it, but maybe you could create a custom agent with a leaner system prompt, and use that rather than the default @general agent from OpenCode? Maybe use very specific prompts to limit the scope of the LLM's work, and thus have do more and think less?
3
u/lincolnthalles 12d ago
First, make sure your local deployment has enough context for the job and that the harness is configured accordingly. A context under 200K is borderline useless for coding.
Inspect the whole thread history (the JSON API queries) and compare. Something could be wrong with code mode or other tool calling and may require you to adjust things in the host or in the harness.
Even OpenCode Go's DeepSeek V4.1 deployment suffers from related issues sometimes. I had a thread where OpenCode V2 filled the context very quickly by inserting a warning (regarding code mode usage) to the model at every wrong tool call it made (and all tool calls were wrong).
About a month ago, DeepSeek on Go was brain-dead for many people for weeks with a similar behavior to what you described, and it was later fixed and attributed to a deployment issue.
The system prompt does play a role in model behavior, but it's pretty minimal for OpenCode V2. Tool descriptions are bigger.
OpenCode V2 compaction is hardcoded, and the prompt is generated programmatically. The results are quite decent, so it's the last thing I would change. First, check why the context is being filled so fast: is your context too little to work with, or is the harness dumping warnings as I described?
You can override the system prompt for any other agent, so you may play with that by creating a prompt that gives the model a procedure to follow. The issue is that a decent prompt will be big, and you already have a context problem.
*** opencode.jsonc ***
If you narrow the issue to the delay or the "but wait", I'd suggest you review the results as you tweak things. Too much hesitation is bad, but a hyper-confident model is even worse, as it will produce only slop.
1
u/for4f 12d ago
yeah this matches what i've seen running local stuff through opencode too. the harness assumes a big frontier model that can juggle a ton of context and tools at once, so with a 27b it just sits there second-guessing itself lol. pi's loop is dumber in a good way, it pushes the model toward acting instead of thinking about acting. thing i'd actually check is the compaction and reasoning settings. opencode compacts and then the small model basically starts over, re-reasoning stuff it already decided. if you can raise the compaction threshold or cut the reasoning budget down it wastes way fewer tokens per task. also worth trying the same task with plan mode off if you've got it on, small models go in circles in plan-then-act loops. for local models i've mostly landed on simpler harness equals better harness. opencode's ecosystem is great when the model can keep up, but under like 30b that extra machinery works against you.
1
u/Agile-War-1904 12d ago
The thing that actually moved the needle for me wasn't prompt tweaking, it was tool surface area. I had two MCP servers attached and one of them exposed 200+ tools, and that schema alone was eating a huge slice of every request before I typed anything. Grouping them behind a single dispatch tool (Code Mode) cut the overhead more than any instruction change did. Worth measuring the token count of your tool block before you start optimizing prompts.
1
u/BABAIIYAGA 6d ago
same model behaving that differently points to d harness more than d model.. I would compare tool calls nd system prompts first hindsight also supports both OpenCode and PI if u want to test whether retaining repo decisions cuts down on repeated reasoning.. just would not expect memory alone to fix overthinking...