tmux
Tmux
Overview
Use tmux to run background jobs while continuing other work. Keep all skill-managed windows in one session, tmux-opencode, so inspection and cleanup happen in one place. Default to wrapper scripts over manual command chaining. Do not block by default; opt in to blocking wait only when requested.
Verify Environment
Confirm tmux availability before using this skill.
tmux -V
If tmux is unavailable, run commands in the foreground.
Session Model
Standardize on a single session.
SESSION="tmux-opencode"
tmux new-session -d -s "$SESSION" -n "main" 2>/dev/null || true
tmux list-windows -t "$SESSION"
scripts/tmux_run_job.py auto-creates this session when missing.
First-Time Setup
Install managed cron cleanup once per machine/user.
python3 scripts/tmux_healthcheck_cron.py --action install
Verify installation.
python3 scripts/tmux_healthcheck_cron.py --action status
Run Jobs (Wrapper First)
Run a command in the background (default behavior).
python3 scripts/tmux_run_job.py --command "npm start"
Run in a named window (auto-normalized to oc-*).
python3 scripts/tmux_run_job.py --window server --command "npm start"
Block until completion only when requested.
python3 scripts/tmux_run_job.py --window build --command "npm run build" --wait
Wait later for an already-started job by target.
python3 scripts/tmux_run_job.py --wait-target "tmux-opencode:oc-build"
Use wait timeout when blocking behavior needs a guardrail.
python3 scripts/tmux_run_job.py --window build --command "npm run build" --wait --wait-timeout-seconds 1800
Auto-close successful windows when waiting.
python3 scripts/tmux_run_job.py --window lint --command "npm run lint" --wait --close-window success
Inspect Output and Control Jobs
Capture visible output.
tmux capture-pane -p -t "tmux-opencode:oc-server"
Capture full scrollback.
tmux capture-pane -p -S - -t "tmux-opencode:oc-server"
Interrupt a running command.
tmux send-keys -t "tmux-opencode:oc-server" C-c
Kill one window.
tmux kill-window -t "tmux-opencode:oc-server"
Cleanup and Healthcheck
Show window health (idle minutes, active state).
python3 scripts/tmux_healthcheck.py
Dry-run stale window cleanup.
python3 scripts/tmux_healthcheck.py --cleanup --max-idle-minutes 240 --dry-run
Run cleanup for stale windows and legacy sessions after interruptions or crashes.
python3 scripts/tmux_healthcheck.py --cleanup --max-idle-minutes 240 --cleanup-legacy-sessions
Install or update automatic periodic cleanup cron (idempotent managed entry).
python3 scripts/tmux_healthcheck_cron.py --action install
Preview cron line without writing.
python3 scripts/tmux_healthcheck_cron.py --action install --dry-run
Check installed cron status.
python3 scripts/tmux_healthcheck_cron.py --action status
Remove the managed cron entry.
python3 scripts/tmux_healthcheck_cron.py --action remove
Quick Pattern
- Start jobs with
scripts/tmux_run_job.py(background by default). - Inspect output with
tmux capture-panewhen needed. - Add
--waitfor immediate blocking, or--wait-targetfor wait-after-start. - Run
scripts/tmux_healthcheck.py --cleanupperiodically or at session end. - Prefer
scripts/tmux_healthcheck_cron.py --action installfor automatic recovery cleanup.
More from ajoslin/dot
kimaki-expert
Provide expert support for Kimaki setup, Discord bot wiring, OpenCode session orchestration, slash-command troubleshooting, and automation workflows. Use when users mention Kimaki, kimaki.xyz, Discord-controlled coding agents, or channel-to-project mapping.
18init-review-policy
Initialize repo-scoped code review policy files under .opencode/review. Use when setting up project-specific review rules for /code-review.
18kimaki-tools
Run common Kimaki project/session operations from OpenCode, especially linking an existing OpenCode session into Discord and Kimaki session listings. Use when users ask to manage Kimaki projects, sessions, or thread mappings from CLI.
18thrifty
Delegate tasks to the cost-effective opencode/glm-5 model. Use when you need inexpensive task execution, simple research, or delegating work that doesn't require the most powerful models.
17index-knowledge
Generate hierarchical AGENTS.md knowledge base for a codebase. Creates root + complexity-scored subdirectory documentation.
17video-understand
|
16