跪拜 Guibai
← All articles
Frontend · GitHub · Vue.js

How DeepSeek-Reasonix Cuts Long-Session Coding Costs 80% Without Compressing Context

By 徐小夕 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Long-session token bills have priced sustained AI pair programming out of reach, and compression fixes make agents forget project context. A cache-first context design shifts the cost burden to provider infrastructure, a pattern that transfers to long-document and RAG agents on any API with prefix caching.

Summary

Long coding sessions run up against the same wall: context grows, every turn re-sends the whole history, and token bills climb. The usual fixes, summarizing or truncating context, trade away details and make the agent lose track of project specifics. DeepSeek-Reasonix refuses that trade. It keeps the session prefix byte-stable and lets DeepSeek's server-side prefix cache absorb the repeated cost. Community tests report hit rates as high as 99.82% in long sessions.

Session context splits into three zones: an immutable prefix built once at startup holds system prompts, tool specs, few-shot examples, and project info; an append-only log catches every model reply, tool call, and command result at its tail; a mutable draft zone at the end carries code under iteration. A dedicated serialization module guards byte-order stability so cache fingerprints survive.

Reasonix operates on local project files directly, executing shell commands, unit tests, and git operations. Every request, tool call, and result is logged, sessions can be replayed and forked, and the ACP sub-agent protocol lets it slot into DeepSeek Harness. The tradeoff is explicit: the cost advantage depends on DeepSeek's prefix cache, context is never compressed, and extreme sessions can hit model window limits.

Takeaways
— DeepSeek-Reasonix is a terminal-only coding agent wired to the DeepSeek API; it does not aim to be a general-purpose framework.
— Session history is append-only: no modification, reordering, or deletion, so the context prefix bytes stay stable and DeepSeek's prefix cache keeps hitting.
— Community tests report long-session cache hit rates up to 99.82%, with input token costs falling by up to 80%.
— Context splits into three zones: an immutable prefix zone (system prompt, tool specs, few-shot examples, project info), an append-only log zone (model replies, tool results), and a mutable draft zone at the tail for code under iteration.
— A dedicated serialization module keeps byte order stable so cache fingerprints don't break.
— Reasonix can read and write source files, run shell commands and unit tests, perform git operations, and do code review autonomously.
— Switching to a model or inference service without compatible prefix caching removes the core cost advantage.
— No context compression means extremely long sessions can hit model context-window limits.
Conclusions

Most frameworks compress or truncate context to shrink the bill; Reasonix engineers byte stability so provider-side caching absorbs the recurring cost. The win is real but confined to DeepSeek's ecosystem, which the article flags as its main limitation.

Cache-first thinking reaches down to the serialization module, which exists solely to keep byte order stable. That depth of coupling explains both the claimed 80% saving and the portability risk.

The closing claim that append-only cache design generalizes to long-document and RAG agents is plausible, but nothing in the source demonstrates it outside DeepSeek's cache semantics.

Concepts & terms
Prefix Cache
A provider-side cache that reuses computation for the leading tokens of a request. When the byte prefix of a new request matches a previously processed prefix, DeepSeek serves it from cache and does not re-bill those tokens.
Append-Only Session
A session log that only grows at the tail. Entries are never modified, reordered, or deleted, so the byte prefix of the context stays stable and the provider cache keeps matching.
ACP Sub-Agent Protocol
A protocol for handing coding subtasks to a subordinate agent. Reasonix implements it so a parent harness such as DeepSeek Harness can delegate pieces of a larger task.
Three-Zone Context
A session layout separating data into an immutable prefix zone, an append-only log zone, and a mutable draft zone at the tail. The split keeps prefix bytes stable for caching while still letting current work change.
From the discussion
Featured comments
用户800942062367 1 likes

Been using it, works well.

徐小夕

Not bad.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗