fairbooks-docs-drift
v0.2.0
Published
Fairbooks Docs Drift: an MCP agent that finds where a package's README, docs and SKILL.md no longer match its tool list, input schemas, OpenAPI spec, CHANGELOG and package.json, runs as a CI gate with SARIF output, and drafts low-risk fixes as copies. Pub
Maintainers
Readme
Fairbooks Docs Drift (fairbooks-docs-drift)
Finds where a package's README, docs and skills no longer match its tools, input schemas, OpenAPI spec, CHANGELOG and package.json, runs as a CI gate with SARIF output, and drafts low-risk fixes as copies. Publishing docs is one human click. Never overwrites docs.
Part of Fairbooks Machine domain agents: one agent, one process, nothing outside its lane. Built on fairbooks-core. MIT, Node ≥ 20, runs on your machine, no account or API key needed.
What it does
Point Fairbooks Docs Drift at a package folder and, ideally, its tool list: an MCP tools/list result, fairbooks_info output, or a plain array. It reads README.md, SKILL.md, docs/ and skills/, and reports drift with the file and line:
- tools: tools in the code that no doc mentions; tools in the docs (tables, backticks,
callexamples) that no longer exist, with the nearest real name when one is one or two letters off; allow/ask/block labels that differ from the tool list; one-click tools whose docs do not say so; "N tools" counts that are wrong; - examples:
call <tool> '{...}'examples with invalid JSON, parameters the input schema does not have, or required parameters left out;npm runscripts that do not exist;npxfor a package with no bin; - package.json: version pins (
[email protected]), "Node ≥ N" and the License section that differ from package.json; - links: relative links to missing files and
#anchorsthat match no heading (GitHub-style slugs); - skills:
SKILL.mdwithout frontmatter, without a description, or with a name that is not lowercase-hyphenated; - OpenAPI (pass
openapi, a spec as JSON): endpoints in the docs (GET /notes/{id},curl -X DELETE https://…/notes/1) that the spec does not have or has with another method, spec operations no doc mentions, and deprecated operations documented without saying so. The server base path is stripped and{id}matches a concrete/notes/42; - changelog: a
CHANGELOG.mdwith no entry for the package.json version, entries newer than it, or two entries for one version (require_changelogalso flags a package with none).
For CI, docsdrift_ci writes fairbooks-docs-drift.sarif (SARIF 2.1.0 for code scanning) and drift.json, and decides pass or fail from fail_on (error by default, or warning, any, none). Give it an earlier drift.json as baseline to see new and fixed findings, and new_only to fail on new drift only; fingerprints ignore line numbers, so moving text does not count as new. The fairbooks-docs-drift ci command exits 1 when the gate fails. Settings can live in a config file checked against the docs_config schema (fairbooks-docs-drift validate-config docs_config docs.config.json).
With approval it writes fixed copies for mechanical fixes only (version pins and unambiguous tool-name typos), within caps (max_fixes, default 20; max_per_file, default 10). Everything else is listed for a person. Because only copies are written, there is nothing to roll back.
Install
npm install -g fairbooks-docs-drift
fairbooks-docs-drift demo # runs on the bundled fictional sample dataAs an MCP server
Claude Code
claude mcp add fairbooks-docs-drift -- npx -y [email protected] mcp --root /path/to/your/exportsCursor / Claude Desktop / VS Code / Windsurf
{ "mcpServers": { "fairbooks-docs-drift": { "command": "npx", "args": ["-y", "[email protected]", "mcp", "--root", "/path/to/your/exports"] } } }--root is the only folder the tools can read or write. Paths outside it are refused.
Tools
| Tool | Policy | What it does |
|---|---|---|
| docsdrift_check | allow | Drift findings with severity, file and line; reads files only |
| docsdrift_write_report | allow | Write docs-drift.md and drift.csv to fairbooks-out/docs |
| docsdrift_ci | allow | CI gate: write fairbooks-docs-drift.sarif and drift.json, pass or fail by fail_on, compare with a baseline |
| docsdrift_draft_fixes | ask (Auto-eligible) | Write fixed copies to fairbooks-out/docs/proposed within caps, plus changes.md and proposal.json (your docs untouched) |
| docsdrift_request_publish | ask · one-click | After a named human approves, record the proposal (bound to its hash; originals must be unchanged) for whoever publishes |
| write_docs | block | Listed so agents see the refusal. Fairbooks Docs Drift never overwrites docs in place. |
| git_push | block | Listed so agents see the refusal. Fairbooks Docs Drift never commits, pushes or publishes. |
Any other tool name is blocked. fairbooks_info shows the pinned model, mode, caps and every decision.
Modes
- Review (
--mode review): read and report only. - Assist (default): the policy above.
askreturns anapproval_id; a person approves once withfairbooks-docs-drift approve <id> --as "Your Name". - Auto (
--mode auto --auto <tool,...>): off by default, opt-in per action, with step/spend caps (--max-steps,--max-spend) and a kill switch (fairbooks-docs-drift kill).
The check and docsdrift_ci can run on every push, and docsdrift_draft_fixes can go on Auto within its caps. Publishing docs is a production_deploy: it stays one-click even in Auto, and --auto docsdrift_request_publish is refused. The approval is tied to the proposal's hash, every proposed file is re-hashed, and the original docs must not have changed since the proposal. Overwriting and pushing stay blocked.
Get a tool list for any MCP server by saving its tools/list response (add a prompts array from prompts/list so prompt names are not mistaken for tools), or for a Fairbooks pack with <pack> mcp and a tools/list request.
Go-live, revoking access, deleting personal data, moving money, legally binding sends and production deploys always need a person's click, in every Fairbooks pack.
GitHub Action
action.yml in this folder is a composite action that runs fairbooks-docs-drift ci with npx, writes the SARIF and fails the job on drift. examples/docs-drift.yml is a workflow that saves an MCP server's tool list, runs the action and uploads the SARIF to code scanning:
- uses: fpavia111-creator/fairbooks-agents/packages/fairbooks-docs-drift@main
id: docs
with:
pack: .
tools: tools.json
fail-on: error
- uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: ${{ steps.docs.outputs.sarif }}Inputs: pack, tools, openapi, config, fail-on, baseline, new-only, require-changelog, out-dir, version. The action only reads the repository and writes into out-dir; it never commits or pushes.
CLI
fairbooks-docs-drift tools
fairbooks-docs-drift call docsdrift_check '{"pack":".","tools":"tools.json"}'
fairbooks-docs-drift call docsdrift_check '{"pack":".","openapi":"openapi.json","require_changelog":true}'
fairbooks-docs-drift call docsdrift_draft_fixes '{"pack":".","tools":"tools.json","max_fixes":5}'
fairbooks-docs-drift ci --pack . --tools tools.json --fail-on error # exit 1 on drift
fairbooks-docs-drift ci --pack . --baseline old/drift.json --new-only # fail on new drift only
fairbooks-docs-drift eval # private evals on the bundled fixturesMCP prompt
docsdrift_drift_review (arguments: pack, optional tools and openapi) walks a host model through getting a tool list, checking, reporting, drafting fixes and the one-click publish a named person approves.
Every call is written to .fairbooks/audit.jsonl (hash-chained JSONL; arguments stored as a hash). Read it with fairbooks-audit-evidence or npx -y -p fairbooks-core fairbooks-verify-log .fairbooks/audit.jsonl.
What it is not
- It does not judge whether the prose is right or complete. "No drift found" means these checks passed, not that the docs are complete.
- It does not run your package, so behaviour that differs from the docs without a name, label, schema or version changing is not caught.
- It never rewrites prose, tables or examples, and never overwrites a file in place.
- OpenAPI specs must be JSON (there is no YAML parser), and endpoints are found by
METHOD /pathtext andcurl -Xlines, so an endpoint described only in prose is not seen. It does not check request or response shapes. - The changelog check looks for a heading with the version; it does not judge what the notes say.
- Not fully autonomous: anything risky waits for a named person.
Data
Everything runs locally on files you choose. No network calls, no telemetry. The bundled fixtures are a fictional pack.
License
MIT © 2026 Kurt Francisco. Source: https://github.com/fpavia111-creator/fairbooks-agents/tree/master/packages/fairbooks-docs-drift
