Problem
thinktank apply patches the working tree directly. If the applied changes break something or the user changes their mind, there is no thinktank rollback — the user must manually run git checkout or git restore . and figure out which files were changed.
This is especially painful when:
- The diff touches many files
- The user already staged other changes they don't want to lose
- They applied agent 2 but now want to try agent 3 instead
Proposed Solution
Before applying a diff, save a restore point:
- Record the list of files to be patched
- Store the pre-apply state of each file in
.thinktank/restore-<timestamp>.json
Add a thinktank rollback command:
$ thinktank rollback
Restoring 4 files to pre-apply state...
✓ src/parser.ts
✓ src/index.ts
✓ tests/parser.test.ts
✓ package.json
Rollback complete. Working tree restored to state before last apply.
Only the most recent apply is tracked (not a full undo stack). Rollback is only available until the next apply or run.
Acceptance Criteria
Problem
thinktank applypatches the working tree directly. If the applied changes break something or the user changes their mind, there is nothinktank rollback— the user must manually rungit checkoutorgit restore .and figure out which files were changed.This is especially painful when:
Proposed Solution
Before applying a diff, save a restore point:
.thinktank/restore-<timestamp>.jsonAdd a
thinktank rollbackcommand:Only the most recent apply is tracked (not a full undo stack). Rollback is only available until the next
applyorrun.Acceptance Criteria
applysaves a restore snapshot to.thinktank/restore-<timestamp>.jsonbefore patchingthinktank rollbackrestores patched files to their pre-apply contentrollbackprints a clear error: "No restore point found. Nothing to roll back.".gitignoreentries (already covered by.thinktank/)--previewmode does not create a restore point (no changes were made)0o600permission policy