On this page6 sections
A concrete pattern for letting one AI app drive another safely: a small local CLI, secrets that never leave the machine that holds them, and human gates for the decisions that matter.
If you already read my post on choosing an AI coding harness, this is the bridge I teased there. If not, this post stands on its own.
Most of my AI tools are islands. The proprietary assistant I use every day lives in one app. The open-source coding harness I run for ticket work lives in another, and for a long time the interface between them was me: copying a ticket into one window, copying the result back into the other. That works, but it means nothing happens unless I'm sitting at the right screen. I wanted the apps to talk to each other directly, with me deciding the important parts.
What "an interface between apps" means here
When you want one AI app to drive another, the surface can be an HTTP API, an MCP server, a CLI wrapper, or webhooks and events. None of these is right in general. The right one depends on where each app runs and what it can reach. The run-through below is how I chose, and why a CLI won for this setup.
The run-through: connecting an assistant to a local coding harness
Starting point: the harness already has a server
OpenCode is client/server under the hood. I run OpenRob, my private fork of OpenCode with my own packaging and defaults; this post is about that fork's local server, not upstream OpenCode as a product. Every client talks to that server over an HTTP API with a published OpenAPI spec. It covers everything I needed: create a session, send a prompt, run the plan and build commands, list pending forms and permission requests, and answer them.
So the question wasn't "how do I add an API?" It was "how does my assistant use the one that's there?"
The spike
Before writing any wrapper, I spent an evening calling the API from the Mac itself: create a session, prompt it, wait, run plan, answer a test form, reject a test permission. It all worked, and it surfaced the details a wrapper should hide:
- Running the API client without naming the server talked to the desktop app's separate server instead. Easy to miss.
- The obvious health route returned the web UI's HTML, so it couldn't be used as a health check.
- Session objects are huge, because each one embeds the full plan markdown. You never want those in a chat.
- Piping large responses from the CLI sometimes truncated them. Writing to a file was reliable.
- The wait call returns no body, so you need a second call to find out how the run actually ended.
That last point matters when a run gets stuck. If orb wait hits its timeout, I treat it as half-failed: call orb status, read whether the session is still running, blocked on a human, or dead, and only then interrupt, and only after asking. A timeout alone is not a kill signal.
Building orb
orb is a single Python script, no dependencies, that lives in its own repo outside the OpenCode fork. That separation is also how I handle API drift. When OpenCode's server shape changes, I bump the wrapper and its mock-server tests against the OpenAPI surface I care about, then upgrade the fork on its own schedule. The harness can move without rewriting the bridge, and the bridge can pin expectations without freezing the harness.
Every command prints one compact JSON object. Sessions are trimmed to the fields an agent actually needs. Exit codes mean something: success, error, timeout, or "blocked on a human" when a form or permission is waiting. A typical ticket session looks like this:
orb health
orb worktree create ~/code/my-app --name tkt-123 --new-branch rob/tkt-123-fix-header
orb new <worktree-dir> "TKT-123 fix header" --approve shell,edit
orb plan ses_… "Fix the header overlap described in TKT-123"
orb wait ses_… --timeout 600
orb pending ses_…
orb build ses_…
orb status ses_…Why a CLI and not an MCP server
My first instinct was an MCP server. But my assistant works from its own cloud computer, and that computer isn't on my private network, so a hosted MCP server couldn't reach the Mac. I also couldn't have the assistant load an MCP process that runs locally on the Mac.
What it can do is run shell commands on my Mac once I've registered it. So a CLI was the simplest thing that worked. Bonus: I can run exactly the same commands myself and test them without any AI involved. I kept an optional MCP phase on the list behind a clear gate, and when the gate came back "no", I cancelled it instead of forcing it.
Hardening
Keep credentials local and scope the tool's access to only the operations it needs:
- The server is bound to localhost only. When I started, it was listening on every interface.
- My own devices reach the web UI over my private network. Nothing is exposed publicly.
- Keep credentials on the machine running the tool. Load them through a local credential helper or secret store, and never print them, put them on the command line, or expose them to the assistant. Protect access to the storage mechanism and plan for rotation and audit.
Teaching the assistant: an operator skill
A tool is only half the interface. The other half is how the agent should use it, so I wrote an operator skill that encodes the loop: check health, create or reuse a session, prefer plan first, wait, show me the plan, ask before building, watch for pending forms and permissions, then report status with a short excerpt of the last answer.
Day to day
Now I can message the assistant from my phone with a ticket, and it creates a fresh worktree on its own branch, starts a session in it, and runs plan. I read the plan on my phone and say go or change it. Each ticket gets its own worktree, so sessions don't trip over each other and a bad run is easy to throw away. Before the bridge, starting that loop meant sitting at the Mac and copying text between apps. After it, I can kick off a plan from my phone in a couple of minutes and keep the Mac as the worker, not the control surface.
Rules I set for the bot
- It never approves or rejects permissions on its own. It shows me the request and the options, and runs
orb permitonly after I choose. Same for forms. - It never builds before I've seen the plan.
- It doesn't kill the server. It can interrupt a stuck session, and only after asking.
- It never asks me to paste a password into chat.
The most useful lesson came during verification. Commands and file edits ran without ever asking, because the server had no permission rules by default. A rule in a skill file can't help if the server never raises the question. So I added a per-session approval policy to orb itself, and sessions the assistant starts now require approval for shell commands and edits. Guardrails belong in the interface, not just in the instructions.
The general pattern
Take away the specific tools and this is what I'd reuse:
- A small, scriptable surface. A few commands with predictable JSON and meaningful exit codes beat a giant API.
- Read before write. Health, list, status and pending are cheap and safe. Make the agent look before it acts.
- A clear auth boundary. The secret lives where the server lives. The caller gets a tool, not a credential.
- Humans on the decisions that matter. Make "blocked on a human" a first-class state, not an error.
- Logs you can audit. Session ids, plan files and short summaries show what happened afterwards.
What I'd refuse next time
- I would refuse another hosted MCP attempt for a server that only lives on my private network. The gate already said no; forcing it would have burned a week.
- I would refuse auto-approving shell or edits "just for the demo." The first verification run proved how fast that goes wrong.
- I would refuse putting the server password in chat, in env vars the assistant can read, or in any cloud secret store the assistant's computer can fetch. The tool runs where the secret lives, or it doesn't run.
What's next
Pi, Hermes and Kandev are examples of tools that could be connected with the same small CLI bridge, as could apps that aren't coding tools at all. The shape stays the same: a small CLI near the app, secrets kept local, and a skill that tells the bot when to stop and ask the user.