Related guides:
Patch is the center of gravity for the AI loop. This is where requirements are refined, code is generated, and the commit message is drafted.
STAN supports two patch payload kinds:
You must not mix both kinds in a single payload.
diff --git, ---/+++, and @@ hunks./). Prefer a/ and b/ prefixes.stan patch enforces exactly one target file per patch payload. For multi-file changes, apply multiple times (one diff per file).Apply from clipboard (default), argument, or file:
stan patch
stan patch --check
stan patch -f changes.patch
Use a ### File Ops block for safe, repo-relative operations:
### File Ops
mkdirp src/new/dir
mv src/old.ts src/new/dir/old.ts
rm docs/obsolete.md
Then follow with a unified diff for any content edits (in a separate payload).
When a patch fails or partially applies, STAN prints a compact diagnostics envelope and (when possible) copies it to your clipboard. Paste it into chat as-is. It includes:
Assistants should respond by generating a corrected unified diff that applies cleanly, including Full Listings only for the failed file when necessary.