Skip to content

Feature: Expose TUI Session Management Commands via ACP (for Zed integration) #8931

@KristjanMinn

Description

@KristjanMinn

Summary

Expose OpenCode's TUI session management features (session list, switch session, new session, rename, fork, etc.) through the ACP (Agent Client Protocol) so they can be used in external clients like Zed's agent panel.

Problem

When using OpenCode via Zed's agent panel (or any ACP client), users lose access to the powerful session management features available in the TUI:

TUI Command Palette (Ctrl+P) features NOT available in ACP:

Feature TUI ACP/Zed
Switch session Ctrl+X L ❌ Not available
New session Ctrl+X N ❌ Not available
Rename session Ctrl+R ❌ Not available
Fork from message menu ❌ Not available
Compact session Ctrl+X C /compact only
Undo/redo message Ctrl+X U/R ❌ Not available
Export session Ctrl+X X ❌ Not available
Copy session transcript menu ❌ Not available
Jump to message Ctrl+X G ❌ Not available

This creates a significant UX gap between TUI and Zed users. Zed users cannot:

  1. Resume previous sessions
  2. Switch between active sessions
  3. Fork conversations at specific points
  4. Navigate session history

Current Architecture

Zed Editor
    │
    │ launches: opencode acp
    │ communicates via: JSON-RPC over stdio (ACP)
    ▼
OpenCode ACP Server (headless)
    │
    │ HTTP SDK API
    ▼
OpenCode Server (sessions exist here)

The TUI is a completely separate code path. ACP runs headless with no access to TUI components.

Proposed Solution

Extend the ACP protocol to expose session management operations:

1. New ACP Methods

// List available sessions
acp.session.list({ 
  limit?: number,
  projectPath?: string 
})  Session[]

// Switch to existing session
acp.session.switch({ 
  sessionId: string 
})  void

// Create new session
acp.session.create({ 
  title?: string 
})  Session

// Fork session from specific message
acp.session.fork({ 
  sessionId: string,
  messageId: string 
})  Session

// Rename session
acp.session.rename({ 
  sessionId: string,
  title: string 
})  void

// Delete session
acp.session.delete({ 
  sessionId: string 
})  void

// Get session info
acp.session.info({ 
  sessionId: string 
})  SessionInfo

// Undo last message
acp.session.undo({ 
  sessionId: string 
})  void

// Redo message
acp.session.redo({ 
  sessionId: string 
})  void

2. Zed Integration

These methods would allow Zed to:

  • Show a session picker in the agent panel UI
  • Add keybindings for session operations
  • Display session history in the sidebar
  • Enable "Continue previous session" workflows

3. Backward Compatibility

This is purely additive — existing ACP clients continue to work unchanged.

Use Cases

  1. Resume work across sessions: User opens Zed, wants to continue yesterday's refactoring session instead of starting fresh

  2. Context switching: User working on feature A needs to quickly answer a question about feature B, then return to A

  3. Branching conversations: User wants to try two different approaches from the same starting point

  4. Session organization: User wants to rename "ACP Session 447d300d-e99b-41ae..." to "Auth refactor discussion"

References

Environment

  • OpenCode version: 1.1.23
  • Zed extension: opencode (from extension marketplace)
  • OS: Linux

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions