remote-control-on-demand

module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: Apache-2.0

README

RCOD: Remote Control On Demand

Build Release

Manage Claude Code sessions remotely via Telegram. RCOD runs on your machine or server, starts claude rc inside selected git repositories, and sends status, logs, crashes, and Claude session links back to your phone.

This repo also includes a Codex-focused Telegram bot that lets you chat with Codex directly inside a selected repository.

Built by zevro.ai.

RCOD demo

What RCOD Does

  • Starts and stops claude rc sessions from Telegram
  • Recursively discovers repositories under a configured projects folder
  • Streams Claude session URLs and selected output events back to Telegram
  • Sends periodic progress heartbeats on long-running sessions
  • Restarts crashed sessions automatically when configured
  • Applies per-project overrides from .rcod.yaml
  • Adds inline Telegram actions for status, logs, restart, stop, and Claude links
  • Paginates repository pickers and supports unique partial project matches
  • Always launches Claude with --permission-mode bypassPermissions

Codex Telegram Chat

The cmd/codexbot entrypoint exposes Telegram as a chat interface for Codex:

  • create a Codex chat session for a repo with /new or /folders
  • switch between chat sessions with /sessions and /use
  • send a normal Telegram message to talk to Codex in the active repo
  • close old chat threads with /close
  • Codex respects rc.permission_mode from config.yaml; default is workspace-write, bypassPermissions opts into full local access, and other accepted values map to Codex sandbox modes

Build and run it with:

cd app && npm ci && npm run build
go build -o rcod ./cmd/codexbot
./rcod -config config.yaml

For local native control helpers:

scripts/start-codexbot-native.sh config.yaml
scripts/status-codexbot-native.sh
scripts/reset-codexbot-native.sh config.yaml
scripts/install-codexbot-native-launchd.sh config.yaml

How It Works

You (Telegram) -> RCOD bot -> claude rc (inside your git repo)
       <- status, logs, Claude link <-

Prerequisites

Requirement Notes
Go 1.25+ Needed only when building from source
Claude Code CLI Install with npm install -g @anthropic-ai/claude-code
Codex CLI Needed for cmd/codexbot; install it and keep codex in your PATH
Telegram bot token Create one via @BotFather
Telegram user ID Get it from @userinfobot

claude must be available in your PATH. For codexbot, codex must also be available in your PATH.

Quick Start

git clone https://github.com/zevro-ai/remote-control-on-demand.git
cd remote-control-on-demand
cd app && npm ci && npm run build && cd ..
go build -o rcod ./cmd/codexbot
./rcod

If config.yaml is missing, RCOD starts an interactive onboarding flow and writes a local config file with mode 0600.

Why It Feels Good

  • no SSH session needed just to check whether Claude is still working
  • Telegram becomes the remote control surface, not a dumb notifier
  • long sessions keep sending heartbeats, so you know work is still moving
  • inline actions make restart, logs, and stop a two-tap flow

Configuration

Minimal config.yaml:

telegram:
  token: "YOUR_BOT_TOKEN"
  allowed_user_id: 123456789

rc:
  base_folder: "/home/user/Projects"
  permission_mode: "workspace-write"
  auto_restart: true
  max_restarts: 3
  restart_delay_seconds: 5

See config.example.yaml for a fuller example with notifications.

Global Config Fields
Field Description
telegram.token Bot token from @BotFather
telegram.allowed_user_id Only this Telegram user can control the bot
rc.base_folder Directory RCOD scans for git repositories
rc.permission_mode Codex bot access mode: workspace-write (default), read-only, danger-full-access, or bypassPermissions
rc.auto_restart Enables automatic restart for crashed sessions
rc.max_restarts Maximum restart attempts before giving up
rc.restart_delay_seconds Delay between restart attempts
rc.notifications.progress_update_interval Optional progress heartbeat interval, for example 10m
rc.notifications.idle_timeout Optional idle notification threshold
rc.notifications.patterns Optional regex-based output notifications

RCOD intentionally always starts Claude with claude rc --permission-mode bypassPermissions. This is not configurable.

Per-Project Overrides

Create .rcod.yaml inside a repository under rc.base_folder to override defaults for that project:

auto_restart:
  enabled: true
  max_attempts: 5
  delay: 10s
prompt: "Focus on triaging open issues first"
max_duration: 2h
notifications:
  progress_update_interval: 10m
  idle_timeout: 10m
  patterns:
    - name: "task_completed"
      regex: "(?i)(task completed|all done)"
      once: true
Field Description
auto_restart.enabled Override global auto-restart for this project
auto_restart.max_attempts Override restart limit
auto_restart.delay Override restart delay, for example 30s or 1m
prompt Extra project-specific context shown when the session starts
max_duration Kill the session after a fixed duration
notifications.* Override global notification settings for this project
Folder Resolution

RCOD only starts repositories that resolve inside rc.base_folder. Direct command arguments such as /start team/api are allowed, but path traversal outside the configured base folder is rejected.

Telegram Commands

Command Description
/start Start a session from the discovered repository list
/kill Stop a running session
/status Show folder, PID, uptime, and restart count
/logs Show the last 50 log lines
/restart Restart a session
/list List active sessions
/folders Browse available repositories
/help Show command help

Commands also accept direct arguments, for example /start my-project or /kill a1b2. /start resolves exact matches first, then unique partial matches.

Running as a Service

Service templates live in packaging/systemd/rcod.service and packaging/launchd/ai.zevro.rcod.plist. Replace the placeholder paths with your own values before installing them.

Session Persistence

RCOD automatically saves the state of all active sessions to a sessions.json file (located in the same directory as your config.yaml).

  • Bot Restarts: If the bot is restarted (e.g., during an update or system reboot), it will automatically re-attach to any claude rc processes that are still running.
  • URL Recovery: Upon re-attaching, the bot re-sends the original claude.ai session link to Telegram so you can resume work immediately.
  • Orphan Monitoring: The bot continues to monitor these "orphaned" processes and will notify you if they eventually exit or crash.

Development

make build
make test
make vet
make fmt

If you do not use make, the equivalent commands are:

cd app && npm ci && npm test && npm run build && cd ..
go build -o rcod ./cmd/codexbot
go test ./...
go vet ./...
gofmt -w cmd internal

Security Notes

  • config.yaml contains your Telegram bot token and should stay local
  • Only telegram.allowed_user_id can control the bot
  • Child processes inherit your user account permissions
  • RCOD strips Claude session environment variables before spawning nested claude rc processes

See SECURITY.md for reporting guidance.

Contributing

See CONTRIBUTING.md.

Assets

License

Apache 2.0

Directories

Path Synopsis
cmd
bot command
codexbot command
internal
bot

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL