Doc Bridge
Playbook

A reusable pattern for making documentation useful to humans and agents.

View raw Markdown · llms.txt · For agents

Doc Bridge Pattern

AgentHandoff for your monorepo — deterministic routing so agents edit the right roots, run the right checks, and stay linked to human documentation.

Published pattern for Agents Playbook. Export with:

ak-docs playbook pattern --text
ak-docs playbook pattern --json

Problem

Coding agents guess package ownership. They edit sibling modules, run repo-wide tests, and ship changes without a bridge to human-facing guides. Wikis and RAG explain concepts but weakly answer where to act.

Solution (three artifacts)

ArtifactRole
AgentHandoffJSON handoff: startHere, editRoots, checks, humanDoc, bridge
DocBridgeIndexDeterministic index + contentHash for CI freshness gates
Self-describellms.txt, capabilities.json for discovery

Four loops

LoopCommandOutcome
Actak-docs query package <id> --agentAgent edits only editRoots
Bridgeak-docs bootstrap agent-docsLink agent corpus ↔ human site
Learnak-docs memory promote --prHITL draft PR from agent memory
Explainak-docs ask "<question>"Local consult + handoff preview

60-second proof

npm i -D @agentskit/doc-bridge
npx ak-docs demo --text
ak-docs mcp install --cursor

AgentHandoff example

{
  "type": "agent-handoff",
  "startHere": "docs/for-agents/packages/auth.md",
  "editRoots": ["packages/auth"],
  "checks": ["pnpm --filter @demo/auth test"],
  "humanDoc": "/docs/guides/auth",
  "bridge": { "humanDoc": "linked" }
}

When humanDoc is missing, handoffs surface bridge.action: "ak-docs bootstrap agent-docs" — a feature, not a silent gap.

MCP contract

Agents call handoff.resolve before editing packages/*:

  1. Read startHere
  2. Stay inside editRoots
  3. Run every checks command
  4. Link humanDoc or escalate missing bridge

CI gate

- uses: AgentsKit-io/doc-bridge@v1.2.1

Or: ak-docs index && ak-docs gate run — stale index fails the PR.

Coverage metric

ak-docs doctor --text
ak-docs doctor --badge

Teams track handoff % and human-bridge % daily.

When to use

  • pnpm/npm monorepos with real package ownership
  • Fumadocs / Docusaurus human sites + dense agent corpus
  • Cursor / Claude / Codex agents that should not guess edit roots

When not to use

  • Single-file repos with no ownership boundaries (AGENTS.md may suffice)
  • Hosted doc chat as primary product (doc-bridge is routing + bridge, not SaaS chat)

Promotion to Playbook

  1. Review this file for secrets and private paths
  2. Open PR to agents-playbook under content/docs/pillars/ai-collaboration/
  3. Or run ak-docs memory promote --pr for memory-sourced findings

References

The AgentsKit ecosystem

Build the agent. Then take it all the way.