opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Persistent shell mode - keep shell session alive after executing commands

Open everhopingandwaiting opened this issue 4 days ago • 2 comments

Feature hasn't been suggested before.

  • [x] 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

  • Related to issue #6248 about shell mode selection problems
  • Complements the existing bash command functionality documented at https://opencode.ai/docs/tui#bash-commands
  • Aligns with opencode's goal of providing seamless development workflow integration

everhopingandwaiting avatar Jan 11 '26 05:01 everhopingandwaiting