4 ms·
I feel that a better title for this article would be: "Some minor annoyances that, when fixed, would improve OpenCode" # Prompt Cache Misses > It globs your f
by LaurensBER 3mo ago
I feel that a better title for this article would be: "Some minor annoyances that, when fixed, would improve OpenCode"
# Prompt Cache Misses
> It globs your filesystem and re-reads AGENTS.md (injected in turn-0 system prompt) on every SSE turn. If you put a quick note in AGENTS.md to be read in the next session, you immediately force a full re-evaluation.
> Personal favourite: it puts the current date in the turn-0 system prompt and re-evaluates every SSE turn. If you’re using OpenCode at midnight you get a full prompt cache miss.
Okay, I can live with those.
# Compaction
>
Want to sit for 10 minutes while the LLM server prefills the entire session with a new prompt prefixed to it, just to turn it into 5 bullet points that go at the top of a new session? Me neither. I get what they are going for, but I’ve not seen it work well. Neither compaction nor pruning is implemented well, and they interact poorly.
Is this an OpenCode specific issue? I've seen the same with Codex and Claude
# System Prompts
> The default system prompt is opinionated (fine) but it has shit opinions (not fine). It took me a while to figure out why my agent kept saying “Use ABSOLUTELY NO COMMENTS” when dispatching subagents.
Okay, so change it? Any LLM is opinionated, this system prompt enforces consistency across different models which seems reasonable.
- nextaccountic 3mo ago> I feel that a better title for this article would be: "Some minor annoyances that, when fixed, would improve OpenCode" Those are labeled as "annoying things" Read also the "alarming things"
- cpburns2009 3mo ago>> > The default system prompt is opinionated (fine) but it has shit opinions (not fine). It took me a while to figure out why my agent kept saying “Use ABSOLUTELY NO COMMENTS” when dispatching subagents. So that's why OpenCode likes to randomly remove my comments.
- dinfinity 3mo agoOpinionated system prompts forcing this are awful. It's similar to putting "ALWAYS INDENT WITH TABS" in the system prompt, but worse, because "self-documenting code" is a convenient lie lazy developers like to propagate. I have the following in my instructions, but I often need to remind agents of it because they follow the shitty system prompt instructions: "ALWAYS include MANY inline code comments describing what blocks of code are supposed to be doing. Inline comments serve as inline specification, a parity check between the code and the specification, and are a means to _communicate_ with all future programmers, including yourself. Write Once, Read Many. The code needs to talk to whomever is looking at it in natural language."
- cevn 3mo agoI actually share that opinion of no comment from LLMs. I just dont want to read them. So as usual, an opinion is… an opinion.
- naasking 3mo agoComments sometimes help the LLM think through a problem. They are particularly useful if you have thinking disabled, eg. it's not uncommon to run Qwen3.6 locally, but its thinking is extremely verbose, so it's fast if you disable thinking, but doing that will sometimes cause it to think a little in comments, and if you disable that too, then it will produce worse output. Comments can always be stripped reliably later.
- cevn 3mo agoThat is interesting, I had no idea comments were used in the process. I've only been using frontier models with maxed thinking, but this could be useful on the other end.
- lynndotpy 3mo agoThis article has several sections and you are commenting on things under the section titled "Annoying Things". There is another section titled "Alarming Things", with a subsection titled "It’s Fucking Full of RCEs". (Those are RCEs other than those which simply derive from the issues pointed out in previous subsections).
- deleted 3mo ago[deleted]
- brianjking 3mo agoDefinitely agree on the title. Also could have worked as 'Some minor annoyances that, when fixed, would improve OpenCode. Also, I don't like AI"
- zyuiop 3mo agoDid both of you intentionally skip the part of the article about the critical security issues?
- troyvit 3mo agoThere were 3,905 words above any mention of an RCE. Can you blame them?
- daureg 3mo agothere were only 110 words before it said “There are two parts to this post: annoying things and alarming things. The second part is longer.” But I agree it would be better with a table of content at the top (or on the side)
- awinter-py 3mo agoI use nono.sh for sandboxing -- I think a lot of power users are using sandbox + YOLO mode because approval prompts slow them down yes it's bad if the permission system is broken, but serious users have not trusted this stuff for a while, find the built-in permissions layer burdensome, and are already using a safety layer somewhere else
- zyuiop 3mo agoWhich makes sense, but as long as the tool itself pretends to provide security features, the fact that these features don't work is a big problem, as it may provide a false sense of security to end users. It'd be better if they had absolutely no permission enforcement and delegated it entirely to another program, as you say.
- 3mo ago
- Hizonner 3mo ago> > The default system prompt is opinionated (fine) but it has shit opinions (not fine). It took me a while to figure out why my agent kept saying “Use ABSOLUTELY NO COMMENTS” when dispatching subagents. > Okay, so change it? Any LLM is opinionated, this system prompt enforces consistency across different models which seems reasonable. OpenCode embeds scatters bad coding policy all over all of its inbuilt prompts, including tool instructions. The only way I've found to fix them is to edit the source code. And, yes, they're also huge and repetitive. A framework's native prompts should include only information about how to interact with the framework itself.
- verdverm 3mo agoyet OpenCode is #1 harness per Artificial Analysis https://artificialanalysis.ai/agents/coding-agents?coding-agents-harness-comparison-chart=harness-index https://artificialanalysis.ai/agents/coding-agents?coding-ag...
- disiplus 3mo agoCache Misses are pretty bad, i have a locally running deepseek v4 flash, i have tuned it now to have 1100-1300 prefill. Its not great but properly useable. Imagine having a session with already 100k and half of it has to be prefilled it would be waiting minutes with worse numbers. And if you are paying by the token, for hosted models, you are wasting money.
- nylonstrung 3mo agoThe bigger point is that the codebase is hopelessly bloated by vibe coded features at this point, mirroring the same problems with Claude Code. And stability, performance, memory use have all gotten terrible. I liked Opencode a lot previously but there's no doubt it's not well-written software. Pi has fully replaced it for me and there are quite a few newer options that learned from Opencode and exercise more minimalism where it matters
- alightsoul 3mo agoCan you name a few? I'm looking for alternatives
- polski-g 3mo agoPi or Dirge
- dominotw 3mo agowrite your own using pi.
- cmrdporcupine 3mo agoOpenAI's Codex tool is not limited to only calling their models. You can create a profile that uses any OpenAI API compatible endpoint. It's written in Rust. It seems to perform well. It also seems (from my poking around in it) on the whole well and deliberately written. It doesn't consume memory like a mf'er like Claude Code. It doesn't sit and chew background CPU like I've seen opencode. I suspect it will accumulate more specific-to-OpenAI-isms over time though.
- snapplebobapple 3mo agoGot a link? Pi is suitably as to make search engines questionable
- dofm 3mo agopi.dev
- versteegen 3mo agoI always run opencode with envvar `OPENCODE_DISABLE_AUTOCOMPACT=1` because I discover a new horrible bug in its autocompact every time I don't... including the config .json option to turn off autocompact not working. Sad but not surprised to hear about all these other issues. I like opencode, it does plenty right but plenty wrong.
- xg15 3mo ago> I feel that a better title for this article would be: "Some minor annoyances that, when fixed, would improve OpenCode" > If you don’t know what OpenCode is, imagine a boot stamping on a human face forever. The boot is made of TypeScript and the face is everything we have learned about security and systems software since the invention of the electronic computer in the 1940s. Regardless if that's a good or bad take, I'd like titles on HN to reflect what the author wanted to say and not editorialized to what HN readers think the article should be saying.
- intothemild 3mo agoThat's the thing. You can't change it. They do not accept PRs from what I've seen. Whilst it's open source it's only in name. There may be the odd PR accepted from outside the team. But very very rarely. It's honestly embarrassing to call this open source. Pi on the other hand, whilst they have their own unique issues with PRs, if you came to them with a genuine problem, or fix, they seem to accept it. Now I point back to those issues you pointed out, all have PRs... Unmerged. Same with the infinite depth subagent calling.
- wasabi991011 3mo agoOpen source doesn't mean that it has to accept PRs. It has never meant that the code author's must accept community contributors. OpenCode has an MIT license, which allows you to copy/fork the code and modify it how you see fit. Please review the open source initiative's definition of open source: https://opensource.org/osd https://opensource.org/osd
- chuckadams 3mo agoSQLite famously doesn't accept PRs either, and it's public domain.
- verdverm 3mo agoI pinged the OC devs to get someone else's PR merged to fix a slop artifact, they did indeed merge external PRs. Like many popular Ai projects, they get 1000s of slop PRs. They are also working on a v2, so fixes to old code are much less likely to land now.
- k-langton 3mo agoHey! I work on OpenCode, so thank you for this measured reply ;) Just wanted to add a few things: - We actually don't do tool-call pruning any more. But compaction is a necessary evil for the time being. There's only so much context window, and if you wish to keep working on the same task for a long time, the model needs to summarize its current progress so it can continue without hitting its token ceiling. - With V2 (in beta atm), we have a new system for handling changing system instructions (AGENTS.md files, available skills, etc.) that avoids cache misses at all costs, while still giving the robot the newest information. I recorded a little video about it here: https://x.com/kitlangton/status/2075749116760457346/video/1 https://x.com/kitlangton/status/2075749116760457346/video/1
- vitamark 3mo agoCan you shed some light on what's the deal with the new interface (web/desktop)? I updated one of my opencode containers today and had to downgrade it back because: 1. Worktree/workspace support is gone altogether. No way for agent to work in parallel on different things safely except prompting it directly to create a worktree. 2. Seeing multiple sessions properly now requires opening tabs for those? 3. In general, switching between several projects/sessions/whatever stopped working, and command palette is hotkey-only. Issues about the new design just sit in an endless unsolved pile on GitHub which seems hopeless. And an agressive stale bot is not helping with that. I came to OpenCode because it seemed hackable and simple, and at this point it seems like a "move fast break a lot" project that you got to live with. (rant over, sorry if this is addressed to the wrong person, just needed to vent a bit)
- jayair 3mo agoYeah it's a big change. Workspace support is being worked on, it was half-implemented before, so we are taking a proper pass at it now. For switching between sessions, can you tell me about your workflow from before? Because a tab can hold a session from any project. Are you saying that opening up a tab is too heavy of an action? GitHub issues though has been a problem from us, we deal with a ton of noise/spam.
- mrighele 3mo ago# Prompt Cache Misses > It globs your filesystem and re-reads AGENTS.md (injected in turn-0 system prompt) on every SSE turn. If you put a quick note in AGENTS.md to be read in the next session, you immediately force a full re-evaluation. > Personal favourite: it puts the current date in the turn-0 system prompt and re-evaluates every SSE turn. If you’re using OpenCode at midnight you get a full prompt cache miss. I used opencode with deepseek v4 via openrouter during the weekend. Openrouter claims a cache hit rate of about 95%. Maybe it can be improved, but it doesn't seem broken. I agree that it is bloated, and uses a lot of memory and cpu. But I don't remember seeing any bug during its usage, or at least not big enough to notice
- trollbridge 3mo agoDeepSeek has a phenomenal cacheing architecture that specifically can work with less-than-ideal clients like this and get cache hits anyway.
- whythismatters 3mo agoWhen I looked into opencode a few months ago I was struck by the default system prompt which came across as messy and random, iirc it also contained a typo or two. It made me look elsewhere and I didn't look back.
- tomComb 3mo agoIMO, if you "put a quick note in AGENTS.md" then you should expect a cache miss. I think that is reasonable and intuitive. That was the first complaint I came across in the article and it made me question the level of indignation of the whole thing.
- wren6991 3mo agoThe minimum fix would be to read it once per user turn, rather than once per tool call turn. As it is, if you tell an agent to update the file and it decides to do multiple edits on separate turns, you take a full cache miss per edit. If you're waiting 5-10 minutes on each miss (deep into a window, which is when you'd usually want to update notes) then you notice the difference. The post is pretty explicit about it happening on every SSE turn, but I realise if I write something that is (to put it mildly) a rant, then I shouldn't expect people to read it charitably. I also wouldn't mind being prompted before invalidating so I can decide whether to keep my cache, like most editors will prompt you if a file is edited externally.
- ubermon 3mo agoyeah, I think per user turn makes sense. But I am more inclining to only include it at session start.