Troubleshooting

Agent Edited the Wrong File?

A fast recovery workflow for the "I asked for one file, but it changed another one" trust-break.

This happens more than people think, especially when file names are similar (like draft-final.md vs draft-final-v2.md) or when work happens across multiple sessions.

Good news: this is usually fixable in minutes if you switch to a path-proof workflow.

Most common symptom

“The change looks right… but it’s in the wrong file or wrong folder.”

2-Minute Recovery Checklist

  1. Stop further edits until file identity is confirmed.
  2. Ask for proof of target: exact full path + first 3 lines before editing.
  3. Require dry-run mode: show planned patch only, no write yet.
  4. Approve one file only with a do-not-touch list for everything else.
  5. After edit, require proof: path + changed lines + unchanged file list.

Known-Good Prompt (Copy/Paste)

Before editing anything, verify file identity.

Target file (only this one): [full path]
Do not edit any other file.

Step 1) Read and show:
- exact full path
- first 3 lines
- last modified timestamp (if available)

Step 2) Show a dry-run patch (no writes yet).
Wait for my approval.

Step 3) After approval, edit only target file.

Step 4) Return proof:
- edited file full path
- exact changed lines/snippets
- explicit list of files NOT touched.

Why This Happens

High-Friction Mistakes to Avoid

1) “Use the latest file” with no path

“Latest” is ambiguous. Always specify a full path or unique filename.

2) Batch edits across many files without checkpoints

If precision matters, run one file at a time and verify after each write.

3) No unchanged-file confirmation

If you don’t request a not-touched list, silent collateral edits can be missed.

Best practice

For critical docs, include a Do Not Touch block naming protected files before any edit begins.

Advanced Edge Cases (Worth Checking)

1) Same filename in multiple roots

Many users keep copies like /workspace/report.md and /workspace/archive/report.md. Require the agent to print the absolute path, not a relative path like ./report.md.

2) Path looks right but points through a symlink

A symlink can resolve to a different real location. Ask the agent to show both: requested path and resolved real path before writing.

3) Session/surface mismatch after a reset

If you switched from dashboard to Discord (or restarted into a fresh session), confirm the active workspace root first. Wrong-file edits often come from working in the wrong session, not bad intent.

4) “Looks unchanged” because edits landed in another branch/folder snapshot

For repo workflows, ask for git status --short and edited file paths right after the change. This catches edits made in an unexpected branch or nested copy.

Escalation Packet (if it keeps happening)

Don’t do this

Don’t keep issuing “one more quick fix” after a wrong-file edit. Pause, verify path identity, then continue.