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 axiomantic/spellbook --skill branch-contextgit clone --depth 1 https://github.com/axiomantic/spellbookWrote 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/axiomantic/spellbook/branch-context)<a href="https://agentmods.dev/skills/axiomantic/spellbook/branch-context"><img src="https://agentmods.dev/badge/skills/axiomantic/spellbook/branch-context/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/axiomantic/spellbook/branch-context"><img src="https://agentmods.dev/badge/skills/axiomantic/spellbook/branch-context.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.00058 | $0.01088 |
| Opus 5.5 | $0.00023 | $0.00435 |
| Sonnet 5.5 | $0.00012 | $0.00218 |
| Haiku 4.5 | $0.00006 | $0.00109 |
Grade A, and why
branch-context 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 2mo 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 — 126 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Branch Context
Type: Reference + Technique
Practical guide for inspecting branch context, handling stacked branches, and producing branch-relative documentation. Core definitions (merge target, merge base, branch diff) live in rules/55-diff-semantics.md; this skill covers usage details.
Invariant Principles
- Directory Determines Truth - Branch-context commands must run from the correct working directory; running from the wrong repo produces silently wrong results.
- Merge Base Is the Reference Point - All branch diffs, PR descriptions, and changelogs describe changes relative to the merge base, never absolute state.
- Stacked Branches Show Only Their Layer - In a stack, each branch's diff includes only what it added on top of its parent branch.
Script Usage
Use $SPELLBOOK_DIR/scripts/branch-context.sh to detect branch context
automatically:
branch-context.sh # summary: target, base, stats, uncommitted state
branch-context.sh diff # full diff (merge base to working tree)
branch-context.sh diff-committed # committed only (merge base to HEAD)
branch-context.sh diff-uncommitted # uncommitted only (staged + unstaged vs HEAD)
branch-context.sh log # commit log since merge base
branch-context.sh stat # diffstat (merge base to working tree)
branch-context.sh stat-committed # diffstat, committed only (merge base to HEAD)
branch-context.sh files # changed file list (merge base to working tree)
branch-context.sh files-committed # changed file list, committed only
branch-context.sh base # the merge base SHA
branch-context.sh target # the detected merge target
branch-context.sh resolution # base provenance on stdout
branch-context.sh json # machine-readable JSON
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.
- 2mo ago First seen · 126 lines · 58 tokens per session scan A 0d050c0e4607
branch-context is a skill published in the GitHub repository axiomantic/spellbook (13 stars, last pushed 5d ago), licensed MIT. It adds 58 tokens to every session and 1,088 once invoked, about $0.0002 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-09-03.
branch-context compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| branch-contextaxiomantic/spellbook | Skill | 13 | 5d ago | MIT | A | 58 | Claude Code, Codex |
| autofix-prQwenLM/qwen-code | Skill | 31k | today | Apache-2.0 | A | 142 | Claude Code |
| repo-hygieneQwenLM/qwen-code | Skill | 31k | today | Apache-2.0 | A | 48 | Claude Code, Codex |
| create-issueQwenLM/qwen-code | Skill | 31k | today | Apache-2.0 | A | 26 | Claude Code |
| docs-update-from-diffQwenLM/qwen-code | Skill | 31k | today | Apache-2.0 | A | 75 | Claude Code, Codex |
| prepare-prQwenLM/qwen-code | Skill | 31k | today | Apache-2.0 | A | 42 | Claude Code |
| pr-stewardagent-of-empires/agent-of-empires | Skill | 5.2k | today | MIT | A | 130 | Claude Code, Codex |