Feature hasn't been suggested before.
Describe the enhancement you want to request
Problem Description
OpenCode currently has the following limitations when managing sub-agent sessions:
- No Auto-Discovery Mechanism - The bottom bar/status line does not automatically display sub-session count and status
- Inefficient Manual Switching - Requires
<leader>right/left to cycle through sessions one by one
- No Auto-Switch Support - Focus does not automatically switch when sub-tasks are created or completed
- Poor Status Visibility - Cannot quickly identify which sub-session is awaiting permission or has completed
Current Status Analysis
Session Navigation Capabilities
| Feature |
Status |
Issue/PR |
| Manual Cycle Switch |
✅ Supported |
Built-in |
| Dialog Picker |
🔄 In Progress |
#6183 / PR #6184 |
| Sidebar Display |
🔄 Partial |
#5242 / PR #4865 |
| Tab Bar Navigation |
🟢 Discussion |
#5826 |
| Tree Manager |
🟢 Discussion |
#6032 |
Auto-Switch Capabilities
| Feature |
Status |
Issue |
| Auto-Switch on Sub-Task Create |
❌ Not Supported |
#6282 (Closed) |
| Auto-Return on Sub-Task Complete |
❌ Not Supported |
#6282 (Closed) |
| Auto-Focus on Permission Request |
❌ Not Supported |
- |
Status Display Capabilities
| Feature |
Status |
Issue |
| Background Task Status |
🔄 In Progress |
#8322 |
| Running Tools & LLM Status |
🔄 In Progress |
#9655 |
| Sub-Agent Info (ACP) |
🟢 Requested |
#11576 |
Proposed Solution
Option 1: Bottom Bar Auto-Discovery + Quick Switch (Recommended)
1. Bottom Bar Auto-Discovery of Sub-Sessions
Automatically display sub-session summary in the status line:
┌─────────────────────────────────────────────────┐
│ [conversation content] │
│ > prompt input │
├─────────────────────────────────────────────────┤
│ build │ claude-sonnet │ 3 sub[1⏳ 2✓] │ $0.02 │
└─────────────────────────────────────────────────┘
Display Content:
- Total sub-session count
- Permission pending count (⏳)
- Completed count (✓)
- Active/busy count (⟳)
2. Click/Shortcut Quick Switch
// Configuration Example
{
"tui": {
"status_line": {
"subsession": {
"enabled": true,
"click_action": "switch_next",
"shortcuts": {
"switch_next": "ctrl+]",
"switch_prev": "ctrl+[",
"switch_picker": "<leader>s",
"auto_switch": true
}
}
}
}
}
3. Auto-Switch Rules
// Auto-Switch Configuration
{
"subsession": {
"auto_switch": {
"on_create": true, // Auto-switch when sub-session created
"on_permission": true, // Auto-focus when sub-session awaits permission
"on_complete": true, // Auto-return to parent when sub-session completes
"on_error": false, // Switch on sub-session error
"exclude_agents": [] // Exclude specific agent types
}
}
}
4. Plugin API Extension
// Plugin Sub-Session Event Subscription
export type PluginInput = {
// ... existing fields
subsession: {
// Get child sessions of current session
list: () => Promise<SubSessionInfo[]>;
// Switch to specific sub-session
switch: (sessionID: string) => Promise<void>;
// Get parent session
getParent: () => Promise<SessionInfo | null>;
// Subscribe to sub-session changes
on: (event: 'created' | 'updated' | 'deleted' | 'permission',
handler: (info: SubSessionInfo) => void) => void;
}
}
interface SubSessionInfo {
sessionID: string;
parentID: string;
agent: string;
status: 'idle' | 'busy' | 'permission_pending' | 'completed' | 'error';
createdAt: number;
updatedAt: number;
title?: string;
}
Option 2: Complete Session Management System
Reference #6032 Nerdtree style, implement full tree session manager:
Sessions (Sidebar)
├─ ● Main Session (build)
│ ├─ ◉ explore-task (waiting permission)
│ ├─ ✓ code-review (completed)
│ └─ ⟳ write-tests (busy)
└─ ○ Other Session (plan)
Option 3: Tab Bar Navigation
Reference #5826, implement horizontal tab bar:
[Main ●] [explore ◉] [review ✓] [tests ⟳] [+ ]
Use Cases
Use Case 1: Parallel Multi-Task Development
User launches multiple sub-tasks:
1. Frontend development task
2. Backend API task
3. Test writing task
Bottom bar displays: 3 sub [1⏳ 1⟳ 1✓]
User can quickly switch to check each task's progress
Use Case 2: Permission Request Auto-Focus
When sub-session needs permission confirmation:
- Auto-switch to that sub-session
- Bottom bar highlights ⏳ icon
- Auto-return to original session after user confirmation
Use Case 3: Plugin Sub-Task Monitoring
export const SubSessionMonitor = async ({ client }) => {
client.subsession.on('permission', (info) => {
client.tui.showToast({
message: `Sub-task "${info.title}" requires permission`,
variant: 'warning'
});
});
client.subsession.on('complete', (info) => {
// Log sub-task completion metrics
logSubSessionMetrics(info);
});
};
Benefits
- Efficiency Improvement - Reduce session switching time by 70%+
- Status Visibility - Real-time awareness of all sub-session states
- Automation - Reduce manual operations, focus on core tasks
- Plugin-Friendly - Provide complete API for plugin extension
- Backward Compatible - Optional feature, does not affect existing workflows
Technical Implementation Suggestions
1. Status Line Integration
// packages/tui/src/status-line.ts
function renderSubSessionInfo() {
const children = sync.session.getChildren(currentSessionID);
const stats = {
total: children.length,
permission: children.filter(c => hasPermissionPending(c.id)).length,
busy: children.filter(c => isBusy(c.id)).length,
completed: children.filter(c => isCompleted(c.id)).length,
};
return `${stats.total} sub[${stats.permission}⏳ ${stats.completed}✓]`;
}
2. Auto-Switch Logic
// packages/opencode/src/session/switch.ts
async function handleSubSessionEvent(event: SubSessionEvent) {
const config = await getConfig();
if (event.type === 'permission' && config.subsession.auto_switch.on_permission) {
await switchToSession(event.sessionID);
}
if (event.type === 'complete' && config.subsession.auto_switch.on_complete) {
const parent = await getSession(event.sessionID).parentID;
if (parent) await switchToSession(parent);
}
}
3. Plugin Event Subscription
// packages/plugin/src/hooks.ts
export const SessionHooks = {
'subsession.created': async (info: SubSessionInfo) => { ... },
'subsession.updated': async (info: SubSessionInfo) => { ... },
'subsession.deleted': async (info: SubSessionInfo) => { ... },
'subsession.permission': async (info: SubSessionInfo) => { ... },
};
Related Issues
Priority Recommendations
- High Priority: Bottom bar sub-session status display + shortcut switching
- Medium Priority: Auto-switch rules (create/permission/complete)
- Low Priority: Plugin API extension + complete tree manager
Configuration Example
{
"$schema": "https://opencode.ai/config.json",
"tui": {
"status_line": {
"enabled": true,
"subsession": {
"enabled": true,
"format": "{total} sub[{permission}⏳ {completed}✓]",
"auto_switch": {
"on_create": false,
"on_permission": true,
"on_complete": true
}
}
}
}
}
References
- Claude Code sub-task management
- VS Code terminal tab management
- tmux/screen session management
- kitty terminal tab system
Feature hasn't been suggested before.
Describe the enhancement you want to request
Problem Description
OpenCode currently has the following limitations when managing sub-agent sessions:
<leader>right/leftto cycle through sessions one by oneCurrent Status Analysis
Session Navigation Capabilities
Auto-Switch Capabilities
Status Display Capabilities
Proposed Solution
Option 1: Bottom Bar Auto-Discovery + Quick Switch (Recommended)
1. Bottom Bar Auto-Discovery of Sub-Sessions
Automatically display sub-session summary in the status line:
Display Content:
2. Click/Shortcut Quick Switch
3. Auto-Switch Rules
4. Plugin API Extension
Option 2: Complete Session Management System
Reference #6032 Nerdtree style, implement full tree session manager:
Option 3: Tab Bar Navigation
Reference #5826, implement horizontal tab bar:
Use Cases
Use Case 1: Parallel Multi-Task Development
Use Case 2: Permission Request Auto-Focus
Use Case 3: Plugin Sub-Task Monitoring
Benefits
Technical Implementation Suggestions
1. Status Line Integration
2. Auto-Switch Logic
3. Plugin Event Subscription
Related Issues
Priority Recommendations
Configuration Example
{ "$schema": "https://opencode.ai/config.json", "tui": { "status_line": { "enabled": true, "subsession": { "enabled": true, "format": "{total} sub[{permission}⏳ {completed}✓]", "auto_switch": { "on_create": false, "on_permission": true, "on_complete": true } } } } }References