Context Cartographer
Build a small documentation system that lets future agents load only the context they need.
Scope Boundary
- Use this skill for documentation-system setup, audit, migration, cleanup, restructuring, or unclear ownership.
- Do not use it for a routine edit when the target owner file is already known.
- Do not use it for automatic durable maintenance already required by
AGENTS.md,CLAUDE.md, Cursor rules,docs/architecture.md, ordocs/code_rules.md. Apply those local instructions directly. - Always use it when the user explicitly invokes
context-cartographer.
Core Rules
- Resolve the project root and inventory real paths before reading project files. Do not guess paths from the current directory or another project.
- Reuse files already read during the task. Reread only a changed file, truncated output, or a specific unread range.
- Keep root agent instruction files short. Put durable topic detail in owner files under
docs/. - Use
AGENTS.mdfor Codex,CLAUDE.mdfor Claude Code,.cursor/rules/context-cartographer.mdcfor Cursor, or thin adapters for selected multi-agent targets. - Inspect read-only before proposing changes.
- Preserve existing project-specific rules and edit surgically.
- Never overwrite, move, merge, or delete existing instruction or docs files without approval.
- Create only files supported by project evidence and current needs.
- Mark unknown facts as
TODO: clarify; never invent project facts. - Keep project-memory docs local-only by default and add them to the repository ignore file unless the user explicitly asks to track or publish them.
- Verify links, owner routing, ignore rules, and stale references after edits.
Required Decisions
Before creating or replacing root agent instructions, resolve:
- agent target;
- code-rules mode: use
docs/code_rules.mdor do not use it; - documentation maintenance mode:
automatic durable maintenanceorrequest-only maintenance; - handling of existing docs: keep as-is, audit only, migrate after approval, or let the agent decide;
- whether project-memory docs remain local-only or are tracked.
Do not infer code-rules mode or documentation maintenance mode. When more than two decisions are missing, use the bundled questionnaire.
Generated root instructions must keep routine maintenance independent from this skill:
- Under
automatic durable maintenance, update the matching owner doc in the same task whenever completed work changes durable behavior, architecture, setup, deployment, staging, test data, access, import/export, public URLs, operator workflow, data model, public interfaces, agent workflow, or documentation ownership. - Under
request-only maintenance, update docs only when explicitly asked and flag likely stale docs. - State that routine maintenance uses root instructions and existing owner docs directly without invoking
context-cartographer. - If no existing owner file fits, invoke this skill and follow the missing-owner protocol. Under automatic durable maintenance, classify and create the smallest justified owner automatically without asking solely for permission to create a Markdown file.
- Invoke this skill later only for setup, audit, migration, cleanup, restructuring, explicit use, or genuinely unclear ownership.
Reference Routing
- For first-time setup, always read
references/setup-workflow.md; it routes the other required references. - For audit, migration, cleanup, restructuring, or unclear ownership, always read
references/existing-docs-workflow.md; it routes the other required references. - Read
references/doc-map.mdbefore choosing files or ownership. - Read
references/file-templates.mdbefore creating root instructions ordocs/*.md. - Read
references/audit-checklist.mdbefore auditing an existing repository. - Read
references/cleanup-rules.mdbefore splitting, merging, deleting, or renaming docs. - Read
references/question_schema.mdbefore creating questionnaire JSON. - Read
references/questionnaire_usage_examples.mdonly when adapting the questionnaire flow.
Workflow
- Resolve the project root and inventory paths with
rg --files. - Classify the project profile, selected agent target, existing docs, ownership, code-rules mode, and maintenance mode.
- For existing docs, show a compact map of current files, topic owners, and planned create/update/delete actions before editing.
- Apply the smallest justified documentation-system change within the user's authorized scope.
- Verify links, stale filenames, owner coverage, local-only ignore rules, and the independent routine-maintenance instructions.
For a new system, follow references/setup-workflow.md.
For audit, cleanup, migration, restructuring, or unclear ownership, follow references/existing-docs-workflow.md.
Questionnaire
For broad setup work with more than two missing decisions:
- Create
.project-questionnaire/questions.jsonfromreferences/question_schema.md. - Set
languageto the user or project language. - Validate with
python3 <this-skill>/scripts/questionnaire_server.py --input .project-questionnaire/questions.json --validate-only. - Run the server on
127.0.0.1with an automatic port. - After the user saves and says they are done, read both answer files before continuing.
Code-rules mode and documentation maintenance mode must be required choices without defaults or recommendation options.
Update Check
Run python3 <this-skill>/scripts/check_update.py --json at most once per day. Ask before installing an available update. Bump VERSION when publishing a change that installed users should receive.
Exit Criteria
Report:
- files created or changed;
- links, routing, and stale references checked;
- local-only ignore policy checked;
- independent automatic-maintenance routing checked;
- validation performed and any checks not run.