Skip to content

feat(chat): /handoff command for cross-session continuity #242

@cniska

Description

@cniska

What would you like?

A /handoff command that summarizes the current session, lets the user review the summary, then starts a new session with that summary injected as the first message. The next agent instance should start with the relevant intent, decisions, and next steps without requiring a manual clipboard workflow.

Additionally, a session-handoff tool should let the model request a handoff when it detects context saturation. The tool should not mutate sessions directly; it should hand control back to the chat harness so the user can review and confirm the same handoff flow.

Motivation

/new wipes context with no continuity. The current manual alternative is to summarize, copy, clear context, and paste the summary into a fresh session. That is error-prone and easy to forget. A native /handoff lets Acolyte own both sides of the transition while preserving the user's ability to review the summary before the destructive reset.

The model is also aware of its own context pressure. A session-handoff tool lets it request a handoff proactively, but the harness should still own confirmation and session mutation.

Proposed approach

/handoff command

Use a harness-owned two-phase flow:

  1. User runs /handoff.
  2. The harness generates a draft handoff summary with a dedicated internal summary prompt, not a normal agent task.
  3. The summary is shown in the transcript for review.
  4. A small picker asks the user to either start the new session or cancel.
  5. On confirm, the harness creates a new session, injects the summary as the first conversational message, switches to it, clears/redraws the transcript, resets token usage, and persists.
  6. On cancel, the current session remains untouched.

The injected summary should be a normal user message, not a system message, because current history assembly filters system messages out of model context.

Summary format

Base the internal prompt on the existing handoff skill format:

# Session summary - <branch or topic>

## What was built
<bullet list: files changed, features added, decisions made>

## Design decisions
<any non-obvious choices and why they were made>

## What's next
<concrete next steps enough for a cold start>

The summary should be dense and self-contained. Preserve intent, decisions, blockers, verification already run, and immediate next steps. Omit file contents, diffs, raw command output, and anything easily recovered from code, docs, git log, or the issue.

If the session began with a prior handoff summary, merge still-relevant carried-forward context into the new summary instead of appending the old summary verbatim.

session-handoff tool

Add a model-callable tool that requests handoff rather than executing it directly. Tool execution happens in the lifecycle/server path, while active session state and transcript ownership live in the chat harness, so direct mutation from the tool would risk client/server drift.

The tool should return a structured result such as session-handoff-requested with a reason. The harness can then surface the request, generate the same reviewable summary, and require explicit user confirmation before starting the new session.

Scope

  • src/chat-commands.ts/handoff command entry point
  • src/chat-slash.ts — slash command registration/help
  • src/i18n/en.ts — user-facing strings
  • Chat picker flow/state for confirm/cancel
  • Session summary generation via internal prompt
  • src/session-toolkit.ts — non-mutating session-handoff request tool
  • Tests for command flow, slash suggestions/help, and tool registration/contract

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions