opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Feature Request: Add `tmux` Support for Multi-Session Agent Testing

Open sandipwane opened this issue 6 months ago • 3 comments

⚠️ Note: I understand from the contribution guidelines that core features need to go through a design process with the core team. I'm opening this issue to start that discussion and gauge interest, not planning to submit a PR without approval.

Summary

Enable OpenCode to manage multiple persistent terminal sessions through tmux integration, allowing it to handle complex workflows with parallel processes, persistent environments, and interactive CLI testing.

Current Limitations

  • No persistence: Can't keep servers running while coding
  • No parallelism: Can't run tests while dev server is active
  • No interactive testing: Can't test CLIs that require user input
  • No real-time monitoring: Can't observe and react to process output

Proposed Solution

Integrate tmux to enable:

  • Multiple persistent terminal sessions
  • Parallel process execution
  • Send keystrokes/input to sessions (crucial for CLI testing)
  • Real-time output monitoring
  • Session switching and management

Key Benefits

1. Interactive CLI Testing

# OpenCode can now test CLIs that require user input\!
Session 1: npm init
  → Send: "my-app" (project name)
  → Send: "1.0.0" (version)
  → Send: "yes" (confirm)

2. Full-Stack Development

Run entire stack in parallel:

  • Frontend: npm run dev
  • Backend: node server.js
  • Database: redis-server
  • Tests: npm test --watch

3. Real-World Example

Current: "I can't fully test this auth flow because I'd need Redis running..."

With tmux: OpenCode starts Redis, runs the app, tests auth flow, monitors sessions, and confirms: "Auth flow tested successfully with proper session storage."

Implementation

Tmux provides a clean API for this functionality:

  • Create/manage named sessions
  • Send keystrokes to sessions (tmux send-keys)
  • Capture output from sessions (tmux capture-pane)
  • Check session status and health

This would be backwards compatible - OpenCode would detect tmux availability and fall back to current behavior if not present.

Why This Matters

  • GitHub Copilot/Cursor/Aider: None support multiple persistent sessions
  • Real Development: Developers always have multiple terminals open
  • Complex Testing: Many tools require interactive input
  • Better AI Assistance: OpenCode could actually verify its work

Conclusion

This single feature would make OpenCode the only AI assistant capable of truly testing and verifying complex applications, especially those with interactive CLIs or multiple services. It bridges the gap between "code generation" and "working software".

sandipwane avatar Jul 23 '25 11:07 sandipwane