# Frag Cost

> clawback fragmentation-cost diagnostic

- Skill: `zapgun-ai/frag-cost` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zapgun-ai/frag-cost`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zapgun-ai/frag-cost/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: zapgun-ai (https://skillmd.com/u/zapgun-ai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zapgun-ai/frag-cost

---


# clawback fragmentation-cost diagnostic

`node .skills/frag-cost/scripts/frag_cost.mjs <instance.ARM.ndjson> [more.ndjson ...]`

Pass the **per-instance** turn-logs (e.g. `runs/<dir>/instance.A0.ndjson`,
`instance.A5.ndjson`), NOT the tee outputs (`A0.ndjson`/`A5.ndjson`) — only the
per-instance logs carry `systemStableKey` alongside `sessionKey` and Anthropic
`usage`. The tee body is pre-clawback and has no stable key.

## Why this exists

`.skills/bench`'s prefix-fragmentation table shows how badly the per-request
`cch` rotation split one logical context into many clawback SESSION KEYs (A0
often 100s → A5 1). That is clawback-layer fragmentation. The trap is assuming
distinct SESSION KEYs ⇒ Anthropic cold-starts. On build v2.1.145.20b they do
NOT: a fully fragmented A0 (336/336 distinct keys) still read ~92.7k tokens
**warm** on its fresh-key turns vs ~968 created (95.8×), 98.6% hit. Anthropic
serves the prefix warm despite cch rotation, so de-fragmentation buys only the
tiny creation delta (~1.8% on a tight loop), not rescued cold-starts. This skill
makes that fresh-vs-repeat cut explicit so the fragmentation count is never
mis-sold as token cost.

## Reading the output

- **fresh key (rotated)** vs **repeat key (stable)** mean usage — the decisive
  cut. `read >> creation` on fresh keys ⇒ served WARM ⇒ fragmentation is not a
  cold-start proxy on this build. `creation >> read` ⇒ fragmentation really is
  cold-starting ⇒ strip-ephemeral has token value in that regime.
- **first-in-stream** — each stream's opening turn; genuine cold-starts by
  nature (high creation), reported separately so they don't contaminate the
  fresh-vs-repeat comparison. Watch for old analyses that sampled these and
  mislabeled their natural cold-start as cch poisoning.
- **VERDICT** line states the read/create ratio and the conclusion.

## Where this sits

Static, post-hoc, zero new tokens. Run it after any `.skills/paired` or
`.skills/ab` block. Pair it with the zero-token `.skills/inspect` (static
breakpoint structure — the theoretical upper bound) to contrast prediction
(inspect) against ground truth (this).

