Remote PTY Broker for Claude Code
An open-source Node.js bridge that allows containerized AI orchestrators to securely manage interactive terminal sessions on remote hosts.
The Problem
Powerful AI coding agents like Claude Code run as interactive CLI tools, meaning they constantly pause to prompt the user for permission (e.g., to run a shell command or delete a file). Containerized orchestrators (like OpenClaw) couldn't drive these tools remotely because they couldn't securely parse and respond to these interactive PTY prompts.
The Constraints
The bridge needed to act as a secure intermediary, wrapping the interactive PTY session, parsing raw ANSI terminal output to detect permission requests, and exposing a REST API for remote orchestrators to approve or deny actions based on programmatic rules.
Capabilities Utilized
- ▪Node.js & PTY Management
- ▪Regex & ANSI Parsing
- ▪Systems Integration
- ▪API Design
The Approach
We built ClawBridge as a lightweight, standalone daemon that runs on the host machine. It spins up Claude Code inside a managed pseudo-terminal (node-pty), intercepts its stdout, and uses a custom parser to detect permission prompts.
The System
ClawBridge exposes a secure HTTP API for session lifecycle management. It features a programmatic 'Approval Envelope' allowing orchestrators to define scoped rules (e.g., auto-approve safe Git operations, deny network access). It also provides clean, ANSI-stripped telemetry and automatic test-result extraction.
The Outcome
ClawBridge unlocked the ability for distributed AI platforms to leverage Anthropic's official CLI tool on remote development machines. It is now a critical infrastructure piece enabling fully automated, unsupervised Claude Code workflows.
