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 skills add magic3007/dotfiles --skill git-rebuild-historygit clone --depth 1 https://github.com/magic3007/dotfilesWrote 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/skills/magic3007/dotfiles/git-rebuild-history)<a href="https://agentmods.dev/skills/magic3007/dotfiles/git-rebuild-history"><img src="https://agentmods.dev/badge/skills/magic3007/dotfiles/git-rebuild-history/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.
<a href="https://agentmods.dev/skills/magic3007/dotfiles/git-rebuild-history"><img src="https://agentmods.dev/badge/skills/magic3007/dotfiles/git-rebuild-history.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.00193 | $0.07851 |
| Opus 5.5 | $0.00077 | $0.03140 |
| Sonnet 5.5 | $0.00039 | $0.01570 |
| Haiku 4.5 | $0.00019 | $0.00785 |
Grade C, and why
git-rebuild-history scanned grade C with 1 finding 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 19d 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.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
rm -rf "$d" How it starts
The opening of the file, as written. The whole thing — 531 lines — stays where its author put it; the contents beside it link to each section on GitHub.
重建分支历史,让探索从不进入历史
分支要合并,但历史里混着探索。目标不是"把探索藏起来",而是让探索从未存在过。
为什么是重建,不是 rebase
rebase -i 只能 drop / squash / reword 已存在的 commit。探索的形状恰恰是它处理不了的:
- 加了又删的文件(
approach_a.py提交过,后来删了):drop 掉"加"那条,"删"那条就变成删除一个不存在的文件;两条都 drop 文件才干净,但你要手工找出所有这种配对。 - 同一路径的反复改写(
thing.py提交成 v1、v2、final):三条 commit 动同一个文件,drop 任何一条都会让后面的 patch 冲突或落空。实测里git cherry-pick这种"删掉旧内容再加新内容"的 commit 会直接变成空 commit。 - squash 也不能免俗:三条合成一条,diff 链里仍留着 v1 的痕迹,只是被压平了。
重建换了个思路:不问"这些 commit 哪些该留",而是问"最终状态相对 base 改了什么",然后按架构分层重新切一遍。探索根本不在输入里,所以不可能出现在输出里。
代价是 commit 边界由你重新决定。原来那些边界本来就不值得沿用——它们是探索的脚印。
0. 先确定两个变量
全文用 $BASE 和 $CHECK,现在就定下来。
$BASE:从哪开始。 是合并目标分支,不是当前分支的 upstream。
BASE_REF=""
for ref in origin/master master origin/main main; do
git rev-parse --verify -q "$ref" >/dev/null 2>&1 && { BASE_REF=$ref; break; }
done
[ -n "$BASE_REF" ] || { echo "找不到合并目标分支,手动指定 BASE_REF" >&2; exit 1; }
BASE=$(git merge-base HEAD "$BASE_REF")
echo "BASE_REF=$BASE_REF BASE=$BASE $(git log -1 --format=%s "$BASE")"
两个坑:
- 不要用
@{upstream}。 它是当前分支自己的远端(origin/feat/x),git merge-base HEAD origin/feat/x得到HEAD——整个重建从错误起点开始,而且不报错。 - 不要写
A || B | sed || echo 默认值这种链。 管道让sed即使输入为空也退出 0,|| echo永远不触发,BASE_REF静默变成空字符串。用上面的 for 循环逐个rev-parse --verify。
$BASE 是"这个分支 fork 出去的那个点",不是"master 现在在哪"。用后者会把别人合进 master 的改动也算进你的 diff。
stacked branch(这个分支基于另一个特性分支)要手动把 BASE_REF 设成那个特性分支。
$CHECK:项目自己的检查命令。 从仓库的 Makefile / package.json / CI 配置里读出来,写成一条能跑的字符串。后面每个 commit 都要用它,所以现在就要确定。
ls Makefile makefile GNUmakefile package.json pyproject.toml tox.ini noxfile.py 2>/dev/null
ls .github/workflows/ .gitlab-ci.yml 2>/dev/null | head
典型形态:
CHECK='make check' # 有 Makefile
CHECK='PYTHONPATH=$PWD/src pytest -q' # Python,注意 $PWD 会在 worktree 里展开
CHECK='npm test --silent' # Node
CHECK='cargo test --quiet' # Rust
CHECK='go test ./...' # Go
一个都没找到(没有构建配置、没有 CI)就自己定一条最小的:跑测试目录、跑类型检查、或至少 import 一遍包。这条检查的作用是抓"某个中间 commit 根本跑不起来",不需要覆盖完整 CI。
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.
- 19d ago First seen · 531 lines · 193 tokens per session scan C 3bc1e6e06ede
git-rebuild-history is a skill published in the GitHub repository magic3007/dotfiles (11 stars, last pushed 5d ago), licensed MIT. It adds 193 tokens to every session and 7,851 once invoked, about $0.0008 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-11.
git-rebuild-history compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| git-rebuild-historymagic3007/dotfiles | Skill | 11 | 5d ago | MIT | C | 193 | Claude Code, Codex |
| merge-readyurmzd/dotfiles | Skill | 6 | 4d ago | Apache-2.0 | A | 208 | Claude Code |
| landurmzd/dotfiles | Skill | 6 | 4d ago | Apache-2.0 | A | 168 | Claude Code |
| commiturmzd/dotfiles | Skill | 6 | 4d ago | Apache-2.0 | A | 115 | Claude Code |
| review-codeooloth/dotfiles | Skill | 24 | today | none | A | 243 | Claude Code |
| review-pr-comments-convergeooloth/dotfiles | Skill | 24 | today | none | A | 50 | Claude Code |
| review-convergeooloth/dotfiles | Skill | 24 | today | none | A | 57 | Claude Code |