feat: complete finalizes tasks — enrich, retitle, close-if-done, batch (0.22.0)#39
Merged
Conversation
New EventType::Rename. upsert_task_from_event applies it as UPDATE tasks SET title — latest rename wins on JSONL replay, so rebuild_state stays deterministic. Enables complete/finalize to fix junk auto-titles without mutating the append-only log. claude-memory-7by Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New finalize.rs: one backend call reads a task's full event history and
returns {retitle, title, done, outcome_tag, outcome, reason}. The model
decides whether the current title is junk and whether the events clearly
show the task finished — heuristics can't tell a natural-language title
fragment from a real one. Pluggable via llm::LlmBackend (Haiku default).
claude-memory-c1w
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
complete <id> now finalizes a legacy task: enrich its memory from the sessions it touched (task-scoped, no dream watermark), ask the model to judge a human title + outcome + whether it is clearly done, write a Rename event if the title is junk, and close it (Close event carrying the outcome) only when done. complete with no id finalizes every open task: a numbered list with event/session counts, exclude-by-number, confirm, then per-task finalize; undone tasks stay open and are listed. --quick skips enrich, --dry-run reports scope, --yes gates non-TTY batch. Close events now persist outcome/outcome_tag in meta and upsert restores them, so a recorded outcome survives a rebuild_state replay. claude-memory-b12 claude-memory-3ro Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Unix-only integration test drives the real claude-p path with a fake `claude` on PATH returning a canned judgment: a junk title (#: 5) is retitled and the task is closed with a persisted outcome, verified through `pack`. Cross-platform logic stays covered by finalize.rs units. claude-memory-jky Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…se+batch) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Turns
task-journal completefrom a thindream --taskalias into a finalizer for legacy tasks — the ones created before live journaling, with junk auto-titles, holey histories, and leftopenthough long done.complete <id>(single)dreamsweep still sees old sessions for untouched tasks).dedup_guardkeeps re-runs from duplicating events. Skipped with--quick.{retitle, title, done, outcome_tag, outcome, reason}. The model decides from content — heuristics can't tell a natural-language title fragment ("пТак обясни…") from a real title.Renameevent when the current title is junk; a good human title is left alone. No preview — append-only keeps the old.Closeevent only when the events clearly show the task is done; unclear tasks stay open with the model's reason. Artifacts are picked up automatically as enriched events are indexed.complete(no id — batch)Numbered list of open tasks (
id · event/session counts · title) → exclude by number → confirm with count → finalize the rest. Not-done tasks stay open and are listed at the end.--quickskips enrich,--dry-runreports scope without calling the model,--yesis required without a TTY (so a hook can't mass-close unattended).New / changed building blocks
EventType::Rename— updatestasks.titleon replay (latest wins); fixes junk titles without mutating the append-only log.finalize.rs— the judge: prompt build, fence-tolerant JSON parse, title-gating, tag normalization. Pluggable viallm::LlmBackend(Haiku default).Closeevents carryoutcome/outcome_tagin meta andrebuild_staterestores them (previously aset_task_outcomeDB write that a rebuild silently dropped).Tests
finalize.rsunits: parse (plain/fenced/prose), title-gating, tag fallback, judge-via-mock — cross-platform.dbunits:Renameupdates title;Closerestores outcome from meta.--yesgate, batch dry-run listing, and a Unix-only end-to-end run through the real claude-p path with a fakeclaudeon PATH proving junk-title → retitle → close-with-outcome viapack.Full local gate green:
fmt --check,clippy --workspace --all-targets -D warnings,test --workspace, lean--no-default-featuresbuild.🤖 Generated with Claude Code