Tmux & Interactive Bash
Relevant source files
The following files were used as context for generating this wiki page:
Tmux and Interactive Bash sessions within the Oh-My-OpenCode project serve as the primary interface for executing complex Command Line Interface (CLI) and Terminal User Interface (TUI) tasks. These tools enable autonomous agents to perform real-time command execution, send keystrokes, and validate terminal outputs without human intervention. This system is a critical component of the project's automated verification and implementation loops.
The integration allows agents like Hephaestus and Prometheus to interact with the system environment dynamically. By leveraging interactive_bash through Tmux sessions, agents can simulate user behavior, manage long-running processes, and capture terminal evidence for task verification.
Sources: src/agents/prometheus/plan-template.ts:74-78, src/agents/hephaestus.ts:252-258
System Architecture & Integration
The Tmux and Interactive Bash functionality is integrated into the agent execution loop, primarily utilized for tasks requiring terminal interaction. The architecture relies on the interactive_bash tool to manage Tmux sessions.
Interaction Flow
The following diagram illustrates how an agent interacts with a TUI application using Tmux and Bash tools.
Verification Scenarios
Interactive Bash is mandated for TUI/CLI verification. Every task involving these interfaces must include "Agent-Executed QA Scenarios" that detail exact tool usage and expected results.
QA Scenario Components
| Component | Description |
|---|---|
| Tool | Specifically interactive_bash (tmux). |
| Preconditions | Build status or configuration required before execution. |
| Steps | Sequence of commands, keystrokes, and wait conditions. |
| Assertions | Validation of stdout/stderr or exit codes. |
| Evidence | Captured terminal output stored in .sisyphus/evidence/. |
Sources: src/agents/prometheus/plan-template.ts:74-84, src/agents/prometheus/plan-template.ts:227-240
Execution Logic
For CLI tasks, the logic follows a specific pattern of session creation and assertion:
- Session Initialization:
tmux new-session: ./my-cli --config test.yaml - Output Waiting: Wait for a specific string (e.g., "Configuration loaded") with a defined timeout.
- Interactive Control: Send keys (e.g., "3" then "Enter") to navigate menus.
- Final Validation: Assert the process exited with code 0 and specific farewell messages in the output.
Sources: src/agents/prometheus/plan-template.ts:231-237, src/agents/hephaestus.ts:252-258
Implementation Details
Agents use Bash analysis to determine project scale and complexity hotspots, which often involves running parallel background tasks.
Analysis Commands
Agents frequently run the following types of commands in Interactive Bash to map codebase structures:
# Measure project scale
total_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)
# Directory depth analysis
find . -type d -not -path '*/.*' -not -path '*/node_modules/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c
Sources: src/features/builtin-commands/templates/init-deep.ts:54-62, src/features/builtin-commands/templates/init-deep.ts:74-80
Git Interaction via Bash
The git-master skill heavily utilizes Bash for parallel context gathering, allowing for faster repository analysis.
Conclusion
The integration of Tmux and Interactive Bash provides a robust framework for autonomous terminal interaction. By utilizing interactive_bash for real-time manipulation and bash for static structural analysis, the system ensures that complex CLI/TUI features are implemented and verified with high precision and automated evidence capture.