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

Usage

List sessions:

tmuxctl list
tmuxctl recent --limit 10
tmuxctl recent --limit 10 --by activity

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

tmuxctl attach codex
tmuxctl create-or-attach codex
tmuxctl :codex
tmuxctl attach-last
tmuxctl attach-last --by activity
tmuxctl attach-recent 2
tmuxctl attach-recent 3 --by activity

tmuxctl :codex is shorthand for tmuxctl create-or-attach codex.

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

tmuxctl a1
tmuxctl a2
tmuxctl a3

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 attach-last
  • tmuxctl attach-recent 2
  • tmuxctl attach-recent 3
  • tmuxctl a1
  • tmuxctl a2
  • tmuxctl a3

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.

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.1.tar.gz (16.0 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.1-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tmuxctl-0.1.1.tar.gz
  • Upload date:
  • Size: 16.0 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.1.tar.gz
Algorithm Hash digest
SHA256 33e6a6d29884ba20b0797708bf5be15f55a7c4c421537c052ff56497623f3d56
MD5 e089439d8844a24ed87f80f8ce1f37b3
BLAKE2b-256 b4ad2bb7b90422efab01b2af73fd361f3454c328d28b758378ab1083980304d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tmuxctl-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14f82c7fed9fff68f9ffe89d5c01f15156c991d03f8f2ec2d9a27f3ecd1c9bc3
MD5 021a97685ed3449776312121880061fc
BLAKE2b-256 46d8e42bf6370d98afb034213d0deadd19014fa0261956c0267bc8a5178f979f

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