Hermes Claude Code RC: Remote Control Claude Code via Telegram

Remotely control Claude Code sessions from Telegram via the Hermes Agent plugin.

Editor & IDEintermediate6 min readVerified Oct 25, 2026
Author
kevinmarmstrong
Stars
2
Language
Python
License
MIT
Upstream updated
2026-04-15
Hermes Claude Code RC: Remote Control Claude Code via Telegram

Overview

The Claude Code Remote Control plugin for Hermes Agent enables you to start, manage, and interact with Claude Code sessions from a mobile phone using Telegram. It bridges the gap between local machine access and mobile convenience, giving you full access to your local filesystem, MCP servers, databases, and local tools without needing a terminal nearby.

This plugin is designed for situations where you need to start a Claude Code remote session from a phone without terminal access, execute headless Claude Code commands, run shell commands on a host machine, or manage multiple Claude Code sessions remotely.

Prerequisites

Before installing the plugin, ensure the following are in place:

  • Hermes Agent with Telegram configured and running.
  • Claude Code CLI installed and authenticated (claude auth login).
  • Claude Pro, Max, Team, or Enterprise subscription (required for the Remote Control feature).

Without these prerequisites, the plugin will not function. Cloud sessions from the iOS app, web, or Routines cannot access the local filesystem, MCP servers, databases, or local tools. Remote Control requires a terminal to start, and this plugin automates that step.

Installation

1. Install the Hermes Patch

The plugin requires a small patch to hermes_cli/plugins.py to add the register_command() method. Navigate to the Hermes agent directory and apply the patch:

cd ~/.hermes/hermes-agent
git apply /path/to/hermes-claude-code-rc/hermes-plugin-commands.patch

Alternatively, you can manually add the register_command() method on PluginContext, the _commands dict on PluginManager, and the get_plugin_command_handler() module-level function.

If the patch is not applied, /cc commands will not be recognized by Hermes.

2. Install the Plugin

Copy the plugin directory into the Hermes plugins folder:

cp -r hermes-claude-code-rc ~/.hermes/plugins/claude-code-rc

For development, you can create a symlink instead:

ln -s /path/to/hermes-claude-code-rc ~/.hermes/plugins/claude-code-rc

3. Restart Hermes

On macOS (using launchd), restart the gateway:

launchctl kickstart -k gui/$(id -u)/ai.hermes.gateway

Or manually:

hermes gateway restart

4. Verify Installation

Send /cc help to your Hermes Telegram bot. If the command listing appears, the installation is successful.

Configuration

All configuration is done through environment variables only. No secrets are stored in code. Set these in ~/.hermes/.env or your launchd plist.

VariableMeaningRequiredDefault
CC_CLAUDE_PATHPath to the Claude Code binaryNoclaude (on PATH)
CC_WORK_DIRWorking directory for sessionsNo$HOME
CC_SHELL_TIMEOUTShell command timeout in secondsNo30
CC_RUN_TIMEOUTClaude run timeout in secondsNo120
CC_URL_TIMEOUTTimeout waiting for session URL in secondsNo30

If environment variables are not set, defaults are used, which may cause unexpected behavior.

Authorization

Hermes enforces Telegram user authorization at the gateway level using the TELEGRAM_ALLOWED_USERS environment variable. Only authorized users can send commands to the bot. Commands from unauthorized users are ignored.

Capabilities

The plugin provides the following capabilities through Telegram slash commands:

  • Start Claude Code remote control sessions via Telegram slash commands.
  • Full local filesystem and tool access from mobile devices.
  • Headless Claude Code command execution (claude -p) with results returned.
  • Shell command execution on the host machine with built-in safety filters.
  • Session management including status checks, stopping sessions, and listing orphaned Claude processes.
  • System information such as uptime and disk usage.
  • Custom subcommand support via handler functions and a routing table.
  • Configurable timeouts for shell, run, and URL waiting.

Subcommands

All subcommands are invoked by sending /cc <subcommand> [args] to your Hermes Telegram bot. Use /cc help to list all available subcommands.

/cc start <session_name>

Starts a Claude Code remote control session with the given name and returns a claude.ai/code/... URL.

Example:

/cc start my-feature

/cc run <prompt>

Runs Claude Code headless and returns the result. The prompt is passed directly to claude -p.

Example:

/cc run check if the tests pass in ~/projects/myapp

/cc shell <command>

Executes a shell command on the host machine. Dangerous commands are blocked by default. To force-execute a blocked command, prefix it with !.

Blocked commands include: rm -rf, sudo, mkfs, fork bombs, and similar dangerous operations.

Examples:

/cc shell ls -la ~/Desktop
/cc shell ! sudo brew services restart nginx

/cc status

Shows active sessions, system uptime, disk usage, and any orphaned Claude processes.

/cc stop <session_name>

Stops the running session with the given name.

Example:

/cc stop my-feature

/cc help

Lists all available subcommands.

Custom Subcommands

You can add new subcommands by writing a handler function and adding it to the SUBCOMMANDS dictionary.

To add a custom subcommand:

  1. Write a handler function with the signature def _handle_ping(args): return f"pong ({int(time.time())})".
  2. Add it to the SUBCOMMANDS dictionary: SUBCOMMANDS = { ..., "ping": _handle_ping }.
  3. Restart Hermes.

Example:

/cc ping

Returns pong with the current Unix timestamp.

How It Works

When you send a /cc command, the plugin:

  1. Receives the command through the Hermes Telegram bot.
  2. Parses the subcommand and arguments.
  3. For session commands (start, stop), it spawns Claude sessions detached from the gateway process using start_new_session=True.
  4. For run commands, it executes Claude Code headless and waits for the result.
  5. For shell commands, it runs the command on the host machine after checking safety filters.
  6. Returns the result to you via Telegram.

Claude sessions are spawned detached from the gateway process, so they continue running even if the Telegram connection is interrupted.

Failure Modes

IssueSymptomResolution
Patch not applied/cc commands not recognizedApply the Hermes patch
Claude Code not installed or authenticatedSession start failsInstall and authenticate Claude Code CLI
No Claude subscriptionRemote Control feature unavailableUpgrade subscription
Telegram user not authorizedCommands ignoredAdd user to TELEGRAM_ALLOWED_USERS
Timeout exceededShell or run command returns errorIncrease timeout or check command
Session URL not captured within CC_URL_TIMEOUTUser not notified of URLIncrease CC_URL_TIMEOUT
Dangerous command blockedCommand failsPrefix with ! to force execute
Environment variables not setDefaults used, unexpected behaviorSet variables in .env

Security Considerations

  • Dangerous shell commands are blocked by default. The safety filter catches rm -rf, sudo, mkfs, fork bombs, and similar commands. To override, prefix the command with !.
  • Telegram authorization is enforced at the gateway level. Only users listed in TELEGRAM_ALLOWED_USERS can send commands.
  • Configuration via environment variables only ensures no secrets are stored in code.
  • Claude sessions are detached from the gateway process, preventing the gateway from being blocked by long-running sessions.

Example Workflow

  1. You are away from your computer and need to start a Claude Code session.
  2. Open Telegram and send /cc start my-feature to your Hermes bot.
  3. The bot returns a claude.ai/code/... URL.
  4. Open the URL on your phone to access the full Claude Code remote control interface with local filesystem, MCP servers, databases, and local tools.
  5. When done, send /cc stop my-feature to end the session.

Notes

  • The plugin uses register_command() which requires the Hermes patch.
  • All commands have configurable timeouts to prevent hangs.
  • The system was designed in 2026 and continues to be maintained for compatibility with the latest Hermes Agent and Claude Code versions.

Sources & References

This page was researched from 2 independent sources, combined and verified for completeness.

Newsletter

The #1 AI Newsletter

The most important ai updates, guides, and fixes — one weekly email.

No spam, unsubscribe anytime. Privacy policy

Other Hermes Agent integrations