Analyze codebase structure, dependencies, and changes. Use when user asks about project structure, where code is located, how files connect, what changed, or before starting any coding task...
Codemap gives you instant architectural context about any codebase. It classifies your intent, detects risk, matches relevant skills, and tracks your working set — all automatically via hooks.
Codemap should also keep its own per-project config healthy. On first use in a repo, or when output is obviously noisy, tune .codemap/config.json before doing deeper analysis so future calls stay code-first instead of asset-first.
codemap . # Project structure and top files
codemap --deps # Dependency flow (imports/functions/hubs)
codemap --diff # Changes vs main branch
codemap --diff --ref <branch> # Changes vs specific branch
codemap --importers <file> # Who imports this file? Is it a hub?
codemap handoff . # Build + save handoff artifact
codemap handoff --latest . # Read latest saved handoff
codemap handoff --json . # Machine-readable handoff payload
codemap skill list # Show available skills with descriptions
codemap skill show <name> # Get full skill instructions
codemap skill init # Create custom skill template
codemap config show # Show current project config
codemap context # Universal JSON context envelope
codemap context --for "prompt" # With pre-classified intent + matched skills
codemap context --compact # Minimal for token-constrained agents
codemap serve --port 9471 # HTTP API for non-MCP integrations
Before deeper Codemap analysis in a repo:
.codemap/config.json.codemap skill show config-setup and follow it.codemap . and codemap --deps.Treat config as repo memory. Once tuned, future Codemap calls should benefit automatically.
Signals that config needs setup or tuning:
.codemap/config.json is missingonly values with no real project shaping.xcassets, screenshots, PDFs, training-data, fixtures, generated files, models, vendor directories)codemap . when:codemap --deps when:codemap --diff when:codemap --importers <file> when:codemap skill show <name> when:<!-- codemap:skills [...] -->codemap skill show config-setup when:.codemap/config.jsoncodemap context when:codemap handoff when:The prompt-submit hook fires on every message and provides:
<!-- codemap:intent {"category":"refactor","risk":"high",...} -->
<!-- codemap:skills [{"name":"hub-safety","score":5},...] -->
Skills matched: hub-safety, refactor — run `codemap skill show <name>` for guidance
codemap skill show for full body| Skill | When to Pull |
|---|---|
config-setup |
Missing, boilerplate, or noisy .codemap/config.json |
hub-safety |
Editing files imported by 3+ others |
refactor |
Restructuring, renaming, moving code |
test-first |
Writing tests, TDD workflows |
explore |
Understanding how code works |
handoff |
Switching between AI agents |
codemap .)codemap --deps)codemap --diff)(new) = untracked, ✎ = modified, (+N -M) = lines changedcodemap --importers <file>)codemap context)--compact strips skills and limits working set for token savingsIf codemap MCP server is configured, these tools are available:
| Tool | Use For |
|---|---|
get_structure |
Project tree |
get_dependencies |
Dependency flow + hubs |
get_diff |
Changed files with impact |
find_file |
Search by filename |
get_importers |
Who imports a file |
get_hubs |
List all hub files |
get_file_context |
Full context for one file |
get_handoff |
Build/read handoff artifact |
get_working_set |
Files edited this session |
list_skills |
Available skills (metadata) |
get_skill |
Full skill instructions |
get_activity |
Recent coding activity |
start_watch / stop_watch |
Control daemon |
status |
Verify MCP connection |
list_projects |
Discover projects |
When codemap serve is running:
| Endpoint | Returns |
|---|---|
GET /api/context?intent=... |
Context envelope |
GET /api/skills |
All skills metadata |
GET /api/skills/<name> |
Full skill body |
GET /api/working-set |
Current working set |
GET /api/health |
Server health |