Installone binary
A single Rust binary — no runtime, no daemon. Install from the public GitHub repo, or drop a prebuilt release binary on your PATH.
built by aktagon.com
Keep the markdown your agents retrieve correct, current, and groundable — checked in CI on every commit.
ctxgrd is a CLI linter for the structured markdown your team and your AI both depend on. ADRs, PRDs, runbooks — every .md file with frontmatter and an ID.
Same input, same output, same exit code.
$ ctxgrd init Created ctxgrd.toml $ ctxgrd pack add agents Added pack 'agents' — 5 namespaces, 4 rule families. $ ctxgrd error[core.cross-ref]: cross-reference 'ADR-007' does not resolve to a known document --> docs/adrs/ADR-013.md:14:5 | 14 | Per ADR-007, the rule compiler is pure, so its output is cacheable. | ^^^^^^^ | help: use an existing ID, or mark retired with ~~ADR-007~~ found: 1 error · 0 warnings
Lint your context. · Markdown only. On purpose.
cargo install ctxgrd01 For the context engineer
ctxgrd catches broken references, tangled decision lineage, and duplicate IDs before they reach the model — and fails CI like a type error.
$ ctxgrd error[core.cross-ref]: cross-reference 'ADR-007' does not resolve to a known document --> docs/adrs/ADR-013.md:14:5 | 14 | Superseded by ADR-007, the rule compiler is pure. | ^^^^^^^ deleted in 9d7192b × 1 broken reference · exit 1
02 One contract, two readers
Every command emits --format json, keeps stdout a clean parseable stream, and returns documented exit codes. An agent can drive ctxgrd without screen-scraping — the same way your CI does.
$ ctxgrd lint --format json | jq '.diagnostics[0]' { "rule": "core.cross-ref", "severity": "error", "file": "docs/adrs/ADR-013.md", "line": 14, "message": "'ADR-007' does not resolve" } $ echo $? 1 # branch on it, no text parsing
Every capability
The whole workflow — bootstrap a config, scaffold records, lint, track the pipeline, keep docs fresh — in one command-line tool.
Scaffold ctxgrd.toml and your first namespaces in one command.
Check every claimed doc. Human output, or --format json for agents.
See the decision frontier — what's ready, what's blocked, what's stale.
Drop in reusable namespace bundles — agents, ops, project-docs, gdpr.
Wire ctxgrd into pre-commit, CI, or a Claude stop-hook.
Generate a correctly-structured ADR, PRD, or runbook from a template.
A single Rust binary — no runtime, no daemon. Install from the public GitHub repo, or drop a prebuilt release binary on your PATH.
One command writes a ctxgrd.toml that already passes its own validator, then lists every built-in pack — pick one to get a whole family of document types at once.
Picks the next free ID for the namespace, slugifies the title, and writes the required-heading skeleton. Prints the path so you can pipe it to your editor.
The default command. Walks the tree, lints every claimed document against its type, and points at the line. Exit 1 on errors — drop it straight into CI.
Treats your document types as a dependency DAG and prints one aligned row per stage: namespace, state, doc count, and what it `needs`. The ready set — stages whose parents are all done — renders as `ready:`. Add --format json for agents.
The same per-namespace DAG as diagram source — Mermaid `flowchart LR` or Graphviz DOT, emitted as text (never rendered). Pipe it into a docs build or a PR comment to show the workflow shape and where you are in it.
Pin a document to the commit of the code it documents. When that code moves, the doc is flagged stale — re-verify, then bless it back to green.
A pack is a reusable bundle of namespaces plus the rules they need. Adding one appends its blocks to ctxgrd.toml — it never clobbers what you already have.
Every block `pack add` writes is stamped with the pack version and a content fingerprint — `# pack: <name>@<version> sha:<hash>`. When the pack definition later evolves (a renamed namespace, a new rule), `pack outdated` reports the drift read-only: exit 0 when in sync, exit 1 when a block has fallen behind. Add --format json for agents.
Pull a pack-definition change into your config. Migrate rewrites fingerprint-clean blocks to the pack's current shape and re-stamps them; a block you have hand-edited is left untouched and surfaced as a structured diff to resolve yourself. The change is idempotent and purely structural — it introduces no new diagnostics. Preview with --dry-run, script it with --format json.
Beyond the built-in packs, ctxgrd has room for commercial packs that bundle a specialised document standard. arc42 — the 12 canonical architecture-documentation sections as required headings — is the first. Commercial license, coming soon.
Install a git pre-commit hook in one command — a lint failure aborts the commit. The same binary and exit codes drive your CI gate and editor LSP.
03 See it work
# 052-rule-compiler.md id: ADR-042 # 031-cache-policy.md id: ADR-042 ↳ Two records claim ADR-042. The agent retrieves "ADR-042" and grounds on the wrong one.
error[core.id-unique] ADR-042 declared twice 052-rule-compiler.md, 031-cache-policy.md ✓ fixed — renumber the compiler record to ADR-058. ✓ build green · exit 0 # every ID resolves to one doc
What it checks
Rules ship as packs — each a bundle of namespaces, one per document type. Point ctxgrd at a tree and every file is linted against its type.
ADR, PRD, RFC, BUG doc types plus the TODO state file and the README front door — engineering doc lifecycle with status vocabularies, required headings, and a README that links the entry guide.
AGENTS — the AGENTS.md cross-tool instruction standard (agents.md).
CLAUDE/CLAUDESKILLS/CLAUDEAGENTS — the files proprietary to Claude Code: the CLAUDE.md instruction file, .claude/skills SKILL.md definitions, and .claude/agents subagent definitions.
CODEXSKILLS — OpenAI Codex SKILL.md definitions (.codex/skills).
GEMINI — the GEMINI.md instruction file Gemini CLI reads.
OPENCODEAGENTS — opencode agent definitions (.opencode/agent/*.md), linted via the opencode.frontmatter rule.
SPEC/TASK/PROMPT — ctxgrd's harness-neutral agent-development document pipeline: a SPEC is implemented via TASKs, and reusable PROMPTs are versioned.
RUN (runbooks) and PMR (postmortems) — the incident-management doc lifecycle, grounded in Google's SRE Book.
Security-document lifecycle (THREAT/VULN/RISK/SECREV/DEPAUDIT) plus neutral governance (POLICY/ASSET) — framework-neutral evidence discipline, no certification intent.
GDPR documentary artifacts (ROPA/DPIA/DPA) over the security base — Regulation (EU) 2016/679 Arts. 28/30/35. Paperwork existence/metadata/freshness only, never legal adequacy.
HIPAA Security Rule safeguard register (SAFEGUARD) and Business Associate Agreement register (BAA) over the security base — 45 CFR 164.308/310/312, Security Rule as in force 2026. Paperwork existence/metadata/freshness only, never legal adequacy.
DESIGN.md structural linting — section order and token reference checks
SOUL.md/STYLE.md persona linting — section presence, order, and pairing
GUIDE — end-user documentation typed by the Diátaxis taxonomy (tutorial/how-to/reference/explanation) with a required title, kept discoverable from the README.
The core tool and every built-in pack are free and MIT-licensed, forever. Commercial packs (arc42, GDPR, HIPAA) are optional add-ons.