explaingit

momolm/codex-mainline

Analysis updated 2026-05-18

34JavaScriptAudience · developerComplexity · 3/5Setup · moderate

TLDR

A bridge that connects OpenAI's Codex CLI to Telegram so you can chat with a running Codex session from your phone.

Mindmap

mindmap
  root((codex-mainline))
    What it does
      Bridges Codex to Telegram
      Keeps session alive
      Forwards messages both ways
    Tech stack
      JavaScript
      Node.js
      Telegram Bot API
    Use cases
      Control Codex from phone
      Send files and images
      Recover from context compaction
    Audience
      Developers using Codex CLI

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Chat with a persistent Codex session through Telegram from your phone or desktop.

USE CASE 2

Send text, images, and files to Codex and receive its responses and files back in Telegram.

USE CASE 3

Use bridge commands to check status, switch language, manage sessions, or stop the process.

What is it built with?

JavaScriptNode.jsTelegram Bot API

How does it compare?

momolm/codex-mainlineblacksnowskill/comfyui-bss_flsamplermaowuzz/chatgpt-session-forge
Stars343434
LanguageJavaScriptJavaScriptJavaScript
Setup difficultymoderateeasymoderate
Complexity3/52/53/5
Audiencedevelopervibe coderops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires Windows, Node.js 22+, the Codex CLI, and a Telegram bot token.

The explanation does not mention a license, so terms of reuse are unclear.

In plain English

Codex Mainline is a bridge that connects OpenAI's Codex CLI tool to Telegram, so you can control a running Codex session from your phone or desktop via chat messages. Codex is a command-line tool that can write and run code, operate files, and execute tasks on your computer. This project keeps a single persistent Codex session alive over time and routes your Telegram messages into it, then relays Codex's responses back to Telegram. The bridge runs on Windows and connects to Codex using the official Codex app-server websocket interface. It is not a reverse proxy or an unofficial imitation of Codex. On the Telegram side it uses a standard bot setup: you create a bot through Telegram's BotFather tool, configure it in the project settings, and restrict access to your own chat ID so only you can talk to it. You can send text, images, and files through Telegram and they get forwarded into the Codex conversation. File delivery in the other direction works too. Several bridge-level commands are available that do not get passed to Codex, including commands to check status, set effort level, switch language, manage sessions, and stop the process. The bridge handles a situation called context compaction (when a conversation gets too long and needs to be summarized) by queuing incoming messages, notifying you via Telegram when compaction starts and finishes, and recovering gracefully if it fails. A watchdog process monitors the bridge and restarts it if it crashes. An optional rhythm feature can send periodic wake messages to prompt Codex to check in or take action on its own. Setup requires Node.js 22 or newer, the Codex CLI, and a Telegram bot token. Windows batch files are included for one-click start and stop. The project supports English and Chinese output and stores all runtime state and logs locally. Credentials and logs are excluded from the repository.

Copy-paste prompts

Prompt 1
Explain how this bridge keeps a single Codex session alive across many Telegram messages.
Prompt 2
Walk me through setting up a Telegram bot token and connecting it to this project.
Prompt 3
What happens when the Codex conversation needs context compaction, and how does the bridge handle it?
Prompt 4
How do I configure the watchdog process so the bridge restarts automatically if it crashes?

Frequently asked questions

What is codex-mainline?

A bridge that connects OpenAI's Codex CLI to Telegram so you can chat with a running Codex session from your phone.

What language is codex-mainline written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js, Telegram Bot API.

What license does codex-mainline use?

The explanation does not mention a license, so terms of reuse are unclear.

How hard is codex-mainline to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is codex-mainline for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.