feat: claude code runner (#9)

This commit is contained in:
banteg
2026-01-01 17:04:49 +04:00
committed by GitHub
parent 4885e3b878
commit 936ea5109b
30 changed files with 2259 additions and 382 deletions
+27 -18
View File
@@ -2,22 +2,26 @@
🐙 *he just wants to help-pi*
telegram bot for [codex](https://github.com/openai/codex). runs `codex exec --json`, streams progress, and supports resumable sessions.
telegram bridge for codex and claude code. runs the agent cli, streams progress, and supports resumable sessions.
## features
stateless resume via `codex resume <token>` lines in chat.
stateless resume, continue a thread in the chat or pick up in the terminal.
edits a single progress message while codex runs (commands, tools, notes, file changes, elapsed time).
progress updates while agent runs (commands, tools, notes, file changes, elapsed time).
renders markdown to telegram entities.
robust markdown rendering of output with a lot of quality of life tweaks.
runs in parallel across threads and queues per thread to keep codex history sane.
parallel runs across threads, per thread queue support.
`/cancel` a running task.
## requirements
- `uv` for installation (`curl -LsSf https://astral.sh/uv/install.sh | sh`)
- `codex` on PATH (`npm install -g @openai/codex` or `brew install codex`)
- at least one engine installed:
- `codex` on PATH (`npm install -g @openai/codex` or `brew install codex`)
- `claude` on PATH (`npm install -g @anthropic-ai/claude-code`)
## install
@@ -29,12 +33,11 @@ runs in parallel across threads and queues per thread to keep codex history sane
1. get `bot_token` from [@BotFather](https://t.me/BotFather)
2. get `chat_id` from [@myidbot](https://t.me/myidbot)
3. send `/start` to the bot (telegram won't let it message you first)
4. run `codex` once interactively in the repo to trust the directory
4. run your agent cli once interactively in the repo to trust the directory
## config
takopi reads `.takopi/takopi.toml` in the current repo, otherwise `~/.takopi/takopi.toml`.
legacy `.codex/takopi.toml` is migrated automatically.
global config `~/.takopi/takopi.toml`, repo-level config `.takopi/takopi.toml`
```toml
bot_token = "123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
@@ -43,6 +46,13 @@ chat_id = 123456789
[codex]
# optional: profile from ~/.codex/config.toml
profile = "takopi"
[claude]
model = "sonnet"
allowed_tools = ["Bash", "Read", "Write", "WebSearch"]
dangerously_skip_permissions = false
# uses subscription by default, override to use api billing
use_api_billing = false
```
## usage
@@ -51,27 +61,26 @@ start takopi in the repo you want to work on:
```sh
cd ~/dev/your-repo
takopi
takopi codex
# or
takopi claude
```
send a message to the bot.
to continue a thread, reply to a bot message containing a resume line.
you can also copy it to resume an interactive session in your terminal.
to stop a run, reply to the progress message with `/cancel`.
## cli
default: progress is silent, final answer is sent as a new message so you receive a notification, progress message is deleted.
default: progress is silent, final answer is sent as a new message (notification), progress message is deleted.
`--no-final-notify` edits the progress message into the final answer (no new notification).
`--debug` enables verbose logs.
if you prefer no notifications, `--no-final-notify` edits the progress message into the final answer.
## notes
* private chat only
* run exactly one instance per bot token
* private chat only: the bot only responds to the configured `chat_id`
* run only one takopi instance per bot token: multiple instances will race telegram's `getUpdates` offsets and cause missed updates
## development