Practice workspaceY
Better task judgment
PRACTICAL CODEX LESSON

Recover without erasing unrelated work

Inventory changes and side effects, preserve evidence, and choose a bounded recovery instead of assuming undo restores everything.

01 / PREDICT

A task went off track after edits, a generated file and an external update. What would returning tracked files to an earlier state fail to recover?

Write a brief prediction before opening the explanation.

02 / EXPLAIN
Read the lesson

Stop the mistaken direction and inventory the state

Course correction begins by naming the mismatch: the agent is replacing a subsystem when the task asks for a small defect fix. Pause the dependent edits and inspect the working tree, relevant diffs and available action history. Separate work that existed before the task from changes attributable to the agent. A file can contain both. An uncertain ownership boundary is a reason to inspect further, not permission to discard everything.

Recovery has more than one boundary

Tracked file changes, untracked artifacts and external side effects are different forms of state. Restoring a tracked file does not prove that a generated file was removed or a remote configuration was restored. A chat history records discussion; it is not a transaction log that guarantees reversal of every action. Determine what a proposed recovery actually affects in the current environment. Preserve relevant evidence privately before correcting a mistake, and avoid destructive commands whose scope exceeds the identified change.

Continue from a smaller, verified brief

After preserving evidence, propose the narrowest recovery that retains authorized work. If user and agent edits overlap, compare the hunks and resolve the overlap deliberately; do not blindly restore the whole file. An external write may need a separately authorized compensating action, with its own verification. Resume the original task with current facts, remaining uncertainties and acceptance checks. A handoff should describe what is still changed and unverified, not simply announce that the agent has reset.

Common mistake

Using a whole-checkout reset as a universal undo, or reporting remote recovery based only on a clean Git diff.

03 / DEMONSTRATE

Make the request actionable

A weak starting brief: Undo everything you did and start from scratch. The external settings should be back too.

Pause the rewrite. Inspect the working tree, task diff and action evidence. Identify pre-existing edits, agent changes, untracked artifacts and any external side effects. Preserve evidence and propose a bounded correction that retains unrelated work. Do not reset the checkout or assume file restoration reverses remote actions. Resume the original bug fix only after checking the resulting state and clarifying unresolved ownership or authorization.

This example is an adaptable request, not evidence that a runtime action has executed.

04 / PRACTICE

An unwanted router rewrite

Simulated state:
Before task: uncommitted accessibility edits in Menu.tsx.
Task: fix a timeout message.
Agent: rewrote router.ts, also changed Menu.tsx, created untracked route-notes.md, and updated a remote preview setting.
No reliable separation of the Menu.tsx edits has been made.

Simulated scenario · No repository access or command execution

Which recovery plan is supported?

Loading your saved lesson progress…