Building CodeZ: A Self-Hosted Control Plane for Claude Code
Claude Code Remote has a problem.
It gives you a chat window on your phone. That's it. No slash commands. No MCP server management. No observability. No cost tracking. No session search. No memory inspection. No permission mode control. No fleet visibility across subagents.
When you leave the CLI, you lose most of what makes Claude Code useful. Remote Control keeps the conversation going, but strips away the control surface -- the part that matters when you're running serious workloads across multiple sessions and projects.
I built CodeZ because I wanted to walk away from my laptop without losing any of that.
What CodeZ is
CodeZ is a self-hosted web UI for Claude Code. It wraps the official CLI -- it doesn't reimplement it, doesn't intercept private APIs, doesn't require an Anthropic API key. It spawns claude as a child process, reads its stream-json output, and presents it in a React interface optimized for mobile.
The stack is deliberately simple: a Bun HTTP server, a React 19 SPA, and a Cloudflare Tunnel for HTTPS access from anywhere. One process. No database. Session history lives in the same JSONL files Claude Code already writes.
CodeZ runs on your existing Claude Code subscription. It spawns the official CLI binary, so you use the same plan, the same rate limits, the same everything. There is no separate billing. No API key required.
The holy grail: orchestration without violating ToS
This is the part of the story I'm most proud of, and it's worth telling in full.
The dream for anyone building on Claude Code is orchestration: having one AI agent direct other AI agents. Claude chat spawns a Claude Code session, sends it a task, monitors its progress, reads the results, and decides what to do next. That's the unlock that turns Claude Code from a tool you operate into an autonomous system you supervise.
The problem is doing this without violating Anthropic's terms of service. You can't reverse-engineer the CLI. You can't intercept internal protocol traffic. You can't inject prompts by writing directly to stdin streams that belong to another process. Every obvious path to orchestration runs through territory that would put you on the wrong side of the ToS -- and would break on the next CLI update anyway.
The breakthrough came from Anthropic themselves. Claude Code ships a feature called Channels (currently in research preview) that is exactly the primitive we needed. Channels is an official plugin architecture that lets external processes communicate bidirectionally with a running Claude Code session. It's documented. It's supported. It's designed for exactly this use case.
We wrote our own Channel plugin: opzero-channel. It's a small MCP-compatible plugin that registers itself via a discovery file, accepts injected prompts over HTTP POST, streams session events back over SSE, and handles permission request relay. When you load it into a Claude Code session with the --channels flag, it opens a communication bridge that any authorized external system can talk to.
This is the architectural foundation everything else is built on. Permission relay from your phone? That's a Channel event surfaced in the UI. Prompt injection from Claude chat? That's an HTTP POST to the Channel's inject endpoint. Cost tracking, session monitoring, fleet visualization -- all of it flows through the Channel's SSE event stream.
Every piece of CodeZ's orchestration layer uses officially supported Claude Code features: the CLI's stream-json output, the Channels research preview, and standard MCP transport. No reverse engineering. No private API access. No ToS gray area.
The result is that Claude chat can orchestrate Claude Code sessions through CodeZ's MCP server, which talks to live sessions through the Channel plugin, which uses Anthropic's own officially supported protocol. An agent directing agents, through a clean chain of official interfaces. That's the holy grail -- and we didn't have to break anything to get it.
Everything Remote Control isn't
Remote Control gives you the standard Claude chat interface pointed at your local session. That's the beginning and end of what it does. A thin pipe -- type a message, see the response, same UI you'd get at claude.ai but pointed at your machine.
CodeZ gives you the full operational layer:
Cost and token tracking. Every session shows a running dollar figure, input/output token counts, and duration. When you're burning through a Max plan's rate limits across multiple sessions, knowing which session is eating your quota isn't optional -- it's essential. Remote Control gives you zero visibility into this.
Session search. Find any past session by message content, not just title. When you come back to a project after a week and need to find the session where Claude refactored the auth module, you need search. Remote Control has no search.
Markers. Bookmark moments in long sessions to review later. When a subagent surfaces something interesting but you don't want to derail the current task, drop a marker and keep going. Come back to it from a dedicated markers panel.
Fleet visibility. See every in-flight subagent across all active sessions in one dashboard. When you have three sessions running with subagents doing parallel work, you need a single view of what's happening. Remote Control shows you one session at a time.
Memory inspection. Read Claude's project memory files directly in the mobile UI. Understand what context Claude is operating with.
Permission mode control. Choose between auto-approve, plan-only, default, accept-edits, and other permission modes per session at creation time.
Voice input. Push-to-talk with auto-submit on silence. When you're on a walk and want to give Claude a complex instruction, dictating is faster than typing on a phone keyboard.
MCP server management. See which MCP servers are connected to a session, monitor tool call latency and error rates, inspect the tool inventory. The CLI gives you this. Remote Control doesn't.
Self-hosted. Your sessions, your server, your data. CodeZ runs on your machine behind your tunnel. Remote Control routes through Anthropic's infrastructure.
Remote Control is a window into a session. CodeZ is the control plane.
The build
CodeZ was built in waves -- compressed sprints where multiple features shipped in sequence, each wave building on the last.
The foundation landed first: session management, live message streaming, SSE multiplexing, mobile layout with iOS safe-area padding, deep links, and a sidebar that groups sessions by git repo name instead of encoded directory slugs.
After Channels shipped, the feature waves came fast.
Wave 1 delivered PWA install (add-to-home-screen removes the Safari chrome entirely), inline send-error feedback, and live sidebar status updates with a brief cyan flash when sessions transition to active.
Wave 2 added cost and token tracking, session disposal confirmation, and the permission mode picker.
Wave 3 shipped voice input, a command palette, auto-memory surfacing, and Cloudflare Access as an optional auth provider.
Wave 4 brought paste-image support (screenshot paste from iPhone into prompts), the markers system, persistent local state, and session grouping by parsed git remote origin.
Wave 5 was the MCP server -- 17 tools exposing the full control plane over standard MCP transport. This is the layer that makes orchestration real: an agent running in Claude chat can create sessions, send prompts, poll for completion, resolve permissions, and read results.
Wave 6 was the dogfood loop -- exercising every MCP tool from Claude chat, finding bugs, and fixing them. Session title sanitization, self-heal log deduplication, tool description enrichment, interaction contract documentation.
Four of those waves shipped in a single day. Some of the commits were authored from my phone, at a birthday dinner, while my family had no idea I was working. That's not a flex -- it's the product proving its own thesis. If you can ship software from a phone at a dinner table, the tool is doing its job.
The MCP server
The MCP server is where CodeZ becomes more than a UI. It exposes 17 tools over standard MCP Streamable HTTP transport covering session lifecycle, prompt injection, permission resolution, event polling, observability, full-text search, and state management.
The interaction model for orchestrating agents is: call create_session or list_sessions to get a target, call send_prompt to inject work, call poll_events to watch for session.idle, then optionally call get_session for the full response. The MCP server handles the Channel bridge underneath.
Authentication uses MCPAuthKit (OAuth 2.1 with PKCE and Dynamic Client Registration). External agents authenticate through a standard OAuth flow before accessing the control plane. No shared secrets, no API keys in config files.
Open source
CodeZ is open source under the MIT license.
The architecture is documented in CLAUDE.md (conventions, style rules, gotchas) and ROADMAP.md (what shipped, what's next, what we decided against and why). The codebase includes agent definition files and research documents covering Claude Code internals.
Installation: clone, bun install, create a config, run. Point a Cloudflare Tunnel at port 4097 and you have HTTPS access from any device. Docker and launchd autostart paths are also documented.
What's next
The roadmap is public in the repo. Near-term priorities include computer use integration (surfacing Claude Code's browser control in the thread with live screenshot streaming), an iMessage relay (text Claude from your phone's native Messages app), subagent output streaming, and server-side fast-path tools that bypass Claude Code entirely for simple file reads and git operations.
Longer term, CodeZ is heading toward swarm mode -- autonomous multi-wave execution where the orchestrator breaks a goal into implementation waves, dispatches agents, integrates results, and self-corrects on failures. The wave pattern already exists in the codebase. The gap is the automation layer on top of it.
And we're already building the next layer: Operator -- a multi-machine connection broker that federates CodeZ instances across devices behind a single MCP endpoint. One conversation, every machine.
CodeZ is part of the OpZero platform -- infrastructure for AI-native development workflows. Deploy what AI builds with a single message. Authenticate MCP servers with hosted OAuth. And now, manage Claude Code from anywhere.