A Gemini CLI extension that enables the execution of long-running shell commands in the background asynchronously using tmux. This integrations functionality has been moved to the "self-command" gemini integration. It does this and more!
- Asynchronous Execution: Run commands like
sleep, builds, or long scripts without timing out the Gemini CLI. - Smart Notifications: "Wakes up" the Gemini agent using
tmux send-keyswhen the background task finishes. It intelligently waits for the terminal to be idle (stable for 10 seconds) before typing, ensuring it doesn't interrupt your work or the agent's current output. - Compact Output: Limits completion notifications to 64 characters to preserve terminal cleanliness, automatically truncating long command strings and output while preserving exit codes.
- Fail-Safe: Checks for the required
tmuxsession environment before execution.
- Gemini CLI
- tmux: Required for session management and notifications.
- Node.js: Environment for running the extension.
You can install this extension directly using the Gemini CLI:
gemini extensions install https://github.com/stevenAthompson/run-long-command-
Clone the repository:
git clone https://github.com/stevenAthompson/run-long-command cd run-long-command -
Install dependencies:
npm install
-
Build the project:
npm run build
-
Link the extension:
gemini extensions link .
The extension requires running inside a tmux session named gemini-cli. A helper script is provided:
./gemini_tmux.shThis will check for the session and create/attach to it as needed.
Inside the tmux session, start your Gemini CLI agent.
You can now ask Gemini to run long commands:
"Run
sleep 10in the background."
Gemini will use the run_long_command tool, return immediately to let you know it started, and then receive a notification (and wake up) when the command finishes.
npm testrun_long_command.ts: Main MCP server implementation.gemini_tmux.sh: Setup script for the tmux environment.run_long_command.test.ts: Unit tests.
MIT