verify-history-rewrite

verify-history-rewrite is a skill for Claude Code, Codex from dimetron/pi-go. It costs 130 tokens per session (2,435 once invoked), scanned A, original, MIT.

A formal model for checking how a coding session rewrites its history when old events are compacted or cleared. Compaction shortens stored conversation history while retaining what is needed for later turns.

In plain words
What is it for?
Use it when changing session storage, compaction, event clearing, or the code that runs before and during an agent turn.
Why use it?
It prevents history from being rewritten during an active turn and prevents a tool request from being separated from its result.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when changing session storage, compaction, event clearing, or the code that runs before and during an agent turn.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dimetron/pi-go/verify-history-rewrite
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add dimetron/pi-go --skill verify-history-rewrite
Clone the repo
git clone --depth 1 https://github.com/dimetron/pi-go

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for verify-history-rewrite

README.md
[![agentmods](https://agentmods.dev/badge/skills/dimetron/pi-go/verify-history-rewrite/github.svg)](https://agentmods.dev/skills/dimetron/pi-go/verify-history-rewrite)
Your own site
<a href="https://agentmods.dev/skills/dimetron/pi-go/verify-history-rewrite"><img src="https://agentmods.dev/badge/skills/dimetron/pi-go/verify-history-rewrite/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for verify-history-rewrite

Your own site · 80×15
<a href="https://agentmods.dev/skills/dimetron/pi-go/verify-history-rewrite"><img src="https://agentmods.dev/badge/skills/dimetron/pi-go/verify-history-rewrite.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 130 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,435 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00130 $0.02435
Opus 5.5 $0.00052 $0.00974
Sonnet 5.5 $0.00026 $0.00487
Haiku 4.5 $0.00013 $0.00244

Measured 20d ago against content hash 2abd1e05116b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

verify-history-rewrite scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 20d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

internal/extension/bundled_skills/verify-history-rewrite/SKILL.md · 187 lines

How it starts

The opening of the file, as written. The whole thing — 187 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Verify the history-rewrite path

A session's event list is rewritten from four places. One of them is not gated on whether a turn is running, and one of them cuts without checking that a tool call and its result stay on the same side. Both are reachable by a user today; neither is caught by a test, because a test cannot easily produce the interleaving.

The properties: history is only rewritten between turns, and a compaction cut never separates a tool call from its result.

This model reports two findings that were real and are now fixed. Both rules broke on the shipped code when the model was written; both are green now because the code was changed, not because a rule was weakened. See Findings for each, the path that reached it, and the test that now holds it.

The model was changed with the fixes: SlashCompact now rounds its cut and GaugeClearsMidTurn ends the turn instead of leaving it running. That is the only legitimate way to make a broken rule green — change the model to match the code, then confirm the break still reproduces. The regression check at the bottom of this skill is what keeps it honest.

If a finding is real and not yet fixed, declare the rule in hack/formal/history/known-findings.txt (one rule name per line). check.sh then prints BROKE history: <rule> / known finding, declared in ... and exits 0; an undeclared break still exits 1. Remove the line when the fix lands — if the rule keeps reproducing, the fix is not covered by the model.

Does my change touch the verified code

git diff --stat <sync-commit>..HEAD -- \
  internal/session/autocompact.go internal/session/compaction.go \
  internal/session/compaction_shed.go internal/session/store.go \
  internal/agent/agent.go internal/tui/commands.go internal/tui/context_rule.go \
  internal/tui/tui.go internal/tui/agent_loop.go

Model covers (each model step names the call it stands for):

Model action Code
RunTurn a turn appends its call and its result together; agent.go:801-823
BeginTurn / FinishTurn a turn starts and settles; agent_loop.go:2013-2075
AutoCompacts runPreTurn → AutoCompact → advanceToCleanBoundary; autocompact.go:60-140, 148-161
SlashCompact /compact → FileService.Compact; store.go:1306-1352
GaugeClearsMidTurn gauge [x] → clearConversation → ClearEvents; tui.go:994-996, commands.go:291-333

Read the full file on GitHub · 187 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 20d ago First seen · 187 lines · 130 tokens per session scan A 2abd1e05116b

Subscribe to this mod's changes

verify-history-rewrite is a skill published in the GitHub repository dimetron/pi-go (232 stars, last pushed 6d ago), licensed MIT. It adds 130 tokens to every session and 2,435 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-09.

Related

verify-history-rewrite compared with skills from other repositories

verify-history-rewrite next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
verify-history-rewritedimetron/pi-goSkill2326d agoMITA130Claude Code, Codex
test-fixpatriceckhart/zotSkill372todayMITA17Claude Code
find-tracesaxiomhq/cliSkill606d agoMITA37Claude Code
troubleshoot-tervaterva-sh/tervaSkill5yesterdayMITA83Claude Code, Codex
golang-lintalexastrum/sklSkill115d agoMITA100Claude Code
golang-troubleshootingalexastrum/sklSkill115d agoMITA130Claude Code
golang-samber-oopsalexastrum/sklSkill115d agoMITA74Claude Code