A Gemini CLI extension that enables the execution of long-running shell commands in the background without blocking the agent. It utilizes tmux to notify the agent upon command completion.
- Asynchronous Execution: Run commands like
sleep, builds, or long scripts without timing out the Gemini CLI. - Auto-Notification: "Wakes up" the Gemini agent using
tmux send-keyswhen the background task finishes. - 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