SGLang Structured Serving
Orchestra-Research/AI-Research-SKILLs
Covers serving LLMs with SGLang, whose RadixAttention reuses cached prefixes, and constraining output to JSON, regex or grammar for agent and tool-calling workloads.
Replay an LLM inference request trace (Mooncake / vLLM / SGLang hashids format) against a block-level KV prefix cache and compute hit statistics.
$ npx skills add benchflow-ai/skillsbench --skill prefix-cache-replay -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install benchflow-ai/skillsbench prefix-cache-replay --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/benchflow-ai/skillsbench.git skills-src && mkdir -p .claude/skills && cp -r skills-src/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay .claude/skills/prefix-cache-replay && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "prefix-cache-replay" agent skill from https://github.com/benchflow-ai/skillsbench/tree/main/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay into .claude/skills/prefix-cache-replay/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "prefix-cache-replay", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/benchflow-ai/skillsbench/tree/main/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replayType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add benchflow-ai/skillsbench --skill prefix-cache-replay -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install benchflow-ai/skillsbench prefix-cache-replay --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/benchflow-ai/skillsbench.git skills-src && mkdir -p .agents/skills && cp -r skills-src/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay .agents/skills/prefix-cache-replay && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "prefix-cache-replay" agent skill from https://github.com/benchflow-ai/skillsbench/tree/main/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay into .agents/skills/prefix-cache-replay/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "prefix-cache-replay", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add benchflow-ai/skillsbench --skill prefix-cache-replay -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install benchflow-ai/skillsbench prefix-cache-replay --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/benchflow-ai/skillsbench.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay .cursor/skills/prefix-cache-replay && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "prefix-cache-replay" agent skill from https://github.com/benchflow-ai/skillsbench/tree/main/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay into .cursor/skills/prefix-cache-replay/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "prefix-cache-replay", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/benchflow-ai/skillsbench.git --path tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add benchflow-ai/skillsbench --skill prefix-cache-replay -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install benchflow-ai/skillsbench prefix-cache-replay --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/benchflow-ai/skillsbench.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay .gemini/skills/prefix-cache-replay && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "prefix-cache-replay" agent skill from https://github.com/benchflow-ai/skillsbench/tree/main/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay into .gemini/skills/prefix-cache-replay/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "prefix-cache-replay", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install benchflow-ai/skillsbench prefix-cache-replayInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add benchflow-ai/skillsbench --skill prefix-cache-replay -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/benchflow-ai/skillsbench.git skills-src && mkdir -p .github/skills && cp -r skills-src/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay .github/skills/prefix-cache-replay && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "prefix-cache-replay" agent skill from https://github.com/benchflow-ai/skillsbench/tree/main/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay into .github/skills/prefix-cache-replay/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "prefix-cache-replay", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add benchflow-ai/skillsbench --skill prefix-cache-replay -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install benchflow-ai/skillsbench prefix-cache-replay --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/benchflow-ai/skillsbench.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay .opencode/skills/prefix-cache-replay && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "prefix-cache-replay" agent skill from https://github.com/benchflow-ai/skillsbench/tree/main/tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay into .opencode/skills/prefix-cache-replay/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "prefix-cache-replay", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
prefix-cache-replayReplay an LLM inference request trace (Mooncake / vLLM / SGLang hashids format) against a block-level KV prefix cache and compute hit statistics.
Prefix Cache Replay is an agent skill from benchflow-ai/skillsbench. Replay an LLM inference request trace (Mooncake / vLLM / SGLang hashids format) against a block-level KV prefix cache and compute hit statistics. Use when given a request trace plus cache configuration and asked for hit rate, hit tokens, or final cache contents. Covers the longest-contiguous-prefix semantics that distinguishes KV prefix caching from full-prompt prompt caching, the policy-specific residency and eviction rules (LRU, LFU, S3FIFO), and the partial-last-block accounting rule.
Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in AI & LLM Engineering, covering LLM inference and serving, LLM cost and token optimization and Caching. It works with SGLang and vLLM. The repository describes itself as: SkillsBench evaluates how well skills work and how effective agents are at using them. The licence is Apache-2.0.
Read from SKILL.md and the folder at commit 9a1f4dd. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Prefix Cache Replay loads about 2.3k tokens when it runs. Until then it costs about 128 tokens; SKILL.md has 1,262 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from benchflow-ai/skillsbench at commit 9a1f4dd, republished under its Apache-2.0 licence (© benchflow-ai). 1,262 words, ~2,311 tokens.
.claude/skills/prefix-cache-replay/SKILL.md (or your agent's skills folder).Modern LLM serving systems — vLLM, SGLang, Mooncake — pack the KV tensors of a prompt into fixed-size blocks of block_size tokens (typically 512). The cache is keyed by a block hash where each hash encodes both the block's own token content and the content of every block before it in the prompt. Two requests that share the first K conversation turns therefore share the first K block hashes, and the cache can reuse those blocks without recomputing attention.
This is block-level prefix caching. It is not the same thing as full-prompt prompt caching (Anthropic, OpenAI), where the cache stores whole prompts and looks them up by exact match. Prefix caching reuses partial prompts; prompt caching does not.
Let a request have hash_ids = [h_0, h_1, ..., h_{n-1}] and input_length = L.
The prefix hit length is the largest integer k such that h_0, h_1, ..., h_{k-1} are all resident in the cache at the time the request arrives.
k must start at index 0. Reuse of h_2 when h_0 is absent does not count.min(k * block_size, L). The min handles the last partial block (when L is not a multiple of block_size). Always apply it — do not return k * block_size unclamped.After the prefix scan, every block in hash_ids — hit or miss — is accessed against the eviction policy in order. Hits update policy state (recency / frequency); misses admit the block and may trigger evictions. What "resident" means is policy-specific, as spelled out below.
S3FIFO replaces LRU / LFU with three static FIFO queues plus a per-block saturating frequency counter. Three things to know:
round(capacity * small_ratio). Newly admitted blocks land here. Default small_ratio = 0.1.capacity - small_cap. Holds the working set promoted from S.freq clamped to [0, max_freq]. Default max_freq = 3. Whenever a resident block is accessed, increment freq and clamp.h in a request's hash_ids)If h is currently in S, increment its freq (saturated). If h is in M, increment its freq (saturated). If h is in G, remove it from G and admit it to the tail of M with freq 0 (this is the canonical Yang et al. variant — some papers admit with freq 1; stick to 0 unless the config says otherwise). Otherwise (h is brand new), admit it to the tail of S with freq 0.
The check on a request's prefix is a residency check (S ∪ M); the per-block access actions above happen for every h in hash_ids, not just the prefix portion.
Before inserting into S, drain the head while |S| is at capacity. Each popped entry from S goes either to M (if its freq ≥ 1, treated as "warm") or to G (if freq == 0, treated as cold). The freq value is preserved when an S entry is promoted to M (it is not reset). Promotion to M may itself evict entries from M; eviction cascades are normal. After draining S, append the new entry at the tail of S with freq = 0.
admit_to_S(h):
while |S| >= small_cap:
(victim, vf) = pop_head(S)
if vf >= 1: admit_to_M(victim, vf) # vf preserved, NOT reset
else: insert_to_G(victim)
append (h, freq=0) at tail of SBefore inserting into M, drain M until exactly one entry is permanently evicted to G. The drain rule is "second-chance": peek the head; if its freq ≥ 1, pop it, decrement freq, append it back at the tail, and continue draining; if its freq == 0, pop it, send to G, and stop. Then append the new entry at the tail of M.
This loop terminates because every requeue decrements freq, and freq is bounded; an entry can be requeued at most max_freq times before its freq == 0 makes it the next eviction.
admit_to_M(h, freq):
while |M| >= main_cap:
(victim, vf) = peek_head(M)
if vf >= 1:
pop_head(M); append (victim, vf - 1) at tail of M; continue
else:
pop_head(M); insert_to_G(victim); break # exactly one real eviction
append (h, freq) at tail of MGhost is a bounded FIFO of hashes only (no freq, no payload). ghost_cap = main_cap, not small_cap. When inserting h into G: if h is already in G, remove it (so it can be re-appended at the tail with fresh recency); otherwise if |G| is at capacity, pop the head. Then append h at the tail.
h is resident iff h ∈ S ∪ M. Ghost membership does NOT imply residency. After replaying the full trace, final_cache_blocks = |S| + |M| (do not add |G|).
Mooncake FAST'25 traces use one JSON object per line:
{"timestamp": <int>, "input_length": <int>, "output_length": <int>, "hash_ids": [<int>, ...]}hash_ids is already block-level; you do not re-tokenize or re-hash. input_length is in tokens. timestamp is arrival time and is irrelevant to a pure replay (it matters only if you also model concurrency or scheduling).
policy == "S3FIFO", you must implement S3FIFO — no substitutions.min(k * block_size, L) cap. Almost every request has a partial last block; an uncapped report inflates total_hit_tokens by hundreds to thousands of tokens on realistic traces.h in G does not imply h resident.|set(hash_ids) ∩ resident| overcounts; non-prefix reuse cannot be served as a prefix cache hit, because the KV state of a missed block must be recomputed and that invalidates everything after it.h in hash_ids regardless of whether h is part of the prefix-hit window. A block that ends up cached late in the request still gets a freq increment if it was already resident.final_cache_blocks includes the ghost. It does not. Report only |S| + |M|.freq on S→M promotion. Don't. The freq value the entry carried in S is the signal that promoted it; preserve it on entry into M. Only fresh admissions (S admit, ghost-hit promote into M) start with freq = 0.int() instead of round() for small_cap. The skill's algorithm is defined with banker's rounding, e.g. round(4096 * 0.1) = 410 blocks. Truncation gives 409 and the resulting eviction trajectories differ from the canonical numbers.ghost_cap = small_cap. Easy slip when copy-pasting the small-queue eviction rule. Ghost is the same size as main, not small — typically ghost_cap = capacity - small_cap.overall_hit_rate == total_hit_tokens / total_prompt_tokens exactly.sum(r["hit_tokens"] for r in per_request) == total_hit_tokens.sum(r["prompt_tokens"] for r in per_request) == total_prompt_tokens.final_cache_blocks <= cache_capacity_blocks. Under S3FIFO with ghost-driven admission, final_cache_blocks is often strictly less than capacity even after thousands of requests; do not pad to fill.hash_id has never been seen and is not in G, hit_tokens == 0.© benchflow-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay of benchflow-ai/skillsbench.
Open the folder on GitHubat commit 9a1f4dd
Prefix Cache Replay next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Prefix Cache Replay this skillbenchflow-ai/skillsbench | 1.8k | — | ~2.3k | Automated safety check: Pass | Apache-2.0 | |
| SGLang Structured ServingOrchestra-Research/AI-Research-SKILLs | 13k | 2 repos | ~2.9k | Automated safety check: Pass | MIT | |
| SageMaker Serving Image Selectionhuggingface/skills | 11k | 1 repos | ~4.6k | Automated safety check: Pass | Apache-2.0 | |
| Dstack Prototypingdstackai/dstack | 2.3k | — | ~1.6k | Automated safety check: Pass | MPL-2.0 | |
| Debug InferenceNVIDIA/OpenShell | 16k | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| Graphsignalgraphsignal/graphsignal | 257 | — | ~6.2k | Automated safety check: Pass | Apache-2.0 |
Orchestra-Research/AI-Research-SKILLs
Covers serving LLMs with SGLang, whose RadixAttention reuses cached prefixes, and constraining output to JSON, regex or grammar for agent and tool-calling workloads.
huggingface/skills
Chooses the right serving container and current image URI for deploying a Hugging Face model to a SageMaker endpoint, preferring Hugging Face images over generic ones.
dstackai/dstack
Use with the dstack skill for model-serving work when the image, serving command, resources, backend/fleet choice, or service behavior is not proven.
NVIDIA/OpenShell
Debug inference clients that use an attached provider and its native endpoint, including hosted APIs and host-local Ollama, vLLM, SGLang, TRT-LLM, LM Studio, or NIM.
graphsignal/graphsignal
Profile AI inference workloads (vLLM, SGLang, TensorRT-LLM, PyTorch, any GPU application) with the Graphsignal profiler and read the results from its local /signals JSON endpoint.
OpenDCAI/One-Eval
驱动 One-Eval 对 API 或本地模型做端到端评测,覆盖纯文本、多模态、代码生成、函数调用和 Agent benchmark。当用户想评测模型在一个或多个 benchmark 上的表现、比较分数、补充 metric,或生成图文评测报告时使用本 skill。
benchflow-ai/skillsbench
This skill should be used when working on Lean 4 formalization projects to maintain persistent memory of successful proof patterns, failed approaches, project conventions, and user preferences…
benchflow-ai/skillsbench
World-class data engineering skill for building scalable data pipelines, ETL/ELT systems, real-time streaming, and data infrastructure.
benchflow-ai/skillsbench
AC branch pi-model power flow equations (P/Q and |S|) with transformer tap ratio and phase shift, matching acopf-math-model.md and MATPOWER branch fields.
benchflow-ai/skillsbench
Civilization 6 district mechanics library. An agent skill from benchflow-ai/skillsbench.
benchflow-ai/skillsbench
Build deterministic, verifiable data visualizations with D3.js (v6).
benchflow-ai/skillsbench
DC power flow analysis for power systems. An agent skill from benchflow-ai/skillsbench.
Categories
Replay an LLM inference request trace (Mooncake / vLLM / SGLang hashids format) against a block-level KV prefix cache and compute hit statistics. Prefix Cache Replay is an agent skill from benchflow-ai/skillsbench. Replay an LLM inference request trace (Mooncake / vLLM / SGLang hashids format) against a block-level KV prefix cache and compute hit statistics.
Prefix Cache Replay fits situations like: given a request trace plus cache configuration and asked for hit rate; final cache contents.
Run `npx skills add benchflow-ai/skillsbench --skill prefix-cache-replay -a claude-code`. Or copy the skill folder (tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay in benchflow-ai/skillsbench) into .claude/skills/prefix-cache-replay in your project. Claude Code loads it when a task matches its description.
Run `npx skills add benchflow-ai/skillsbench --skill prefix-cache-replay -a codex`. Or copy the skill folder (tasks/llm-prefix-cache-replay/environment/skills/prefix-cache-replay in benchflow-ai/skillsbench) into .agents/skills/prefix-cache-replay in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add benchflow-ai/skillsbench --skill prefix-cache-replay -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/prefix-cache-replay, .gemini/skills/prefix-cache-replay, .github/skills/prefix-cache-replay and .opencode/skills/prefix-cache-replay in your project.
SKILL.md names no scripts, command-line tools or credentials: Prefix Cache Replay is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Prefix Cache Replay is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.3k tokens (SKILL.md is roughly 9.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Prefix Cache Replay: SGLang Structured Serving (Orchestra-Research/AI-Research-SKILLs, 13k stars), SageMaker Serving Image Selection (huggingface/skills, 11k stars), Dstack Prototyping (dstackai/dstack, 2.3k stars) and Debug Inference (NVIDIA/OpenShell, 16k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
benchflow-ai (a GitHub organization) maintains it in benchflow-ai/skillsbench, which has 1,834 GitHub stars. The repository holds 189 skills in this directory. The repository was last updated on July 23, 2026.
Source: benchflow-ai/skillsbench on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.