ketan_write_file_safe
Write files with pre-flight validation, atomic snapshots, and automatic rollback on failure.
Instructions
Write a file to the workspace with FULL Ketan-OS protection:
Pre-flight invariant guard: Python AST syntax check for .py files, dangerous pattern detection.
Atomic snapshot of current workspace state before writing.
Write the file.
On any failure → automatic rollback to pre-write state.
Always prefer this over direct file writes for safe, reversible mutations.
Args: filepath: Path relative to workspace root (e.g., "src/main.py") content: Full file content to write
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| filepath | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |