Skip to content

[feat] polylogue resume <session-id> — reconstruct work-state context for fresh agent #309

Closed

Description

@Sinity

Problem

After a reboot, crash, context compaction, or model handoff, a fresh agent session should be able to recover the work state for a task without rereading raw transcripts or relying on private scratch files.

Polylogue already stores the raw conversations and now has durable session products: profiles, enrichments, work events, phases, and work threads. The missing surface is a focused resume brief that composes those facts into an operator-safe handoff.

Strengthened scope

Build polylogue resume <session-id> as a typed product-backed command, not just a rendered transcript summary.

The first vertical slice should:

  • resolve abbreviated or full conversation/session IDs through the existing repository lookup path;
  • build a ResumeBrief domain object in the archive/product layer before adding CLI rendering;
  • include target-session facts: ID, provider, title, timestamps, parent/continuation metadata, message count, repository/path signals, branch names, tags, tool counts, and last-message state;
  • include semantic evidence when available: session profile, enrichment intent/outcome/blockers, work events, phases, and matching work-thread context;
  • distinguish evidence categories explicitly: facts from stored conversation rows, inferred state from session products, and uncertainty/next-step candidates;
  • include nearby related sessions from the same thread/continuation path and same work-thread session IDs where available, while keeping the output compact;
  • support --json/root --format json for machine handoff and a readable plain renderer for human terminal use;
  • degrade clearly when session products are not materialized, with repair guidance rather than traceback or silent omission;
  • avoid network access, live provider calls, or private scratch/log dependencies.

Non-goals

Relation

Adjacent to #313, which models richer session clusters and work threads. This issue should land the resume-first vertical slice using existing thread/product evidence, leaving richer clustering heuristics for later.

Acceptance criteria

  • polylogue resume <session-id> returns a concise handoff brief for a known archived session.
  • polylogue --format json resume <session-id> emits a stable JSON envelope with facts, inferences, related_sessions, uncertainties, and next_steps fields.
  • The plain output names facts and inferred state separately and includes the likely next step when evidence supports one.
  • Missing session-product rows produce an explicit availability/repair note instead of failing the whole command.
  • Tests cover an interrupted/continued work fixture, a normal single-session fixture, JSON output, missing-session behavior, and product-unavailable degradation.
  • Generated CLI docs, terminal snapshots, and command/proof catalog surfaces are refreshed.

Activity

  1. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Execution start log:

    I strengthened the issue before implementation per the current directive. The widened target is now a typed product-backed resume brief rather than a one-off text renderer.

    Initial implementation stance:

    • Build the resume domain object below CLI first, using stored conversation facts and existing session products where available.
    • Keep [research] Session-cluster / work-thread concept — group conversations on same task #313 out of scope: related sessions can use existing parent/session-tree and work-thread IDs, not new clustering research.
    • Provide both human plain output and a stable JSON envelope for machine handoff.
    • Treat missing product materialization as an explicit uncertainty/repair note, not a hard failure.

    I am starting from fresh and will open a focused PR for #309.

  2. Sinity commented on Apr 23, 2026

    @Sinity
    OwnerAuthor

    Implemented in PR #379.

    Execution notes:

    • Added a typed ResumeBrief assembly layer in polylogue/archive_resume.py instead of rendering transcripts directly from the CLI.
    • Wired the brief through ArchiveOperations, the facade, and polylogue resume <session-id> with plain and JSON output.
    • Included session facts, product-derived inferences, work events, phase summaries, work-thread context, related sessions, uncertainties, and next-step hints.
    • Avoided raw conversation IDs in FTS by using normalized FTS plus exact fallback over stored work-thread session_ids.
    • Refreshed CLI docs, proof catalog, quality projections, showcase baselines, and terminal snapshots.

    Verification recorded on the PR: final devtools verify passed, focused resume/help tests passed, showcase baselines matched, generated surfaces were in sync, and the push hook quick baseline passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clitype:feat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions