Skip to content

feat: complete finalizes tasks — enrich, retitle, close-if-done, batch (0.22.0)#39

Merged
Shahinyanm merged 5 commits into
mainfrom
feat/complete-finalize
Jun 13, 2026
Merged

feat: complete finalizes tasks — enrich, retitle, close-if-done, batch (0.22.0)#39
Shahinyanm merged 5 commits into
mainfrom
feat/complete-finalize

Conversation

@Shahinyanm

Copy link
Copy Markdown
Member

What

Turns task-journal complete from a thin dream --task alias into a finalizer for legacy tasks — the ones created before live journaling, with junk auto-titles, holey histories, and left open though long done.

complete <id> (single)

  1. Enrich — re-read the sessions that touched the task and append the decisions/findings live capture missed. Task-scoped: it does not read or advance the project-global dream watermark, so tasks finalize independently (and a later dream sweep still sees old sessions for untouched tasks). dedup_guard keeps re-runs from duplicating events. Skipped with --quick.
  2. Judge — one LLM call over the task's full (now-enriched) history returns {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.
  3. Retitle — a Rename event when the current title is junk; a good human title is left alone. No preview — append-only keeps the old.
  4. Close — a Close event 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. --quick skips enrich, --dry-run reports scope without calling the model, --yes is required without a TTY (so a hook can't mass-close unattended).

New / changed building blocks

  • EventType::Rename — updates tasks.title on 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 via llm::LlmBackend (Haiku default).
  • Close outcome is now durableClose events carry outcome/outcome_tag in meta and rebuild_state restores them (previously a set_task_outcome DB write that a rebuild silently dropped).

Tests

  • finalize.rs units: parse (plain/fenced/prose), title-gating, tag fallback, judge-via-mock — cross-platform.
  • db units: Rename updates title; Close restores outcome from meta.
  • CLI integration: dry-run scope, unknown-id error, batch TTY/--yes gate, batch dry-run listing, and a Unix-only end-to-end run through the real claude-p path with a fake claude on PATH proving junk-title → retitle → close-with-outcome via pack.

Full local gate green: fmt --check, clippy --workspace --all-targets -D warnings, test --workspace, lean --no-default-features build.

🤖 Generated with Claude Code

Shahinyanm and others added 5 commits June 13, 2026 19:24
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>
@Shahinyanm Shahinyanm merged commit b2e6141 into main Jun 13, 2026
7 checks passed
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.

1 participant