workflow-cache-discipline
Skill1 starsChanged 6 months agoMITView on GitHub
Keep the prompt PREFIX stable and put dynamic content LAST so the serving layer's prefix cache stays warm across turns. Emit the stable parts (system prompt, skill metadata, tool schemas) first and unchanged; never interleave per-turn content (tool results, retrieved chunks) into the stable prefix. Trigger when assembling context for a multi-turn session and before any action that would rewrite early context.
In this repository33 other files it gives its agents.
- skill-process-gotchasSkill
- workflow-codegraphSkill
- workflow-conductorSkill
- workflow-context-condenserSkill
- workflow-context-hygieneSkill
- workflow-criticSkill
- workflow-deadline-disciplineSkill
- workflow-deep-researchSkill
- workflow-done-definitionSkill
- workflow-edit-formatSkill
- workflow-effort-routingSkill
- workflow-escalateSkill
- workflow-execute-from-planSkill
- workflow-filesystem-offloadSkill
- workflow-learn-frameworkSkill
- workflow-long-running-processesSkill
- workflow-lspSkill
- workflow-memory-curationSkill
- workflow-plan-contractSkill
- workflow-plan-firstSkill
- workflow-planSkill
- workflow-quality-barSkill
- workflow-repomapSkill
- workflow-retrieve-before-actSkill
- workflow-spec-drivenSkill
- workflow-stuck-detect-resetSkill
- workflow-stuckSkill
- workflow-subagent-isolationSkill
- workflow-subtask-loopSkill
- workflow-task-finishSkill
- workflow-task-startSkill
- workflow-tool-selectionSkill
- workflow-verify-enhancedSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
Never interleave per-turn content (a retrieved chunk, a tool result) *into* the stable prefix — append it to the suffix.
- Distinctive: line 32
Avoid edits that rewrite early context mid-session.
- Distinctive: line 35
Prefer [[workflow-filesystem-offload]] (keep a short stable reference, read the detail back on demand) over pasting large dynamic blobs …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
workflow-cache-discipline
<!-- TRIGGERS WHEN: multi-turn session; before any action that rewrites early context -->The serving layer (vLLM) caches the longest unchanged prefix of the prompt across turns — a cache hit skips re-prefilling those tokens. The orchestration side maximizes that hit rate for free, with no serving-layer change, by keeping the prefix STABLE.
The boundary (stable prefix → dynamic suffix)
Emit in this order, and never reorder:
- Stable prefix (identical every turn): system prompt → skill metadata → tool schemas. These must be byte-identical across turns.
- Dynamic suffix (changes every turn): conversation history → retrieved chunks → tool results → the current user turn.
Rules:
- Never interleave per-turn content (a retrieved chunk, a tool result) into the stable prefix — append it to the suffix.
- Avoid edits that rewrite early context mid-session. In particular, the [[workflow-context-condenser]] rewrites the prefix and so busts the cache — which is exactly why it's gated to "only near the limit, not routinely."
- Prefer [[workflow-filesystem-offload]] (keep a short stable reference, read the detail back on demand) over pasting large dynamic blobs that push the prefix around.
Verify it's working
The prefix cache is observable: vLLM exposes vllm:prefix_cache_hits_total /
vllm:prefix_cache_queries_total (see $VLLM_BASE_URL/../metrics, surfaced by
hm observe). In a healthy multi-turn session the hit ratio should RISE across turns;
a sudden drop means something rewrote the prefix (a condense, a reordered system
block, a tool-schema change) — investigate before continuing.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

