Agent Session Handoff
@twonines/agent-session-handoffv2026.08.16.1
01README
Unified session capture, normalisation, summarisation, and cross-agent handoff for kiro, opencode, pi, and claude coding-agent sessions. Reads each tool's native session store, normalises to a shared schema, stores as versioned swamp data, and exports/imports portable JSON bundles so any agent can resume where another left off.
Methods
- list_sessions — discover available sessions for a tool, with metadata - capture — read a native session, normalise, and store as versioned data - export — produce a portable JSON bundle from a captured session - import — ingest a portable bundle back into swamp data
02Models
@twonines/agent-session-handoffv2026.08.16.1agent_session_handoff.ts
fn list_sessions(tool: enum, filterDir?: string, limit: number)
Discover available sessions for a given agent tool (kiro, opencode, pi, claude) with metadata. Scans the native session store and returns a summary list.
| Argument | Type | Description |
|---|---|---|
| tool | enum | Which agent tool's sessions to list |
| filterDir? | string | Only list sessions from this project directory (pi, claude only) |
| limit | number | Maximum number of sessions to return |
fn capture(tool: enum, sessionId?: string, filePath?: string, summary?: string)
Read a native session, normalise it to the shared schema, and store as versioned swamp data. Returns the session name for use in export.
| Argument | Type | Description |
|---|---|---|
| tool | enum | Which agent tool's session to capture |
| sessionId? | string | Session ID (UUID). If not provided, uses the most recent session for the tool. |
| filePath? | string | Direct path to a session JSONL file (overrides sessionId lookup) |
| summary? | string | Optional summary of the session intent and progress. If not provided, the first user message is used as title. |
fn export_bundle(sessionName: string)
Export a previously captured session as a portable JSON bundle file that can be imported by any agent. The bundle includes full session metadata and normalised turns.
| Argument | Type | Description |
|---|---|---|
| sessionName | string | Name of a previously captured session (from capture output) |
fn import_bundle(bundlePath: string)
Import a portable JSON bundle (from another agent's export) into swamp data, making it available for the current agent to reference.
| Argument | Type | Description |
|---|---|---|
| bundlePath | string | Path to a portable JSON bundle file to import |
fn handoff_to(sessionName: string, target: enum, projectDir?: string, additionalContext?: string)
Hand off a captured session to another agent by generating a structured markdown context file and writing it to the target agent's auto-loaded context location. The target agent will pick up this context automatically on its next session start.
| Argument | Type | Description |
|---|---|---|
| sessionName | string | Name of a previously captured session (from capture output) |
| target | enum | Target agent to hand off to |
| projectDir? | string | Project directory for the target agent. Defaults to the session's original directory. |
| additionalContext? | string | Extra instructions or context to include in the handoff file |
Resources
session(infinite)— A captured and normalised agent session with metadata and turns
sessionList(5m)— Discovered sessions for a given tool
handoffOutput(7d)— Metadata about a completed handoff — where the context file was written and for which target agent
Files
bundle(application/json)— Portable JSON bundle for cross-agent handoff — importable by any agent
03Stats
A
100 / 100
Downloads
0
Archive size
26.2 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned
04Platforms
05Labels