TELEGRAM_BOT_TOKEN=123456:replace_me # Comma-separated numeric Telegram chat IDs. Leave empty only for first-run # discovery, then send /id to the bot and paste the returned ID here. TELEGRAM_ALLOWED_CHAT_IDS= # Where Codex should run. Keep this narrow. CODEX_WORKDIR=/absolute/path/to/your/workspace CODEX_BIN=codex CODEX_SANDBOX=workspace-write CODEX_TIMEOUT_SECONDS=1200 # Set by scripts/run_current_session.sh at runtime. Do not put this in a shared/global shell profile. # CODEX_BIND_CURRENT_SESSION=1 # Alternative: bind Telegram to one explicit Codex session/thread id. # CODEX_RESUME_SESSION=your-codex-thread-id # Optional: require messages to start with /codex before running Codex. TELEGRAM_REQUIRE_CODEX_PREFIX=0 # If another Codex session still owns the bridge, replace it when activating # from the current session. This only targets the PID recorded in runtime state. TELEGRAM_REPLACE_EXISTING=1 TELEGRAM_ACK_MESSAGE= # Optional: receive Telegram images, Markdown, PDF files, and configured # voice/audio transcripts, and allow Codex to return generated images, # Markdown, and PDFs from its per-request artifacts directory. TELEGRAM_ATTACHMENTS_ENABLED=1 TELEGRAM_MAX_DOWNLOAD_BYTES=20971520 TELEGRAM_MAX_UPLOAD_BYTES=20971520 TELEGRAM_MAX_ARTIFACT_FILES=4 # Optional: transcribe Telegram voice notes/audio locally before sending text # to Codex. This can reuse the standalone transcribe.py CLI from # https://github.com/yingwang/cc-telegram-voice; no Claude Code integration is used. # If the command does not include {audio}, the bridge appends the downloaded # audio path as the final argument. # TELEGRAM_AUDIO_TRANSCRIBE_COMMAND="/absolute/path/to/cc-telegram-voice/.venv/bin/python /absolute/path/to/cc-telegram-voice/transcribe.py {audio} --lang zh" TELEGRAM_AUDIO_TRANSCRIBE_TIMEOUT_SECONDS=180 TELEGRAM_AUDIO_TRANSCRIPT_MAX_CHARS=12000 # Optional: synthesize Codex replies as Telegram audio. The bridge owns the # routing logic; the TTS engine is a replaceable local command. # Modes: # off never send synthesized audio # on_demand send audio only for /voice, /both, or messages asking for 语音回复 # mirror send audio for inbound voice/audio unless the user asks for text # always send audio for every reply unless the user asks for text TELEGRAM_TTS_MODE=off # Example male Edge TTS voice, matching the yilu-ting style of using edge-tts: # TELEGRAM_TTS_COMMAND="edge-tts --voice zh-CN-YunxiNeural --rate=-8% --file {input} --write-media {output}" TELEGRAM_TTS_TIMEOUT_SECONDS=120 TELEGRAM_TTS_MAX_CHARS=1200 TELEGRAM_TTS_OUTPUT_EXTENSION=mp3 TELEGRAM_TTS_SEND_AS=audio # Optional: write Telegram inbound/outbound records to private local inbox files. TELEGRAM_INBOX_ENABLED=1 # TELEGRAM_INBOX_PATH=~/.codex/channels/telegram/inbox.md # TELEGRAM_INBOX_JSONL_PATH=~/.codex/channels/telegram/inbox.jsonl # Optional: persistent Telegram persona and selective local memory. TELEGRAM_PERSONA_ENABLED=1 # TELEGRAM_PERSONA_PATH=~/.codex/memories/telegram-persona.md TELEGRAM_MEMORY_ENABLED=1 TELEGRAM_MEMORY_AUTO=1 # TELEGRAM_MEMORY_JSONL_PATH=~/.codex/memories/telegram-memory.jsonl # Codex decides whether a Telegram exchange is worth remembering. Use # /remember or messages starting with "记住:" / "remember:" to force a memory. # Normal chat still goes to inbox; not every message becomes memory. TELEGRAM_MEMORY_RECENT_EVENTS=12 TELEGRAM_MEMORY_MAX_CHARS=8000 # Hand each Telegram turn to the live Codex session with `codex queue` rather than # starting a second writer on its thread. Telegram and the terminal then share one # context, which is what CODEX_BIND_CURRENT_SESSION was for before Codex 0.151 # began enforcing one writer per thread. Needs a running Codex session: the answer # is read back from that thread's rollout log under ~/.codex/sessions. CODEX_USE_QUEUE=0