Typer-based CLI for tmux-backed Codex orchestration sessions
Project description
tmux-orche
Modern tmux-backed Codex orchestration for persistent CLI sessions.
tmux-orche turns a one-off orch.py script into an installable Python CLI with a clean command surface, XDG-based configuration, and a reusable tmux + tmux-bridge backend for long-lived Codex orchestration sessions.
Features
- Installable
orchecommand built with Typer + Rich - Persistent tmux sessions instead of one-shot subprocess execution
- Fire-and-forget prompt submission with later inspection via the same session
- XDG-compliant config and state paths
- Compatible with the existing tmux +
tmux-bridgeorchestration model - Works with Codex native notify hooks through
~/config/orch.json
Installation
Install with pip
From PyPI:
pip install tmux-orche
From a local checkout:
pip install .
Install with uv
As a tool:
uv tool install tmux-orche
From a local checkout:
uv tool install .
If you prefer a project environment instead of a global tool install:
uv pip install .
Install from source
git clone https://github.com/parkgogogo/orche
cd orche
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install .
After installation, the orche command should be available on your PATH.
Quick Start
Create or reuse a persistent Codex session:
orche session-new --cwd /path/to/repo --agent codex
Create a named session and bind a Discord channel for native Codex notify hooks:
orche session-new \
--cwd /path/to/repo \
--agent codex \
--name repo-codex-main \
--discord-channel-id 123456789012345678
Send a prompt into an existing session:
orche prompt --session repo-codex-main --prompt "analyze the test failures"
Check session status:
orche status --session repo-codex-main
Read the latest terminal output:
orche read --session repo-codex-main --lines 80
Type text without pressing Enter:
orche type --session repo-codex-main --text "focus on database queries first"
Send keys:
orche keys --session repo-codex-main --key Enter
orche keys --session repo-codex-main --key Escape --key Enter
Get the latest turn summary:
orche turn-summary --session repo-codex-main
Interrupt the running task:
orche cancel --session repo-codex-main
Close the session window:
orche close --session repo-codex-main
Commands
| Command | Description | Key Options |
|---|---|---|
orche backend |
Print the active backend type. | None |
orche config get |
Read a supported runtime config value. | <key> |
orche config set |
Write a supported runtime config value. | <key>, <value> |
orche config list |
List supported runtime config values. | None |
orche session-new |
Create or reuse a persistent Codex session. | --cwd, --agent, --name, --discord-channel-id |
orche prompt |
Send a fire-and-forget prompt to an existing session. | --session, --prompt |
orche status |
Show resolved pane, cwd, running state, and session metadata. | --session |
orche read |
Read recent pane output through tmux-bridge. |
--session, --lines |
orche type |
Type text into the session without submitting it. | --session, --text |
orche keys |
Send one or more key presses to the session. | --session, --key |
orche cancel |
Send Ctrl-C to the active session. |
--session |
orche turn-summary |
Print the latest inferred turn summary for a session. | --session |
orche close |
Kill the tmux window and remove local session metadata. | --session |
For built-in help:
orche --help
orche session-new --help
orche prompt --help
Configuration
tmux-orche follows the XDG Base Directory convention.
Primary config file:
~/.config/orche/config.json
Compatibility config file for existing notify hooks:
~/config/orch.json
State directory:
~/.local/share/orche/
Typical state files include:
meta/<session>.jsonfor per-session metadatahistory/<session>.jsonlfor local action historylocks/<session>.lockfor session coordinationlogs/orche.logfor runtime event logging
The runtime config stores fields such as:
- active
session - resolved
discord_session codex_turn_complete_channel_id- current
cwd,agent, andpane_id
Whenever orche updates its runtime config, it mirrors the data to ~/config/orch.json so existing Codex notify hooks can keep working.
You can manage notification-related config directly from the CLI:
orche config set discord.bot-token "YOUR_DISCORD_BOT_TOKEN"
orche config set discord.channel-id "123456789012345678"
orche config set discord.webhook-url "https://discord.com/api/webhooks/..."
orche config set notify.enabled true
orche config list
Supported config keys:
discord.bot-tokendiscord.channel-iddiscord.webhook-urlnotify.enabled
Requirements
orche depends on these external tools being installed and available:
tmuxtmux-bridgecodexCLI
Python requirements:
- Python
3.9+
The backend expects:
- tmux can create and manage persistent windows
tmux-bridgecan resolve, read, type, and send keys to panescodexcan be launched inside tmux with--no-alt-screen
Backend Model
The workflow is intentionally simple:
session-newcreates or reuses a named tmux-backed Codex session.promptsubmits work into that existing session and returns immediately.statusandreadinspect the live session later.type,keys,cancel, andcloselet you continue steering the same session.
This keeps the orchestration stateful without forcing the CLI itself to stay attached.
Notification Workflow
tmux-orche is designed to work with the existing Codex native notify pipeline. This repository also includes a local hook variant at scripts/notify-discord.sh, adapted from the mature discord-turn-notify.sh design without modifying the original script in ~/.codex/hooks/.
Architecture
Codex native notify
|
v
discord-turn-notify.sh
|
+--> reads ~/config/orch.json written by orche
|
+--> reads Codex JSON payload
|
+--> calls orche turn-summary when it needs a concise summary
|
v
Discord
What orche Provides
orche session-newwrites the active session context to both:~/.config/orche/config.json~/config/orch.json
orche turn-summary --session <name>exposes the current turn-summary logic in a CLI-friendly wayorche _turn-summary --session <name>is also available as a hidden compatibility aliasorche config get/set/listprovides a stable interface for notification secrets and channel settings
This keeps the design minimal:
- Codex owns notify events
- the existing shell hook owns Discord delivery
orcheonly provides session metadata and summary extraction
Codex Native Notify Setup
In ~/.codex/config.toml:
notify = ["/bin/bash", "/Users/dnq/.codex/hooks/discord-turn-notify.sh"]
That hook can then read ~/config/orch.json, inspect the Codex payload, and post to Discord.
If you want to use the repo-local adapted hook instead, point Codex at:
notify = ["/bin/bash", "/path/to/orche/scripts/notify-discord.sh"]
Codex Notify Setup
Automatic setup is intentionally not built into orche.
Reasons:
~/.codex/config.tomlis global user config, not repo-local state- users may already have a custom
notifypipeline that should not be overwritten - Discord bot tokens are sensitive and should not be silently written into scripts or config files
The recommended setup is manual and explicit.
-
Ensure
~/.codex/config.tomlexists. -
Add the notify hook entry:
notify = ["/bin/bash", "/Users/dnq/.codex/hooks/discord-turn-notify.sh"]
-
Create
~/.codex/hooks/discord-turn-notify.shif it does not already exist. -
In that hook:
- read
~/config/orch.jsonto getcodex_turn_complete_channel_id,session, andcwd - read the Codex JSON payload passed into the hook
- call
orche turn-summary --session "$session"when you need a concise completion summary
- read
-
Provide secrets safely:
- prefer
orche config set discord.bot-token ...orDISCORD_BOT_TOKEN - avoid hardcoding tokens into tracked files
- set
discord.channel-idwithorche config setor viaorche session-new --discord-channel-id ...
- prefer
Example shell pattern:
orche config set discord.bot-token "your-token"
orche config set discord.channel-id "123456789012345678"
orche session-new \
--cwd /path/to/repo \
--agent codex \
--name repo-codex-main \
--discord-channel-id 123456789012345678
Then inside the hook:
session="$(jq -r '.session // ""' ~/config/orch.json)"
summary="$(orche turn-summary --session "$session" 2>/dev/null || true)"
channel_id="$(orche config get discord.channel-id)"
bot_token="${DISCORD_BOT_TOKEN:-$(orche config get discord.bot-token)}"
This keeps the responsibility split cleanly:
- Codex emits notify events
- the hook handles external delivery
orcheprovides session metadata and summary extraction
Using orche with the Existing Hook
- Start or reuse a session:
orche session-new \
--cwd /path/to/repo \
--agent codex \
--name repo-codex-main \
--discord-channel-id 123456789012345678
- Send work:
orche prompt --session repo-codex-main --prompt "review the latest changes"
- When Codex emits a native notify event, the hook reads:
codex_turn_complete_channel_idsessioncwdagentpane_id
from ~/config/orch.json.
- If the hook needs a short completion summary, it should call:
orche turn-summary --session repo-codex-main
Hook Integration Note
If your current hook still shells out to the old orch.py _turn-summary, update that call site to:
orche turn-summary --session "$session"
or, if you want minimal behavior change:
orche _turn-summary --session "$session"
The rest of the notification design can stay exactly as it is.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tmux_orche-0.1.0.tar.gz.
File metadata
- Download URL: tmux_orche-0.1.0.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99690f9e64e7400b551a0b2d4c21c0a2cf873b5806032b51e57ee978085df856
|
|
| MD5 |
248743470a4a592656e3b15410bcc9b0
|
|
| BLAKE2b-256 |
4030747b6f4103b8f9e58150623b1e83f10eae1f3dd53221849df9fc02e901df
|
Provenance
The following attestation bundles were made for tmux_orche-0.1.0.tar.gz:
Publisher:
publish.yml on parkgogogo/orche
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tmux_orche-0.1.0.tar.gz -
Subject digest:
99690f9e64e7400b551a0b2d4c21c0a2cf873b5806032b51e57ee978085df856 - Sigstore transparency entry: 1204625932
- Sigstore integration time:
-
Permalink:
parkgogogo/orche@40b07114580af75abfe64d2bf9846de589cf2f24 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/parkgogogo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40b07114580af75abfe64d2bf9846de589cf2f24 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tmux_orche-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tmux_orche-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
789b1223caee9b5342ff7b2cc6d2dc32be46214f78caa3e2d9db319f1177d389
|
|
| MD5 |
b8e7e254eea020875a774237654610a0
|
|
| BLAKE2b-256 |
460cadb4320aa79c5840f0fd627aab2dd3eb9b44623be361ea36231eced37a70
|
Provenance
The following attestation bundles were made for tmux_orche-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on parkgogogo/orche
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tmux_orche-0.1.0-py3-none-any.whl -
Subject digest:
789b1223caee9b5342ff7b2cc6d2dc32be46214f78caa3e2d9db319f1177d389 - Sigstore transparency entry: 1204625951
- Sigstore integration time:
-
Permalink:
parkgogogo/orche@40b07114580af75abfe64d2bf9846de589cf2f24 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/parkgogogo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40b07114580af75abfe64d2bf9846de589cf2f24 -
Trigger Event:
push
-
Statement type: