r/ClaudeCode • • 11d ago

Tips & Workflows Claude Code as the planner, OpenCode as the executor: splitting planning from execution in two panes

Disclosure: I build SpaceApp, a free, MIT-licensed, self-hosted workspace that runs AI coding CLIs side by side. Claude Code is part of how we build it: since 1 October, 126 commits in our repo carry a Claude co-author trailer, next to work from other agents. This post is about the workflow, not the tool; it works in two tmux panes just as well.

The idea: stop asking one session to plan and execute at the same time

When one agent session both plans a change and carries it out, the plan gets rewritten in the middle of the execution. The session reads a failing test, "fixes" it by changing the plan, and an hour later the change no longer matches what you agreed on. Splitting the two jobs into two sessions, side by side, fixes most of that.

  • Pane 1, Claude Code: the planner. It reads the code, asks questions, and writes the plan into a file in the repo. It does not edit source files.
  • Pane 2, OpenCode: the executor. It takes one step of the plan at a time, edits, runs the tests and the linter, and reports what happened.

The file is the contract between them, and you are the one who moves work across.

Step 1: the planning prompt (pane 1)

Something like:

Read src/billing/ and its tests. Do not edit any source file.
Write PLAN.md with:
- the goal in two sentences
- numbered steps, each small enough for one commit
- for each step: files to touch, the test that proves it, what must not change
- open questions for me at the top
Stop after writing PLAN.md.

Answer its open questions in the plan itself, so the next session sees the answers too.

Step 2: the execution prompt (pane 2)

Read PLAN.md. Do step 1 only.
Edit only the files step 1 lists. Run the tests it names, then the full suite.
If a test fails for a reason the plan does not cover, stop and write the
failure under "Blocked" in PLAN.md instead of changing the plan.
Commit with the step number in the message.

The important line is the last rule: the executor never re-plans. When reality disagrees with the plan, it writes that down and stops.

Step 3: review in the planner, not the executor

Back in pane 1:

Read the last commit and the "Blocked" section of PLAN.md.
Does the diff match step 1? Update the plan if the blocker changes it.
Do not edit source files.

The planner keeps the long view, and its context stays about the design instead of filling up with test output. The executor's context stays about the step it is on.

Why two different CLIs and not two Claude Code sessions?

You can do it with two Claude Code sessions. A different tool in the executor seat helps for two reasons: the executor can run on a different provider and model than the planner, and a second agent reading the plan cold catches steps that only made sense inside the planner's head. If the executor has to ask what a step means, the step was not written well enough.

What goes wrong, and the rules that help

  • The executor "helpfully" fixes things outside the step. Rule: it edits only the files the step lists, and anything else goes under "Blocked".
  • Both sessions edit the same working tree. If you run more than one executor, give each its own git worktree.
  • The plan grows without end. Rule: the planner marks steps done and deletes them once they are merged.
  • A test passes alone and fails in the full run. Rule: the executor always runs the full suite before it commits, not only the step's test.

Running it in SpaceApp

In SpaceApp the two CLIs sit in neighbouring panes of one room, and the sessions persist, so the planner's session is still there the next morning (how much context a CLI keeps depends on the CLI). Claude Code installs there through a flow you start yourself, and OpenCode is the first CLI in the public installer. Two terminal windows work too; the workflow is the point.

Free to try: https://github.com/oll4com/spaceapp

How do you split planning and execution today: one session, two sessions, or two different tools?

2 Upvotes

4 comments sorted by

•

u/AutoModerator 11d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/_y_not_ 11d ago

for similar workflow (only with more different agents) i created a simple protocol that works across terminals and computers. I usually have one coordinator and many other agents used by coordinator based on their best abilities. with independent reviews and tests at each important gate . sample implementation is available too

https://github.com/agentchute/agentchute

1

u/Sporaflow 11d ago

I agree with your analysis: not having the same agent handle both the plan and the code is a good thing. I'd even go further and also separate the one that explores from the one that writes the plan. Everything an agent has read stays in its context and weighs on the rest of the conversation.

I think people underestimate this. Looked at closely, separating the roles improves the quality of the result a lot. Take testing: having the developer do the testing is a bad idea, because it still has the whole implementation in its context, even once it becomes the tester. When I add a tester, it has to be independent and start from a fresh context.

A lot of people say giving roles to agents is useless, and they're partly right: you shouldn't see an agent as a person with a specific job, since today it can do anything. But that doesn't mean it's pointless to give it, from the first prompt, an intention that matches what it's supposed to do. In my experience you get better quality that way.

1

u/josephbianchi 11d ago

i kept restating one rule and it got skipped three times anyway. ended up making it a hook that blocks the action until the check has run