Checked on: 2026-10-22.
A code change does not tell you which documents it made wrong. Docstale lists every document whose source files changed since someone last reviewed it.
- You list the source files that each document describes in
docstale.toml. - After you review a document,
docstale stamprecords its sources indocstale.lock. docstale checklists each document whose sources changed since its stamp.
Docstale compares Git object ids. It does not call an LLM or guess what a change means. You commit the lock, so your agent, pre-commit, CI, and teammates all get the same answer.
You need Python 3.11 or newer and Git.
-
Install docstale:
uv tool install git+https://github.com/xiaosq2000/docstale.git
-
Create
docstale.tomlat the repository root. Each line maps a document to the files it describes:[documents] "README.md" = ["src/", "pyproject.toml"] "docs/api.md" = ["src/api/"]
-
Check that these documents are accurate today, then stamp them and commit the lock:
docstale stamp --all git add docstale.toml docstale.lock
-
After you change code, run the check:
docstale check
Its output starts with each document to review and the sources that changed:
Documentation needs review. README.md (changed since 9c1b2e7d41f0) src/client.py -
Read the document, fix it if needed, and stamp it. Stamp it even when nothing needed fixing:
docstale stamp README.md
Editing a document does not count as a review. Only docstale stamp clears it.
To record several reviews at once, pass one or more document paths:
docstale stamp README.md docs/api.mdWhen documents watch other documents, review upstream documents first. Docstale lists them in that order.
Claude Code, Codex, and pi can run docstale when a session starts and before the agent finishes a request. If sources change during the session, docstale asks the agent to review the affected documents. Outside a Git repository, the hooks stay silent.
A reminder does not grant permission to edit files. If your request requires a
read-only response, the agent must only report the affected documents. It must
not edit files or run docstale stamp.
-
Add these hooks to
.claude/settings.jsonor.codex/hooks.json. Keep the settings that are already in the file:{ "hooks": { "SessionStart": [ { "hooks": [ { "type": "command", "command": "docstale hook", "timeout": 30 } ] } ], "Stop": [ { "hooks": [ { "type": "command", "command": "docstale hook", "timeout": 30, "statusMessage": "Checking documentation impact..." } ] } ] } } -
In Codex, open
/hooksand trust the new entry. -
Optional: add the reviewer subagent for your coding agent. It reads the diff and the document, and answers
unaffected,affected, orunsure. It never edits or stamps files.For Claude Code:
mkdir -p .claude/agents curl -o .claude/agents/docstale-reviewer.md https://raw.githubusercontent.com/xiaosq2000/docstale/main/.claude/agents/docstale-reviewer.md
For Codex, use a version that supports native
.codex/agents/*.tomlfiles:mkdir -p .codex/agents curl -o .codex/agents/docstale-reviewer.toml https://raw.githubusercontent.com/xiaosq2000/docstale/main/.codex/agents/docstale-reviewer.toml
To choose another model, edit
modelin the reviewer file. The Claude Code default ishaiku. The Codex defaults are:model = "gpt-6-luna" model_reasoning_effort = "high"
In Codex, set both values to ones your model and account support. Restart Codex after adding or changing the definition. These settings affect only the reviewer, not the main agent or other subagents.
Pi uses an extension instead of JSON hooks. You need pi 1.0.2 or newer and the
docstale command from the quick start.
-
Install the extension:
pi install git:github.com/xiaosq2000/docstale
Add
--localto install it for one project instead of every project. -
Start a new pi session. Alternatively, run
/reloadin the current session.
The extension saves a session baseline and checks before pi finishes a request. If a document needs review, it sends the reminder to the model and requests one continuation. It does not start a reviewer subagent or stamp documents.
The extension runs docstale from PATH. If needed, set DOCSTALE_EXECUTABLE
to the executable's full path before starting pi. The value is one executable
path, not a shell command.
To pause any agent hook in one checkout, run docstale disable. Run
docstale enable to enable the hooks again. Manual checks still run.
To block a commit while a document needs review, add the pre-commit hook:
repos:
- repo: https://github.com/xiaosq2000/docstale
rev: <commit>
hooks:
- id: docstaleStage docstale.lock with the rest of the commit.
To fail CI instead, add this step after the checkout:
- uses: astral-sh/setup-uv@v6
- run: uvx --from git+https://github.com/xiaosq2000/docstale.git docstale checkdocstale check exits 0 when no document needs review, 2 when one does, and
1 when the configuration or Git fails.
| Topic | Page |
|---|---|
Patterns, shared lists, globs, and {dir} |
Configure documents |
| Fingerprints, merges, and JSON output | Check and stamp documents |
| When the hook reminds the agent | Agent hook |
| What the reviewer subagent does | Reviewer subagent |
| Pre-commit and CI details | Pre-commit and CI |
pipx, upgrades, moving from doc-sync, and removal |
Installation guide |
| Development setup and architecture | Contributing |
Docstale is released under the MIT License.