cartographer은(는) 무엇을 하나요?
Spend context only on code that matters: irrelevant code costs tokens and accuracy.
S=<skill_dir> = folder of this file. Run python3 "$S/scripts/<tool>.py" from the project root
(Windows: python or py -3; Python 3.9+, nothing to install). The 4 Laws are mandatory;
each is scaled to the task, so none is optional "ceremony".
Law 1 — Skeleton Survey First
- Never start with
ls -R,find,tree,dir /s,Get-ChildItem -Recurse,**/*globs, or whole-file reads. Allowed: one non-recursivels, or a file the user named. - Task known →
map_workspace.py --query "<3-6 identifiers / domain words>"→ top 10 files (--top N), each with imports/imported-by and only the matching symbols:.def save(db: "Session", retries: int = 3) -> None [L13-18]. - Know the name →
map_workspace.py --find <Name|Class.method>→ file +[La-b]of each definition. Prefer it over grep for definitions. - Grep is fine after the map, for exact strings that are not definitions (error messages, config keys, CSS classes, call sites).
- Big picture →
map_workspace.py(entry points, suggested checks, deps, hotspots, tree, skeleton). - Resuming or reviewing work in progress →
map_workspace.py --changed(--changed mainfor a branch). ⚠ syntax errorin a skeleton = already broken before you; report it.
Impact check — run map_workspace.py --impact <file> before you change anything other code
relies on: a function/method signature, an exported name, a rename/move/delete, a return
type or shape. Then fix every direct importer it lists. Not needed for changes inside a function
body that keep its contract (e.g. a constant, a condition, a message).
Law 2 — Surgical Reading Only
- File over 120 lines → never read it whole (no normal read tool,
cat,type,Get-Content). - Read only the block you need, by the map's range or by name:
surgical_read.py --file <path> --start <A> --end <B>·surgical_read.py --file <path> --symbol Class.method - Output:
Showing Lines 115-173 of 1,450 total lines; target lines120 | …, ±5 context115 : …. Line numbers are exact; edit by them. Need a caller?--findit and read that range. - Several reads may go in one shell call.
Law 3 — Telegraphic Breadcrumbs (long or resumable work)
- Required when the task has more than 5 steps, touches 3 or more files, the user says
"continue/resume", or the context was compacted. Small edits (1-2 files, few steps) skip it.
checkpoint_manager.py --statusfirst. Resume if it matches; unrelated → ask before--init --force.- None →
--init "<objective; done-criteria>"then--update --next "A;B;C". - After each step:
--update --done "<what>" --next "<next>" --files "a.py,b.ts" [--note "<decision>"].
- Telegraph style: one line ≤160 chars, no filler, keep identifiers/paths/numbers/decisions.
invoice calc → Invoice.total()·VAT: Decimal not float (rounding) - After compaction or interruption:
--statusbefore anything else; trust it over memory.
Law 4 — Zero-Error Verification (every task that edited files)
- Run
checkpoint_manager.py --verifyafter every editing task, even if tests already passed. No state file needed: it checks git-modified files (plus--files/ recorded files) with the language's own parser: Python, JSON/ipynb, TOML, JS (node --check), PHP (php -l), Ruby (ruby -c), shell (bash -n), Go (gofmt -e); a missing tool is reported, never faked. - It must end
✔ Verification passed. On✘, fix the first error (a caret marks the line), then re-run.✘on a git file you never touched → pre-existing; tell the user, don't silently fix. It also printsLaws this task: ✔ 1 survey · ✔ 2 surgical · – impact · – 3 memory · ✔ 4 verifyfrom a local log of this task's Cartographer calls. Every✘/⚠line names what was missed; fix it now when you can (e.g. re-read a changed file surgically), and mention the rest. - Then run the commands it prints after
Next:(the project's tests/lint/build) and any related tests from--impact. If one cannot run, say so in your answer. - Terminal errors: use only the ≤5 root-cause lines (first error, its file:line, the failing
code). Never paste or re-read full logs;
surgical_read.pythe frame in your code, fix, re-run. - If
.cartographer_state.mdexists, ask once: "Keep it or delete it?" →--cleanonly on a clear yes.
Quick Reference
| Need | Command |
|---|---|
| Relevant files + line ranges | map_workspace.py --query "jwt refresh expiry" |
| Where is X defined | map_workspace.py --find Invoice.total |
| Whole-repo overview | map_workspace.py (--path sub/, --depth 2, --max-chars 25000) |
| Read lines / a symbol | surgical_read.py --file F --start A --end B / --symbol Name |
| Who depends on a file | map_workspace.py --impact F |
| Work in progress | map_workspace.py --changed [REF] |
| Memory (long tasks) | checkpoint_manager.py --status / --init / --update / --clean |
| Done? | checkpoint_manager.py --verify → then its Next: commands |
Error messages, worked examples, map tuning and the optional Rust engine (ask the user before
installing it) are in references/REFERENCE.md. Read it only when you need it.
Final check before you say "done" — answer each in your head:
- Did I start with
--query/--find(notls -R/full reads)? - Did I read files over 120 lines only surgically?
- Did I run
--impactif I changed a signature, export or name? - Long task (>5 steps or 3+ files)? Then is the state file up to date?
- Did
--verifypass, and did I run itsNext:checks (or say why not)? - If a state file exists, did I ask whether to keep it?