Skip to main content

Documentation Update Loop

Overview

The documentation update loop discovers and fixes problems in existing documentation for a specific topic or area. Unlike the Documentation Bootstrap loop (which generates docs from scratch), this loop targets scoped updates with source verification, structural validation, and accuracy checks.

The current tracked artifacts are .agents/tasks/prd-doc-update.json, .agents/tasks/templates/prd-doc-update.template.json, and the convenience copy .agents/tasks/prd-active.json. Treat any additional prompt/engine paths below as local setup that must be verified before execution.

Template: prd-doc-update.template.json Prompt: PROMPT_docs-update.md Stories: 9 (DU00-DU08)

Story Breakdown

PhaseIDTitleDepends OnOutput
ScopeDU00Lock effective scope--.ralph/docs-update-scope.md
DiscoveryDU01Code drift, accuracy audit, gap analysisDU00.ralph/docs-update-discovery.md
DiscoveryDU02Link validation and nav syncDU00.ralph/docs-update-links.md
PlanningDU03Merge findings into prioritized planDU01, DU02.ralph/docs-update-plan.md
ExtractionDU04Create extraction artifactsDU03.ralph/docs-update-extractions.md
WritingDU05Apply documentation updatesDU04Updated .mdx files
VerificationDU06Structural lint and link checkDU05.ralph/docs-update-verification.md
VerificationDU07Technical accuracy spot-checkDU05.ralph/docs-update-accuracy.md
FinalDU08Build validation and reportDU06, DU07.ralph/docs-update-report.md

Dependency Graph

DU01 and DU02 are independent -- link validation doesn't need source drift analysis and vice versa. Similarly, DU06 and DU07 are independent verification tracks that can run in any order.

Phases Explained

Phase 1: Scope (DU00)

Converts the user's intent (e.g., "update k12 workflow docs") into concrete include/exclude paths for both source code and documentation files. Maps source directories to their corresponding doc directories.

Phase 2: Discovery (DU01, DU02)

Two independent analyses:

  • DU01 discovers content problems: stale claims, inaccurate values, missing sections, placeholder content, and gaps where source code has no corresponding documentation.
  • DU02 discovers structural problems: broken internal links, orphaned pages not in sidebars.js, dead navigation entries, and missing cross-references between related docs.

Phase 3: Planning and Extraction (DU03, DU04)

DU03 merges all findings into a prioritized remediation plan with batches grouped by doc file. DU04 reads source code to create lean extraction artifacts for changes that need new content (not just corrections).

Phase 4: Writing and Verification (DU05, DU06, DU07)

DU05 applies all updates from the plan using a surgical edit approach. Then two independent verification tracks run:

  • DU06 checks structural quality: frontmatter, heading structure, Mermaid rendering, link integrity, sidebar sync.
  • DU07 performs a technical accuracy spot-check on the top 5 highest-impact changes by re-reading the source code and verifying every concrete claim.

Phase 5: Final Validation (DU08)

Runs the Docusaurus build validation and compiles a comprehensive report with metrics, change summary, and recommendations for future iterations.

Quality Gates

  1. Read .ralph/intake/current-guidelines.json at the start of every story
  2. Never modify files outside scope.include except tracking artifacts
  3. Every factual claim must be source-verified before writing
  4. Preserve existing doc structure and style unless the finding requires change
  5. Keep sidebars.js in sync when adding/removing/renaming docs
  6. Use extract-then-write pattern for new content
  7. Never fabricate content -- defer if source cannot be found
  8. After any doc edit, verify no broken internal links were introduced
  9. Require Docusaurus build validation before final story

Finding Categories

TypeDescription
STALEContent no longer matches source code
INACCURATEFactual error (wrong path, enum, config key)
MISSINGRequired section or page entirely absent
INCOMPLETESection exists but lacks depth
PLACEHOLDERTODO, TBD, "coming soon"
RENDERING_BUGMermaid \n, broken frontmatter
BROKEN_LINKInternal link target does not exist
ORPHANED_PAGEDoc file not in sidebars.js
DEAD_NAV_ENTRYsidebars.js entry with no file
MISSING_XREFRelated docs not cross-referencing each other

Findings are prioritized by severity:

SeverityCriteria
CriticalActively misleading, broken rendering, placeholder text
HighInaccurate claims, missing required sections, broken links
MediumIncomplete coverage, missing cross-references
LowStyle issues, minor structural improvements

Scope Configuration

The loop scope is set via intake. Examples:

# Target a specific domain
/docs-update-loop-bootstrap k12 workflows

# Target a source directory
/docs-update-loop-bootstrap src/auth/**

# Target a doc section
/docs-update-loop-bootstrap loops

# Target Bruno testing docs
/docs-update-loop-bootstrap bruno-testing

When no scope is provided, defaults to repository-wide docs update.

Artifacts

ArtifactWritten ByPurpose
.ralph/docs-update-scope.mdDU00Source-to-doc mappings, scope guards
.ralph/docs-update-discovery.mdDU01Findings by severity and type
.ralph/docs-update-links.mdDU02Broken links, orphaned pages, nav issues
.ralph/docs-update-plan.mdDU03Prioritized remediation batches
.ralph/docs-update-extractions.mdDU04Extraction artifact inventory
.ralph/docs-update-verification.mdDU06Lint and link check results
.ralph/docs-update-accuracy.mdDU07Accuracy spot-check results
.ralph/docs-update-report.mdDU08Final report with metrics and recommendations