Open agent-written Markdown in Lineform
Claude Code hook · verified against Claude Code v2.1.198
This hook opens any Markdown or text file your agent writes or edits in Lineform, so you read and review it in a real window (with live reload) instead of scrolling the terminal.
Setup
- Install the
lineformcommand line tool: in Lineform, choose Lineform → Install Command Line Tool…. (The recipe also works without it, viaopen.) - Add the hook to your Claude Code settings —
~/.claude/settings.json(all projects),.claude/settings.json(this project), or.claude/settings.local.json(this project, local only).
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "f=$(jq -r '.tool_input.file_path // empty'); case \"$f\" in *.md|*.markdown|*.txt) command -v lineform >/dev/null 2>&1 && lineform \"$f\" || open -b com.lineform.app \"$f\";; esac"
}
]
}
]
}
}
What it does: after Claude Code’s Write or Edit
tool runs, the hook reads the event JSON on stdin, extracts tool_input.file_path
with jq, and — only for .md, .markdown, or
.txt files — opens it in Lineform (using the lineform CLI if
installed, otherwise open -b com.lineform.app). It exits silently for anything
else. Because Lineform live-reloads, repeated edits refresh the open window rather than piling
up new ones. Requires jq.
Why there is no “open approved plans” recipe (yet)
Verified against Claude Code v2.1.198, ExitPlanMode does not emit a
PostToolUse file-path event — it triggers a permission request, and the plan is
passed as text, not a file — so there is no reliable path for a hook to open. Rather than
publish a recipe that doesn’t work, it is omitted until a verified mechanism exists. (If you
write plans to a file yourself, the recipe above already opens them.) Recipes for other agents
will be added only after the same end-to-end verification.