Stale Task Lists
TODO.md says “Implement auth”
Reality: Auth shipped 3 months ago
Zero-Drift Governance is the practice of continuously validating that your documentation matches your codebase reality. No more outdated ADRs, broken links, or forgotten task lists.
Traditional projects suffer from documentation drift: docs become stale as code evolves.
Stale Task Lists
TODO.md says “Implement auth”
Reality: Auth shipped 3 months ago
Outdated Architecture
ARCHITECTURE.md says “Uses MongoDB”
Reality: Migrated to PostgreSQL last quarter
Broken Links
Docs link to src/utils/auth.ts
Reality: File moved to src/middleware/auth.ts
Violated Size Limits
NEXT-TASKS.md should be under 200 lines
Reality: Grew to 450 lines over 6 months
The problem: AI agents trust documentation. When docs drift, AI hallucinates or makes bad decisions.
Zero-Drift means documentation is validated automatically and continuously:
cortex-tms validate --strictOutput:
✓ NEXT-TASKS.md exists and is well-formed✓ File size under limit (185/200 lines)✓ All internal links resolve✓ No placeholder text ([Project Name] found and fixed)✓ copilot-instructions.md follows schema✓ All ADRs follow naming convention✓ No dead links in documentation
Project health: EXCELLENTRule: Required files must exist in expected locations.
cortex-tms validateChecks:
NEXT-TASKS.md existsCLAUDE.md exists.github/copilot-instructions.md existsdocs/core/ directory exists✗ NEXT-TASKS.md not found✗ docs/core/PATTERNS.md not found
Recommendations:- Run `cortex-tms init` to scaffold missing files- Check that you're in the project root directoryRule: HOT files must respect size limits to preserve AI context budget.
Validated limits:
| File | Max Lines | Current | Status |
|---|---|---|---|
NEXT-TASKS.md | 200 | 185 | ✓ OK |
.github/copilot-instructions.md | 100 | 95 | ✓ OK |
Violation example:
✗ NEXT-TASKS.md exceeds limit (245/200 lines)
Recommendations:- Archive completed tasks to docs/archive/sprint-YYYY-MM.md- Move backlog items to FUTURE-ENHANCEMENTS.md- Break large tasks into smaller incrementsRule: Documentation links must resolve to real files.
Checks:
<!-- In PATTERNS.md -->**Canonical Example**: `src/components/Button.tsx:15`Validation:
src/components/Button.tsx existsFailure:
✗ Broken link in docs/core/PATTERNS.md:42 Target: src/components/Button.tsx (not found)
Recommendations:- File moved? Update link to new location- File deleted? Remove link or document deprecationRule: Structured files must follow expected formats.
Required sections:
## Active Sprint: [Name]**Why this matters**: [Context]Valid:
## Active Sprint: User Authentication
**Why this matters**: Mobile app needs secure API access
- [ ] JWT token generation- [ ] Token validation middlewareInvalid:
## Tasks
- Implement authValidation error:
✗ NEXT-TASKS.md malformed Missing required section: ## Active Sprint Missing context: **Why this matters**
Recommendations:- Add sprint name with descriptive title- Add "Why this matters" to provide AI contextRequired sections:
See: .github/copilot-instructions.md template for full schema
Rule: ADRs (Architectural Decision Records) must follow naming pattern.
Expected: NNNN-lowercase-with-dashes.md
Valid:
0001-use-postgresql-for-storage.md0023-migrate-to-react-18.mdInvalid:
use-postgresql.md (missing number)0001_UsePostgreSQL.md (wrong format)Validation:
✗ Invalid ADR filename: docs/decisions/use-postgresql.md Expected format: NNNN-lowercase-with-dashes.md
Recommendations:- Rename to: 0001-use-postgresql-for-storage.mdRule: Production docs should not contain unreplaced placeholders.
Placeholders use [Bracket Syntax]:
[Project Name][e.g., Next.js 15, Vue 3][Briefly describe...]Validation:
cortex-tms validate --strictIf found:
⚠ Placeholders found in production files: - CLAUDE.md:5 - [Project Name] - docs/core/ARCHITECTURE.md:12 - [Frontend Framework]
Recommendations:- Replace placeholders before committing- Use plain text for production docscortex-tms validateChecks:
Use when: Running locally during development
cortex-tms validate --strictAdditional checks:
Use when: Running in CI/CD pipelines or before releases
cortex-tms validate --config .cortex-validation.jsonCustom rules:
{ "maxLines": { "NEXT-TASKS.md": 150, "copilot-instructions.md": 80 }, "requiredFiles": [ "docs/core/PATTERNS.md", "docs/core/SCHEMA.md" ], "forbiddenTerms": [ "TODO", "FIXME" ]}name: Validate Documentation
on: pull_request: paths: - 'NEXT-TASKS.md' - 'docs/**' - '.github/copilot-instructions.md'
jobs: validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20'
- name: Install Cortex TMS
- name: Validate Documentation run: cortex-tms validate --strict
- name: Check File Sizes run: | NEXT_TASKS_LINES=$(wc -l < NEXT-TASKS.md) if [ $NEXT_TASKS_LINES -gt 200 ]; then echo "❌ NEXT-TASKS.md exceeds 200 lines" exit 1 fi echo "✓ File size checks passed"Result: Pull requests fail if documentation is invalid.
Validate before committing to catch issues earlier:
# .husky/pre-commit or .git/hooks/pre-commit#!/bin/bash
echo "🔍 Validating documentation..."
# Run Cortex TMS validationcortex-tms validate --strict
if [ $? -ne 0 ]; then echo "❌ Documentation validation failed" echo "Fix errors above before committing" exit 1fi
echo "✅ Documentation validation passed"Blocked scenarios:
NEXT-TASKS.md with 250 linesMake Changes
Edit NEXT-TASKS.md, add new tasks, update patterns
Run Validation Locally
cortex-tms validateFix any errors reported
Archive Completed Tasks
If NEXT-TASKS.md is approaching 200 lines:
# Move completed tasks to archivecortex-tms archive sprint-2026-01Commit Changes
Pre-commit hook validates again automatically
Push & Open PR
CI/CD validates in GitHub Actions
Merge
Production docs are guaranteed to be valid
✗ NEXT-TASKS.md exceeds limit (245/200 lines)Fix options:
# Create archive for completed sprintmkdir -p docs/archivemv completed-tasks.md docs/archive/sprint-2026-01.md
# Clean up NEXT-TASKS.md# Remove completed tasks, keep only active sprint<!-- In NEXT-TASKS.md -->## Active Sprint: Auth (Keep)
<!-- Move to FUTURE-ENHANCEMENTS.md -->## Future: Analytics Dashboard (Move)## Future: Email Notifications (Move)<!-- Bad: One huge task -->- [ ] Build complete auth system (50 lines of subtasks)
<!-- Good: Multiple focused tasks -->- [ ] JWT token generation- [ ] Token validation middleware- [ ] Refresh token rotation✗ Broken link in docs/core/PATTERNS.md:42 Target: src/components/Button.tsx (not found)Fix:
Button.tsx moved: git log --follow src/components/Button.tsxPATTERNS.mdcortex-tms validate⚠ Placeholder found: CLAUDE.md:5 - [Project Name]Fix:
<!-- Before --># [Project Name]
<!-- After --># Acme SaaS PlatformAI Agents Trust Docs
When docs are always valid, AI agents follow them confidently. No more hallucinations.
Faster Onboarding
New team members (human or AI) get accurate information immediately. No “docs are outdated” warnings.
Enforced Discipline
Validation forces good habits: archive regularly, fix broken links, respect size limits.
No Surprises
Issues caught in CI/CD, not discovered 6 months later when AI agents are confused.
Before marking a task ✅ Done:
cortex-tms validate --strictAutomation: Add this checklist to your Definition of Done in NEXT-TASKS.md.
A: You probably don’t. 200 lines = ~20-30 focused tasks, which is already 2-4 weeks of work.
Solutions:
FUTURE-ENHANCEMENTS.mdA: Yes, but not recommended. Use .cortex-ignore:
docs/legacy/temp-notes.mdFiles in .cortex-ignore skip validation.
A: Different --strict level. Run cortex-tms validate --strict locally to match CI behavior.
Now that you understand Zero-Drift Governance: