/claude-leverage:refresh-context-mapfrom claude-leverage
Rebuilds the smart-context-surfacing manifest (.claude-leverage-context-map.json) after AIDEV anchors, AGENTS.md files, or ADRs change. Run after git merges or refactors that move anchor-bearing files.
Ships in claude-leverage. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Rebuild the smart-context-surface manifest used by the PreToolUse hook
(scripts/hooks/context-surface.sh). See
docs/adr/0008-smart-context-surfacing-via-pretooluse-hook.md
for the design rationale.
AIDEV-NOTE / AIDEV-TODO / AIDEV-QUESTION anchors.AGENTS.md files.docs/adr/ that reference specific source files.git merge that touched anchor-bearing files (.gitattributes keeps
the local manifest on conflict via merge=ours, but it'll be stale relative
to the merged tree until rebuilt)./stack-check flags drift between the manifest and git ls-files..githooks/) does it automatically
if enabled. If you've enabled it, manual /refresh-context-map is redundant..claude-leverage-context-map.json present means the PreToolUse hook
silently no-ops — nothing to refresh).Runs:
python ${CLAUDE_PLUGIN_ROOT}/scripts/build-context-map.py
from the repo root. The script:
git ls-files), skipping binaries (NUL-byte sniff).AIDEV-* anchors, indexes:
AGENTS.md from dirname(file) to repo rootdocs/adr/*.md) that mention this file path verbatim (word-boundary match).claude-leverage-context-map.json at the repo root, atomically (.tmp + rename).The PreToolUse hook reads this manifest on every Read/Edit/Write/MultiEdit
and injects a per-file context slice via hookSpecificOutput.additionalContext.
.claude-leverage-context-map.json. It's generated. Edit
the source (anchors, per-dir AGENTS.md, ADRs) and rebuild. A hand-edited
manifest drifts from the tree, and the next rebuild silently overwrites it..gitattributes sets merge=ours so merge conflicts
on it auto-resolve to local — rebuild afterward (see "When to invoke").A failed rebuild is safe. If python is missing or the script errors, the
manifest is simply not updated — the PreToolUse hook then reads a stale (or
absent) manifest and no-ops gracefully, surfacing slightly less context. It
never blocks a tool call. So a failed rebuild degrades the feature; it does not
break your session. Fix the Python environment and re-run when convenient.
After running, the script prints a summary line:
Wrote ./.claude-leverage-context-map.json (234 files, 89 anchors)
Higher numbers than last time → you've added anchors / ADR references.
Lower numbers → anchors were deleted or files removed from git ls-files.
To check drift without writing (CI use):
python scripts/build-context-map.py --check
# exit 0 if up to date, exit 1 with "DRIFT:" line on stderr if regen would differ
Set CLAUDE_LEVERAGE_CTX_DISABLE=1 in the environment to disable the hook
entirely without removing the manifest. Useful for one-off diagnostic sessions
where the context injection is noise.
By default the hook surfaces only AIDEV-* anchors (the trap-catching content
per the Run-3 token-tax finding). Set CLAUDE_LEVERAGE_CTX_VERBOSE=1 to also
include per-dir AGENTS.md references and related ADR paths in every
injection. Useful in repos where the per-dir AGENTS.md surface is dense and
worth the extra tokens; off by default to keep the tax minimal in the common
case.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
context-map, manifest-rebuild, aidev-anchors, agents-md, adr
16 skills in this plugin
/adr-newUSE WHEN a load-bearing architectural decision is being made in conversation (database / framework / auth model / integration choice, or explicit rejection of an alternative) — one likely to be re-litigated in 6 months without the rationale. Bootstraps a numbered MADR ADR in `docs/adr/`, asks for context + decision + alternatives, updates the index. Immutable status once accepted. See `docs/adr/README.md` for the convention; full Do/Don't list in this SKILL body.
/arch-mapUSE WHEN setting up a repo for AI-first work, after a major directory restructure, or when an agent needs structured answers like "which modules are stable?" / "what's the public surface of X?" that the prose AGENTS.md doesn't give cheaply. Bootstraps or refreshes `architecture.yml` at repo root — machine-readable module metadata (path / role / stability / public_surface / depends_on / paired_with / owners). Hand-curated; the skill drafts, the user confirms. See ADR 0005 for why this file lives at root and why YAML over JSON.
/codex-sandboxUSE WHEN setting up Codex CLI in a project, tightening sandbox for prod/CI, or when user asks about Codex permissions. Interactive helper for per-project `.codex/config.toml`: `dev` / `prod` / `custom` profiles, idempotent via markers, preserves unmanaged config below the block. Codex-only artifact.
npx claudepluginhub filip-podstavec/claude-leverage --plugin claude-leverageOther plugins' skills for the same job