home / skills / velcrafting / codex-skills / cartographer
This skill generates a deterministic project map (Tree.txt and docs/PROJECT_MAP.md) for a repository to aid quick understanding without altering code.
npx playbooks add skill velcrafting/codex-skills --skill cartographerReview the files below or copy the command above to add this skill to your agents.
---
name: cartographer
description: Generate a deterministic project map (Tree.txt + docs/PROJECT_MAP.md) for a repo. Use only when explicitly invoked.
metadata:
short-description: Repo map generator
mode: write
idempotent: true
---
# Cartographer
## Goal
Produce a **durable, reviewable map of the repo** that helps humans and agents understand structure quickly, without inventing architecture or behavior.
Primary outputs:
- `Tree.txt` (curated, deterministic tree)
- `docs/PROJECT_MAP.md` (index linking key artifacts)
This skill **maps what exists**. It does not decide how the system should work.
---
## Non-negotiables
- Do not write outputs into `.codex/` (runtime only).
- Do not modify application code.
- Prefer deterministic output (stable ordering, stable excludes).
- Do not invent architecture, intent, or rules.
- If artifacts already exist, update them in place with minimal diff.
---
## Inputs
- Target repo root (explicit or inferred)
- Default exclude rules (defined in script)
- Optional flags passed to the script:
- `--tree`
- `--map`
- `--all`
- `--max-depth <n>`
---
## Outputs
- `<repo>/Tree.txt`
- `<repo>/docs/PROJECT_MAP.md`
Optional (future extensions, not required):
- `<repo>/docs/diagrams/system/*`
- Colocated `*.state-machine.md`
---
## When to use
- After significant repo growth or restructuring
- When onboarding new contributors or agents
- Before or after cross-cutting refactors
- Prior to publishing or reviewing governance artifacts
Do **not** use as a substitute for:
- ARCHITECTURE.md
- system diagrams
- decision records
---
## Workflow
### 1) Preconditions (read-only)
- Identify repo root.
- Confirm the repo is not `.codex/` itself.
- Check whether `docs/` exists (create only if needed for outputs).
---
### 2) Run the cartographer script
Execute from repo root or with an explicit path:
```sh
python3 scripts/project_ops/cartographer.py --all
This skill generates a deterministic, reviewable map of a codebase and creates two primary artifacts: Tree.txt and docs/PROJECT_MAP.md. It focuses on representing what already exists without inventing architecture, intent, or behavior. Use it only when explicitly invoked to update or create the map files.
The script inspects the project root, applies stable exclude rules, and produces a curated tree listing with stable ordering and depth limits. It then generates an indexed PROJECT_MAP.md that links to key artifacts and governance files found in the codebase. Existing Tree.txt or docs/PROJECT_MAP.md are updated in place with minimal diffs to preserve history.
Will the skill change source code?
No. It only writes Tree.txt and docs/PROJECT_MAP.md and avoids modifying application code.
Can it invent architecture or intent?
No. The output maps existing files and structure; it does not infer or create architecture or behavioral rules.