Repository navigation
Description
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
}) → void2. 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
- ACP implementation:
packages/opencode/src/acp/agent.ts - TUI session picker:
packages/opencode/src/cli/cmd/tui/ - Session storage:
~/.local/share/opencode/storage/session/ - Related discussion: Zed ACP integration (Integration with zed agentic-coding-protocol #892, Opencode in Zed editor #3353)
Environment
- OpenCode version: 1.1.23
- Zed extension: opencode (from extension marketplace)
- OS: Linux
Activity
github-actions commentedon Jan 16, 2026
This issue might be a duplicate of existing issues. Please check:
Additionally, for keybind-related aspects of this request, please also check our pinned keybinds documentation: #4997
Add session management types for ACP protocol
Add ACP session management handlers
Register session management tools in ACP agent server
Implement session management handlers for ACP
Fix agent.ts - Correct session management imports and handlers
xsa-dev commentedon Jan 30, 2026
PR with Implementation Available 🎉
Hi @thdxr! This feature request has a working implementation ready for review:
PR: xsa-dev#1
Branch:
feat/acp-session-management-v2What the PR adds:
✅ 13 Session Management ACP Commands:
listSessions- List all available sessionsswitchSession- Switch to a different sessioncreateSession- Create a new sessionforkSession- Fork the current sessionrenameSession- Rename a sessiondeleteSession- Delete a sessiongetSessionInfo- Get information about a sessionundoMessage- Undo the last messageredoMessage- Redo the last messagecompactSession- Compact the sessionexportSession- Export a session (text/json/markdown)jumpToMessage- Jump to a specific messageduplicateSession- Duplicate a sessionFiles Changed:
packages/opencode/src/acp/agent.ts- ACP command registration and handlerspackages/opencode/src/acp/session-handlers.ts- Session management implementationspackages/opencode/src/acp/session-types.ts- TypeScript interfacesUsage Example:
Notes from Author:
This is a simplified implementation that uses file-based storage for sessions. Future work could integrate with OpenCode's internal session storage via SDK for more robust session management.
Related Feature Requests:
The PR is mergeable and ready for review. Let me know if you need any changes!
xsa-dev commentedon Jan 30, 2026
Note: This implementation was AI-generated using OpenCode itself! 🤖✨
PR with Implementation Available 🎉
Hi @thdxr! This feature request has a working implementation ready for review:
PR: xsa-dev#1
Branch:
feat/acp-session-management-v2What the PR adds:
✅ 13 Session Management ACP Commands:
listSessions- List all available sessionsswitchSession- Switch to a different sessioncreateSession- Create a new sessionforkSession- Fork the current sessionrenameSession- Rename a sessiondeleteSession- Delete a sessiongetSessionInfo- Get information about a sessionundoMessage- Undo the last messageredoMessage- Redo the last messagecompactSession- Compact the sessionexportSession- Export a session (text/json/markdown)jumpToMessage- Jump to a specific messageduplicateSession- Duplicate a sessionFiles Changed:
packages/opencode/src/acp/agent.ts- ACP command registration and handlerspackages/opencode/src/acp/session-handlers.ts- Session management implementationspackages/opencode/src/acp/session-types.ts- TypeScript interfacesUsage Example:
Notes from Author:
This is a simplified implementation that uses file-based storage for sessions. Future work could integrate with OpenCode's internal session storage via SDK for more robust session management.
Related Feature Requests:
The PR is mergeable and ready for review. Let me know if you need any changes!
feat(acp): Expose TUI Session Management Commands via ACP (anomalyco#…
jackeydou commentedon Feb 13, 2026
I saw there was another merged PR that implements session/list and session/fork, I am still wondering if it's possible that opencode acp can support session export and import like opencode CLI?
feat: implement session/resume RPC for OpenCode
github-actions commentedon Apr 15, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.