batch_modify
Apply a single natural-language instruction to each file in a batch, with options for atomic rollback on failure or best-effort partial success.
Instructions
Apply the SAME natural-language instruction independently to each file in files. Use for sweeping consistent edits — 'add JSDoc to every exported function in lib/', 'replace console.log with logger.info'. transactionMode:'all_or_nothing' (default) rolls every file back if any one fails; 'best_effort' keeps the successful edits and reports failures. This tool does NOT find cross-file references — each file is edited in isolation. For symbol renames that must update callers, use refactor. For one file with custom instructions, use modify_file. ⚠️ DESTRUCTIVE when review:false: writes to every file in the batch (per-file backups at <path>.backup.<timestamp>). The default review:true returns the proposed diffs without writing. Returns: shape depends on review. review:true (default): {success, status:'pending_review', filesProcessed, patterns, instructions, modifications:[{filePath, status:'pending_review'|'error', summary, diff, stats, error?}], successCount, failureCount, approval_instructions, tokens_saved}. review:false (auto-write): {success, status:'completed'|'partial', filesProcessed, modifications:[{filePath, status:'written'|'error', summary, stats, error?}], successCount, failureCount}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | File paths or glob patterns to modify | |
| instructions | Yes | Instructions to apply to each file | |
| options | No |