docs-digest
Skill61 starsChanged 7 days agoMITView on GitHub
Compress a repo's docs and OpenSpec specs into one token-dense, agent-only primer at .claude/graph/DOCS_DIGEST.md — the prose twin of GRAPH_REPORT.md. Use when docs context is too large to load, after substantial docs or spec edits, or when asked to rebuild or refresh the docs digest. Not for producing human-readable documentation.
In this repository16 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- bootstrapSkill
- commitSkill
- dispatchSkill
- evalsSkill
- explain-codeSkill
- exploreSkill
- fix-testsSkill
- graphSkill
- manual-test-planSkill
- reportSkill
- review-artifactsSkill
- review-codeSkill
- settleSkill
- shipSkill
- specSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Run this when: the digest is missing or stale, docs or living specs changed substantially, or the user asks to rebuild it.
- Very specific: line 36
If the index is empty, stop and report that: a repo with no docs/ and no openspec/specs/ has nothing to digest, and inventing one is worse …
- Very specific: line 40
If .claude/graph/DOCS_DIGEST.md exists, compare its frontmatter source_hashes against each files[].sha256 in the index.
- Very specific: line 46
Read .claude/graph/docs-index.json in full.
- Very specific: line 52
Spec coverage: Every openspec/specs/*/spec.md capability gets at least its title and requirement blurbs — the capability map is the single …
- Distinctive: line 53
Breadth over depth: Prefer one section from each of ten documents over ten sections from one.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Produce one agent-only primer that lets a fresh agent understand this repo's documented domain without reading docs/ end to end.
GRAPH_REPORT.md answers what connects to what. This answers what this project means. They are siblings, both under .claude/graph/.
Inputs: docs/** and openspec/specs/**, via the deterministic index.
Output: .claude/graph/DOCS_DIGEST.md, overwritten in place.
Never indexed: openspec/changes/**. Active change artifacts are read directly, not digested.
Run this when: the digest is missing or stale, docs or living specs changed substantially, or the user asks to rebuild it. Do not run it per query — interactive skills should read an existing fresh digest, not regenerate one.
Execution
1. Index (deterministic — no model judgement)
interlock-graph docs-index . --writeWrites .claude/graph/docs-index.json covering docs/ and openspec/specs/, with a sha256 and heading spans per file.
If the index is empty, stop and report that: a repo with no docs/ and no openspec/specs/ has nothing to digest, and inventing one is worse than having none.
2. Staleness check
If .claude/graph/DOCS_DIGEST.md exists, compare its frontmatter source_hashes against each files[].sha256 in the index. All match, and the user didn't force a refresh? Report fresh and stop.
Rebuild when: hashes mismatch, the digest is missing, or the user says rebuild / refresh / force.
3. Selective read — never concatenate the corpus
Read .claude/graph/docs-index.json in full. It is an inventory, not the corpus.
Then read section spans only (offset/limit from each entry's startLine/endLine), highest signal first. Rank the index entries yourself using these signals, in order:
- Entry points. A file whose path or title matches
readme,architecture,overview,getting-started,contributing, oradr— these state intent and structure. - Inbound references. Files linked to most often from other indexed files. The index records outbound links; invert them. A doc everything points at is load-bearing.
- Spec coverage. Every
openspec/specs/*/spec.mdcapability gets at least its title and requirement blurbs — the capability map is the single most useful thing in the digest. - Breadth over depth. Prefer one section from each of ten documents over ten sections from one. You are building a map, not a summary.
Drop first under token pressure: long analysis or research write-ups, changelogs, meeting notes, anything whose blurb already conveys the point, and peripheral spec capabilities. For those, use the index blurb instead of reading a span.
Rank what the repo actually contains. Do not assume any particular filename exists.
Forbidden: find docs -exec cat, reading every docs/**/*.md or openspec/specs/**/*.md end to end, reading anything under openspec/changes/, and writing output anywhere under docs/ or openspec/.
4. Write the digest
Overwrite .claude/graph/DOCS_DIGEST.md with exactly this contract:
---
audience: agent-only
target_tokens: 2500
generated_at: <ISO-8601>
source_hashes:
<path>: <sha256>
# one entry per indexed file
---
# docs-digest
## map
- <short-key> → <path>
## facts
- <dense telegraphic facts; ;-joined clauses fine>
## workflows
- <agent-relevant workflows and constraints>
## specs
- <capability> → key requirements / constraints (telegraphic, pointer-heavy)
## pointers
- <path>#<heading> Lstart-LendOmit ## specs entirely when the index contains no openspec/specs/ files.
Style — this is read by agents, not people. Telegraphic. Abbreviations fine. Lists and →. No tutorial tone, no narrative padding, no worked examples. Prefer a pointer over a paraphrase whenever the reader could drill down with interlock-graph context or a Read span.
Budgets: soft cap ~2500 tokens (ceil(chars/4)), hard stop ~3200. Drop lowest-priority content first. Never state a fact that isn't in the index or a span you actually read.
5. Report (≤10 lines)
Output path, token estimate, file count split by docs/ vs openspec/specs/, fresh-vs-rebuilt, and a reminder that humans should keep reading docs/ — this artifact is not for them.
Relation to the graph skill
| Need | Use |
| Prose bootstrap / domain primer | This digest (DOCS_DIGEST.md) |
| Structural bootstrap | GRAPH_REPORT.md, interlock-graph query |
| Task-specific cited excerpts | interlock-graph context / docs |
| Active change artifacts | Read openspec/changes/<name>/ directly — never this digest |
| TOC and hashes for this skill | interlock-graph docs-index |
Follow ${CLAUDE_PLUGIN_ROOT}/shared/TOOL-ECONOMY.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

