Documentation freshness ledger for coding-agent workflows
Project description
Documentledger
Documentledger is a documentation freshness ledger for coding-agent workflows. It records repository scans, maps documentation sections to source units, reports affected documentation when linked source units change or disappear, and renders update context that tells an agent exactly which sections to inspect and rewrite.
It is designed to keep documentation honest: documentation sections are linked to the source units they describe, and a scan marks those sections affected when their tracked source units change.
Status
Alpha. Documentledger is usable for internal documentation maintenance and is approaching a first release. The CLI surface, storage schema, and link model are stable enough to rely on, but breaking changes are still possible before 1.0.
Install
pip install -e .
This exposes the docledger console script. Documentledger requires Python 3.10 or newer.
ledgercore>=0.2is an active dependency. Documentledger uses it for YAML storage, atomic writes, config discovery, path validation, scan/doc identity helpers, and SHA-256 hashing helpers.
Quickstart
From the root of a repository:
docledger init
docledger --json status
docledger --json scan
docledger links add-section --doc docs/usage.md --section usage-cli --source-unit py:function:src/cli.py::main --coverage cli-command --impact behavior --reason "Documents the CLI workflow."
docledger --json docs affected
docledger docs build-context --affected --print
After updating and validating an affected section, mark it fresh:
docledger mark-fresh --doc docs/usage.md --section usage-cli --reason "Docs updated after scan version 1."
Workflow
- Initialize.
docledger initcreatesdocumentledger.tomland a.documentledger/storage directory. - Scan.
docledger scanhashes source and documentation files under the configured roots, indexes Python source units, and rewrites.documentledger/scan.yamlonly when source or doc hashes change. Unchanged scans reuse the latest scan version and reportunchanged. - Link.
docledger links add-section --doc DOC --section SECTION --source-unit SOURCE_UNITconnects a documentation section to a source unit with coverage, impact, reason, and tracked hashes.links add --doc DOC --source SOURCEremains available as a broad-file fallback. - Find affected sections.
docledger docs affectedlists documentation sections whose linked source units changed or disappeared. - Build update context.
docledger docs build-context --affected --printrenders the affected sections, linked changed source units, source snippets, unlinked changed sources, and configured validation commands. - Update and validate. Rewrite only the affected sections by default, then run the validation commands.
- Mark fresh.
docledger mark-fresh --doc DOC --section SECTION --reason "..."refreshes tracked source-unit hashes and section hashes in a versioned doc record. Unlinked docs are rejected by default; pass--allow-unlinkedonly for intentionally unlinked docs.
State model
Documentledger state is intentionally timestamp-free.
.documentledger/storage.yamlstoresschema_version,project_uuid, andstate_version..documentledger/scan.yamlstores the currentdocumentledger.scan.v4baseline with source/doc hashes, source-unit inventory, unit deltas, affected-section projections, stale-doc compatibility output, unmapped changed units, and monotonic scanversion..documentledger/docs/*.yamlstoresdocumentledger.doc_record.v4records with section links, tracked source-unit hashes, derived linked sources, freshness hashes,last_fresh_scan_version, notes, and integerversionvalues..documentledger/rendered/latest-context.mdis derived output and should stay ignored.
Freshness is hash-based only. Documentledger does not persist or compare legacy timestamp fields, mtime, or other date-based freshness markers.
Bootstrapping a new repository
A fresh repository has no links yet, so the first scan reports no stale docs. To drive an initial documentation pass, include sources that have no documentation link:
docledger init
docledger scan
docledger docs build-context --all --include-unlinked --print
The bootstrap section lists every source file that has no linked documentation. Create docs for them, add links with docledger links add-section or the broad-file docledger links add fallback, scan again, validate, then mark the docs fresh.
Commands
| Command | Purpose |
|---|---|
docledger init |
Create config and storage metadata. |
docledger status |
Report workspace state: uninitialized, config_only, or initialized. |
docledger doctor |
Validate storage schema, doc records, and link integrity. |
docledger scan |
Record a new scan and compute changes. |
docledger sources list / show |
Inspect source-unit ids for precise section links. |
docledger links list / add-section / remove-section / import-map |
Manage section-to-source-unit links. |
docledger links audit |
Check section links for missing sections, missing source units, and duplicate edges. |
docledger docs list / sections / affected / stale / build-context |
Inspect docs and render update context. |
docledger mark-fresh |
Record that a section or doc matches the latest scan. |
Pass --json before any command to emit a stable JSON envelope. Without --json, commands print human-readable output, and errors print concise Error: messages (use --json for machine-readable error envelopes).
Limitations
- Freshness is driven by source-unit hash changes routed through explicit links. Docs without links never become affected from source changes.
mark-freshis rejected for unlinked docs by default to prevent silently tracking a doc that can never become affected. Use--allow-unlinkedfor intentionally unlinked docs.- Source and documentation roots are configured statically in
documentledger.toml; there is no per-path ignore configuration yet.
Development
python -m pytest -q
python -m compileall -q documentledger tests
Documentation is built with Sphinx:
bash docs/build.sh
License
Apache-2.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file documentledger-0.1.0.tar.gz.
File metadata
- Download URL: documentledger-0.1.0.tar.gz
- Upload date:
- Size: 111.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e272e82ce9e0df983e05384f8afd0ac7a1a5f4e4c5f93825b0bec20268c0b2fa
|
|
| MD5 |
73e8d6ced2dc7fd71c97b5981cb8eb79
|
|
| BLAKE2b-256 |
727a422297f794a40a77b46faf70e49417532b05bf28e38049165ea901d9ea7f
|
File details
Details for the file documentledger-0.1.0-py3-none-any.whl.
File metadata
- Download URL: documentledger-0.1.0-py3-none-any.whl
- Upload date:
- Size: 35.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff959af04e05224fb52ba3ab79ba44790035e9430f2305ab03468c9ed8920367
|
|
| MD5 |
6574673a5a4c28ea9d6aa4652c24af41
|
|
| BLAKE2b-256 |
09ca3ae076536114e5eceb5059b4a0512a6d991914fabcac950c1fb8a4dda06e
|