Reasonix prefix-cache mechanism: почему loop является продуктом
Полезная часть reference articles - architecture: DeepSeek cache rewards stable prefixes, and Reasonix turns that into an agent-loop constraint.
Ключевые выводы
- DeepSeek context caching rewards full reuse of persisted prefixes.
- Reasonix should be explained through immutable prefix, append-only log, and volatile scratch.
- Compaction is a rare reset point, not an every-turn rewrite.
- Use `prompt_cache_hit_tokens` and `prompt_cache_miss_tokens` instead of promising one fixed hit rate.
The constraint is prefix reuse
DeepSeek's context cache is built around overlapping prefixes. When later requests fully match a persisted prefix unit, the matched portion can count as a cache hit.
That means an agent cannot treat prompt construction as cosmetic. Reordering messages, injecting unstable metadata, or rewriting the old transcript can destroy the byte-level prefix that the cache depends on.
- Stable system and tool definitions matter.
- Append-only history is friendlier to cache reuse than rewritten history.
- Temporary scratch should not pollute the persisted prompt path.
Reasonix makes cache behavior an architecture rule
The useful architecture story is the three-zone loop from the reference articles: immutable prefix, append-only log, and volatile scratch. Treat it as an explanatory model, not as a place to copy their version or GitHub statistics.
The immutable prefix carries stable instructions and tool shape. The log grows forward with assistant and tool results. Scratch is the short-lived planning and reasoning space that should not constantly rewrite earlier turns.
- Immutable prefix: fixed instructions and tool contract.
- Append-only log: prior work grows in order instead of being rearranged.
- Volatile scratch: temporary state is reset or distilled before it changes the long-term prompt.
Compaction is the rare reset point
Long sessions eventually need context management. Reasonix's spec frames compaction as a low-frequency event near the context limit: summarize older middle history, keep recent turns, and continue from a new compacted state.
That is the right way to write the mechanism. The system has one intentional cache-reset point, then goes back to prepend-stable, append-forward behavior between resets.
What users can measure
DeepSeek exposes cache status through usage fields such as `prompt_cache_hit_tokens` and `prompt_cache_miss_tokens`. A serious Reasonix article should tell readers to watch those fields instead of promising one universal hit rate.
The product claim is not that every session always hits the same number. The stronger claim is architectural: Reasonix is built so cache hits have a real chance to survive long coding loops.
Источники
Обсудите статью в community
Для follow-up questions используйте site Q&A board вместо external comment thread.