drft
A structural integrity checker for linked file systems.
Files link to other files. When a target changes, the files that depend on it may no longer be accurate. drft tracks these dependencies and flags what needs review.
It treats your directory as a graph — files are nodes, links are edges — and validates the structure. drft check catches broken links, cycles, and staleness. drft lock snapshots hashes so it can detect when a dependency changes and flag everything downstream. drft impact <file> tells you what to review when you touch a file.
Each drft.toml declares exactly one graph. Run drft from anywhere inside the directory tree and it walks up to the nearest config. That's the model — everything else is configuration.
Install
Or download a prebuilt binary from GitHub Releases.
The binary is called drft.
Quick start
How it works
drft discovers files matching your include patterns, runs parsers to extract links, and builds a dependency graph. It then validates the graph against rules:
- Broken links — edges to files that don't exist (
unresolved-edge) - Cycles — circular dependencies (
directed-cycle) - Staleness — files changed since last lock, including transitive dependents (
stale) - Isolation — nodes with no connections or disconnected components (
orphan-node,fragmentation)
drft ships with built-in rules covering structural integrity, plus support for custom rules via external commands. All rules default to warn. Override to error for CI enforcement or off to suppress.
Underneath the rules, drft computes structural analyses — degree, centrality, connected components, depth, and more. Rules consume these analyses; you can also query them directly with drft report.
Commands
| Command | What it does |
|---|---|
drft check |
Validate the graph against enabled rules |
drft lock |
Snapshot file hashes to drft.lock for staleness tracking |
drft impact |
Show what depends on given files, sorted by review priority |
drft graph |
Export the dependency graph (JSON Graph Format or DOT) |
drft report |
Query structural analyses directly |
drft parse |
Show raw parser output before graph construction |
drft config show |
Display resolved configuration |
drft init |
Create a default drft.toml |
Most commands support --format json and drft check supports --watch. Run drft --help for the full flag reference.
Configuration
drft.toml in the directory root:
= ["**/*.md"] # which files become nodes (default)
= ["drafts/*"] # also respects .gitignore
[] # built-in parser, no config needed
[]
= "error" # escalate for CI
= "off" # suppress if expected
[] # or use table form for options
= "warn"
= ["README.md"]
Parsers extract links from files. drft includes markdown and YAML frontmatter parsers; you can add custom parsers for any format. See the configuration reference for all options.
LLM integration
All commands support --format json with actionable fix fields in every diagnostic. drft impact is designed for agent workflows — it shows which files to review after an edit, sorted by priority.
This repo dogfoods the pattern with Claude Code hooks. See CLAUDE.md for the agent instructions and .claude/settings.json for the hook configuration.
Docs
The full documentation covers parsers, graph construction, structural analyses, rules, and configuration.
License
MIT