built by aktagon.com

Your ADRs are AI context. Lint them like code.

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.

Lint your context. · Markdown only. On purpose.

MIT cargo install ctxgrd We run it on our own docs, every commit

01 For the context engineer

Context rot fails the build.

  • A cross-reference points at an ADR you deleted.
  • A decision was superseded — but nothing downstream knows.
  • Your agent retrieves it anyway, and ships the wrong pattern.

ctxgrd catches broken references, tangled decision lineage, and duplicate IDs before they reach the model — and fails CI like a type error.

02 One contract, two readers

Built for humans and agents alike.

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.

0  clean1  diagnostics2  config error

03 Every capability

One binary. From install to CI.

init

Scaffold ctxgrd.toml and your first namespaces in one command.

lint

Check every claimed doc. Human output, or --format json for agents.

status

See the decision frontier — what's ready, what's blocked, what's stale.

pack add

Drop in reusable namespace bundles — agents, ops, project-docs, gdpr.

hooks install

Wire ctxgrd into pre-commit, CI, or a Claude stop-hook.

new

Generate a correctly-structured ADR, PRD, or runbook from a template.

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.

Bootstrap a configctxgrd init

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.

Scaffold a recordctxgrd new

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.

Lint the whole treectxgrd

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.

Lint one namespace--namespace / --pack

Point a run at part of the tree. `--namespace ADR` lints the ADRs and skips everything else; `--pack ops` lints every namespace that pack contributed, resolved through the stamps in your own config rather than the pack definition, so it never scopes to something you never adopted. A name the config does not declare exits 2 instead of quietly linting nothing.

Accepted cannot rest on a draftcore.dep-status

A document marked accepted while the decision under it is still a draft records something that has not happened yet. The rule reads `depends_on` and names both halves: a terminal-status document may not depend on a non-terminal one. Settle the dependency, or reopen the dependent until it settles.

Cap the context filecore.file-budget

An instruction file that grows past the model's own limit gets truncated, and the part that falls off the end is not the part you would have chosen. The rule counts characters against a budget — 150,000 by default, Claude's own ceiling — and says how many to cut. Raise `max_chars` per namespace when the size is deliberate.

Zero documents is not a passexpect_min

A source that exits clean without emitting anything produced a run byte-identical to one where every document passed. `[sources.<name>]` now carries a floor: `expect_min`, default 1, and falling under it warns. A namespace whose paths matched only files the walker skipped says so too, rather than counting zero and reporting green. Set `expect_min = 0` for a source that may legitimately emit nothing.

A rule that cannot run says socfg.rule-inert

Some rules only ever lint id-less, path-claimed files - CLAUDE.md, TODO.md, DESIGN.md. Bind one to a namespace that also claims `core.id` and it is silently unreachable: `ctxgrd rules` lists it as active, the config is valid, and the check never executes. The combination is now a config error naming both halves, because a rule you believe is guarding something and is not is worse than no rule at all.

See your work queuectxgrd status

Reads `depends_on` across every document and sorts them into ready, blocked, and settled. A document is ready when everything it depends on is accepted; a blocked row names the dependency holding it up. There is no stage order to declare — the graph is the order. Add --format json for agents.

The queue an agent readsstatus --format json

The readiness census as one row per document: id, namespace, status, whether it can be picked up, and the ids holding it back. Clean stdout, so a router chooses the next piece of work without screen-scraping a report written for a person.

Draw the graphctxgrd status --format mermaid|dot

The same document graph as diagram source — Mermaid `flowchart LR` or Graphviz DOT, emitted as text and never rendered. Pipe it into a docs build or a PR comment to show what is waiting on what.

Read the graph in a browserctxgrd serve

A read-only local view of the governed docs — the namespace index, server-rendered markdown, clickable `depends_on` edges, and the same work queue. It binds loopback only and prints its URL as one JSON line on stdout, so an agent can discover the port it landed on. Logs go to stderr.

The changelog writes itselfctxgrd changelog

Release notes derived from the document graph instead of a file everyone forgets to edit. Each whitelisted document is attributed to the first release tag whose tree marks it terminal, so a shipped section is read back from the tag and cannot drift. `--check` is the CI gate, `--write` regenerates in place, `--format json` feeds an agent.

Keep docs freshctxgrd pin

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.

Adopt a packctxgrd pack

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.

Spot pack driftctxgrd pack outdated

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, or someone edits the block by hand, the fingerprint stops matching and `pack outdated` reports the divergence read-only: exit 0 when in sync, exit 1 when a block has drifted. Add --format json for agents.

Propagate a pack changectxgrd pack migrate

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.

Commercial packsctxgrd pack list --paid

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.

Wire into CIctxgrd hooks

Installs ctxgrd as a numbered fragment under a tracked `.githooks/pre-commit.d/` and points `core.hooksPath` at it, so a sibling linter's gate composes beside it instead of overwriting it. A lint failure aborts the commit. The same binary and exit codes drive your CI gate and editor LSP.

Gate the agent's turnlint --harness claude

Wired as a Claude Code Stop hook, ctxgrd runs the moment the agent tries to finish. An error-severity diagnostic returns a block decision carrying the reason, so the agent repairs the document before handing back. Warnings never block and a clean run is silent. The hook always exits 0 — the verdict travels in the payload, not the exit code.

04 See it work

The error your agent would otherwise have trusted.

Before — ctxgrd off
After — ctxgrd in CI

05 What it checks

Every doc type. Every rule.

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.

Project docs7 namespaces

ADR, PRD, ROADMAP, 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.

Agent context1 namespace

AGENTS — the AGENTS.md cross-tool instruction standard (agents.md).

Claude Code3 namespaces

CLAUDE/CLAUDESKILLS/CLAUDEAGENTS — the files proprietary to Claude Code: the CLAUDE.md instruction file,.claude/skills SKILL.md definitions, and.claude/agents subagent definitions.

OpenAI Codex1 namespace

CODEXSKILLS — OpenAI Codex SKILL.md definitions (.codex/skills).

Gemini CLI1 namespace

GEMINI — the GEMINI.md instruction file Gemini CLI reads.

opencode1 namespace

OPENCODEAGENTS — opencode agent definitions (.opencode/agent/*.md), linted via the opencode.frontmatter rule.

Agent workflow4 namespaces

SPEC/TASK/PROMPT/HANDOFF — ctxgrd's harness-neutral agent-development document pipeline: a SPEC is implemented via TASKs, reusable PROMPTs are versioned, and a HANDOFF carries work to the next session.

Operations2 namespaces

RUN (runbooks) and PMR (postmortems) — the incident-management doc lifecycle, grounded in Google's SRE Book.

Security7 namespaces

Security-document lifecycle (THREAT/VULN/RISK/SECREV/DEPAUDIT) plus neutral governance (POLICY/ASSET) — framework-neutral evidence discipline, no certification intent.

GDPR3 namespaces

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.

HIPAA2 namespaces

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.

SOC 21 namespace

SOC 2 control-to-evidence register (SOC2) over the security base — AICPA Trust Services Criteria (2017, rev. 2022): the mandatory Common Criteria CC1-CC9 plus the optional Availability/Confidentiality/Processing-Integrity/Privacy categories. Paperwork existence/metadata/freshness only, never operating-effectiveness adequacy.

ISO 270011 namespace

ISO 27001 control-to-evidence register (ISO27001) over the security base — ISO/IEC 27001:2022 Annex A: 93 controls across the Organizational/People/Physical/Technological themes. Paperwork existence/metadata/freshness only, never implementation adequacy.

NIST 800-531 namespace

NIST 800-53 control-to-evidence register (NIST80053) over the security base — NIST SP 800-53 Rev 5: the 20 control families (AC-SR), family-level grain. Paperwork existence/metadata/freshness only, never implementation adequacy.

Design system2 namespaces

design — structural linting for the two root design-context files a design agent reads before it works: DESIGN.md (the visual system — how it looks) and PRODUCT.md (the strategy — register, platform, users, purpose, positioning, who/what/why).

Persona2 namespaces

SOUL.md/STYLE.md persona linting — section presence, order, and pairing

Domain-Driven Design2 namespaces

DDD — strategic Domain-Driven Design docs on the dependency graph: BOUNDEDCONTEXT (a model/language boundary with its Ubiquitous Language, aggregates, and domain events) and CONTEXTMAP (one Evans strategic-pattern relationship edge per file, riding depends_on).

C41 namespace

C4 — architecture-diagram docs typed by the C4 model level (context/container/component/code) plus the supplementary deployment/dynamic/landscape views, each declaring its level and carrying a title.

Ccpa2 namespaces

CCPA/CPRA processing register (CCPA) and service-provider agreement register (SPA) over the security base — California Civil Code Title 1.81.5, Cal. Civ. Code §§ 1798.100/1798.140. Paperwork existence/metadata/freshness only, never legal adequacy.

Checklist1 namespace

CHECKLIST — turns a markdown checklist into an auditable, commit-pinned sign-off: every box checked and the sealed state pinned to a real, in-history commit.

Eu Ai Act2 namespaces

EU AI Act obligation register (AIACT) and Art. 27 fundamental rights impact assessment register (FRIA) over the security base — Regulation (EU) 2024/1689. Paperwork existence/metadata/freshness only, never conformity or legal adequacy.

Github4 namespaces

GitHub community-health files — CONTRIBUTING, CODE_OF_CONDUCT, SECURITY, SUPPORT — path-claimed as id-less docs with a warning-severity existence nudge. README stays in project-docs; LICENSE is excluded.

Gitlab2 namespaces

GitLab community-health files — CONTRIBUTING and CHANGELOG — path-claimed as id-less docs with a warning-severity existence nudge. README/LICENSE excluded; CHANGELOG is first-class on GitLab.

Governance1 namespace

DEC — a program/governance decision register (docs/decisions/[0-9]*.md): one id-keyed markdown record per material program decision, carrying the decision, its rationale, cross-cutting impact, and the approving authority. First member of the RAID+ register family.

Guide1 namespace

GUIDE — end-user documentation typed by the Diátaxis taxonomy (tutorial/how-to/reference/explanation) with a required title, kept discoverable from the README.

Intake2 namespaces

Inbound requests from downstream repos — CR (a JSM-Change-shaped, id'd, linted change request) and FEEDBACK (a light id-keyed note record: id/source/date, free-form body, on the HubSpot/Jira fields-over-headings model).

Marketing4 namespaces

marketing — the markdown-documentable marketing-strategy artifacts on the dependency-free side of the CRM line: CAMPAIGN briefs, buyer PERSONAs, POSITIONING, and the ICP, each a structured record grounded in a named framework.

Nis22 namespaces

NIS2 cybersecurity risk-management register (NIS2) and Article 23 incident register (NIS2INC) over the security base — Directive (EU) 2022/2555 Arts. 20, 21(2) and 23. Paperwork existence/metadata/freshness only, never conformance to the statutory reporting clock.

Qa1 namespace

TEST — a pinned Test Completion Report register (docs/tests/TEST-*.md): one id-keyed markdown record per release milestone, carrying the exit-gate verdict, the tree and contract revision it ran against, its outstanding defects, and sign-off. IEEE 829 / ISO-29119-3 completion report.

Research1 namespace

RESEARCH — deep-research reports (docs/research/**) kept evidence-honest: a sources/evidence section is required and a limitations/data-gaps section is nudged, with optional per-genre skeleton routing.

Stripe Integration Web1 namespace

INTSTRIPE — the seven-phase Stripe web-integration checklist: a commit-pinned sign-off whose phases and @stripe.* anchors ctxgrd enumerates and wrkgrd's anchor-coverage proves.

Lint your context like you lint your code.

The core tool and every built-in pack are free and MIT-licensed, forever. Commercial packs (arc42, GDPR, HIPAA) are optional add-ons.