DEV Community

Avery Lin
Avery Lin

Posted on

The Documentation Trust Boundary: What a Model May Draft and What You Must Own

The real cost of AI-generated documentation is not the first draft; it is the quiet moment when a user follows instructions that no human verified. A model can summarize, reframe, and explain, but it cannot own a promise about compatibility or security. This article defines a machine-readable boundary contract that separates content a model may draft from content a human must own.

Why guidelines fail

A policy that says a human must review generated docs is too vague. Reviewers get no signal about which lines carry risk and which lines are safe reference material. The result is a binary choice: trust every generated sentence or distrust the entire file, and both paths produce stale documentation.

The fix is to encode ownership in the file system and in the merge gate. When a generated change touches a human-owned section, the pull request must wait. That rule is not a process suggestion; it is an automated check that the team can test and adjust.

The draft boundary contract

A draft boundary contract is a YAML file that classifies every documentation path into one of four categories. The table below is the mental model; the YAML block after it is the machine-readable version.

Category What belongs there Model may draft Human gate
Draftable Glossary terms, boilerplate snippets, code comments Yes Lint and spelling only
Reviewable API walkthroughs, setup guides, tutorials Yes Manual review plus example execution
Owned Compatibility promises, deprecation schedules, security notes No A named human must mark the file
Blocked Legal text, customer data, internal strategy Never No model access at all

The owned category is the one that prevents silent failures. A model can compose a deprecation notice, but it cannot decide when a breaking change is acceptable or which customers need a migration path.

A boundary file to start from

version: 1
contracts:
  - paths:
      - docs/glossary/**
      - docs/reference/boilerplate/**
    category: draftable
    ai_draft: true

  - paths:
      - docs/tutorials/**
    category: reviewable
    ai_draft: true
    review_required: true
    must_run_examples: true

  - paths:
      - docs/compatibility.md
      - docs/deprecations/**
      - docs/security/**
    category: owned
    ai_draft: false
    owner_required: true

  - paths:
      - docs/legal/**
      - docs/customer-data/**
    category: blocked
    ai_draft: false
    model_access: forbidden
Enter fullscreen mode Exit fullscreen mode

A checker for the merge gate

The checker below is a minimal implementation, adapted to the boundary file above. It treats unclassified files as owned by default and only allows changes when the owner marker is present.

def check_boundary(config_path: str, changed_files: list[str]) -> int:
    from pathlib import Path
    import yaml

    config = yaml.safe_load(Path(config_path).read_text())
    failures = []

    for change in changed_files:
        matched = [
            rule for rule in config['contracts']
            if any(Path(change).match(p) for p in rule['paths'])
        ]

        if not matched:
            failures.append(change + ' is unclassified; add a boundary rule')
            continue

        rule = matched[0]
        if rule.get('ai_draft', True) and rule.get('category') != 'owned':
            continue

        content = Path(change).read_text(errors='ignore')
        if 'REVIEWED-BY' not in content:
            failures.append(
                change + ' belongs to ' + rule['category'] + ' and needs REVIEWED-BY'
            )

    for failure in failures:
        print('::error file=' + failure + '::boundary violation')
    return 1 if failures else 0
Enter fullscreen mode Exit fullscreen mode

The marker REVIEWED-BY is a small convention. When a human owns a section, they add a comment such as <!-- REVIEWED-BY: avery -->; the checker refuses to merge generated changes that lack it.

CI integration

name: doc-boundary
on: pull_request
jobs:
  boundary:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - run: |
          pip install pyyaml
          DIFF=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }})
          python check_boundary.py docs-boundary.yaml --diff "$DIFF"
Enter fullscreen mode Exit fullscreen mode

How to adopt the workflow

Start with the smallest possible contract instead of a perfect taxonomy. Classify three path prefixes, keep every unmatched path in owned-by-default mode, and run the checker on the first generated PR.

  1. Write docs-boundary.yaml for your three riskiest documentation paths.
  2. Treat every unlisted path as owned until proven otherwise.
  3. Run the checker in repository CI and make it a required check.
  4. Let the contract evolve with the codebase; update categories only after a real failure or a real merge freeze.
  5. Track violations for one month, then remove the rules that never fire.

This ordering matters because it separates the moment of generation from the moment of ownership. A model draft can arrive quickly, but the human verification happens before the branch merges, not after the user reads the page.

Where free options fit

The contract is tool-agnostic, and the same file works in any repository. For teams that want a low-cost experiment, MonkeyCode offers two relevant pieces: free model access for producing candidate drafts and a free server option for hosting a small runner that executes this checker. Disclosure: This article was prepared as part of MonkeyCode's product outreach. Replace either piece with any other model or any other CI host, and the boundary still protects the docs.

Limitations and who should skip this

A boundary contract cannot judge semantic truth; it only enforces process. It becomes theater when no maintainer exists, because a human marker can be added without review. It also adds little when documentation is generated directly from source code, because the ownership decision belongs in code comments, not in prose files.

Do not use this exact approach for a legal-heavy codebase, for customer-data documents, or for a team without a designated docs owner. In those cases, the missing step is not a checker; it is an owner who can be held accountable.

The useful gate is before the merge

A documentation pipeline that cannot distinguish draftable content from owned content will eventually ship advice nobody verified. Write the boundary file first, run the checker on one PR, and let the gate teach everyone where ownership actually lives. If you wait to add the contract until after a review, you are back to trusting goodwill instead of process.

Top comments (0)