Skip to content

feat(acp): add persisted session list and load support - #1116

Open
giuliastro wants to merge 4 commits into
PrimeIntellect-ai:mainfrom
giuliastro:agent/acp-session-list-load
Open

feat(acp): add persisted session list and load support#1116
giuliastro wants to merge 4 commits into
PrimeIntellect-ai:mainfrom
giuliastro:agent/acp-session-list-load

Conversation

@giuliastro

@giuliastro giuliastro commented Aug 10, 2026

Copy link
Copy Markdown

Summary

Add standard ACP persisted-session discovery and loading to Prime Agent.

  • advertise sessionCapabilities.list and loadSession
  • implement session/list over the existing AgentConnection.listSavedSessions() registry
  • support optional cwd filtering and opaque cursor pagination
  • implement session/load via AgentConnection.switchSession()
  • replay persisted user/assistant text as standard ACP session/update chunks
  • keep the existing one-active-session-per-connection invariant
  • add protocol-level tests and update ACP documentation

Motivation

ACP session/list is now stable and gives clients a standard way to discover agent-owned persisted sessions. Prime Agent already exposes the required saved-session primitives internally (listSavedSessions and switchSession), so supporting this at the ACP boundary avoids client-specific session registries and adapters.

This is useful for editors, remote clients and other ACP consumers that want to browse and reopen Prime Agent sessions without depending on Prime-specific filesystem knowledge.

Behavior

session/list returns persisted Prime Agent session IDs, cwd, title and modification timestamp. Results are filtered by cwd when supplied and paginated with an opaque cursor.

session/load resolves the ACP sessionId through Prime Agent's saved-session registry, switches the underlying AgentConnection, subscribes to live updates, and replays persisted user/assistant text before returning.

The ACP process still hosts only one active session at a time. Clients must session/close before creating or loading another session on the same connection.

Tests

Added acp-sessions.test.ts covering persisted-session listing/filtering and load/history replay.

Note

Add session/list and session/load support to ACP mode

  • Adds a session/list handler that returns persisted sessions with optional cwd filtering and cursor-based pagination (page size 50).
  • Adds a session/load handler that switches to a saved session by ID and replays prior user/assistant text messages as session/update notifications before returning.
  • Only one active session is allowed per connection; session/new or session/load is refused while a session is active.
  • The initialize response now advertises loadSession: true and the list session capability.
  • Behavioral Change: non-text content from prior messages is omitted during replay on session/load.

Macroscope summarized c172efb.

@giuliastro
giuliastro marked this pull request as ready for review August 10, 2026 06:51
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