Skip to content
Agent loop · Docs

Docs Until In Sync

Check every code sample and command in your README and docs against the real code, fix what drifted, and repeat until all examples run as written.

Up to 8 iterationsStop rules and safety limits
The prompt

Copy the Docs Until In Sync loop

Stops when every code sample and command in the docs runs or type-checks against the current code, or after 8 iterations. Edit the settings block, then paste the whole prompt into your agent.

docs-until-in-sync.prompt.md
You are running the "Docs Until In Sync" loop.

Settings (edit before running):
- Docs to check: README.md and docs/**/*.md
- Scratch directory for running examples: /tmp/docs-check
- Max iterations: 8

Goal: every example in the docs works against the current code.

Before the loop: build an inventory of every code block, shell command, config snippet, and referenced function, flag, or option. Number them.

Each iteration:
1. Take the next batch of up to 10 inventory items.
2. Check each one:
   - Shell commands: run them in the scratch directory, never in the repo root, and only if they are read-only or local (no deploys, no publishing, no network writes).
   - Code samples: compile or type-check them against the current source.
   - API names, flags, config keys: confirm they exist in the source with the documented name, type, and default.
3. Fix drifted docs to match the code. If the code looks wrong and the docs look right, do not change code; list it as a possible bug.
4. Re-check the items you fixed. Mark each item as ok, fixed, or flagged.

Stop when:
- Every inventory item is ok, fixed, or flagged. Success.
- You reach the max iteration count.

Rules:
- Only edit documentation files. Never change source code in this loop.
- Keep the existing tone, headings, and structure. Do not rewrite sections that are correct.
- Never run commands that publish, deploy, send email, or modify remote resources.

Final report: the inventory with statuses, files edited, and the list of possible code bugs.
When to use it

When this loop fits

  • You renamed functions, flags, or config keys and the README still shows the old ones.
  • Users keep filing issues because the getting started steps no longer work.
  • You are cutting a release and want the docs to match the code that ships.
How it works

What happens on each pass

The agent repeats these steps until the stop condition holds or it runs out of iterations.

  1. Inventory examples. Extract every code block, CLI command, config snippet, and API name from the docs.
  2. Check each one. Run commands in a scratch directory, compile or type-check code samples, and look up every referenced API in the source.
  3. Fix the drift. Update the docs to match the code, or flag places where the code looks wrong instead.
  4. Re-check. Re-run the checks on the edited pages until they all pass.
Recommended servers

MCP servers for this loop

The 6 strongest of 2619 matching servers, ranked by how closely they fit and then by trust score.

More in Knowledge
  • pmndrs docs logo
    Trust score 69 of 100, Good

    pmndrs docs

    by pmndrs · TypeScript

    Search and read the docs and examples of react-three-fiber, drei, zustand, jotai... from your agent

    RegistryRemote
    LicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: B. Last commit or release 25 days ago. Down one letter for 31 open issues against 120 stars.
    120 stars—/wk weekly downloads— tools
  • Trust score 68 of 100, Good

    The canonical Python stdlib oracle for AI coding agents — always free, always MIT, token-frugal.

    Registry
    LicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 14 days ago.
    9 stars—/wk weekly downloads— tools
  • Octri API Docs logo
    Trust score 67 of 100, Good

    Octri API Docs

    by octridev · TypeScript

    Search an Octri project's API docs and call its endpoints as tools, shaped by its SDK Studio config.

    Registry
    LicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 6 days ago.
    3 stars—/wk weekly downloads— tools
  • Trust score 67 of 100, Good

    gitlab-docs

    by ozanmutlu · TypeScript

    Search and browse 2,900+ official GitLab documentation pages via MCP

    Registry
    LicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 12 days ago.
    3 stars—/wk weekly downloads— tools
  • Trust score 67 of 100, Good

    Semantic search over WSO2 docs (APIM, IS, MI, Choreo, Ballerina) via RAG and pgvector.

    Registry
    LicenseQualityMaintenanceLicense: A. Apache-2.0 is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 22 days ago.
    3 stars—/wk weekly downloads— tools
  • Trust score 65 of 100, Good

    Nifra docs

    by nifrajs · TypeScript

    Nifra docs, runnable examples, and API types as an MCP server for any AI assistant.

    RegistryRemote
    LicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 8 days ago.
    6 stars—/wk weekly downloads— tools
Run it

How to run this loop

  1. Connect the tools. Install a server the loop can use, for example pmndrs docs, or rely on your agent's built-in terminal and file access.
  2. Edit the settings block. Replace the example commands, targets, and limits with your project's own. Keep the iteration cap low on the first run.
  3. Paste it into an agent session. Start a fresh session in Claude Code, Cursor, or VS Code agent mode, in the repository root, and paste the prompt.
  4. Review before you merge. Read the final report and the diff. The loop leaves its work for you to review rather than shipping it.
FAQ

Docs Until In Sync questions

When does the Docs Until In Sync loop stop?

It stops as soon as every code sample and command in the docs runs or type-checks against the current code. It also stops after 8 iterations by default, or earlier when the prompt's own stop rules say it is stuck, and then reports what changed and what is left. Change the cap in the settings block at the top of the prompt.

How do MCP servers help keep docs in sync?

Documentation servers such as Context7 give the agent current docs for your dependencies, so it can tell whether an example is wrong because of your code or because a library changed. Knowledge base servers let it check pages that live outside the repository, like Notion or Confluence.

Why is the agent only allowed to edit documentation?

When docs and code disagree, either one could be wrong. Restricting the loop to docs keeps the diff safe to merge, and anything that looks like a code bug is flagged for a person to decide instead of being silently changed to match the docs.

Keep exploring
All loops