{"data":{"slug":"github-tmustier-pi-for-excel-skills-tmux-bridge-6e59df4f2042","title":"Run Local CLI Tools via Tmux Bridge","summary":"Access local terminal tools like `pi` through a secure tmux bridge for command execution and output capture.","url":"https:\/\/skillshunter.net\/skills\/github-tmustier-pi-for-excel-skills-tmux-bridge-6e59df4f2042","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-tmustier-pi-for-excel-skills-tmux-bridge-6e59df4f2042","markdown_url":"https:\/\/skillshunter.net\/skills\/github-tmustier-pi-for-excel-skills-tmux-bridge-6e59df4f2042.md","download_url":"https:\/\/skillshunter.net\/skills\/github-tmustier-pi-for-excel-skills-tmux-bridge-6e59df4f2042\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"The tmux bridge requires a local tmux bridge process running on the user's machine. The bridge is a local HTTPS server that can be started with `npx pi-for-excel-tmux-bridge`.","instructions":"---\nname: tmux-bridge\ndescription: Local terminal access via the tmux bridge. Use when the user asks about running shell commands, setting up the tmux bridge, or troubleshooting terminal connectivity.\ncompatibility: Requires a local tmux bridge process running on the user's machine.\nmetadata:\n  tool-name: tmux\n  docs: docs\/tmux-bridge-contract.md\n---\n\n# Tmux Bridge\n\nThe tmux bridge gives Pi access to a real local terminal on the user's machine. The `tmux` tool is always registered \u2014 it just needs the bridge process running locally to work.\n\n## What it does\n\nWhen the bridge is running, the `tmux` tool can:\n- **list_sessions** \u2014 see active tmux sessions\n- **create_session** \u2014 start a new shell session (optionally in a specific directory)\n- **send_keys** \u2014 type commands into a session\n- **capture_pane** \u2014 read terminal output\n- **send_and_capture** \u2014 send a command and wait for output in one call\n- **kill_session** \u2014 close a session\n\n## Running `pi` (or other local CLIs) via tmux\n\nThe tmux pane is a normal local shell. If `pi` is installed, you can invoke it directly with `send_keys`\/`send_and_capture` text like any other command.\n\nRecommended flow:\n1. `list_sessions` then `create_session` (or reuse an existing session)\n2. Optional one-time check: `command -v pi`\n3. Send the `pi ...` command\n4. Monitor output with `capture_pane`\n\nFor long-running jobs, avoid rapid repeated captures. Prefer:\n- `capture_pane` with `wait_ms` (for example 15000-30000), or\n- `send_and_capture` with `wait_for` + `timeout_ms` when you know a completion pattern.\n\n## How to set it up\n\n### 1. Start the bridge\n\nThe bridge is a local HTTPS server. Run it from a terminal:\n\n```bash\nnpx pi-for-excel-tmux-bridge\n```\n\nThis defaults to **real tmux mode** on `https:\/\/localhost:3341`.\n\nOptions:\n- `--install-missing` \u2014 auto-install tmux via Homebrew (macOS)\n- `TMUX_BRIDGE_MODE=stub` \u2014 safe simulated mode (no real shell execution)\n- `TMUX_BRIDGE_TOKEN=your-secret` \u2014 require auth token\n\n### 2. Configure in Pi (usually not needed)\n\nThe default bridge URL (`https:\/\/localhost:3341`) works automatically \u2014 no configuration required. If you need a custom URL or auth token:\n\n```\n\/experimental tmux-bridge-url <url>\n\/experimental tmux-bridge-token <token>\n\/experimental tmux-status\n```\n\n### 3. Accept the local HTTPS certificate\n\nThe bridge uses a self-signed cert. You may need to visit `https:\/\/localhost:3341` in your browser once and accept it.\n\n## When the bridge is not running\n\nThe `tmux` tool stays registered but returns an error if the bridge is unreachable. Python tools (`python_run`, `python_transform_range`) still work via the in-browser Pyodide fallback \u2014 tmux is the only tool that strictly requires its bridge.\n\n## Security\n\n- Loopback-only (localhost)\n- Origin allowlist\n- Optional bearer token auth\n- Session names and key tokens are validated\n- No shell interpolation (argv-based tmux calls)\n\n## Troubleshooting\n\n- **\"bridge URL is unavailable\"** \u2014 the bridge process isn't running. Start it with `npx pi-for-excel-tmux-bridge`.\n- **\"timed out\"** \u2014 the bridge is running but the command took too long. Default timeout is 15s; use `timeout_ms` for longer operations.\n- **CORS\/cert errors** \u2014 visit the bridge URL directly in your browser and accept the certificate.\n","use_cases":["Execute `pi` commands in a tmux session","Capture output from long-running CLI processes","Troubleshoot terminal connectivity issues"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/tmustier\/pi-for-excel\/blob\/899295f55e698e3dacad1c45c5ba47f86adc596f\/skills\/tmux-bridge\/SKILL.md","source_commit":"899295f55e698e3dacad1c45c5ba47f86adc596f","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-16T06:08:24.000000Z","updated_at":"2026-11-16T10:49:37.000000Z","seo_title":"Run Local CLI via Tmux Bridge","seo_description":"Access local CLI tools like pi through a secure tmux bridge for command execution and output capture.","seo_keywords":["run local cli via tmux","execute pi commands in tmux","tmux bridge for cli tools","capture cli output in tmux","secure tmux terminal access"]}}