DEV Community

Cover image for How I use my bots to plan, and a dedicated spare MacBook to write the code
Cristian Calabro
Cristian Calabro

Posted on Originally published at x.com AI-assisted

How I use my bots to plan, and a dedicated spare MacBook to write the code

Originally published on X.

The main idea is to use Grok Bot as an orchestrator, with a coding agent CLI (Codex, Claude Code, GitHub Copilot CLI, or Grok) doing the engineering.

I talk through an idea with one of my bots in chat. The bot has the context and the memory, and it writes the plan. When I say to send it to the Mac, the work goes to a dedicated spare MacBook, not to a cloud coding agent.

Why I split it this way

I want my bots' credits spent on planning and orchestration, not on coding. Coding burns the most tokens, and I already pay for Codex, Grok, Claude, and Copilot CLI subscriptions, so the coding runs on those.

I also wanted "send it to implement" to go to my own spare MacBook rather than to a cloud coding agent. On that machine, I have my CLIs, my subscriptions, and my choice of model and effort per task. It's the same environment I use myself, so a repo behaves for the agent the way it does for me.

The bot keeps the context: the conversation, the memory, and what I care about. That's why it's the right place to plan. The CLI is the right place to read code, edit, and run tests.

How it's connected

Tailscale links the bot computer and the spare MacBook on a private network. Nothing is exposed to the internet.

On that MacBook, there is a dedicated non-admin macOS user just for agents. The agent CLIs run with permission prompts off, because a headless run needs that, so the blast radius has to be the account itself. That user can't sudo. It also can't reach my personal files, my browser sessions, or my keychain.

Remote Login (SSH) is limited to that user, and only the bots' key is allowed in, so the bots can't log in as me.

A Tailscale access rule (an ACL) lets the bot device reach exactly one thing: SSH on that spare MacBook. My main Mac is off-limits to the bots, for now. My own devices keep full access.

The agent CLIs are installed and logged in under the agents user, separate from my personal account and my personal sessions.

GitHub access is a fine-grained token for that user, scoped to the repos I choose, with only contents and pull requests access. The agents can push branches and open draft pull requests. They are not allowed to merge, push to main, or delete branches. Pull requests stay draft for my review, at least for now.

No secrets go in tasks or in chat. Tokens are typed on the MacBook itself, never pasted to a bot. Runs only happen on the machine I named.

One gotcha: from the bot side, the spare MacBook was only reachable by its full MagicDNS name, the long name Tailscale uses on the private network, not the short name or the IP.

The launcher

The launcher on the spare MacBook is a small shell script. I used SSH and a tiny script, not a platform, because it's easy to read and easy to audit.

It has two modes, plan and build. The bot calls it over SSH with the repo, the task or the plan, and an optional CLI, model, and effort.

When a run starts, this is what the script does:

  1. It creates a run folder with the task, the prompt, the log, and the status.
  2. It uses one cached clone per repo on the MacBook, and gives the run a fresh git worktree on its own branch. Plan runs get a read-only worktree. Runs stay isolated from each other and from my own checkouts. They start faster, and they share git history instead of downloading the repo each time. A small lock keeps two runs on the same repo from fetching at once. When a run is finished, its worktree is cleaned up.
  3. It picks the coding agent CLI, the model, and the reasoning effort. If I name them in chat, that wins. If not, the launcher reads a small header at the top of the plan file. If neither says, it uses Codex.
  4. It wraps the task in a short prompt that tells the CLI to follow this repo's agent rules. In plan mode, that means change nothing and write a plan with a suggested CLI, model, and effort. In build mode, that means implement the work, run the tests, commit, don't push, and write a pull request title and description.
  5. It starts the CLI headless in its own background session, so closing the connection can't stop the run.
  6. After a build, the launcher, not the model, pushes the branch and opens a draft pull request. If the coding agent made no changes, the run is marked "no changes" and nothing is pushed. Pull requests are always drafts. Nothing is merged, and nothing is pushed to main. The pull request has a footer that names the CLI, model, and effort, so when I open it I can see that without digging.
  7. It writes a final status: done, no changes, failed, or stopped.
  8. It sends that result to the bot that started the run. Each bot has its own webhook, a URL the launcher posts to when a run ends, and the launcher retries if the call fails.

The model never gets push or merge as part of its job. The launcher does the one git step that leaves the machine, and only as a draft.

It also has a few small commands. Mostly the bots use these.

  • list shows every run, with its status and a one-line summary of the repo, the mode, the CLI, the model, and the effort.
  • status shows one run's state, and the pull request link if there is one.
  • log shows the end of the CLI's transcript, which is what the bot reads to explain a failure. There's no live view in the chat. If I want to watch a run, I connect to the MacBook and follow the run's log there.
  • result shows the plan a plan run wrote.
  • stop kills a run I no longer want and marks it stopped. A stopped build pushes nothing.

The shared skill

Any of my bots can do this. They share one computer, so one connection and one shared skill serve all of them.

The skill is a saved recipe in my shared library. It holds how to reach the spare MacBook, how to call the launcher in plan and build mode, how the CLI, the model, and the effort are chosen, the format of that header at the top of a plan, and how to watch a run and report back. It also holds the rules already described: never merge, never push to main, never delete branches, draft-only pull requests, no secrets in tasks or chat, and only that one MacBook.

The skill only applies when I name the MacBook, for example "send it to the Mac to plan" or "send it to implement." Otherwise the bot works in chat as usual. A plan never turns into a build unless I say so.

The flow

I stay in GrokBot the whole time. After a bot starts a run, it tells me the run started and stops there. I can keep doing other things while the plan or the implementation runs in the background on the spare MacBook.

When the run ends, the launcher calls that bot's webhook with the run id and its status. That wakes the bot. It checks the run on the MacBook over SSH, because it only trusts the run id from the call, then messages me with the pull request link, the plan, or what stopped it.

My first version had the bot wait in a background loop that checked the run's status every 30 seconds. That didn't work. Once the bot's turn ended, nothing woke it when the loop finished, so a run could end without anyone telling me. The webhook fixed that.

The launcher writes that status, not the model. The statuses are:

  • done: finished, and for a build there are commits and a draft pull request.
  • no changes: the CLI finished, but nothing was committed. That usually means it stopped on purpose, such as on a repo rule or an approval gate, or couldn't do the work.
  • failed: the CLI or the push and pull request step errored.
  • stopped: I canceled it.

"Blocked" is not a separate status. When a build ends with no changes, the bot reads the end of the log to find out why, and tells me in plain words. I don't read the logs. That's a rule I made.

Here's a full run, from the chat to the draft pull request:

  1. I chat with a bot in Grok Bot about an idea, and the bot writes the plan. It has the context and the memory, so planning is what it's good at.
  2. I read the plan and approve it or edit it in chat.
  3. I say "send it to implement." The bot sends the approved plan to the spare MacBook, word for word, plus a note that I approved it in chat, with the date. The launcher creates a fresh worktree and runs a CLI on it. The CLI follows the repo's own workflow, implements the work, runs the tests, and commits. The launcher pushes the changes and opens a draft pull request. Nothing merges, and nothing touches the main branch.
  4. The bot messages me when it's done, with the pull request link and a short summary, or a plain explanation of what blocked it.
  5. I review the pull request. If something needs fixing, I tell the bot, and it sends the fixes as a build on that same pull request. The fixes land as new commits on the same PR, never a force push, with a comment summarizing what changed. No second pull request stacked on the first.
Grok Bot: idea and plan
  -> Approve or edit in chat
  -> Send it to implement on the MacBook
  -> CLI builds, tests, and commits
  -> Draft pull request and a short summary
  -> Review, then fixes as new commits on the same pull request
Enter fullscreen mode Exit fullscreen mode

How a run goes

Let's say I'm chatting with a bot about a small docs change to one of my repos. The bot writes the plan, and I approve it. In the same message I pick the CLI, the model, and the effort: Codex, gpt-6-luna, medium.

Then I say "send it to implement." The launcher gives the run a fresh worktree and runs Codex with the approved plan. This repo has its own spec-driven workflow with a human approval gate, so the agent reads the repo's rules, writes the proposal and the spec, and stops at the gate. The bot brings me the exact text to approve. I approve it, and the agent records my approval, implements the work, runs the tests, validates the specs, and commits. The launcher pushes the branch and opens a draft pull request. The bot messages me the link, with a short summary.

At one point the repo's tooling needed one extra section that the approved spec didn't have. The agent stopped instead of changing the approved text. The message was: "It stopped at your spec gate because the tooling needs one extra section that wasn't in the text you approved. Here's the exact addition; approve it and I'll continue." I approved it, and the build continued.

A blocked message always says what stopped the run, why, and the one thing needed next, never a log dump. Another example, if the repo's workflow needs a tool that isn't installed on the MacBook: "The build stopped without changing anything. Your repo's workflow requires a tool that isn't installed on the MacBook, and the agent followed the rule to stop and ask. Here's the one command to install it, and I'll rerun once it's in."

Choosing the tool

I can name the CLI, the model, and the thinking effort in chat, for example: "implement with Codex, gpt-6-luna, medium."

Or the plan itself carries that choice in a small header at the top of the file, in this format:

---
cli: codex
model: <optional>
effort: high
---
Enter fullscreen mode Exit fullscreen mode

That way the planner can recommend the right tool for the build: a cheaper model for an easy one, or a stronger one for a hard one.

What I say in chat wins. If I don't say it, the launcher reads that header. If neither is set, the default is Codex.

A model in the header only counts if its CLI is the one running.

Repo rules still win

Each repo's own agent rules load exactly as they would if I opened the session myself: AGENTS.md, CLAUDE.md, skills, and harness workflows. Chat or plan choices are passed as flags on top of that.

If a repo has a human approval gate, for example spec approval before code, the agent stops there. The bot brings me the exact text to approve. Only then does it build.

The setup orchestrates. It does not bypass the harness. The work is harness engineering plus orchestration, with me in the loop where it matters.

What's next

I considered a session viewer, including tools like Orca and t3.code, and I don't need one yet. What matters right now is that the bots can run a plan and open pull requests. A viewer can wait until/if I need to watch a run live.


I wrote this because I wanted my bots' credits spent on planning, and the coding done on my own CLIs and machine. Leave your questions in the comments too, and I'll answer them.

I'm Cristian Calabro, a software engineer with 15+ years of experience. More about my work at ccalabro.dev and how I help teams as a remote engineering and AI advisor.

Follow me on X for more.

Top comments (0)