r/opencodeCLI • • 17d ago

I built Prefixwise to name why a request missed the prompt cache, asking OpenCode users what evidence is missing

Prompt caching reuses the KV cache of a shared prompt prefix, so a repeated system prompt or conversation history does not get recomputed. When a request misses, most engines just say miss. No reason.

Prefixwise is a proxy that names why a request missed: first write, evicted, a system prompt edit, a template re-render, and a few more. It works with vLLM, SGLang, Claude, and OpenAI. 0.10.1 runs inside vLLM as middleware, no proxy needed there.

I built it because I kept losing cache hits I could not explain. Measured so far: 120 turns on vLLM Qwen3-4B, 100% agreement with the engine's own cache report.

I have not wired it to OpenCode yet, and I am not claiming an integration exists. For OpenCode users: what would you want it to collect, request logs or something else? Try it and tell me what evidence is missing: pip install prefixwise, https://github.com/tejachavali/prefixwise

3 Upvotes

4 comments sorted by

1

u/[deleted] 17d ago

[removed] — view removed comment

1

u/No-Individual159 17d ago edited 17d ago

Update: built the view u/Individual-Quote-958 asked for. It's in 0.10.7.

pip install prefixwise
prefixwise run -- opencode run "your prompt"
prefixwise report --session latest

Real opencode 1.19.5 session below: 14 requests, 84.2% served from cache, $0.13, nothing avoidable. The only misses are the three first requests (a Haiku call, the main Sonnet thread, and a second shorter thread). "first changed" is the block where the prompt stopped matching the previous request, counted over the whole prompt, tools first, then system, then messages.