Summary note: This is a summary of X posts by Ollama (@ollama) and Together AI (@togethercompute) from November 17, 2026, plus the joint Together AI and Ollama article “Making open models work for long-horizon agentic workloads” (by Zain Hasan and Parth Sareen), not a reprint of the originals. Original link: https://x.com/ollama/status/2122531964154712541
Note: The Ollama post was published on November 17 (last edited 11:27; the page does not state a timezone); at the time of checking (November 19, ~09:05) it showed 39,802 views, 548 likes and 259 bookmarks. The joint article’s numbers are idealized arithmetic; its engine-side advice lacks measured data such as cache-hit rates, which existing commentary has already pointed out — noted at the end of this post.
On November 17, Ollama posted three lines about keeping coding agents fast in Claude Code, Codex, Pi and more. The post quotes Together AI’s point: coding agents resend the whole conversation on every turn, and prefix caching keeps long sessions fast — but only if both the harness (the agent framework) and the inference engine do their part. The post itself drew only 39,802 views — no viral hit — but the joint article it points to (by Together AI’s Zain Hasan and Ollama’s Parth Sareen) explains the problem thoroughly enough to be worth a post of its own.
Why agents are a caching problem
Agents are a large-input, small-output workload: every step resends the system prompt, tool definitions, the request, every file read and every command run, just to get back a short tool call. Prefill dominates that work; decoding only streams a few dozen tokens.
Prefix caching works like this: the inference engine stores the key/value (KV) state computed for a prompt prefix, and reuses it on the next request when the prefix matches, processing only the new tokens at the tail. The joint article gives simple math: if each turn adds about the same amount, ten turns without a cache process 1 + 2 + … + 10 = 55 units of prompt, and with a cache only 10. At a hundred turns it is 5,050 against 100.
But one rule governs everything else: the cache matches from the very first token up to the first token that is different, and stops there. Appending text at the end is cheap. Changing anything earlier — even one character — means everything after that point is processed again.
Five things that break the cache
1. Values in the system prompt that change every turn. A current time, git status, the current directory, or “turn 14 of 40” in the system prompt means the whole session is re-read on every turn, because the system prompt sits at the very top. The article’s measured example: one changed timestamp near the top left only the first 32 tokens matching, so the model re-read 10,244 tokens — the same as starting fresh — taking about 2–4 minutes. The fix: keep the system prompt byte-identical for the whole session (and ideally across sessions); put changing information in a new message at the end instead.
2. Changing reasoning effort mid-session. On at least one open model, the chat template writes the reasoning-effort setting into the first system block. Ollama found this with GLM (other write-ups identify it specifically as GLM-5.3-Flash): raising effort mid-task re-processes the entire session. The fix: pick an effort level per session and don’t change it; if you want a different level, start fresh (or compact first).
3. Tools added near the top. Tool search that inserts a new tool definition into the tool list near the top invalidates everything after it. The fix is to append tool definitions after the conversation — though some chat templates reject mid-conversation tool definitions, so support depends on the model. A community reply adds a related case: MCP servers connected in a different startup order change the tool ordering, so the prefix changes too (“same tools, new prefix, cold cache”).
4. Oversized tool results. A file the agent reads becomes part of every request after it. If it reads 3,000 lines when it needed 40, you carry those 3,000 lines for the rest of the session. Trimming is right — the problem is the next item.
5. Silent truncation. If a tool returns the first 100 lines of a 640-line file without saying it stopped, the model doesn’t know the rest exists and will happily edit code it never saw. The article’s example: in a 640-line file, convert_timezone sits at line 420, and the model went ahead and edited without ever seeing it. The fix: truncate with an explicit range, e.g. “lines 1–100 of 640”. And Ollama’s third lesson is the remedy when it already happened: tell the agent its output was cut off, and it will go back and read what it missed.
Three rules for the engine side
The second half of the joint article covers what the inference engine must get right: cache-aware routing (a session’s cache lives on one node, so route by a client-supplied cache key, or hash the prefix to the node with the longest match — which also lets new sessions hit a shared identical setup; but load-aware routing may still pick a cold idle node over a hot overloaded one); keeping caches alive across idle gaps (agents wait minutes on tests, so offload idle session caches to CPU memory and restore them on the next turn, rather than holding GPU memory or discarding them); and memory, not compute, as the limit (paged allocation of cache blocks and continuous batching let bursts of subagents take slots as they free up; oversized tool results and bloated subagent contexts consume cache memory other sessions need). Subagent context also needs a deliberate choice: inheriting the parent session gets a full cache hit, but the cached prefix still costs attention and GPU memory for every generated token.
A caveat: the limits of this article
Commentary has also pointed out that the harness advice is concrete, but the engine side lacks measured evidence: no cache-hit rates, no time-to-first-token curves, no cost per 100-turn session — the published text stops just as it reaches whether the cache is still resident and routed to the same GPU. Caching a 300B-plus session across 100 turns is not free memory. So the article works best as a checklist, not as a performance guarantee.
Key facts
- Source: Ollama’s November 17 X post, pointing to the Together AI and Ollama joint article “Making open models work for long-horizon agentic workloads”.
- Core rule: prefix caching matches from the first token up to the first differing token; appending at the end is cheap, changing one character early reprocesses everything after it.
- The math: ten turns without a cache process 55 units of prompt vs 10 with one; a hundred turns, 5,050 vs 100.
- Three lessons: a timestamp in the system prompt breaks the cache (measured: only the first 32 tokens matched, 10,244 tokens re-read); changing reasoning effort mid-session wipes the whole cache (GLM writes effort into the system block); telling the agent its output was cut off gets it to read what it missed.
- Two more traps: tool definitions inserted near the top (a different MCP startup order causes the same problem); silent truncation of tool output (100 lines of a 640-line file, with the needed function at line 420, leads the model to edit unseen code).
- Limitation: the engine side lacks measured cache-hit and cost data — use it as a checklist, not a performance guarantee.
Written by

