A private-chat IM bot service that runs on macOS, uses the Codex Python SDK to handle messages, manage threads and approvals, and stream results back to IM.
codex-im-connector is a locally running Python service. It does not provide a web UI or expose an external HTTP API. Instead, it runs directly as a macOS background service and is responsible for:
- Receiving private chat messages from IM
- Forwarding messages to the Codex App Server / Codex Python SDK
- Managing user threads, default models, working directories, and approval state
- Streaming model output back to IM
The current primary integration target is a Feishu/Lark private chat bot.
- Feishu/Lark private chat text and image input
- Codex thread management
- Streaming text output and image result delivery
- Approval prompts and user confirmation
- Model and reasoning effort switching
- Current thread rename, compact, and status inspection
- Working directory switching with allowlist validation
- macOS background service with auto-start on login through a user-level
launchdLaunchAgent
Tested versions:
- Feishu client >= 7.66
- Codex CLI >= 0.125.0
The bot currently supports these commands:
/help: Show help/new [name]: Create a new thread and switch to it/list [search_term]: List remote threads/resume <thread_id>: Resume a specific thread/status: Show current thread info and session state/rename <name>: Rename the current thread/compact: Compact the current thread context/models: List available models/model <name> <reasoning_effort>: Set the default model and reasoning effort/cwd <path>: Update the default working directory for future new threads/cwd --current <path>: Switch the current thread and also update the default working directory for future new threads/stop: Interrupt the current running task/steer <text>: Add steering text without interrupting the current turn
Before running the installer, prepare the following:
- A macOS machine
gitinstalledcurlinstalled or available- A usable Feishu bot application
- A usable local Codex CLI binary path
The repository
scripts/install.shwill installuvand Python 3.12 automatically, but it will not installgitfor you.
This project depends on a local Codex CLI binary, and the installer requires you to provide CODEX_BIN.
See the official OpenAI Codex CLI documentation:
Recommended preparation:
- Install Codex CLI by following the official documentation
- Confirm that the
codexcommand works - Record the actual binary path, for example:
/opt/homebrew/bin/codex
- Complete login or API credential setup as required by the official documentation
Installer requirements:
CODEX_BINmust point to an existing executable file- The installer does not provide a default value for this field
You can verify it manually in Terminal first:
which codex
codex --help- Sign in to the Feishu Open Platform developer console
- Create a Feishu/Lark agent app directly

- Retrieve the App ID and App Secret
If the bot does not respond after you send a message, first check message receiving, card interaction, message send/update, and image upload/download permissions.
You must provide these during installation:
FEISHU_APP_IDFEISHU_APP_SECRET
Notes:
- Both are required
- The installer writes them into
.env FEISHU_APP_SECRETis sensitive and should never be committed to version control
Download the installer locally first, then run it.
Use Terminal.app or iTerm2, and do not run it with sudo.
- Download the installer:
curl -fsSL -o install.sh https://raw.githubusercontent.com/fish106/codex-im-connector/main/scripts/install.sh- Run the installer:
bash install.shThe installer will guide you through:
- Choosing
APP_ROOT_PATH- Default:
~/.cic
- Default:
- Cloning or updating the code into:
APP_ROOT_PATH/src/codex-im-connector
- Installing Python dependencies automatically
- Filling in the required configuration
- Generating
.env - Creating and installing the
launchdLaunchAgent - Starting the service in the background
After installation, the service runs as a macOS user-level LaunchAgent:
- Installed at:
~/Library/LaunchAgents/com.fish106.codex-im-connector.plist
- Starts automatically after login
- Keeps running in the background
Default directory layout:
APP_ROOT_PATH/workspace: default working directoryAPP_ROOT_PATH/data: SQLite data directoryAPP_ROOT_PATH/logs: log directoryAPP_ROOT_PATH/src/codex-im-connector: source code directory
Use these commands:
launchctl print gui/$(id -u)/com.fish106.codex-im-connector
tail -f ~/.cic/logs/stderr.log
tail -f ~/.cic/logs/stdout.logIf you use a custom APP_ROOT_PATH, replace ~/.cic with your actual path.
The runtime configuration is stored at:
APP_ROOT_PATH/src/codex-im-connector/.env
You can edit this file directly, for example:
CODEX_BINCODEX_ALLOWED_CWD_ROOTSCODEX_MODELCODEX_DEFAULT_REASONING_EFFORTFEISHU_APP_IDFEISHU_APP_SECRET
Important:
- Do not change
APP_ROOT_PATHafter installation APP_ROOT_PATHdetermines the code path, database path, log path, workspace path, andlaunchdruntime path- If you need a different
APP_ROOT_PATH, the recommended flow is:- Uninstall the current installation
- Run the installer again and choose the new
APP_ROOT_PATH
After editing .env, restart the macOS background service so the new configuration takes effect.
You can use:
launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.fish106.codex-im-connector.plist
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.fish106.codex-im-connector.plistOr:
launchctl kickstart -k gui/$(id -u)/com.fish106.codex-im-connectorRecommended:
- Run
bootout + bootstrap - Check the logs to confirm the service started correctly
Example:
tail -f APP_ROOT_PATH/logs/stderr.log
tail -f APP_ROOT_PATH/logs/stdout.logReplace APP_ROOT_PATH with your actual installation path.
If you only want to upgrade to the latest code and restart the service, you do not need to re-enter configuration and .env will not be rewritten.
If you used the default installation path ~/.cic, run:
curl -fsSL https://raw.githubusercontent.com/fish106/codex-im-connector/main/scripts/upgrade.sh | bashIf you used a custom APP_ROOT_PATH, export it first and then run the upgrade command:
export APP_ROOT_PATH=/your/app/root
curl -fsSL https://raw.githubusercontent.com/fish106/codex-im-connector/main/scripts/upgrade.sh | bashThe upgrade script will:
- Read the existing installation metadata
- Pull the latest repository code
- Run
uv syncto update dependencies - Rebuild and restart the
launchdbackground service
It will not:
- Ask for configuration again
- Overwrite your existing
.env - Change
APP_ROOT_PATH
You can run the uninstall script from the installation path:
bash APP_ROOT_PATH/src/codex-im-connector/scripts/uninstall.shReplace APP_ROOT_PATH with your actual installation path.
The uninstall script will:
- Stop and remove the LaunchAgent
- Remove the source code directory
- Ask whether to delete the entire
APP_ROOT_PATH
Main directories:
client/: Codex App Server / SDK runtime wrapperconnector/: IM platform connector abstractions and Feishu implementationcore/: configuration and logging initializationdb/: SQLAlchemy models and database initializationmodel/: Pydantic data modelsservice/: routing, approvals, rendering, and session managementscripts/: install, uninstall, and LaunchAgent templatetests/unit/: unit tests
The main flow is:
main.pystarts the applicationapp.pywires together the database, session service, approval service, runtime, connector, and routerFeishuConnectorreceives Feishu events over WebSocketRouterServicehandles commands, approvals, and normal messagesCodexRuntimecalls the Codex App Server / AsyncCodex- Output is streamed back to Feishu through the connector
The project uses:
- Python 3.12
uvsqlalchemyaiosqlitepydantic-settingslark-oapiopenai-codex-app-server-sdk
Common local development commands:
uv sync --extra dev
uv run python main.py
uv run pytest