/cartographer:cartographerfrom cartographer
Audit CLAUDE.md, AGENTS.md, and .claude/rules/ instruction files for contradictions, stale references, dead rules, scope collisions, and entities no instruction file mentions. Runs a full audit in the foreground (with lock). Use when the user explicitly invokes /cartographer, or when they want immediate feedback after editing an instruction file. Supports --scope, --type, --verbose, --status, and --force flags.
Ships in cartographer. 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.
Cartographer audits the persistent instruction layer of the current project and reports findings in the conversation. The automated SessionStart path handles periodic background audits; this skill is for on-demand use.
The Bash tool may be zsh and keeps no functions between calls, so send this block inside bash, in one call:
bash <<'ONLOOKER_SKILL'
<the two Setup blocks>
<the block for this mode>
ONLOOKER_SKILL
set -uo pipefail
export CLAUDE_SESSION_ID="${CLAUDE_SESSION_ID}"
PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT}"
export CLAUDE_PLUGIN_ROOT="$PLUGIN_ROOT"
source "$PLUGIN_ROOT/scripts/lib/cartographer-config.sh"
source "$PLUGIN_ROOT/scripts/lib/onlooker-project-key.sh"
source "$PLUGIN_ROOT/scripts/lib/cartographer-lock.sh"
source "$PLUGIN_ROOT/scripts/lib/cartographer-events.sh"
source "$PLUGIN_ROOT/scripts/lib/cartographer-collect.sh"
source "$PLUGIN_ROOT/scripts/lib/cartographer-analyze.sh"
Load config and resolve project context:
REPO_ROOT=$(onlooker_project_repo_root "$(pwd)")
cartographer_config_load "$REPO_ROOT"
PROJECT_KEY=$(onlooker_project_key "$(pwd)")
CARTOGRAPHER_DIR="${ONLOOKER_DIR:-$HOME/.onlooker}/cartographer/$PROJECT_KEY"
mkdir -p "$CARTOGRAPHER_DIR"
/cartographer — full auditRuns all phases in the foreground. Acquires the audit lock (non-blocking).
LOCK_FILE="$CARTOGRAPHER_DIR/audit.lock"
if ! cartographer_lock_acquire "$LOCK_FILE"; then
echo "An audit is already in progress."
echo "Run \`/cartographer --status\` to follow it, or \`/cartographer --force\` to restart."
exit 0
fi
export CARTOGRAPHER_DIR CARTOGRAPHER_TRIGGER="manual" ONLOOKER_DIR="${ONLOOKER_DIR:-$HOME/.onlooker}"
bash "$PLUGIN_ROOT/scripts/run-audit.sh"
cartographer_lock_release "$LOCK_FILE"
After the audit completes, read findings and render them to the conversation grouped by severity (see Rendering section).
/cartographer --verbose — all findingsShows ALL known findings (new + previously seen) from $CARTOGRAPHER_DIR/findings/, including ones already resolved — that is what makes this the verbose view. Resolved findings are tagged so "did my fix take?" is answerable here. Does NOT re-emit bus events — renders to in-conversation output only.
echo "## Known Cartographer Findings"
echo ""
for f in "$CARTOGRAPHER_DIR/findings/"*.json; do
[[ -f "$f" ]] || continue
jq -r '(if .resolved == true then "[RESOLVED] " else "" end) as $r |
"\($r)**[\(.severity | ascii_upcase)]** \(.type) — \(.description)\n Files: \(.file_a // "n/a") / \(.file_b // "n/a")\n Fix: \(.suggested_fix // "n/a")\n"' "$f" 2>/dev/null
done
/cartographer --status — audit statusReports the running state and last completion time. No LLM calls.
echo "## Cartographer Status"
if cartographer_lock_is_held "$CARTOGRAPHER_DIR/audit.lock"; then
pid=$(cat "$CARTOGRAPHER_DIR/audit.lock" 2>/dev/null)
echo "Audit running (PID $pid)"
else
echo "No audit in progress"
fi
if [[ -f "$CARTOGRAPHER_DIR/last_audit_at" ]]; then
ts=$(cat "$CARTOGRAPHER_DIR/last_audit_at")
echo "Last completed: $(date -r "$ts" 2>/dev/null || date -d "@$ts" 2>/dev/null || echo "$ts")"
fi
runs=$(ls "$CARTOGRAPHER_DIR/runs/" 2>/dev/null | wc -l | tr -d ' ')
total=$(ls "$CARTOGRAPHER_DIR/findings/" 2>/dev/null | wc -l | tr -d ' ')
open=$(cat "$CARTOGRAPHER_DIR/findings/"*.json 2>/dev/null \
| jq -s '[.[] | select(.resolved != true)] | length' 2>/dev/null || echo 0)
echo "Open findings: $open"
echo "Total findings on disk: $total (includes resolved)"
echo "Audit runs recorded: $runs"
/cartographer --force — force restartKills the running audit (if any) and starts fresh.
LOCK_FILE="$CARTOGRAPHER_DIR/audit.lock"
if cartographer_lock_is_held "$LOCK_FILE"; then
pid=$(cat "$LOCK_FILE" 2>/dev/null)
if [[ -n "$pid" ]]; then
kill "$pid" 2>/dev/null || true
sleep 1
fi
rm -f "$LOCK_FILE"
fi
# Then proceed as a normal full audit
/cartographer --type=<type> — single finding typeNarrows the audit to one finding type: contradiction, dead_rule, stale_ref, scope_collision, or undocumented_entity. Export CARTOGRAPHER_TYPE_FILTER before running.
export CARTOGRAPHER_TYPE_FILTER="stale_ref"
Analyzers that cannot produce the requested type are skipped entirely, so this is cheaper than a full audit — each skipped analyzer is an LLM call not made. Useful for re-checking one class of drift after fixing it without paying for the rest.
One caveat, because the saving is not uniform: contradiction and dead_rule come out of a single LLM pass, so asking for either runs that pass and discards the other type from the results. Requesting one of those two costs the same as running both; the other three types are genuinely skippable.
An unrecognized type is an error rather than a filter that matches nothing — an empty audit looks exactly like a clean repo, so a typo would read as good news.
/cartographer --scope=<path> — scoped auditLimits analysis to instruction files under <path>, relative to the repo root or absolute. Export CARTOGRAPHER_SCOPE_PATH before running.
export CARTOGRAPHER_SCOPE_PATH="plugins/tribunal"
The scope narrows which files are analyzed; it does not become the repo root. stale_ref resolves path-like tokens against the real root, and re-rooting would report every reference outside the scope as broken.
Both flags compose, and both apply to manual runs only — the SessionStart and PostToolUse hooks always run unfiltered.
After a manual audit completes, render findings grouped by severity. Resolved findings are skipped — a finding whose drift the user already fixed must stop appearing here, or the advice to fix it never stops being given:
echo "## Cartographer Findings"
echo ""
for severity in error warning informational; do
count=0
output=""
for f in "$CARTOGRAPHER_DIR/findings/"*.json; do
[[ -f "$f" ]] || continue
jq -e '.resolved != true' "$f" >/dev/null 2>&1 || continue
fsev=$(jq -r '.severity // "warning"' "$f" 2>/dev/null)
[[ "$fsev" != "$severity" ]] && continue
(( count++ )) || true
output+=$(jq -r '"- **\(.type)**: \(.description)\n `\(.file_a // "n/a")`\n Fix: \(.suggested_fix // "n/a")\n"' "$f" 2>/dev/null)
output+=$'\n'
done
if [[ "$count" -gt 0 ]]; then
echo "### ${severity^} ($count)"
printf '%s\n' "$output"
fi
done
cartographer.issue.found — emitted for NEW findings only (not in dedup store). Downstream consumers must deduplicate on payload.finding_hash.cartographer.audit.complete — emitted when all phases complete (or partial with status: "partial").--verbose renders known findings as in-conversation output only — no bus events.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub onlooker-community/ecosystem --plugin cartographer