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 1mo 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.
- 1mo ago First seen · 126 lines · 58 tokens per session scan A 0d050c0e4607
branch-context is a skill published in the GitHub repository axiomantic/spellbook (10 stars, last pushed 2d 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.
Other skills, from other repositories
repo-hygiene
Use when the scheduled repo-hygiene workflow runs from GitHub Actions (or an operator dry-run) to scan the repository for small, certain docs/test/code hygiene issues and fix them as one batched branch.
create-issue
Draft and submit a GitHub issue from a user idea or bug description, with bilingual body and correct labels.
docs-update-from-diff
Review local code changes with git diff and update the official docs under docs/ to match. Use when the user asks to document current uncommitted work, sync docs with local changes, update docs after a feature or refactor, or when phrases like "git diff", "local changes", "update docs", or "official docs" appear.
prepare-pr
Prepare GitHub pull request title and body files from the current branch diff, especially for non-interactive CI/autofix flows that must follow the repository PR template without pushing or creating the PR.
git-revert-safety
Apply when reverting commits, undoing merges, or recovering from branch contamination. Covers collateral damage verification (manifest, package.json, CHANGELOG, lockfiles), cherry-pick vs revert decision matrix, partial-revert detection, merge-parent handling, and post-revert CI verification. Prevents the most common…
safe-extraction
Apply when extracting code from a large monolith file into submodules. Covers barrel re-exports, internals DI seam proxy patterns, CI invariant allowlist updates, and cross-file test verification. Prevents CI failures, broken imports, and test regressions from code extraction.