DEV Community

Avery Lin
Avery Lin

Posted on

A Quarantine for Model-Drafted Docs: Free Model, Human Merge

A Quarantine for Model-Drafted Docs: Free Model, Human Merge

Free model access and a free server option make documentation drafting cheap enough to treat as a disposable experiment. That cheapness becomes a maintenance liability when proposed text flows into the real documentation without a human checkpoint. The workflow below quarantines every model-generated proposal, requires explicit human promotion, and fails CI if any proposal escapes quarantine. This example uses MonkeyCode's free model access and free server option for the generation layer. Disclosure: This article was prepared as part of MonkeyCode's product outreach.

The Generation/Review Asymmetry

Documentation review is the bottleneck, not generation. A free model can produce a first-draft API description in seconds, but a human must still verify parameter names, defaults, error codes, and example behavior against source code. If every generated sentence lands directly in docs/, review effort grows linearly with model output, which defeats the cost advantage. Quarantine solves the problem by separating generated proposals from accepted documentation at the filesystem level. Volume can then rise without forcing unreviewed content into the tree.

A Machine-Readable Ownership Manifest

The first artifact is a TOML file that records which paths are human-owned, which are eligible for model drafts, and which require approval. Unknown paths default to human-owned, so the safest behavior requires no extra configuration.

# docs_quarantine.toml
[owners]
'docs/index.md' = 'human_owned'
'docs/architecture/**' = 'human_owned'
'docs/guides/**' = 'model_draftable'
'docs/api/**' = 'needs_approval'
'docs/changelog.md' = 'model_draftable'
Enter fullscreen mode Exit fullscreen mode

The model_draftable value means a model may propose prose for that path, but the proposal must wait in quarantine. The needs_approval value allows drafting after a named human approves the outline. human_owned forbids direct model edits entirely, although a human can still accept a useful proposal and rewrite it.

The division is not arbitrary; it follows a risk table. API references and tutorials are safe drafting candidates because a human can verify them against executed examples. Architecture overviews and security notes encode decisions that the model cannot know, so a human must own them from the first word.

Section type Free model may draft Human must own
API parameter reference Parameter list and description skeletons Exact names, defaults, error semantics
Tutorial / recipe Story structure and scaffolded steps Every example executed; product behavior confirmed
Changelog summary Candidate descriptions per release Versions, dates, user impact
Architecture overview Nothing Context, rationale, decisions
Security / compliance notes Nothing Full authorship and review

The Quarantine Script

The second artifact is a small Python script that makes the manifest executable. It requires Python 3.11+ because it uses tomllib for TOML parsing. The script has three commands: quarantine moves a proposal into docs/_quarantine, promote moves a human-approved proposal into the real docs tree, and check is meant for CI.

#!/usr/bin/env python3
'Quarantine model-drafted documentation proposals.'
import sys, tomllib, pathlib, shutil
from fnmatch import fnmatch

CONFIG_PATH = 'docs_quarantine.toml'

def load_config():
    with open(CONFIG_PATH, 'rb') as f:
        return tomllib.load(f)

def owner_for(config, doc_path: str):
    for pattern, owner in config['owners'].items():
        if fnmatch(doc_path, pattern):
            return owner
    return 'human_owned'

def quarantine(config, proposal: pathlib.Path):
    doc_path = f'docs/{proposal.stem}.md'
    owner = owner_for(config, doc_path)
    if owner == 'human_owned':
        print(f'REJECTED: {doc_path} is {owner}')
        return 1
    if 'status: proposed' not in proposal.read_text():
        print('REJECTED: proposal lacks a status marker')
        return 1
    qdir = pathlib.Path('docs/_quarantine')
    qdir.mkdir(exist_ok=True)
    target = qdir / proposal.name
    shutil.move(str(proposal), str(target))
    print(f'QUARANTINED: {target}')
    return 0

def promote(config, doc_id: str):
    qfile = pathlib.Path('docs/_quarantine') / f'{doc_id}.md'
    if not qfile.exists():
        print(f'NOT FOUND: {qfile}')
        return 1
    text = qfile.read_text().replace('status: proposed', 'status: accepted')
    dest = pathlib.Path('docs') / f'{doc_id}.md'
    dest.parent.mkdir(parents=True, exist_ok=True)
    dest.write_text(text)
    qfile.unlink()
    print(f'PROMOTED: {dest}')
    return 0

def check(config):
    errors = []
    for md in pathlib.Path('docs').rglob('*.md'):
        if '_quarantine' in md.parts:
            continue
        text = md.read_text()
        if 'status: proposed' in text:
            errors.append(f'proposed file outside quarantine: {md}')
        owner = owner_for(config, str(md))
        if owner == 'human_owned' and 'last-reviewed-by:' not in text:
            errors.append(f'reviewer missing in human-owned file: {md}')
    if errors:
        print('; '.join(errors))
        return 1
    print('OK')
    return 0

if __name__ == '__main__':
    cfg = load_config()
    cmd = sys.argv[1]
    if cmd == 'quarantine':
        raise SystemExit(quarantine(cfg, pathlib.Path(sys.argv[2])))
    if cmd == 'promote':
        raise SystemExit(promote(cfg, sys.argv[2]))
    if cmd == 'check':
        raise SystemExit(check(cfg))
Enter fullscreen mode Exit fullscreen mode

A proposal is just a Markdown file with two front-matter lines: status: proposed and last-reviewed-by:. The quarantine command refuses any proposal whose target path is human-owned, so a wrong API call cannot silently overwrite a guarded file. The promote command changes the status flag and moves the file into the real docs tree; that action is the human signature. The check command scans the tree and fails when it finds a proposed file outside the quarantine directory or a human-owned file without a reviewer marker.

Using the Free Tier as a Drafting Engine

The workflow assumes the generation layer is cheap but not necessarily reliable. With MonkeyCode's free model access and free server option, you can send many proposals at near-zero marginal cost, but you should design for occasional timeouts or truncated responses. The free server option is also not a proxy for production latency or throughput; treat it as an experimental environment.

The concrete loop is five steps:

  1. Create a proposal file in the proposals/ directory with the doc ID and the generated content.
  2. Run python docs_quarantine.py quarantine proposals/guide-quickstart.md.
  3. If the script rejects it, check whether the ownership pattern is too broad or the proposal target is human-owned.
  4. When a human finishes reviewing, run python docs_quarantine.py promote guide-quickstart.
  5. Update last-reviewed-by: with the reviewer's handle and commit.

This loop keeps docs/ clean. The quarantine directory is allowed to contain nonsense because no reader will see it. The only way a proposal reaches readers is through an explicit human promote.

CI Gate and Ownership Checks

A repository without automation loses the ownership guarantee. Add a CI step after the docs job that runs the same check command:

python docs_quarantine.py check
Enter fullscreen mode Exit fullscreen mode

The command should run after tests because it depends on no external service. If it exits non-zero, the pull request cannot merge. That turns the ownership manifest from a design document into an enforced boundary.

Honest Limitations and Who Should Skip This

This workflow solves an ownership problem, not a correctness problem. It does not verify that a generated example executes, that an API parameter exists, or that a security note matches reality. You still need a run-before-merge test for examples and a human with product knowledge for every accepted file. The manifest also relies on stable path conventions; if docs get reorganized, the patterns can silently default to human_owned and block legitimate drafts, which is safe but annoying. Teams that require deterministic tone, legal review, or regulated documentation should not rely on free-model drafts at all. For a small documentation suite that already accepts editing overhead, quarantine is a measurable way to keep the human in charge while the free server absorbs the bulk of first-draft work. Try it on one guide and compare review time before you expand the scope.

Top comments (0)