Skip to content

Persistent shell mode - keep shell session alive after executing commands #7750

@everhopingandwaiting

Description

@everhopingandwaiting

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Description

Problem

Currently, when using the ! command to enter shell mode in opencode TUI, the shell session exits immediately after executing a single command. This requires users to repeatedly type ! to execute multiple shell commands, which disrupts workflow efficiency.

Current Behavior

  1. Type ! to enter shell mode
  2. Execute a command (e.g., ls -la)
  3. Shell automatically exits and returns to opencode TUI
  4. Must type ! again for the next command

Expected Behavior

Option to keep shell session persistent:

  1. Type ! to enter shell mode
  2. Execute multiple commands without re-entering shell mode
  3. Use exit or ctrl+d to manually exit shell mode

Use Cases

  • Rapid file system exploration requiring multiple ls, cd, find commands
  • Git operations requiring multiple commands (git status, git log, git diff)
  • Development workflow with multiple build/test commands
  • System administration tasks requiring multiple shell commands

Proposed Solutions

  1. Persistent Shell Mode Toggle: Add a configuration option to enable persistent shell mode
  2. Shell Mode Indicator: Visual indicator showing when in shell mode
  3. Graceful Exit: Use exit command or ctrl+d to leave persistent shell mode
  4. Command History: Maintain shell command history across sessions

Implementation Ideas

  • Environment variable: OPENCODE_PERSISTENT_SHELL=true
  • Config file option: tui.persistent_shell: true
  • Command toggle: /persistent-shell to enable/disable mode
  • Visual indicator in status bar when in persistent shell mode

Benefits

  • Improved workflow efficiency for multi-command operations
  • Reduced context switching between opencode and shell
  • Better user experience for shell-heavy workflows
  • Maintains opencode's integration benefits while providing shell flexibility

Operating System

All platforms (Linux, macOS, Windows)

Terminal

All supported terminals

OpenCode Version

Latest version (1.x)


Additional Notes

This issue is related to the current shell mode implementation where the ! command provides temporary shell access but exits after each command execution. The request is to enhance this feature to support persistent shell sessions for improved developer productivity.

References

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussionopentuiThis relates to changes in v1.0, now that opencode uses opentui

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