Skip to main content

A daemon that lets AI agents orchestrate OpenAI Codex CLI tasks

Project description

Codex-Listener

A daemon that lets AI agents (Claude, ChatGPT, etc.) orchestrate OpenAI Codex CLI tasks. Submit coding tasks, track progress, and collect results — all through simple shell commands that any AI can call.

Architecture

AI Agent  ──  scripts/*.py (submit)  ──▶  codex-listener daemon (FastAPI)
User     ◀── Feishu Bot card                              │
                                                          │ subprocess
                                                          ▼
                                                  codex exec --json --full-auto

AI agents run standalone Python scripts via their shell tool. Each script talks to the daemon over HTTP on localhost and prints structured JSON to stdout. No curl or HTTP knowledge needed in prompts.

Installation

# From source (Recommend)
uv pip install -e .

# From PyPI
uv tool install codex-listener

# Verify
codex-listener --version

Requires Python 3.10+ and OpenAI Codex CLI on PATH.

Quick Start

# Start the daemon
uv run codex-listener start

# Submit a task (fire-and-forget — daemon notifies user via Feishu on completion)
python3 skills/Codex-Listener/scripts/submit.py --prompt "fix the bug in auth.py" --cwd /path/to/project

# Stop the daemon
uv run codex-listener stop

Daemon Management

uv run codex-listener start [--port 19823] [--host 127.0.0.1]   # Start daemon
uv run codex-listener stop                                        # Stop daemon
uv run codex-listener status                                      # Check if running
uv run codex-listener logs [-f] [-n 50]                           # View logs

AI Skill Scripts

Standalone Python scripts in skills/Codex-Listener/scripts/ for AI agents to submit tasks to the daemon. All output a single JSON object to stdout. Exit code 0 = success, 1 = error. The daemon notifies the user via Feishu Bot on completion.

python3 skills/Codex-Listener/scripts/submit.py --prompt "..." [--model gpt-5.3-codex] [--cwd .] [--sandbox workspace-write]
python3 skills/Codex-Listener/scripts/status.py --task-id <id>
python3 skills/Codex-Listener/scripts/list_tasks.py [--status running]
python3 skills/Codex-Listener/scripts/cancel.py --task-id <id>
python3 skills/Codex-Listener/scripts/health.py

Configuration

Config file: ~/.codex-listener/config.json (auto-created on first run).

{
  "feishu": {
    "enabled": true,
    "appId": "cli_xxxx",
    "appSecret": "xxxxx",
    "encryptKey": "",
    "verificationToken": "",
    "allowFrom": ["ou_xxxx"]
  },
  "telegram": {
    "enabled": false,
    "token": "",
    "allowFrom": [],
    "proxy": null
  },
  "qq": {
    "enabled": false,
    "appId": "YOUR_APP_ID",
    "secret": "YOUR_APP_SECRET",
    "allowFrom": []
  }
}

feishu — Feishu Bot notification settings. When a task completes or fails, the daemon parses the Codex session JSONL (extracting the last assistant message, token usage, and completion time) and sends an interactive card to the configured recipients.

Field Description
enabled Set to true to enable Feishu notifications
appId Feishu app ID (from Feishu Open Platform)
appSecret Feishu app secret
encryptKey Event encryption key (optional, for webhook verification)
verificationToken Event verification token (optional)
allowFrom List of Feishu open_ids to receive notifications

telegram — Telegram Bot notification settings. Similar to Feishu, sends formatted messages when tasks complete or fail.

Field Description
enabled Set to true to enable Telegram notifications
token Telegram Bot token (from @BotFather)
allowFrom List of Telegram chat IDs to receive notifications (Get from NanoBot console)
proxy Optional HTTP/HTTPS proxy URL (e.g., "http://proxy.example.com:8080")

qq — QQ Bot notification settings using Botpy SDK. Sends formatted messages to users when tasks complete or fail.

Field Description
enabled Set to true to enable QQ notifications
appId QQ Bot application ID (from QQ Open Platform)
secret QQ Bot application secret
allowFrom List of user openids to receive notifications

AI Integration

Copy the skill file for your AI tool:

  • Claude Code: Copy skills/Codex-Listener/SKILL.md to your project's .claude/skills/ directory.
  • NanoBot: Copy skills/Codex-Listener/SKILL.md to your nanobot's Workspace skills/ directory.

The skill file teaches the AI how to use the Python scripts in skills/Codex-Listener/scripts/.

Project Structure

src/codex_listener/
├── __init__.py          # Package version
├── cli.py               # CLI entry point (start/stop/status/logs)
├── daemon.py            # Daemon lifecycle (PID file, background process)
├── server.py            # FastAPI HTTP server
├── task_manager.py      # Codex subprocess lifecycle & state management
├── models.py            # Pydantic models (TaskCreate, TaskStatus, etc.)
├── config.py            # Configuration loading (~/.codex-listener/config.json)
├── session_parser.py    # Parse Codex session JSONL for results & token usage
└── channels/            # External bot notification channels
    ├── __init__.py      # Channel exports
    ├── feishu.py        # Feishu Bot API (send card notifications)
    ├── qq.py            # QQ Bot API (send text notifications via Botpy)
    └── telegram.py      # Telegram Bot API (send text notifications)

skills/Codex-Listener/
├── SKILL.md             # AI skill definition
└── scripts/
    ├── codex_client.py  # Shared HTTP client (stdlib only)
    ├── submit.py        # Submit a task (fire-and-forget)
    ├── status.py        # Check task status (optional)
    ├── list_tasks.py    # List tasks (optional)
    ├── cancel.py        # Cancel a task
    └── health.py        # Daemon health check

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codex_listener-0.1.2.tar.gz (69.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codex_listener-0.1.2-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file codex_listener-0.1.2.tar.gz.

File metadata

  • Download URL: codex_listener-0.1.2.tar.gz
  • Upload date:
  • Size: 69.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codex_listener-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f2c2dee79fe6712418ae8a3ca1ca78cce8a1b466fc005952a10f7ded7a4efedc
MD5 c4b72c794b145c66f9091692fcb4df2a
BLAKE2b-256 330b84eb85451d9164f9ff5831cdcafb783bfb8dd225d3df761655365bb11644

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_listener-0.1.2.tar.gz:

Publisher: publish.yml on TalexCK/Codex-Listener

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codex_listener-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: codex_listener-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codex_listener-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 32b4945c1996f4c77a642bc9a80fd76b4c7cfbaf022c08634ba925bfe93d0d47
MD5 d44a70325960575aa91ece490a5f06e6
BLAKE2b-256 92dda7ab8c015105314837b15baeaca0f1a8982fac02a0d60f5327cbdd11cfa4

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_listener-0.1.2-py3-none-any.whl:

Publisher: publish.yml on TalexCK/Codex-Listener

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page