write
Create or replace files with intelligent caching that suppresses unchanged content, returning only diffs for modified files. Supports append and dry-run previews.
Instructions
Create or replace a file, with cache refresh and optional overwrite diffs.
Use this when you already know the full new file content. For targeted
changes inside an existing file, prefer edit or batch_edit.
Routing rules:
New file or full replacement: use
write.Small localized change: use
edit.Multiple localized changes in one file: use
batch_edit.
Behavior:
Deterministic successful overwrites omit full diffs by default.
Set
show_diff=trueor use debug mode to include the diff explicitly.New files return creation status.
append=truesupports chunked construction for large files.dry_run=truepreviews without writing.auto_format=trueis best used near the end of an edit cycle.
Args:
path: File path to create or replace.
content: Full content to write, or appended content when
append=true.
create_parents: Create missing parent directories when needed.
dry_run: Preview without writing.
auto_format: Run formatter after write.
show_diff: Return the diff explicitly even for deterministic writes.
append: Append instead of overwrite.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| content | Yes | ||
| create_parents | No | ||
| dry_run | No | ||
| auto_format | No | ||
| show_diff | No | ||
| append | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| truncated | No | ||
| status | No | ||
| path | No | ||
| diff | No | ||
| diff_state | No | ||
| diff_omitted | No | ||
| created | No | ||
| dry_run | No | ||
| tokens_saved | No | ||
| bytes_written | No | ||
| tokens_written | No | ||
| diff_stats | No | ||
| content_hash | No | ||
| from_cache | No |