GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — Compaction requests write an Anthropic prompt cache entry that is never read (1.28M cache-write tokens, 0 reads in 7 days) · Issue #48542 · anomalyco/opencode Closed as not planned Closed as not planned Copy link Labels DescriptionSummaryWhen compaction runs against an Anthropic model, every request writes a prompt cache entry that is never read back. Over 7 days on this machine, 70 successful compactions wrote 1,278,055 cache tokens and read exactly 0. Cache writes are billed at a premium over ordinary input tokens, so this is a pure surcharge on every compaction with no possibility of payback. The compaction payload is unique by construction, because the window that selects the conversation slice slides forward each time, so no prefix is ever shared between two compaction requests. MeasurementRead from
Representative rows from the successful group, showing that essentially the whole prompt goes to a cache write while billed input stays at 3 tokens:
ReproductionConfigure an Anthropic model as the compaction model, run sessions long enough to compact several times, then query the database: import sqlite3, json, time from pathlib import Path db = Path.home() / ".local/share/opencode/opencode.db" c = sqlite3.connect(f"file:{db}?mode=ro", uri=True) since = int((time.time() - 7 * 86400) * 1000) reads = writes = 0 for mid, _, data in c.execute( "select id,time_created,data from message where time_created>?", (since,) ): r = json.loads(data) if not (r.get("summary") is True and r.get("mode") == "compaction"): continue if r.get("providerID") != "anthropic": continue cache = (r.get("tokens") or {}).get("cache") or {} reads += cache.get("read", 0) writes += cache.get("write", 0) print("cache read:", reads, " cache write:", writes) ExpectedCompaction requests should not request prompt caching, or the cache scope for them should be configurable. The summarization system prompt is small and stable and could reasonably stay cached; the conversation payload is what carries the volume and it is never reused. Notes on causeI did not trace this in source, so treat this part as a hypothesis rather than a finding. Reading the shipped bundle, the Anthropic request builder appears to attach I also could not find any user-facing setting that would turn this off. The top-level config keys in the shipped build are Environment
Activity
MetadataMetadataAssigneesLabelsTypeProjectsMilestoneRelationshipsDevelopmentIssue actions | |||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |