codemap

Generates hierarchical codemaps and change-aware state files for unfamiliar repositories.

1|Updated Jul 23, 2026
One-click install
npx skills add https://github.com/sanjanb/my-agent-harness --skill codemap-sanjanb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: codemap
Source: https://github.com/sanjanb/my-agent-harness/tree/main/skills/codemap
Command: npx skills add https://github.com/sanjanb/my-agent-harness --skill codemap-sanjanb

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? When starting work on an unfamiliar codebase, agents and developers lack a structured map of directory responsibilities, design patterns, and data flow, forcing expensive re-exploration on every task. ## Core Features & Use Cases - Hierarchical Codemap Generation: Creates a codemap.md in every relevant folder documenting responsibility, design patterns, data flow, and integration points, plus a root-level Repository Atlas aggregating all sub-maps. - Change Detection: Tracks file and folder hashes in .slim/codemap.json so subsequent runs only update codemaps for folders that actually changed. - Legacy Migration & AGENTS.md Registration: Automatically migrates .slim/cartography.json state and registers the codemap in AGENTS.md so agents discover it on every session. - Use Case: You clone a large TypeScript monorepo you have never seen. Run the codemap skill to select core source files, scaffold per-folder codemaps, delegate documentation to fixer agents, and produce a root atlas for future sessions. ## Quick Start Ask the agent to generate a codemap for this repository so it can document the architecture and folder responsibilities.

Frequently Asked Questions about codemap

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a codemap for an unfamiliar repository?

Run codemap.mjs init with a root path and include/exclude glob patterns, such as src/**/*.ts included and node_modules excluded. This creates .slim/codemap.json state plus empty codemap.md templates in each folder for agents to fill in.

How do I detect which files changed since the last codemap run?

Run codemap.mjs changes --root on the repository. It recomputes file hashes against the saved state and reports added, removed, and modified files plus the list of affected folders that need codemap updates.

Does codemap support incremental updates instead of full rescans?

Yes. When .slim/codemap.json already exists, the workflow skips initialization, detects only changed files, updates codemaps for affected folders, and saves new state with codemap.mjs update.

What files are excluded from codemap generation?

Tests, documentation, translations, build output, and dependencies are mandatorily excluded, including patterns like **/*.test.ts, tests/**, docs/**, dist/**, and node_modules/**. The .gitignore file is also respected automatically.

What happens to legacy cartography.json state files?

The script automatically migrates .slim/cartography.json to .slim/codemap.json on the next run. The migration renames the file in place and continues with normal change detection without losing prior state.