by who96
CLI Discord bridge with Codex-first runtime and legacy Claude compatibility.
# Add to your Claude Code skills
git clone https://github.com/who96/cli-discord-bridgeSingle-file Discord bridge for Codex CLI operation.
The actively maintained runtime targets Codex: one Discord channel connects to one Codex CLI process. Legacy artifacts remain only for rollback and command continuity.
Command surface remains compatible with earlier bridge flows:
/new /status /connect /handoff /help.
CHANNEL_IDDiscord message -> bridge.py -> codex exec/resume --json -> parse JSON events -> Discord reply
Bridge state:
~/.cli-discord-bridge/~/.cli-discord-bridge/session.json
thread_idsession_id~/.cli-discord-bridge/handoffs/codex exec --json --skip-git-repo-check [--dangerously-bypass-approvals-and-sandbox] [-m MODEL] "<prompt>"codex exec resume --json --skip-git-repo-check [--dangerously-bypass-approvals-and-sandbox] [-m MODEL] <thread_id> "<prompt>"thread.started.thread_id as authoritative thread IDNo comments yet. Be the first to share your thoughts!
item.completed.item.type=="agent_message" text as reply body/connect safety:
/connect <thread_id> is strict.thread.started.thread_id, bridge treats it as failure and blocks auto-fallback.Implicit fallback:
| Variable | Required | Default | Description |
|---|---|---|---|
| DISCORD_TOKEN | Yes | — | Discord bot token |
| CHANNEL_ID | Yes | — | Discord channel ID |
| CODEX_BIN | No | codex | Codex CLI binary path |
| CODEX_MODEL | No | empty | Optional model override |
| CODEX_TIMEOUT | No | 300 | Max seconds per Codex call |
| CODEX_CWD | No | $HOME | Working directory for Codex call |
| CODEX_FULL_ACCESS | No | 0 | 1 enables --dangerously-bypass-approvals-and-sandbox |
| SELFTEST_ON_START | No | 0 | 1 runs startup selftest |
Compatibility fallback (for smooth migration):
CLAUDE_CWD can still be used if CODEX_CWD is not setCLAUDE_TIMEOUT can still be used if CODEX_TIMEOUT is not set| Command | Behavior |
|---|---|
| /new | Clear current thread; next message creates a new thread |
| /status | Show current thread, cwd, timeout, backend |
| /connect [thread-id] | Bind explicit thread (no arg = reset) |
| /handoff | Summarize old thread -> coldstart new thread; rollback old thread if new bootstrap fails |
| /help | Show command help |
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
DISCORD_TOKEN="xxx" \
CHANNEL_ID...