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.
npx agentmods add commands/alleneubank/claude-code/rewrite-historygit clone --depth 1 https://github.com/alleneubank/claude-codeWrote 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.
[](https://agentmods.dev/commands/alleneubank/claude-code/rewrite-history)<a href="https://agentmods.dev/commands/alleneubank/claude-code/rewrite-history"><img src="https://agentmods.dev/badge/commands/alleneubank/claude-code/rewrite-history.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02140 |
| Opus 5 | $0.00000 | $0.01070 |
| Sonnet 5 | $0.00000 | $0.00428 |
| Haiku 4.5 | $0.00000 | $0.00214 |
Grade A, and why
rewrite-history 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 167 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Reimplement the current branch with a clean, narrative-quality git commit history suitable for reviewer comprehension. Execute each step fully before proceeding to the next.
Determine Branch Name
First, determine the current branch name: !git branch --show-current
Store this value and use it wherever {branch_name} appears in subsequent steps.
Determine Default Branch
First, determine the repository's default branch: !gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'
Store this value and use it wherever {default_branch} appears in subsequent steps.
Hard Rules
- Rewrite history in-place on the current branch name (
{branch_name}). - You may create additional branches for independent changes (see Triage Changes and Create Independent Branches below).
- Create a local backup ref before rewriting (prefer an annotated tag). Do not push backup refs unless I explicitly ask.
- Before any history-rewriting command (
git reset,git rebase,git push --force*), print the exact command(s) you will run and wait for my confirmation. - After rewriting, update the remote branch using
git push --force-with-lease origin HEAD:{branch_name}. Do not push independent branches without my confirmation. - If syncing with
origin/{default_branch}results in conflicts, abort and stop. Do not attempt to resolve conflicts as part of this rewrite-history workflow.
Validate and Backup
Before any changes, validate the current state:
- Run
git statusto confirm no uncommitted changes or merge conflicts exist - Run
git fetch originto get the latest remote state - If issues exist, resolve them before proceeding
- Record the current HEAD sha for verification later
Analyze Diff
Study all changes between the current branch and the default branch to form a complete understanding of the final intended state. Use git diff and read modified files to understand:
- What functionality was added, changed, or removed
- The logical groupings of related changes
- The dependencies between different parts of the implementation
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.
- 4d ago First seen · 167 lines · 0 tokens per session scan A cbc356692edd
rewrite-history is a command published in the GitHub repository alleneubank/claude-code (52 stars, last pushed 2mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,140 tokens. 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-08-30.
Other commands, from other repositories
checkpoint
Create a checkpoint by staging the changes you have made using git. usage: git [-v | --version] [-h | --help] [-C ] [-c = ] [--exec-path[= ]] [--html-path] [--man-path] [--info-path] [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare] [--git-dir= ] [--work-tree= ] [--namespace= ] [--super-prefix= ]…
commit
智能创建 git 提交,分析代码变更并生成符合项目规范的提交信息.
changelog
Summarize staged git changes into a concise changelog/commit message.
commit
Create professional git commits with conventional commit format and clean commit rules.
wrap
End-of-session ritual. Updates handoff, priorities, daily log, and triggers synapse hygiene. Optional git commit with --commit flag.
commit
You are creating a conventional commit scoped to the current phase of work.