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 read
Author
kevinmarmstrong
Stars
2
Language
Python
License
MIT
Upstream updated
2026-04-15
Hermes Claude Code RC: Remote Control Claude Code via Telegram

This integration connects the Hermes Agent to Claude Code's Remote Control feature, allowing you to start, manage, and interact with Claude Code sessions from your phone via Telegram. With this plugin wired up, an agent can start a remote session, run headless commands, execute shell commands on your host machine, and check system status all through simple slash commands.

What It Does

Diagram: What It Does

  • Starts Claude Code remote sessions via Telegram slash commands, returning a session URL you can open in the Claude iOS/Android app.
  • Provides full local filesystem and tool access from mobile devices, including local MCP servers, databases, and any tools installed on your machine.
  • Executes headless commands (/cc run) that run Claude Code with the -p flag and return the result.
  • Runs shell commands on the host machine (/cc shell) with built-in safety filters that block dangerous operations like rm -rf, sudo, mkfs, and fork bombs.
  • Shows active sessions, system uptime, disk usage, and any orphaned Claude processes via /cc status.
  • Stops a running session by name with /cc stop.
  • Lists all available subcommands with /cc help.

This plugin bridges the gap between cloud-based Claude sessions (iOS app, web, Routines) which cannot access your local filesystem, and the Remote Control feature which runs on your machine with full local access but requires a terminal to start. As the sources explain, cloud sessions are great for GitHub-connected work but cannot access local filesystem, local MCP servers, local databases, or any tools installed on your machine. Remote Control is the only option that runs on your machine with full local access, but it requires a terminal to start the session. This plugin lets you message your Hermes Telegram bot from anywhere, it starts the Remote Control session on your machine, and sends you the URL to open in the Claude app.

The sources describe three tiers of remote access:

  • Quick cloud task: Open the Claude iOS app, describe the task, done. No setup needed. But no local machine access.
  • Local session from phone: /cc start my-feature via Telegram, open the URL in Claude app. Full local access. This is what this plugin enables.
  • Automated/scheduled: Routines (cloud) for recurring tasks, or /cc run (local) for one-shot commands on your machine.

Setup

Prerequisites

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

1. Apply the Hermes patch

This plugin uses register_command() which requires a small patch to hermes_cli/plugins.py. This patch adds gateway slash command support to the Hermes plugin system.

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

Or apply manually. The patch adds three things:

  • register_command() method on PluginContext
  • _commands dict on PluginManager
  • get_plugin_command_handler() module-level function

2. Install the plugin

# Clone or copy into your Hermes plugins directory
cp -r hermes-claude-code-rc ~/.hermes/plugins/claude-code-rc

Or symlink for development:

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

3. Restart Hermes

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

# Or manually
hermes gateway restart

4. Verify

Send /cc help to your Hermes Telegram bot. You should see the command listing.

Configuration Reference

All configuration is via environment variables (set in ~/.hermes/.env or your launchd plist):

VariableDefaultDescription
CC_CLAUDE_PATHclaude (on PATH)Path to the Claude Code binary
CC_WORK_DIR$HOMEWorking directory for sessions
CC_SHELL_TIMEOUT30Shell command timeout (seconds)
CC_RUN_TIMEOUT120Claude run timeout (seconds)
CC_URL_TIMEOUT30Timeout waiting for session URL (seconds)

How It Works

Architecture

The sources provide this architecture diagram:

Phone (Telegram) --> Hermes Gateway --> /cc plugin --> claude remote-control
                                                          |
                                                          v
Phone (Claude app) <-- claude.ai session URL <-- stdout scan

The plugin registers a /cc slash command with Hermes. When invoked:

  1. Hermes dispatches the command directly (no LLM call needed).
  2. The plugin routes to the appropriate subcommand handler.
  3. For /cc start, it spawns claude remote-control --name <name> as a detached subprocess.
  4. A background thread scans stdout for the session URL.
  5. The URL is sent back to the user via Telegram.

How Remote Control Works

Claude Code's Remote Control feature (claude remote-control) starts a local server that:

  • Keeps your machine as the execution environment (nothing moves to the cloud).
  • Exposes a session URL accessible from the Claude iOS/Android app or any browser.
  • Supports full bidirectional control (send prompts, see results, approve tool use).
  • Uses TLS over the Anthropic API (no inbound ports needed).

Requirements and Limitations

  • Requires Hermes Agent with Telegram configured.
  • Requires Claude Code CLI installed and authenticated (claude auth login).
  • Requires a Claude Pro/Max/Team/Enterprise subscription (required for Remote Control).
  • The plugin requires a small patch to hermes_cli/plugins.py to add gateway slash command support. This patch adds register_command() method on PluginContext, _commands dict on PluginManager, and get_plugin_command_handler() module-level function.
  • Cloud sessions (iOS app, web, Routines) cannot access your local filesystem, local MCP servers, local databases, or any tools installed on your machine. Only Remote Control provides full local access.
  • The plugin is designed for local machine execution; it does not move computation to the cloud.

Troubleshooting

Plugin not responding after installation

If sending /cc help to your Hermes Telegram bot does not return the command listing, verify that the Hermes patch was applied correctly. Check that the plugin directory is present at ~/.hermes/plugins/claude-code-rc and that Hermes was restarted using one of the provided commands:

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

# Or manually
hermes gateway restart

Shell commands blocked

Dangerous commands (rm -rf, sudo, mkfs, fork bombs, etc.) are blocked by default with a warning. To force-execute a blocked command, prefix it with !:

/cc shell ! sudo brew services restart nginx

Session URL not received

If /cc start does not return a URL, check the CC_URL_TIMEOUT environment variable (default 30 seconds). The background thread scans stdout for the session URL; if the session takes longer to start, increase this timeout. Also verify that CC_CLAUDE_PATH points to a valid Claude Code binary and that claude auth login has been run successfully.

Orphaned Claude processes

Use /cc status to check for any orphaned Claude processes. The status command shows active sessions, system uptime, disk usage, and any orphaned Claude processes. You can stop a session by name with /cc stop <name>.

Timeouts

All commands have configurable timeouts to prevent hangs. Adjust CC_SHELL_TIMEOUT (default 30 seconds) for shell commands, CC_RUN_TIMEOUT (default 120 seconds) for headless Claude commands, and CC_URL_TIMEOUT (default 30 seconds) for session URL waiting.

Adding New Commands

Adding a subcommand is two steps:

1. Write the handler function

def _handle_ping(args):
    """Check if the bot is alive."""
    return f"pong ({int(time.time())})"

2. Add it to the routing table

SUBCOMMANDS = {
    "start": _handle_start,
    "run": _handle_run,
    "shell": _handle_shell,
    "status": _handle_status,
    "stop": _handle_stop,
    "help": _handle_help,
    "ping": _handle_ping,  # <-- add here
}

Restart Hermes and /cc ping is live.

Safety

  • Auth: Hermes enforces TELEGRAM_ALLOWED_USERS at the gateway level. Only authorized users can invoke /cc commands.
  • Shell safety: Dangerous patterns (rm -rf, mkfs, fork bombs, sudo, etc.) are blocked by default with a force-bypass option (prefix with !).
  • Process isolation: Claude sessions are spawned with start_new_session=True (detached from the gateway process).
  • Timeouts: All commands have configurable timeouts to prevent hangs.
  • No secrets in code: Configuration is via environment variables only.

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