Compactsim — Security skill for Claude Code
Audit local Claude Code and Codex session transcripts, measure Context Rent per tool output, and replay counterfactual autoCompactWindow policies offline.
How to install Compactsim
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open princejain756/compactsim and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Compactsim does
Audit local Claude Code and Codex session transcripts, measure Context Rent per tool output, and replay counterfactual autoCompactWindow policies offline.
Alternatives in Security
- Loongsuite Pilot — Local-first telemetry collector for AI coding agents — unified OpenTelemetry events for Claude Code, Codex, Cu 150 ★
- Validation Gate — Audit replay, regression, and rollback gates before promoting an evolution candidate 58 ★
- Codeinspectus — Local-first MCP security scanner for AI-generated apps 47 ★
README
compactsim
Zero-dependency profiler and counterfactual `autoCompactWindow` replay simulator for local Claude Code (`~/.claude/projects`) and Codex (`~/.codex/sessions`) JSONL transcripts.

Install & Run
npx compactsim
No API keys, no network calls, and no dependencies. By default it scans `~/.claude/projects/**/*.jsonl` and `~/.codex/sessions/**/*.jsonl`.
# Run against a specific directory or JSONL transcript
npx compactsim --dir ~/.claude/projects
# Run against the bundled 24-turn sample transcript
npx compactsim --demo
# Emit machine-readable JSON or a standalone dark-mode HTML report
npx compactsim --json > report.json
npx compactsim --html report.html
Why this exists
On 1M-context models, Claude Code waits until roughly 967K tokens before compacting the conversation. Every turn between 200K and 967K resends the full transcript history. Across 147 real local sessions (2,284 deduplicated API turns, 255.79M total input tokens) on my machine, 47.8% of weighted token spend happened on the 307 turns where the window had already crossed 200K tokens.
Setting `"autoCompactWindow"` lower cuts that tail cost, but compacting too aggressively triggers 65-second summary pauses, invalidates the prompt cache prefix on the turn after compaction, and causes post-compaction amnesia where the agent immediately re-reads files it had read 10 turns earlier because the summary dropped implementation details.
`compactsim` parses your actual local session history and replays every turn under candidate compaction windows (`400K`, `250K`, `150K`) and sliding tool-output eviction (`slide-tools@15t`) so you can pick a threshold backed by your own workload instead of a guess.
What it measures
- Streaming-aware turn deduplication (
1.4xto3.0xovercount correction): My first parser summed `mess
Related Skills
Mod Cost
Audit Claude Code and Codex CLI token usage, cache efficiency, and BTE cost metrics across local session trans
Claude Desktop Tools
Native Windows 11 desktop application that acts as an autonomous visual command center to audit local storage,
Securevector AI Threat Monitor
Security & Observability for AI Agents — audit every tool call, enforce allow/block policies, catch prompt inj
Snarx
Local-first security sandbox, MCP proxy, and offline time-travel policy debugger for AI coding agents (Claude
LLM Spend Audit
Your agent setup charges rent on every session, before it does any work. Three stdlib-only instruments: what y
Traceary
Local-first session log and audit trail for AI coding agents (Claude Code, Codex, Gemini)
Related Agents
Session Miner
Mines one batch of AI-coding session transcripts (Claude Code, Codex, Grok, and agy) for corrections, errored
Svpg Researcher
Searches the local SVPG/Marty Cagan corpus (481 articles + podcast transcripts) and returns a cited brief. Use
Am Feedback Scout
Read-only scout for archi-magic feedback. Reads the recent local Claude Code session transcripts that used arc