aliatx2017/reasonix-hermes/cache-first-architecture
- community
Checking that the SKILL.md file is still in the repository.
Cache-first agent architecture — immutable prefix, append-only log, volatile scratch. Preserving DeepSeek prefix cache hit rates across turns.
Install
npx vskill@latest install aliatx2017/reasonix-hermes/cache-first-architectureSKILL.md
Cache-First Architecture
The constitution encodes it: "Cache-first system prompt — byte-stable prefix across turns for DeepSeek prefix cache." This skill explains the architecture so you preserve cache hit rates when touching the controller, agent, or boot assembly.
Three regions
Critical invariant: Memory blocks (Hindsight, project memory) MUST NOT be appended to the system prompt mid-session. Every byte change in the prefix breaks the entire cache. The controller's Compose drains pendingMemory into the turn tail (a user message), never the prefix. Do not alter this.
Cache economics
DeepSeek prefix cache: 50-120× cheaper on hit vs. miss.
| Cache Hit | Cache Miss | Output | ||
|---|---|---|---|---|
| v4-flash | $0.02/M | $1/M | $2/M | |
| v4-pro | $0.025/M | $3/M | $6/M |
Current implementation achieves ~99.8% cache hit rate.
Tool-call repair
The agent handles common LLM output issues without breaking the cache:
- Truncation — repair unbalanced JSON from max_tokens cutoff
- Storm — suppress duplicate (tool, args) calls within a turn
- Flatten — detect deep schemas, present compactly
Pitfalls
- Memory blocks in system prefix — single biggest cache killer. Route through turn tail.
- History reordering — any edit/reorder breaks append-only invariant. DeepSeek caches sequential prefixes.
- Tool schema regeneration — re-generating tool JSON every call produces different bytes → cache miss.
- Mid-session prompt mutation — constitution says "never mutate mid-session — ride the turn tail."
Related
cost-aware-llm-pipeline— flash-first routing, auxiliary offloading, budget thresholds (the routing layer above this cache foundation)- Constitution rule: "Cache-first system prompt"
internal/control/controller.go—Compose,pendingMemorydraininternal/compress/— token compressorREASONIX.md— "Cache-stable prefix" research backing (Zhang, 2606.13361)
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.reasonix/skills/cache-first-architecture/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aliatx2017/reasonix-hermes/cache-first-architecture)