Get updates
Recipe

AI harness for writing a long document

Job: draft and revise a long document without the agent drifting off voice or rewriting chapters you'd already approved. Coding harnesses are good at this because they edit files and track changes.

Checked against official docs on Oct 18, 20265 sourcesNo affiliate links

Which harness fits

Aider

Best for careful revision

Every change is its own git commit. /diff shows what changed, /undo throws it away. Add only the chapter you're working on.

Claude Code

Best for critique plus drafting

Give an editor subagent read-only tools so it can only comment, while the main session drafts.

OpenCode

Best for hard limits on what changes

Permission rules can allow edits only in drafts/ and deny them everywhere else.

The project layout

One file per chapter, under git
mkdir -p book/drafts && cd book && git init
touch STYLE.md OUTLINE.md AGENTS.md drafts/01-intro.md drafts/02-problem.md
AGENTS.md
# Writing rules
- Read STYLE.md and OUTLINE.md before writing anything.
- Edit only the chapter file you're asked about, in drafts/.
- Keep the author's voice. Don't add headings, lists or summaries that aren't in the outline.
- Mark facts that need a source with [CITE] instead of inventing one.
- Report word count changes after each edit.
STYLE.md (example)
# Style
- Plain English. Short sentences. Active voice.
- Second person ("you"), no "we".
- No filler: "In today's world", "It's important to note".
- Numbers: digits for 10 and up.

Rig A: Aider

.aider.conf.yml
read:
  - AGENTS.md
  - STYLE.md
  - OUTLINE.md
Revise one chapter
aider drafts/02-problem.md
# inside aider:
#   /diff   show what changed since your last message
#   /undo   discard the last change
#   /commit commit anything you edited by hand

Files loaded with read are marked read-only, so Aider uses the style guide without editing it. Before editing a file with uncommitted changes, Aider commits your changes first, so your edits and its edits stay separate in history.

Rig B: Claude Code editor subagent

.claude/agents/editor.md
---
name: editor
description: Reviews a chapter against STYLE.md and OUTLINE.md and returns numbered suggestions. Never edits.
tools: Read, Grep, Glob
---
Read STYLE.md, OUTLINE.md and the chapter you're given.
Return at most 15 numbered suggestions, each quoting the exact sentence
and saying why it breaks the style guide or the outline. Don't rewrite whole paragraphs.

Listing only Read, Grep, Glob means the subagent has no edit tool. Ask the main session to apply the suggestions you accept.

Rig C: OpenCode, edits only in drafts/

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "edit": { "*": "deny", "drafts/*.md": "allow" },
    "bash": "ask"
  }
}

The last matching rule wins, so the specific drafts/*.md rule after the catch-all opens just that folder.

Failure modes

  • Voice drift over many sessions. Keep STYLE.md short and concrete; quote banned phrases.
  • Silent rewrites of approved chapters. Work on a branch; Aider's per-edit commits make them visible.
  • Made-up facts. The [CITE] marker rule gives the agent an honest alternative to inventing a source.

FAQ

What is the best AI harness for writing?

For revising a long document, Aider: each change is a git commit you can review or undo. Claude Code is strong when you want a read-only editor subagent to critique drafts. OpenCode is best when you need hard limits on which files can change.

Can coding agents write prose?

Yes. They edit text files like any other. What helps is the coding workflow around them: version control, one file per chapter and a rules file every session loads.

How do I keep my style consistent?

Put it in a short STYLE.md and load it every session: read: in Aider's config, a line in AGENTS.md for OpenCode and goose, or an import in CLAUDE.md.

Sources

  1. Aider docs: git integration · checked Oct 18, 2026
  2. Aider docs: coding conventions · checked Oct 18, 2026
  3. Claude Code docs: subagents · checked Oct 18, 2026
  4. OpenCode 1 docs: permissions · checked Oct 18, 2026
  5. OpenCode 1 docs: rules · checked Oct 18, 2026

Spotted something out of date? Email sternberg@mail.grokbot.com.

Related