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:
- Resume previous sessions
- Switch between active sessions
- Fork conversations at specific points
- 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
-
Resume work across sessions: User opens Zed, wants to continue yesterday's refactoring session instead of starting fresh
-
Context switching: User working on feature A needs to quickly answer a question about feature B, then return to A
-
Branching conversations: User wants to try two different approaches from the same starting point
-
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
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:
Ctrl+X LCtrl+X NCtrl+RCtrl+X C/compactonlyCtrl+X U/RCtrl+X XCtrl+X GThis creates a significant UX gap between TUI and Zed users. Zed users cannot:
Current Architecture
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
2. Zed Integration
These methods would allow Zed to:
3. Backward Compatibility
This is purely additive — existing ACP clients continue to work unchanged.
Use Cases
Resume work across sessions: User opens Zed, wants to continue yesterday's refactoring session instead of starting fresh
Context switching: User working on feature A needs to quickly answer a question about feature B, then return to A
Branching conversations: User wants to try two different approaches from the same starting point
Session organization: User wants to rename "ACP Session 447d300d-e99b-41ae..." to "Auth refactor discussion"
References
packages/opencode/src/acp/agent.tspackages/opencode/src/cli/cmd/tui/~/.local/share/opencode/storage/session/Environment