πŸ›‘οΈ DocGuard

MCP serverDev tools

Docguard lets your AI catch documentation drift, which means spotting when docs have fallen out of date, and verify that the claims in those docs still hold up. Every check is deterministic, so the same documents always produce the same result.

Unavailable. This server has no hosted endpoint yet, so Ahel can't serve it.

Add to setup to save this item as a reference. Ahel cannot run it, and signing in will not install it.

What your AI can do with it

  • Guard documentation against drift
  • Score how much documentation has drifted
  • Explain what the drift checks found
  • Verify the claims your documentation makes
  • Diagnose documentation problems

Getting started

  1. Save this item in Your setup as a reference.
  2. Read the source or reference documentation for its setup requirements. Saving it here does not connect it to your AI.
  3. Check this page for availability before trying to install it through Ahel.

From the project's README

As published by raccioly/docguard in README.md.

English Β· PortuguΓͺs (BR) Β· EspaΓ±ol

The enforcement layer for Spec-Driven Development. Validate. Score. Enforce. Ship documentation that AI agents can actually use.


✨ See what DocGuard catches in 30 seconds β€” no install, no setup:

npx docguard-cli demo

Runs against a baked-in sample project with intentional drift and shows you the findings + a clear path to fixing them.


Table of Contents

  • What is DocGuard?
  • Why DocGuard?
  • Quick Start
  • Spec Kit Integration
  • Usage
  • Validators
  • Reading a finding
  • Templates
  • AI Agent Support
  • Slash Commands
  • Examples
  • Testing
  • Enterprise Adoption
  • CI/CD Integration
  • What's New
  • File Structure
  • Configuration
  • Research Credits

What is DocGuard?

DocGuard enforces Canonical-Driven Development (CDD) β€” a methodology where documentation is the source of truth, not an afterthought. AI writes the docs, DocGuard validates them.

Traditional DevelopmentCanonical-Driven Development
Code first, docs maybeDocs first, code conforms
Docs rot silentlyDrift is tracked and enforced
Docs are optionalDocs are required and validated
One AI agent, one contextAny agent, shared context via canonical docs

DocGuard is an official GitHub Spec Kit community extension. It validates the artifacts that Spec Kit creates, ensuring your specs stay high-quality throughout the development lifecycle.

🧭 How it works (8-page brief) Β· πŸ“– Philosophy Β· πŸ“‹ CDD Standard Β· βš–οΈ Comparisons Β· πŸ”¬ Validation Β· πŸ—ΊοΈ Roadmap

Architecture

graph TD
    CLI["CLI Entry<br/>docguard.mjs"] --> Commands["Commands (23)"]
    Commands --> guard["guard"]
    Commands --> generate["generate"]
    Commands --> score["score"]
    Commands --> diagnose["diagnose"]
    Commands --> setup["setup wizard"]
    Commands --> other["diff Β· init Β· fix Β· trace Β· impact Β· sync Β· reconcile Β· retire Β· specs<br/>explain Β· memory Β· upgrade Β· agents Β· hooks Β· badge Β· ci Β· watch"]

    guard --> Validators["Validators (29)"]
    generate --> Scanners["Scanners (4)<br/>routes Β· schemas Β· doc-tools Β· speckit"]
    score --> Scoring["Weighted Scoring<br/>8 categories"]
    diagnose --> Validators
    diagnose --> AIPrompts["AI-Ready<br/>Fix Prompts"]

    Validators --> Output["Output"]
    Scanners --> Output
    Scoring --> Output
    Output --> Terminal["Terminal"]
    Output --> JSON["JSON"]
    Output --> Badge["Badge"]

    style CLI fill:#2d5016,color:#fff
    style Validators fill:#1a3a5c,color:#fff
    style Scanners fill:#1a3a5c,color:#fff
    style Output fill:#5c3a1a,color:#fff

Distribution: Node.js core (npm) Β· Python wrapper (PyPI) Β· GitHub Action (action.yml) Β· Spec Kit Extension (ZIP)


Why DocGuard?

DocGuard checks declared documentation facts against repository evidence and gives agents structured repair tasks. Deterministic checks cover supported facts, references, and generated sections. Human-authored requirements and architectural decisions retain their authority when implementation diverges.

A guard result describes the checks performed. The CDD grade measures structural maturity. Exact declarations in .docguard-evidence.json can verify selected statements against current local evidence; every other statement remains unverified. Coverage and unresolved claims remain visible, so teams can choose an appropriate enforcement policy.

Research motivates evaluation of this approach. A 2026 study found that repository context files did not generally improve task success and increased inference cost in its evaluated settings. It also found agents generally followed the instructions. These results support testing concise, relevant context and measuring actual task outcomes; they do not establish DocGuard's effectiveness. Evaluating AGENTS.md, revised June 2026.

The current roadmap prioritizes accurate detection, reproducible evidence, document lifecycle management, and contributor-supplied regression cases. Released plans and superseded specifications are removed from active AI context and remain recoverable from Git.


⚑ Quick Start

Package naming: this repo is raccioly/docguard; the published package is docguard-cli on both npm and PyPI; the installed command is docguard. Same project β€” the -cli suffix is just the registry name. The package runs no install scripts, so npm i -g docguard-cli --ignore-scripts is equivalent.

Node.js (npm)

# No install needed β€” run directly
npx docguard-cli diagnose

# Or install globally
npm i -g docguard-cli
docguard diagnose

Python (PyPI)

pip install docguard-cli
docguard diagnose

Note: The Python package is a thin wrapper that delegates to npx. Node.js 18+ is required on the system.

Docker (MCP server)

The MCP server ships as a container image on GHCR β€” no Node.js install required. Public image, so no authentication is needed to pull it:

# Run the MCP server against the current directory
docker run -i --rm -v "$PWD":/workspace ghcr.io/raccioly/docguard:latest

The entrypoint is the stdio MCP transport: stdout is the JSON-RPC channel, so don't pipe anything else into it. Mount the project you want inspected at /workspace and pass {"projectDir": "/workspace"} in tool calls (or rely on the default working directory).

Pin a version rather than tracking latest in CI:

docker run -i --rm -v "$PWD":/workspace ghcr.io/raccioly/docguard:0.34.9

The server is read-only β€” it never writes to the mounted project.

More ways to integrate

  • pre-commit β€” changed-only guard on every commit:
    repos:
      - repo: https://github.com/raccioly/docguard
        rev: v0.29.0
        hooks: [{ id: docguard-guard }]   # docguard-guard-full for pre-push
    
  • MCP (Claude, Cursor, any MCP client) β€” claude mcp add docguard -- npx -y docguard-cli mcp; 5 read-only tools (guard, score, explain, verify-claims, diagnose). Registry manifest ships in-repo (server.json, Smithery-ready).
  • GitLab CI β€” component staged at templates/ci/gitlab-component.yml (guard/score/ci job with a SARIF artifact).
  • Homebrew β€” brew install raccioly/tap/docguard (formula in packaging/homebrew/).

Core Workflow

# 1. Initialize docs for your project
npx docguard-cli init

# 2. Or reverse-engineer docs from existing code
npx docguard-cli generate

# 3. AI diagnoses issues and generates fix prompts
npx docguard-cli diagnose

# 4. Validate β€” use as CI gate
npx docguard-cli guard

# 5. Check maturity score
npx docguard-cli score

The AI Loop

diagnose  β†’  AI reads prompts  β†’  AI fixes docs  β†’  guard verifies
   ↑                                                       ↓
   └───────────────── issues found? β†β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

diagnose is the primary command. It runs all validators, maps every failure to an AI-actionable fix prompt, and outputs a remediation plan. Your AI agent runs it, fixes the docs, and runs guard to verify.

Mechanical vs. agent fixes

DocGuard splits drift into two kinds and is explicit about which is which:

KindExampleHow it's fixed
Mechanical (deterministic)An endpoint documented in API-REFERENCE.md that the OpenAPI spec confirms is gonedocguard fix --write deletes the row + detail block itself β€” no AI
Agent (needs judgment)Rewriting an X-Ray prose section as CloudWatch; writing a new endpoint's request/responseRouted to an AI agent via diagnose / fix --doc prompts

docguard fix --write only touches docs marked <!-- docguard:generated true --> (override with --force), is idempotent, and prints exactly what changed. It never rewrites prose β€” that stays with the agent.

Continuous documentation workflow

guard ──▢ fix --write (mechanical, auto) ──▢ guard ──▢ diagnose (agent prompts for the rest)
  • CI / pre-commit: docguard hooks --type pre-commit --auto-fix installs a hook that applies mechanical fixes, re-stages the docs, then runs guard; anything left is surfaced as agent prompts.
  • Agent-driven: docguard diagnose --auto scaffolds missing docs and applies mechanical fixes, then emits prompts for the content rewrites that remain.
  • JSON for automation: guard/diagnose --format json include a mechanicalFixes array and tag each issue mechanical vs agent, so an agent can apply or delegate precisely.

🌱 Spec Kit Integration

DocGuard is a community extension for GitHub's Spec Kit framework. While Spec Kit focuses on creating specifications (via AI slash commands like /speckit.specify and /speckit.plan), DocGuard focuses on validating their quality.

How They Work Together

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Spec Kit      β”‚          β”‚    DocGuard       β”‚
β”‚                  β”‚          β”‚                   β”‚
β”‚  /speckit.specifyβ”‚ ──────→  β”‚  docguard guard   β”‚
β”‚  Creates specs   β”‚          β”‚  Validates specs  β”‚
β”‚  (AI-driven)     β”‚          β”‚  (automated)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
PhaseToolWhat happens
1. Initializespecify initCreates .specify/ directory and templates
2. Write specs/speckit.specifyAI creates spec.md with FR-IDs, user stories
3. Validatedocguard guardChecks spec quality (mandatory sections, FR/SC IDs)
4. Plan/speckit.planAI creates plan.md with technical context
5. Validatedocguard guardChecks plan quality (sections, structure)
6. Tasks/speckit.tasksAI creates tasks.md with phased breakdown
7. Validatedocguard guardChecks task quality (phases, T-IDs)
8. Implement/speckit.implementAI writes code
9. Enforcedocguard guardFinal quality gate β€” CI/CD

What DocGuard Validates in Spec Kit Projects

  • spec.md β€” Mandatory sections (User Scenarios, Requirements, Success Criteria), FR-xxx IDs, SC-xxx IDs
  • plan.md β€” Summary, Technical Context, Project Structure sections
  • tasks.md β€” Phased task breakdown (Phase 1, 2, 3+), T-xxx task IDs
  • constitution.md β€” Detected at .specify/memory/constitution.md or project root
  • Requirement traceability β€” FR, SC, NFR, US, AC, UC, SYS, ARCH, MOD, T IDs

Installing as a Spec Kit Extension

specify extension add docguard

This installs DocGuard's slash commands (/docguard.init, /docguard.guard, /docguard.review, /docguard.fix, /docguard.update) into your AI agent's command palette.


Usage

DocGuard ships 23 commands (the "Daily 5" + 18 situational tools, including lifecycle reconciliation, retirement and spec tracking, the zero-install demo, the mcp server, and the ci pipeline gate). Six additional one-shot scaffolders are accessed via docguard init --with <name>. Legacy command forms remain compatible until v1.0 and print their replacements.

The Daily 5 β€” what you'll reach for 95% of the time:

CommandWhat It Does
initBootstrap a project (--wizard for interactive Β· --with <name> for scaffolders)
guardValidate against canonical docs β€” 29 validators
diffShow gaps between docs and code (--since <ref> for impact mode)
syncRefresh code-truth doc sections β€” keeps memory always up to date
scoreStructural CDD maturity score (0-100; not a guard verdict; --diff for delta between refs)

Tools (situational, but day-to-day useful):

CommandPurpose
demoZero-install showcase β€” runs guard against a baked-in drifting fixture (npx docguard-cli demo)
diagnoseAI orchestrator β€” guard β†’ emit fix prompts in one command
fixGenerate AI fix instructions for specific docs (--doc <name> --format prompt)
fix --writeApply deterministic fixes (no AI β€” version bumps, counts, anchors, sections)
fix --historyAudit log of every mechanical fix applied (from .docguard/fixed.json)
generateReverse-engineer docs from existing codebase (--plan for AI scan) β€” includes auto-generated Mermaid ER diagrams from your detected schemas (Prisma/Drizzle/TypeORM/Sequelize/Django/Rails) in DATA-MODEL.md
agentOne-shot agent task graph, or a bounded current-evidence packet for one task (--task <text>, --format json)
explain <warning|CODE>Paste any warning β€” or a finding code like SEC001 β€” to get the validator's docstring, fix path, and how to suppress
verify --evidenceEvaluate strict statement-to-source declarations for typed JSON values, bounded collection counts, saved oasdiff JSON, and saved Buf JSON Lines. Results distinguish scoped verification, contradiction, stale inputs, inconclusive evidence, and unsupported formats.
verify --semanticExtract documented numbers/limits/enums (retention days, rate limits, GSI/role counts, status enums) as a task list for an agent to check against code β€” the semantic-drift class regex/AST can't see
verify --instructionsAudit AGENTS.md/CLAUDE.md themselves for drift: duplicate rules, never-vs-always contradictions, stale file pointers, unknown commands β€” plus clustered rule pairs as agent judgment tasks
feedbackReview any finding or a synthetic false-positive/false-negative/unsupported fixture; verify its opposite control, reduce it deterministically, search open and closed duplicates, and optionally emit a test-only contribution. Nothing is submitted automatically.
retireFind completed or superseded planning material (--plan/--check; --fail-on-warning gates advisory candidates) and explicitly remove clean tracked documentation from active AI context. .docguard-archive.json records recovery metadata and retired requirement identities, and --retention-ref proves the source revision remains reachable. This is separate from the Spec Kit Archive extension, which consolidates feature documents.
reconcileBuild a read-only code↔spec review graph since a Git ref. Classifies mechanical facts, approved intent, decisions, unrelated changes, and unsupported evidence; --write applies only mechanical generated-section refreshes.
specsMaintain the versioned spec registry, preflight new specs, and apply evidence-gated completion transactions with bounded outcomes and active-context regeneration. Verified living specs can record later reviewed maintenance without reopening or duplicating the specification.
specs --check / specs --writeValidate or refresh .docguard-specs.json, the byte-stable index of immutable spec IDs, reviewed lifecycle/lineage/scope, artifact digests, task state, explicitly scoped test evidence, and archive tombstones. Refreshes preserve the reviewed block.
specs preflight [--path <spec>]Before specification, print current spec lifecycle and evidence. Before planning, check the generated draft for structural blockers and report semantic overlap as review-only evidence.
mcpMCP server β€” exposes guard/score/explain/verify/report/diagnose as native tools for Claude, Cursor, and any MCP client. Stdio: claude mcp add docguard -- npx docguard-cli mcp. Team-shared HTTP: docguard mcp --transport http --port 8585 (loopback by default; non-loopback binds require --api-key)
reportCompliance-evidence bundle for audits β€” combined readiness, guard verdict, structural maturity, ALCOA+ attributes, and fix history, stamped with git commit and a tamper-evident sha256 integrity hash (--format json, --out <file>). Evidence, not a gate: always exits 0
ciPipeline gate: guard + structural maturity in one command with READY/ATTENTION/BLOCKED assessment β€” never scaffolds or touches source; its only write is its own .docguard/history.jsonl (opt out: --no-history). --threshold <n> fails below a score, --fail-on-warning for strict mode, --format json for parsers
score --trendScore trajectory from recorded ci runs β€” sparkline, delta, and the last 10 runs with commit stamps
memoryPer-domain accuracy headline (endpoints / entities / env / tech)
memory --diffDrill into which specific claims don't match code
memory --packWrite .docguard/context-pack.md β€” compact, code-truth-stamped session-start context for AI agents
score --diffDrill into which checks pulled each category down
trace / trace --reverse <file>Requirements traceability β€” forward AND reverse
trace --featuresPer-feature spec-adherence scores (requirement coverage, task completion, task evidence, artifacts) β€” worst-first with fix hints
upgrade [--apply] [--pr]Check + migrate .docguard.json schema; --pr opens a PR
watchLive mode: re-run guard on file changes

init --with <name> scaffolders β€” picked at init time:

ScaffolderWhat It Generates
agentsAGENTS.md, CLAUDE.md, .cursor/rules/, .github/copilot-instructions.md
hooksGit pre-commit / pre-push hooks
ciGitHub Actions / pipeline YAML
badgeShields.io score badges for README
llmsllms.txt (AI-friendly summary)
publishExternal doc-site config (Mintlify) β€” experimental

Run them solo (docguard init --with hooks) or stacked (docguard init --with agents,hooks,badge,ci).

To declare an exact fact, copy templates/evidence-manifest.json to .docguard-evidence.json, point its literal Markdown template at one unique statement, and bind that value to a supported local source. Run docguard verify --evidence --format json before enabling the guard in CI. External compatibility declarations consume saved oasdiff or Buf output and require current SHA-256 identities for every declared repository input.

Deprecation aliases β€” setup Β· agents Β· hooks Β· badge Β· llms Β· publish Β· impact remain compatible until v1.0 with a yellow stderr warning. audit β†’ guard is permanent and silent; ci is a current first-class pipeline command.

CLI Flags

FlagDescriptionCommands
--dir <path>Project directory (default: .); explicit selection suppresses ancestor-root guidanceAll
--verboseShow detailed outputAll
--quiet / -qSuppress banner β€” for hooks, CI loops, scriptsAll
--format jsonMachine-readable output (clean JSON, no ANSI bleed)guard, score, diff, trace, diagnose, memory, impact, explain, verify, reconcile, retire, specs
--format sarifSARIF 2.1.0 output β€” findings as rules/results for GitHub Code Scanning and SARIF dashboardsguard
--format junitJUnit XML output β€” one testcase per validator, for GitLab CI (artifacts:reports:junit), Jenkins, Azure DevOps, CircleCIguard
--update-baselineAdopt DocGuard on a legacy repo without a red day one: freeze today's findings into a committed .docguard.baseline.json; guard/ci then gate only NEW drift. Suppression is always visible ("N pre-existing finding(s) suppressed"), and --no-baseline shows the full pictureguard
--fullGenerate llms-full.txt (full doc bodies inlined) instead of the llms.txt link indexllms
--packWrite .docguard/context-pack.md β€” agent session-start contextmemory
--syncRegenerate the agent-file family (CLAUDE.md, Copilot, Cursor, …) from AGENTS.md; hash-marked, never touches hand-written files without --forceagents
--checkCI gate for the synced agent-file family β€” exit 2 when a variant is staleagents
--forceOverwrite existing files (creates .bak backups)generate, agents, init
--force-redoBypass ping-pong suppression in .docguard/fixed.jsonfix --write
--profile <name>Starter / standard / enterpriseinit
--no-spec-kitSkip auto-init of .specify/ / .agent/ scaffoldinginit
--changed-only [--since <ref>]Pre-commit lite mode (6 fast validators on changed files only)guard
--timingsPer-validator wall-time profile (slowest first)guard
--show-failingShow warnings/errors even when status is PASSguard
--pinRecord running CLI version into .docguard.json (reproducibility)guard
--diffPer-category drill-downscore, memory
--check-onlyExit 1 if behind (for CI)upgrade
--applyActually run the migrationupgrade
--prOpen a PR with the migrationupgrade
--reverse <file>Reverse traceability (code β†’ docs)trace
--no-indirectSkip the reverse-import-graph analysis (docs about modules that import a changed file)impact, diff --since
--prsOpen-PR doc-conflict analysis β€” two PRs impacting the same canonical doc = merge-order risk (needs the gh CLI)impact
--transport http --port --host --api-key --pathServe MCP over Streamable HTTP instead of stdio (team-shared server; loopback-only unless an api-key is set)mcp
--historyShow fix audit logfix

Shortened here. Read the whole README on GitHub.

Signals

GitHub stars
32
Forks
1
Last commit
Oct 2026
Weekly downloads
1k
Advanced
Delivery
docguard MCP server β†’ your Ahel connector (mcp.ahel.ai) β†’ your AI.
Item type
mcp-server
Key
io-github-raccioly-docguard
Source
github.com/raccioly/docguard