Skip to main content

Small tmux session controller with recurring sends

Project description

tmuxctl

Small tmux session controller with recurring sends.

tmuxctl lets you:

  • list tmux sessions by name
  • show the most recent sessions by creation time or activity
  • attach to a named session or jump to the most recent ones quickly
  • send a message to a session's active pane
  • store recurring jobs in SQLite
  • run a lightweight daemon loop that executes due jobs

Install

Install from PyPI with uv:

uv tool install tmuxctl
tmuxctl --help

Or with pip:

pip install tmuxctl
tmuxctl --help

Install from GitHub with uv:

uv tool install git+https://github.com/alexeygrigorev/tmuxctl.git
tmuxctl --help

Install from a local checkout in editable mode:

git clone https://github.com/alexeygrigorev/tmuxctl.git
cd tmuxctl
uv tool install -e .
tmuxctl --help

If you update the local checkout later, reinstall with:

uv tool install -e . --force

For development, tests, and builds:

uv sync --dev
uv run pytest
uv build

If you want this checkout's virtualenv binaries on your shell PATH, run:

./install.sh

That appends this repo's .venv/bin to ~/.bashrc and does nothing if the line is already present.

Usage

List sessions:

tmuxctl list
tmuxctl l
tmuxctl r
tmuxctl recent --limit 10

Attach to a session directly or jump to the newest one:

tmuxctl codex
tmuxctl attach codex
tmuxctl create-or-attach codex
tmuxctl :codex
tmuxctl kill codex
tmuxctl kill 2
tmuxctl k 2 --yes
tmuxctl attach-last
tmuxctl attach-recent 2
tmuxctl attach-recent 3

tmuxctl codex resolves to tmuxctl attach codex. tmuxctl :codex resolves to tmuxctl create-or-attach codex. tmuxctl kill NAME_OR_ID kills a session by name or by the numeric ID shown in tmuxctl list.

There are also short hidden aliases for the most recent sessions:

tmuxctl 1
tmuxctl 2
tmuxctl 3
tmuxctl 10

Send one message now:

tmuxctl send codex "check status and fix if something is broken or stuck"

Send one message from a file:

tmuxctl send rk-codex --message-file prompts/rk-codex-progress.txt

By default, tmuxctl send waits 200ms before pressing Return. Override that with --enter-delay-ms or disable Return with --no-enter.

Create a recurring job:

tmuxctl add codex --every 15m --message "check status and fix if something is broken or stuck"

Recurring jobs also store an Enter delay. By default that is 200ms, and you can override it with --enter-delay-ms.

Example: send an automated follow-up to rk-codex every 30 minutes:

tmuxctl add rk-codex --every 30m --message-file prompts/rk-codex-progress.txt

You can load message text from a file with --message-file for tmuxctl send, tmuxctl add, and tmuxctl edit.

For tmuxctl add and tmuxctl edit, the file path is stored with the job. Scheduled runs read the file at send time, so updating the prompt file changes future runs without recreating the job.

To switch an existing job to the shared prompt file:

tmuxctl jobs
tmuxctl edit <job_id> --message-file prompts/rk-codex-progress.txt

Example: check a worker session every 30 minutes and unblock stalled progress:

tmuxctl add lnewly-57 --every 30m --message "Status check for litehive: report current progress, current task, and the last meaningful change. Check whether progress is stalled, not whether you personally feel stuck. Identify blockers, lack of movement, repeated retries, failing commands, broken states, or missing dependencies. If progress is stalled, choose the best next concrete action to unblock litehive and execute it. Fix any problems you can fix now, then continue the work and summarize what changed."

Edit an existing job:

tmuxctl edit 2 --every 45m
tmuxctl edit 2 --message "check status and continue"
tmuxctl edit 3 --message-file prompts/rk-codex-progress.txt

Remove a job:

tmuxctl remove 3

List jobs and logs:

tmuxctl jobs
tmuxctl logs --limit 20

tmuxctl jobs shows whether a job uses inline text or a linked file prompt.

Logs include the target session, whether the send was manual or scheduled, whether Return was sent, the Enter delay used, and any recorded error text.

If a scheduled job fails 3 runs in a row, tmuxctl daemon removes it automatically.

Run the scheduler:

tmuxctl daemon

Shortcuts

Useful shortcuts for hopping between recent sessions:

  • tmuxctl 1
  • tmuxctl 2
  • tmuxctl 3
  • tmuxctl 10
  • tmuxctl r
  • tmuxctl attach-last
  • tmuxctl attach-recent 2
  • tmuxctl attach-recent 3

How Scheduling Works

tmuxctl does not create cron entries and it does not require editing crontab.

Recurring jobs are stored in SQLite at:

~/.config/tmuxctl/tmuxctl.db

The commands work like this:

  • tmuxctl add ... inserts a recurring job into the database
  • tmuxctl edit, pause, resume, and remove update that stored job
  • tmuxctl daemon polls the database for due jobs and runs them

That means recurring sends only happen while the daemon is running.

If you want jobs to keep running after logout or reboot, use an external process manager to keep the daemon alive, for example:

  • systemd --user on Linux
  • launchd on macOS
  • cron @reboot as a fallback

Even in those setups, cron or systemd only starts tmuxctl daemon. The recurring schedule itself still lives in the tmuxctl database.

Bash Completion

tmuxctl includes shell completion through Typer.

Install completion for your current Bash setup:

tmuxctl --install-completion

Preview or manually wire the Bash completion script:

tmuxctl --show-completion bash

Session-taking commands also complete existing tmux session names in Bash. At the top level, Bash completion also suggests plain session names and :session shortcuts.

If you work from this checkout often and want its virtualenv binaries on your PATH, run:

./install.sh

That appends this repo's .venv/bin to ~/.bashrc and leaves the file unchanged if the line is already present.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tmuxctl-0.1.2.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tmuxctl-0.1.2-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file tmuxctl-0.1.2.tar.gz.

File metadata

  • Download URL: tmuxctl-0.1.2.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.14.3 HTTPX/0.28.1

File hashes

Hashes for tmuxctl-0.1.2.tar.gz
Algorithm Hash digest
SHA256 967c0cf24de7e09a60918922a65353185925ef63c8589221b464ea1a29ea8317
MD5 3113db6aad11d6e5afcce4a6b003324d
BLAKE2b-256 9158954ab8cd896fac5649571c093c317e7007d5a940890391ec69d69f13e4c0

See more details on using hashes here.

File details

Details for the file tmuxctl-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tmuxctl-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.14.3 HTTPX/0.28.1

File hashes

Hashes for tmuxctl-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d24a8c188ab585863b79854fd3efed398d5b31bb4fb7f058d81dbb6721394ddb
MD5 388d0b567f620c9c0f7ab7bb8a12bfe9
BLAKE2b-256 3889518cf98c093f1ed50089ed505880e3845e54ad0e8311031e3e07fbbe35a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page