🗺️ docmap
docmap — instant documentation structure for LLMs and humans.
Navigate massive docs without burning tokens.
The Problem
Documentation files are everywhere — READMEs, design docs, changelogs, API references, PDFs. But:
- LLMs can't open large markdown files or PDFs (token limits)
- Humans have to open each file to see what's inside
- There's no "file tree" for documentation content
- And once you find a section, there's no way to say "show me the Python code block" or "find the warning callout"
The Solution
docmap .
╭──────────────────────── docs/ ────────────────────────╮
│ 22 files │ 645 sections │ ~109k tokens │
│ 18 callouts · 41 code blocks · 7 tables · 2 math │
│ 33 tasks (19 done) · 4 wiki · 6 embeds │
╰────────────────────────────────────────────────────────╯
├── README.md (3.8k, 18 §) · 14 code · 1 tables
├── docs/ARCHITECTURE.md (7.7k, 33 §) · 6 code · 3 callouts
├── docs/API.md (12.1k, 47 §) · 21 code · 4 tables
└── CHANGELOG.md (15.2k, 41 §) · 2 callouts
One command. Full inventory. No LLM needed.
Install the CLI
# macOS/Linux (cask — prebuilt binary, no CLT/compile step)
brew tap JordanCoin/tap && brew install docmap
# Prebuilt release archive (no local compile). Use `brew upgrade docmap` after new tags.
# Windows
scoop bucket add docmap https://github.com/JordanCoin/scoop-docmap
scoop install docmap
Other options: Releases | go install github.com/JordanCoin/docmap@latest
Hooks (recommended)
One command wires docmap into Claude Code and Codex so it fires without being asked:
docmap setup # detected agents; or --agent claude|codex|both, --global, --check
What then happens, with no prompt engineering:
- Session start:
📚 Docs: 26 md, 0 pdf · 222 sections · ~55.7k tokens, the 5 most recently committed docs, and the stale claim count (skipped if it would take over 1.5 s).
- After every Edit/Write:
📚 Docs mentioning cmd/hooks.go (9 sections): followed by up to 8 doc > section lines. Nothing is printed when no doc mentions the file.
- Before Read of a markdown file over 200 lines or any PDF: the section tree (max 60 lines, once per file per session) and
Read only the section you need: docmap <file> --expand "<title>".
Entries go in .claude/settings.local.json and .codex/hooks.json (--global for ~/.claude/settings.json, ~/.codex/hooks.json). Setup is idempotent and never touches other hooks.
MCP server
docmap mcp speaks stdio MCP so agents can call structured tools instead of shelling out and scraping ANSI.
docmap mcp
Ship-with-repo config (.mcp.json):
{
"mcpServers": {
"docmap": {
"command": "docmap",
"args": ["mcp"]
}
}
}
Tools (all return typed JSON): docmap__inventory, docmap__tree, docmap__brief, docmap__section, docmap__expand, docmap__find_by_type, docmap__at_line, docmap__since, docmap__stale, docmap__search, docmap__json, docmap__refs.
Claude Desktop / other clients — same stanza in ~/Library/Application Support/Claude/claude_desktop_config.json (or your client's MCP config). Requires docmap on PATH.
Install the Claude Code skill
docmap ships a Claude Code skill (SKILL.md) that teaches Claude when and how to use the CLI — the drill-downs, line lookups, search across notables, and --since git integration. Pick whichever install method fits your workflow.
Option A — Plugin marketplace (recommended)
Inside Claude Code, add this repo as a marketplace and install the plugin:
/plugin marketplace add JordanCoin/docmap
/plugin install docmap@docmap
That's it. Claude Code clones the repo, picks up .claude-plugin/marketplace.json, and installs the docmap plugin from plugins/docmap/. The skill becomes available as /docmap and Claude will auto-invoke it when you're working with markdown docs.
The plugin also ships the three hooks (hooks/hooks.json), so a marketplace install needs no docmap setup: session start, post-edit doc mentions and pre-read trees fire on their own as long as docmap is on PATH.
Without the plugin, one line in your global ~/.claude/CLAUDE.md gets every agent most of the way: Before Read on any .md over 200 lines, run docmap <file> and read only the section you need.
Update later with /plugin marketplace update.
Option B — Personal user skill
Drop the SKILL.md into your personal Claude skills folder so it's available across every project, no marketplace needed:
mkdir -p ~/.claude/skills/docmap
curl -o ~/.claude/skills/docmap/SKILL.md \
https://raw.githubusercontent.com/JordanCoin/docmap/main/plugins/docmap/skills/docmap/SKILL.md
Option C — Project-scoped (commit to your repo)
If you want every contributor on a specific project to auto-load the docmap skill while working in that repo, commit it to .claude/skills/:
mkdir -p .claude/skills/docmap
curl -o .claude/skills/docmap/SKILL.md \
https://raw.githubusercontent.com/JordanCoin/docmap/main/plugins/docmap/skills/docmap/SKILL.md
git add .claude/skills/docmap/SKILL.md
Browse the skill
Read the shipped SKILL.md on GitHub before installing: plugins/docmap/skills/docmap/SKILL.md.
Usage
docmap . # Map everything in a directory
docmap README.md # Deep dive single file
docmap report.pdf # PDF document structure
docmap notes.txt # Plain-text structure (inferred headings or pages)
docmap config.yaml # YAML file structure
docmap README.md --section "API" # Filter to section
docmap README.md --expand "API" # Raw section source with file:L-L
docmap . --brief # Session start: counts + recent docs (skips stale)
docmap . --brief --stale # Brief plus stale claim count
docmap . --stale # Flag stale path/binary/date/env claims
docmap . --stale --remote --json # Also check URLs/config values (network)
docmap file.md --type code # List every code block
docmap file.md --type code --lang python # Only Python code blocks
docmap file.md --type callout --kind warning # Only warning callouts
docmap file.md --type table # Every table with its headers
docmap docs/ --type code --lang bash # Same, across a directory (skips files with none)
docmap file.md --at 154 # What's at line 154?
docmap file.md --since HEAD~5 # Constructs on lines changed since a git ref
docmap . --since HEAD --json # Same, machine-readable (includes deletions)
docmap . --mentions --since HEAD # Docs that mention files git says changed
docmap file.md --search "auth" # Search titles, content, and notables
docmap dirA dirB --search "auth" --compact # Search multiple roots
docmap docs/ --terms-file queries.txt --compact # One query per line
docmap . --refs # Cross-references between docs
docmap . --all # Include node_modules, vendor and .gitignore'd files
docmap file.md --json # Full typed AST as JSON
Multiple roots are supported for search only. File paths in search results are
relative to the root they came from, so duplicate names from different roots
are retained as separate hits even when their displayed paths are identical.
When both --search and --terms-file are supplied, the
explicit search query runs first, followed by terms in file order; blank lines
and lines beginning with # are ignored.
Search answers with the lines that matched, so you can go to file:line
without expanding a section first:
$ docmap . --search "blast radius"
7 sections match 'blast radius' · 7 lines · 7 files
docs/COMMANDS.md > Commands > Modes > Blast radius (125)
:121 ### Blast radius
README.md > codemap > What it's for (134)
:96 | **Blast radius** | Who breaks if you change this file. |
docs/HOOKS.md > Codemap Hooks > Why This Matters (93)
:436 2. **Sees** the blast radius after making changes
Results are ranked: a title match first, then whole-word matches before
matches inside a longer word (hub before github), then by number of
matching lines. Each section shows its first three matching lines and a count
of the rest; past 25 sections the list is cut with a count. A phrase that
wraps across a line break, or a word hyphenated at a line end, still matches
and is reported at the line where it starts.
Use --compact for one file > section line per hit in document order (with
## term headings when multiple queries run). Add --json to get an array
such as
[{"term":"auth","file":"api.md","section":"Authentication","tokens":42,"line":12,"count":2,"hits":[{"line":14,"text":"…"}]}].
--section and --expand take the best match for a name: an exact title,
then a title that starts with it, then one that contains it. When the name is
ambiguous the others are listed on stderr; pick one with its full title or a
breadcrumb, --expand "Appendix > Setup". When nothing matches, the closest
titles are printed instead of a bare "not found".
Output
Single file deep dive
docmap docs/ARCHITECTURE.md
╭──────────────── ARCHITECTURE.md ─────────────────╮
│ Sections: 33 │ ~7.7k tokens │
│ 3 callouts · 6 code blocks · 2 tables │
╰───────────────────────────────────────────────────╯
├── System Design (2.1k) · core, actor model
│ ├── Vision (214)
│ ├── Core Principles (412) · Headless-first, Plan before execute
│ └── Architecture Overview (789) · go :42-68, mermaid :74-92
├── Components (3.2k)
│ ├── Scheduler (892) · note :118 Schedulers run in their own actor
│ ├── Orchestrator (1.1k) · 2 tables :156 Name, :172 State
│ └── Memory (RAG) (1.2k) · go :214-245, sql :250-268
└── Security (1.4k)
└── (empty heading)
Every section shows its token count plus a dense inline annotation of what's inside it. Code blocks, callouts, tables, and math blocks all carry :line jump targets.
Drilling into one construct type
Want every Python code block? Every warning? Every table?
docmap file.md --type code --lang python
╭──── file.md — code blocks ────╮
│ 3 code blocks in 2 sections │
╰─────────────────────────────────╯
Installation > Setup (214)
:34-41 python
Usage > Examples (1.1k)
:120-134 python
:142-156 python
Each hit carries the exact line range and breadcrumb. Drop that into a grep, an editor, or hand it to another agent.
What's at line N?
docmap file.md --at 154
╭──── file.md — line 154 ────╮
│ code_block │
╰──────────────────────────────╯
Section: Installation > Setup
Node: code L154-156 lang=python
Changed since a git ref
docmap README.md --since HEAD~10
╭──── README.md — since HEAD~10 ────╮
│ 49 changed lines across 8 sections │
╰─────────────────────────────────────╯
docmap > Usage (110)
code L64-71 lang=bash
docmap > PDF Support (231)
code L132-133 lang=bash
code L136-145 lang=(none)
Uses git diff --unified=0 from the file's repository root, so it works even when your shell is not inside the repo. New files (untracked, or added after the ref) count as fully changed. Directory mode (docmap . --since main) prints only the docs that actually changed, lists deleted: / renamed: for docs that moved since the ref, and ignores non-doc paths. Binary docs (e.g. PDFs) light up as fully changed. Combine with --json to get changed_lines, change (A/M/D/R), and old_path for renames. docmap . --mentions --since HEAD uses git's changed paths as mention needles — including non-doc paths (e.g. .go) and deletes — while --since listing itself stays doc-only.
Stale claims
docmap . --stale
docmap . --stale --days 30 --check-flags
docmap . --stale --remote --allow-domains example.com,github.com --json
Local checks (zero network): missing backticked paths, binaries not on PATH, status-heading dates older than --days (default 90), and $ENV keys absent from .env.example / compose / config files.
--remote adds HEAD checks for http(s) URLs, tool 1.2.3 vs tool --version, and KEY=value claims that disagree with root config. Output is file > section: reason plus a count; --json emits the finding array. Default --brief skips stale checks (prints a hint); --brief --stale adds a one-line stale: N summary.
PDF support
PDFs with outlines show document structure, with each bookmark anchored to the text layer. Anchoring follows the bookmark's own destination (page and position), so a section lands on its real heading rather than on the table-of-contents line, running header or figure label that repeats its title; outlines without destinations fall back to matching titles in the text. Parsed PDFs are cached like markdown, keyed on mtime and size. PDFs without outlines fall back to page-by-page. Either way --expand, --at and --search work, with line numbers into the extracted text. Scanned/image-only PDFs show a page count but no text.
docmap extracts the text itself, by position, so the output reads the way the page does:
- Words and lines. Gaps between glyphs become spaces and baseline changes become line breaks. PDFs that space words by moving the pen (every TeX document) no longer come out as one run of letters.
- Ligatures.
fi, fl, ffi and glyphs named f_i or T_h come out as the letters you would search for, so quantification finds quantification.
- No silent fusion.