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
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
  }
}

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")

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.

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

Testing

See TEST.md for manual test procedures covering daemon operations and AI skill commands.

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)
    └── 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.1.tar.gz (63.6 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.1-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codex_listener-0.1.1.tar.gz
  • Upload date:
  • Size: 63.6 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.1.tar.gz
Algorithm Hash digest
SHA256 5b74fae613879c674d8f858e2d4a991ca2e7101ae3348d7f5a87d5b33fba3374
MD5 314338df7b08da7d9fe4399abdb82f8f
BLAKE2b-256 9b55e26e1f3ae22508586b5a4ad8d9b83920791de8eb0566557bd4b9bb36fe05

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_listener-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: codex_listener-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14719d7fd7dc6c0c7367887fcaf4228420de55e497859c9b6bac953cfbff7ba5
MD5 5f56f03323ca865ed18344a84c9c266e
BLAKE2b-256 b85b10b06c26b27f71545009aa1baf4548fd2a40b17ccd874c8f31aed8c4328d

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_listener-0.1.1-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