← r/LocalLLaMA
▲
4
-1
17👁
r/LocalLLaMA · u/laerciosantana · 4d ago

While I was investigating why my opencode context was large I created the opencoder-leaner to try prune the context (minimal prune in the tools, agent pi-like, bash only)

I was a little obsessed about the size of my context, mainly because I use a local LLM with little context). So I started looking in the opencode codebase to understand how the context was builded. After learn a lot, I'm really impressed how context of opencode can be customized. Before, I thought that the context of opencode was bloated and closed to changes, since I only see people praise pi about it. With a custom primary agent we can disable almost every thing in the context (besides the environment message).

The context is: environmentMessage + agent prompt + agent.md instructions + skills descriptions + tools descriptions.

For a test I created a blank agent with minimal agent prompt, without agent.md instructions and without tools, it resulted in a start context size of 220 tokens. I never thought that opencode was able to do this. I have created some agents to test the impact of the tools. In this plugin I even created a bash agent that only has a bash tool, similar to the mini-swe-agent, which reduced the context size from a base of \~10.3k to \~1.3k tokens. I created a pi-like agent too, it have only some tools similar to pi, it reduce the context to \~5.5k tokens.

Analyzing the context builded I found some overlap instructions and out of scope instructions in the tool - IMO. So I removed theses.

things like: "Use gh for GitHub tasks, including PRs, issues, checks, and releases; return the PR URL when done." from bash/shell tool description

The repo: https://github.com/LaercioSantana/opencode-leaner

install: {"plugin": \["opencode-leaner"\]}

7 0 4 10/5 23:42 10/9 08:00 UTC
scorecomments17 sightings
first seen 2026-10-05 23:42 UTClast seen 2026-10-09 08:00 UTCscore then 5score now 4gained -1sightings 17
open on reddit ↗ 💬 2