Skip to content

Fix: keep forget --all from relearning earlier tasks of live sessions - #188

Merged
aayank13 merged 1 commit into
mainfrom
fix/forget-all-relearn
Oct 10, 2026
Merged

aayank13 merged 1 commit into
mainfrom
fix/forget-all-relearn

Conversation

@aayank13

Copy link
Copy Markdown
Owner

Fixes #152

forget --all deleted the session progress rows, and those rows were the only record of what had already been extracted. The next ingest of a session that was still running then treated it as new and extracted every closed task in the whole transcript again. Learning "Page 2 in src/paginate.js repeats the last product from page 1" in a session, running trodden forget --all --yes and then ending the next turn in that same session brought the paginate procedure straight back, along with every other task the session had done before the forget. The same happened for a queued ingest or for a session that had never been ingested yet.

forget --all now records the time it ran in the settings table, in the same transaction that deletes everything else. Ingest skips any task that started at or before that time, the same way it already skips tasks at or below a session's extracted watermark. A task that ended before the forget is left out of outcome settling too, and a task that straddles it counts like a follow-up to work already extracted: it can still settle an injection made after the forget, but it is never learned from. Tasks that start after the forget are learned as usual.

I went with one global cutoff rather than keeping a watermark per session because it covers every way old events can come back, not only sessions that already had a progress row: queued ingests, sessions that were never ingested, and later hooks of journaled agents. It also means forget --all can keep deleting the session rows, which hold transcript paths and repositories the user asked to forget. The trade-off is that trodden backfill after forget --all no longer learns anything from before the forget either. That seemed right for a privacy feature, since what the user deleted should not come back by any route. Forgetting a single procedure or a repository is unchanged.

To reproduce, I built the binary, pointed TRODDEN_HOME at a scratch directory, wrote a Claude Code transcript with two finished tasks in a fresh git repository and ran trodden ingest on it, which learned the first task. After trodden forget --all --yes I appended two more tasks with later timestamps and ingested again, like the next Stop hook would. Before the fix, that ingest reported 3 new procedures and trodden list showed the paginate and checkout tasks from before the forget next to the new cart one. After the fix it reports 1 new procedure and only the cart task is listed.

A new ingest test does the same against a live session and fails without the fix (it learns 3 tasks instead of 1). A store test checks that forget --all records the time and that forgetting a repository afterwards leaves it alone. cargo fmt, cargo clippy --workspace --all-targets -D warnings and cargo test --workspace pass.

@aayank13
aayank13 merged commit 13219b4 into main Oct 10, 2026
4 checks passed
@aayank13
aayank13 deleted the fix/forget-all-relearn branch October 10, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After forget --all, the next ingest of a live session learns everything again

1 participant