docmap

command module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README ยถ

๐Ÿ—บ๏ธ docmap

docmap โ€” instant documentation structure for LLMs and humans. Navigate massive docs without burning tokens.

License Go

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

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.

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. ๏ฌ, ๏ฌ‚, ๏ฌƒ and glyphs named f_i or T_h come out as the letters you would search for, so quantification finds quanti๏ฌcation.
  • No silent fusion. A font's ToUnicode map is honoured first, Windows-1252 punctuation is decoded (0.625โ€“125, never 0.625125), and a glyph with no known Unicode value becomes ๏ฟฝ instead of vanishing.
  • Exponents. A raised or lowered number next to a digit keeps a marker: 1.58ร—10^7, never 1.58ร—107.
  • Search sees through layout. A phrase that straddles a line wrap matches, and so does a word hyphenated at a line end (under-/mined matches undermined). This applies to markdown and plain text too.

To take the text from an extractor you already trust while keeping docmap's outline structure, name it in DOCMAP_PDF_TEXT_CMD. The command gets the PDF path in place of {} (or appended), writes plain text to stdout, and may separate pages with form feeds:

export DOCMAP_PDF_TEXT_CMD="pdftotext -layout {} -"

The value is split on whitespace and run directly, not through a shell. If the command fails, docmap says so on stderr and uses its own extractor.

Plain-text support

.txt files are documents too, in single-file mode and in directory walks. A .txt with markdown headings parses as markdown. Otherwise structure is inferred from underlined titles, numbered (2.3 Methods) or ALL-CAPS headings, then form-feed page breaks (what pdftotext emits); a file with none of those is one (full text) section, so it still counts in the inventory and answers --search, --expand and --at. Directory walks leave out dependency lists and build files (requirements*.txt, CMakeLists.txt) and anything over 1 MB, and say how many were skipped; --all includes them.

YAML support

YAML files map keys to sections with nested children. Sequences use name/id/title fields for titles when available.

References mode

See how docs link to each other:

docmap . --refs

What docmap recognizes

Full CommonMark + GitHub Flavored Markdown + Obsidian extensions:

  • Headings โ€” ATX and Setext (underline) style, all 6 levels
  • Frontmatter โ€” YAML, TOML, JSON at file start
  • Callouts โ€” GFM alerts: > [!NOTE] / [!TIP] / [!IMPORTANT] / [!WARNING] / [!CAUTION]
  • Tables โ€” with column alignment and inline content
  • Code blocks โ€” fenced with language tag, indented, tilde-fenced, with attributes
  • Lists & tasks โ€” ordered/unordered, nested, tight/loose, GFM task checkboxes
  • Blockquotes โ€” plain, nested, lazy continuation
  • Math โ€” inline $โ€ฆ$, block $$โ€ฆ$$ and \[โ€ฆ\]
  • Footnotes โ€” references and multi-paragraph definitions
  • Definition lists โ€” Pandoc-style
  • HTML blocks โ€” <div>, <details>, <kbd>, comments, entities
  • Link references โ€” [label]: url "title", reference-style links and images
  • Autolinks โ€” angle-bracket URLs, GFM bare URLs, email addresses
  • GFM extras โ€” @mentions, #issues, commit SHA autolinks, :emoji: shortcodes
  • Obsidian โ€” [[wiki links]], [[Page|alias]], [[Page#header]], [[Page#^block]], ![[embeds]] with sizing

Why docmap?

Before After
"Read this 100k token doc" docmap --type code file.md โ†’ 8 jump targets
Open 20 files to find something docmap . inventory header
Scroll through giant CHANGELOGs --at 2400 โ†’ which section am I in?
Guess what's in each doc Every file has a one-line notable digest
grep for "warning" in callouts --type callout --kind warning

Sister tool

docmap is the documentation companion to codemap:

codemap .   # code structure
docmap .    # doc structure

Together: complete spatial awareness of any repository.

How it works

Markdown: parsed with goldmark (CommonMark + GFM extensions) plus post-passes for math blocks, GFM callouts, Obsidian wiki links, HTML entities, @mentions, #issue refs, commit SHAs, and emoji shortcodes. The result is a typed AST with 40+ node kinds that the renderer compresses into the dense tree view.

PDF: outline/bookmarks and the content-stream lexer come from ledongthuc/pdf; text decoding and layout are docmap's own (parser/pdftext.go). Falls back to per-page structure if no outline exists.

YAML: parsed by yaml.v3 with keys mapped to sections.

No API calls. Just fast, local parsing.

Performance: parsed documents are cached under your user cache directory (~/Library/Caches/docmap/cache/<repo hash>/ on macOS, ~/.cache/docmap/cache/<repo hash>/ on Linux), keyed by absolute path + mtime + size. Nothing is written inside the repo. Set DOCMAP_NO_CACHE=1 to disable. Older versions wrote <repo>/.docmap/cache; delete it if one is left behind.

JSON output

docmap file.md --json emits the full typed AST alongside the legacy sections tree:

{
  "documents": [{
    "filename": "file.md",
    "summary": {
      "callouts": 5, "tables": 4, "code_blocks": 8,
      "tasks": 6, "tasks_checked": 3, "wiki_links": 4
    },
    "sections": [...],
    "nodes": [
      { "kind": "frontmatter", "format": "yaml", "raw": "..." },
      { "kind": "heading", "level": 1, "title": "..." },
      { "kind": "code_block", "language": "python",
        "line_start": 154, "line_end": 156, "code": "..." },
      { "kind": "callout", "variant": "warning",
        "line_start": 228, "line_end": 230 }
    ]
  }]
}

Pipe it into jq, another tool, or hand it to an agent.

Contributing

  1. Fork โ†’ 2. Branch โ†’ 3. Commit โ†’ 4. PR

See CONTRIBUTING.md for details.

License

MIT

Documentation ยถ

The Go Gopher

There is no documentation for this package.

Directories ยถ

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL