The Stealth Proxy for AI Agents: Inside remote_compilation_helper

How a Rust-based interceptor tricks local AI models into building on remote clusters, saving your laptop battery without changing a single prompt.

7 min read • View on GitHub • More from Dicklesworthstone

A small mechanical bird singing into a vintage microphone, with a massive array of industrial gears hidden beneath the floorboards.
The AI agent issues standard commands at the surface level, while heavy processing happens entirely out of sight.
Key Takeaways

The AI Workstation Meltdown

AI models are excellent at writing code. They are terrible at managing local infrastructure. When an agent like Claude Code or OpenCode decides to run a build on a massive Rust project, it operates blindly. It will happily pin your local CPU at 100 percent and drain your laptop battery to zero.

Running parallel agentic loops saturates hardware quickly. The traditional fix is to instruct the AI to use a remote server. You write a custom prompt telling the model to use ssh or a wrapper script. The model inevitably forgets, reverts to standard local commands, and the fan noise returns.

The remote_compilation_helper (RCH) solves this by acting as a stealth proxy. It intercepts standard build commands and offloads them to a remote server cluster. The genius is in the transparency. The AI agent never knows the build happened a thousand miles away. It requires zero prompt engineering and zero behavior changes from the LLM.

The Transparent Intercept

Wrappers fail because they require active participation from the user or the agent. RCH succeeds because it is invisible. It operates as a PreToolUse hook. It intercepts shell commands before they execute.

When the agent calls a standard build command, the high-performance Rust binary evaluates the request against a five-tier classification pipeline. It decides if the task is a pure compilation job or a local mutation that needs to stay on the host machine.

interactive flowchart showing a local terminal issuing 'cargo build'

If the task is clear for remote execution, the central orchestrator takes over. The daemon manages worker state, queues the job, and accounts for available CPU slots on the remote fleet.

Mapping the Dependency Closure

Moving a command to a remote server is easy. Moving the exact context required to execute that command is notoriously difficult. Rust projects often rely on local path dependencies. If you only send the root project to a remote worker, the build will fail because the worker lacks the adjacent library code.

RCH solves the partial workspace problem through deterministic closure planning. The engine scans local configuration files to find and sync local path dependencies. It ensures the remote worker has the exact file tree needed to complete the job.

A close-up of a magnifying glass hovering over a tangled knot of thick ropes, which are then pulled perfectly straight into a neatly organized loom.
Untangling local path dependencies into a deterministic build plan.

The system categorizes dependencies by risk class. It evaluates how likely a dependency is to break the build or leak sensitive data. This provides a security-first view of the project structure before any code leaves the local machine.

Trust But Verify: Artifact Integrity

Networked compilation is only useful if the resulting binary is identical to one built locally. The system requires a robust trust layer to verify artifacts returning from the remote worker.

RCH uses a Blake3 hashing system to verify that files have not been corrupted during transit. It includes critical security checks to prevent directory traversal attacks. A compromised remote worker cannot return a malicious file path designed to overwrite sensitive local files.

"<p><em>Installs rch + rchd, bootstraps config, and can install/start the background daemon. If remote execution cannot proceed, RCH fails open to local execution.</em></p> </div>"

The Fail-Open Philosophy

Infrastructure fails. Networks drop packets. Remote workers go offline. If a remote build tool crashes when the network blinks, it breaks the developer's flow. RCH is built around a strict fail-open philosophy.

If the daemon cannot deterministically map dependencies, or if the remote fleet is unreachable, the system does not block the workflow. It immediately routes the job back to the local CPU. The AI agent experiences a slight delay, but the command still succeeds.

A vintage steam train traveling on a track where a bridge has collapsed ahead, with a mechanical switch track smoothly diverting the train onto a safe parallel route.
The fail-open architecture ensures a blocked network route never stops the workflow.

Wrappers vs. Proxies

Remote build tools have existed for decades. The distinction lies in how they integrate with the caller. Legacy tools operate as wrappers. They require explicit invocation and manual dependency synchronization.

RCH operates as a transparent proxy. It intercepts standard commands and handles state synchronization automatically. This architectural shift is what makes it uniquely suited for AI coding agents.

Feature The Wrapper Approach (e.g., cargo-remote) The Interceptor Approach (RCH)
Invocation Requires explicit wrapper command (cargo remote build) Intercepts standard command (cargo build)
AI Agent Awareness Requires explicit prompt instruction Completely transparent to the agent
Dependency Sync Manual or simple rsync Deterministic closure planning
Failure Mode Fails the agent loop Fails open to local CPU

By abstracting the remote infrastructure entirely, the tool turns a lightweight laptop into a high-end workstation. It allows AI agents to operate at maximum velocity without melting the hardware they run on.


Sources: Dicklesworthstone/remote_compilation_helper repository and architectural decision records.