Reset mechanics¶
tilth reset [<session_id>] tears down a session's artifacts. It runs entirely outside the normal loop — no model calls, no validators, no evaluator. (The pre-Phase-3 --reset flag still works for one minor version.)
The flow¶
- Resolve the session. Bare
tilth resetpicks the latest by directory name (parallel totilth resume); explicittilth reset <id>targets that one. - Recover paths.
_read_checkpoint()givesworkspace(worktree) andbranch._source_for_session()scansevents.jsonlfor thesession_startevent to recover the source repo (the path is already in the log, so no checkpoint schema change was needed for this). - Confirm.
input("Continue? [y/N] ")unless--yesis passed. The prompt is the default;--yesis the override. - Tear down via
ws.reset_session_state():git worktree remove --force <worktree>against the source. Force is always passed: reset's whole purpose is to discard a session's work, and the user already confirmed via the[y/N]prompt (or--yes). Refusing on dirty would defeat the user's stated intent. A failure here now indicates a true filesystem-level problem (locks, perms) rather than uncommitted changes.git branch -D session/<id>against the source (force-delete is correct for thesession/*namespace, which is never auto-merged).shutil.rmtree(sessions/<id>/)for whatever's left on the harness side.
- Each step is idempotent — already-missing pieces are reported as skipped, not errored. You can run
tilth resetagainst a half-cleaned-up state and it'll finish the job.
Diagram suggestion — step-by-step flow diagram of the four side effects, each with a green "ok" branch and a yellow "already gone, skipped" branch. Reinforces idempotency as a property of the whole command, not just one step.
There's no --reset --all and no "keep events" mode. The [y/N] prompt is the only safety gate; once you confirm, the session is gone.