Skip to content

Persist live comments so a Hunk review session can be continued after quit #113

@benvinegar

Description

@benvinegar

Problem

If you quit Hunk, you lose your live agent comments for that review session.

That makes longer review workflows fragile: comments are useful precisely because they accumulate context, but today that context appears to be tied to the lifetime of the live session.

Current implementation notes

Relevant pieces:

  • feat: add live session comment lifecycle #53feat: add live session comment lifecycle
  • src/mcp/sessionRegistration.ts
    • createInitialSessionSnapshot() starts each session with liveComments: []
  • src/mcp/daemonState.ts
    • session snapshots are tracked in daemon memory while the session is connected

That is great for live coordination, but there does not appear to be a persistence / restore path for comments or session state after the TUI exits.

Desired behavior

There should be a way to continue a previous Hunk review session and restore its live comments (and ideally related state like the focused file/hunk).

The UX could be something like:

  • hunk --continue-session
  • hunk session resume ...
  • or another explicit restore flow

Scope suggestions

Persist at least:

  • review input identity (working tree / show ref / patch file / etc.)
  • live comments
  • selected file / selected hunk
  • maybe note visibility / other lightweight view state

A local-only sidecar under .hunk/ seems like a reasonable starting point.

Acceptance criteria

  • A user can quit Hunk and later reopen the same review with comments restored.
  • Restored sessions reconnect to the same review input, not just the same repo.
  • Restoring a session also restores the current focus when possible.
  • There is an explicit way to discard stale/old saved sessions.
  • Add coverage for saving and restoring at least one live-comment session.

Notes

This issue is about persistence of review context, not only daemon uptime. Even if the daemon exits cleanly, users should still be able to resume a meaningful review later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentsAgent-to-hunk communication (MCP, selections, comments)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions