How It Works
Quick Start
A missing or failing formatter never fails the edit — the original write is kept and errors are logged at debug level.
How It Works
After a successfuledit_file or apply_patch, the pipeline detects a formatter by file extension, runs it, and re-reads the file on exit code 0.
| Extension | Default command |
|---|---|
.py | ruff format {path} (falls back to black) |
.js, .ts, .tsx, .json, .css, .md | prettier --no-config --no-editorconfig --write {path} |
.go | gofmt -w {path} |
.rs | rustfmt {path} |
{path} placeholder is the absolute path to the edited file. If omitted from your argv list, it is appended automatically.
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
post_edit_format | str | "off" | "off", "auto", or "on" |
formatters | dict[str, list[str]] | Built-in map | Per-extension formatter argv |
post_edit_diagnostics | str | "auto" | Separate linter/diagnostics pass |
Best Practices
Start with auto mode
Start with auto mode
post_edit_format="auto" runs a formatter only when one is on PATH — zero cost when none is installed.Use project-local prettier
Use project-local prettier
Prefer
./node_modules/.bin/prettier so the version matches package.json.Pin formatter versions in CI
Pin formatter versions in CI
Match local and CI formatter versions to avoid diff churn between runs.
Skip when CI already formats
Skip when CI already formats
Most useful for interactive agent sessions where you want immediate clean output.
Related
File Editing
Core edit and patch tools
Code Agent
Code assistant configuration

