codex-im-bridge is a local Node.js bridge that lets Feishu messages control a local Codex runtime.
中文文档: README.zh-CN.md
Runtime path:
Feishu -> local codex-im-bridge process -> local codex app-server -> Feishu cards
Codex state (threads, approvals, run context) stays on your local machine. Feishu is only the remote control UI.
- Feishu long-connection bot runtime
- Bind one Feishu conversation to one or more local workspaces
- Thread management: continue, create, switch, inspect recent messages
- Approval workflow in Feishu cards (
approve,approve session,reject) - Multi-agent support per workspace:
- list agents and active agent
- switch active agent
- run a prompt on a specific agent
- run one prompt across multiple agents in parallel and return a summary
- Streaming or final-only reply cards
- Node.js 18+
- A Feishu self-built app with event subscriptions enabled
- Local Codex CLI/Desktop runtime available on the machine running
codex-im-bridge
Install and run directly from TypeScript (no build step required):
npm install
npm run feishu-botRun compiled output:
npm run feishu-bot:distInstall globally as a CLI:
npm run build
npm install -g .
codex-im-bridge feishu-botEnvironment variables:
FEISHU_APP_IDFEISHU_APP_SECRETCODEX_IM_BRIDGE_CODEX_COMMAND(default:codex)CODEX_IM_BRIDGE_CODEX_ENDPOINT(optional websocket endpoint; if set, no local spawn)CODEX_IM_BRIDGE_DEFAULT_WORKSPACE_ID(default:default)CODEX_IM_BRIDGE_FEISHU_STREAMING_OUTPUT(default:true)CODEX_IM_BRIDGE_WORKSPACE_ALLOWLIST(comma-separated absolute path prefixes)CODEX_IM_BRIDGE_SESSIONS_FILE(default:~/.codex-im-bridge/sessions.json)
If codex is not found in PATH, set CODEX_IM_BRIDGE_CODEX_COMMAND to an absolute executable path.
On macOS, codex-im-bridge also attempts /Applications/Codex.app/Contents/Resources/codex.
codex-im-bridge loads env files with Next.js-like priority:
~/.codex-im-bridge/.env./.env~/.codex-im-bridge/.env.local./.env.local
Shell environment variables already present at process start always win.
/codex bind /absolute/path/codex where/codex workspace/codex browse [/absolute/path]/codex agents/codex agent use <agentName>/codex agent run <agentName> <prompt>/codex parallel <agent1,agent2,...> <prompt>/codex message/codex switch <threadId>/codex remove /absolute/path/codex new/codex stop/codex approve/codex approve session/codex reject/codex help
src/index.ts: entrypoint and env loadingsrc/cli.ts: CLI runnersrc/feishu-bridge-runtime.ts: Feishu event handling + orchestrationsrc/codex-gateway.ts: JSON-RPC transport (spawn/websocket)src/conversation-store.ts: local conversation/workspace/agent mappingsrc/codex-message-utils.ts: event/message normalization and parsingsrc/feishu-views.ts: interactive card builderssrc/types.ts: shared runtime types
Before pushing a release or publishing to npm:
npm run check
npm run build
NPM_CONFIG_CACHE=/tmp/.npm-cache-codex-im-bridge npm pack --dry-runNotes:
buildrunscleanfirst, so stale files indist/are removed.- npm package contents are constrained by the
fileswhitelist inpackage.json. prepackautomatically runsnpm run build.
- Keep
CODEX_IM_BRIDGE_WORKSPACE_ALLOWLISTset in production. - Treat Feishu app credentials as secrets.
- Keep the host machine online and protected: this service is a bridge to local Codex, not a hosted SaaS.