engine
source

02 · write funnel

Six checks. Every write.

Reading is optimistic — try the cheap tool first. Writing isn't. A stale read, a bad patch, a syntax error nobody caught: nothing lands until all six checks pass.

01readUnread files can't be edited. Full stop.
02guardNo symlinks, no escapes, no lockfiles, no secrets.
03idSHA-verified against the last read. No stale writes.
04syntaxRe-parsed with tree-sitter. New errors get rejected.
05writeAtomic. A batch lands whole, or not at all.
06undoFull before/after bytes, journaled, re-verified.
apply_edit(auth.py)

without a write funnel

agent

auth.py

Writes go straight to disk. A broken edit saves just as easily as a good one.

with the write funnel

agent

write funnel

committed

auth.py

Six checks pass. The edit lands, journaled and undo-ready.

Three endings. One pipeline.

running
read
guard
id
syntax
write
undo
running…

Six checks pass. The edit lands, journaled and undo-ready.

Scope, honestly

The gate covers Python, Go, JavaScript, TypeScript. The model's own git tools are read-only — it can't script a commit. The one thing that mutates git is the worktree settle step, and that always waits on you first.

25 test modules cover the runtime. 8 exercise the write funnel alone, offline, no LLM.

next03.agents