Productivity

How Zo Runs AI Coding Agents for You

Claude Code

Claude Code, Codex CLI, and Gemini CLI all have headless modes. They accept a prompt, do the work, and exit. No interactive terminal needed. Anthropic documents claude -p. OpenAI provides codex exec. Google builds Gemini CLI with a -p flag for non-interactive use. They're designed to be run by scripts, CI pipelines, and orchestration systems.

Your Zo is an orchestration system. It's an always-on cloud computer with a terminal, git, and 100+ tools. It can launch any of these coding agents, feed them a task, manage the git workflow around them, and deliver the results to you on Telegram, SMS, or email. The coding agent writes the code. Your Zo handles everything else.

The pattern

Every CLI coding agent follows the same pattern:

  1. You give it a prompt and a working directory
  2. It reads the codebase, writes code, runs commands
  3. It exits when the task is done

Your Zo wraps that pattern with everything the coding agent can't do on its own:

  • Git orchestration. Create a branch or worktree, run the agent, commit, push, open a PR.
  • Scheduling. Run the agent on a schedule: nightly test fixes, weekly dependency updates, morning code reviews.
  • Delivery. Text you the PR link. Email the diff. Send a Telegram message with the summary.
  • Tool access. Connect the agent to Zo's tools via MCP: web search, Gmail, Calendar, Drive, image generation, and more.
  • Chaining. Run one agent, check the result, run another. Your Zo can launch Claude Code to write a feature, then launch Gemini CLI to review it.

The coding agent stays focused on code. Your Zo handles the orchestration, communication, and infrastructure around it.

Claude Code

Claude Code is pre-installed on every Zo. No setup required beyond authentication. It's the most capable of the three for complex, multi-file changes and has native MCP support for connecting to Zo's tools.

For the full setup guide — authentication options, interactive use, headless mode, worktree workflows, MCP integration, and troubleshooting — see How to Run Claude Code on Zo.

The short version for headless runs:

Prompt

Run Claude Code headlessly with the prompt "Read the codebase in /home/workspace/my-project and fix any failing tests"

Your Zo launches claude -p, passes the prompt, and reports the results. For the worktree + PR workflow that creates an isolated branch, runs Claude Code, and opens a pull request, see the dedicated post.

Codex CLI

Codex CLI is OpenAI's open-source terminal coding agent. It reads your codebase, writes code, and runs commands. The codex exec subcommand runs it non-interactively — no TUI, just input and output.

Install it:

Open Zo's terminal:

text
npm install -g @openai/codex

Save your OpenAI API key in Settings > Advanced as OPENAI_API_KEY.

Run it headlessly:

Prompt

Run Codex CLI headlessly with the prompt "Refactor src/utils/parser.ts to use the new schema validation library" in /home/workspace/Code/myproject

Your Zo launches codex exec, passes the prompt, and reports the results.

Run it in a worktree with a PR:

Prompt

Run Codex CLI in an isolated git worktree, then create a PR.

Task: Add unit tests for all exported functions in src/lib/ Repo: /home/workspace/Code/myproject

Instructions:

  1. Create a worktree from origin/main under /tmp/worktrees/
  2. Run codex exec with my task in that directory
  3. Commit, push, and open a PR
  4. Text me the PR link

Codex strengths: Codex CLI is open-source and uses OpenAI models. It's a good option if you prefer GPT-4o or o3 for code generation, or if you want to customize the agent's behavior by forking the repo. It also tends to be faster for smaller, focused changes.

Gemini CLI

Gemini CLI is Google's terminal-based AI coding tool. It supports non-interactive execution for scripted and automated workflows, and benefits from Gemini's large context window for working with bigger codebases.

Install it:

Open Zo's terminal:

text
npm install -g @google/gemini-cli

Save your Google API key in Settings > Advanced as GEMINI_API_KEY.

Run it headlessly:

Prompt

Run Gemini CLI headlessly with the prompt "Review the code in src/auth/ and suggest security improvements" in /home/workspace/Code/myproject

Run it in a worktree with a PR:

Prompt

Run Gemini CLI in an isolated git worktree, then create a PR.

Task: Update all deprecated API calls to use the v2 endpoints Repo: /home/workspace/Code/myproject

Instructions:

  1. Create a worktree from origin/main under /tmp/worktrees/
  2. Run Gemini CLI non-interactively with my task
  3. Commit, push, and open a PR
  4. Email me the PR link with a summary of what changed

Gemini CLI strengths: The large context window (up to 1M tokens) makes Gemini CLI well-suited for tasks that require understanding a large codebase at once — reviewing architecture, finding patterns across many files, or migrating APIs with widespread usage. It's also a good choice for code review, where reading comprehension matters more than code generation.

Choosing the right agent for the task

Each agent has different strengths. Your Zo doesn't care which one it's running — they're all terminal programs — so you can pick the best tool for each job.

TaskBest fitWhy
Complex multi-file featureClaude CodeBest at multi-step reasoning and coordinated changes across files
Quick focused refactorCodex CLIFast for small, targeted changes
Large codebase reviewGemini CLILarge context window reads more code at once
Security auditGemini CLI or Claude CodeBoth handle detailed analysis well
Test writingAnyAll three write tests effectively
Bug fix from error logClaude CodeStrong at debugging and iterating until tests pass

You're not locked into one agent. Try Claude Code this week. Try Codex next week. Run both on the same task and compare the PRs.

Chain agents together

Since your Zo orchestrates the process, it can chain multiple agents on the same task. Use one agent to write code and another to review it:

Prompt

Run Claude Code in a worktree on myproject with the task: "Add a rate limiting middleware to src/api/server.ts with configurable limits per endpoint."

When it's done, run Gemini CLI in the same worktree with: "Review the changes. Check for edge cases, missing tests, and security issues. Write your review as a comment."

If both pass, open a PR with both the implementation and the review notes. Text me the link.

Use one agent to generate tests and another to review the fixes:

Prompt

Every night at midnight, run Claude Code on myproject: "Run the full test suite. If any tests fail, fix them."

Then run Codex on the same worktree: "Review the test fixes for correctness. Revert any fix that changes test expectations rather than fixing the actual bug."

If there are changes after both passes, open a PR. Otherwise, text me "All tests passing."

Chaining works because your Zo controls the sequence. It launches agent A, waits for it to finish, checks the result, decides whether to launch agent B, and handles the git workflow around the whole thing. The agents don't need to know about each other.

Give coding agents access to Zo's tools

By connecting a coding agent to the Zo MCP server, it gains access to everything your Zo can do: web search, email, calendar, file management, image generation, and more.

Prompt
Set up the Zo MCP server for Claude Code

This works with any agent that supports MCP. Claude Code has native MCP support. For agents that don't, your Zo can bridge the tools via mcporter.

With MCP connected, a coding agent can search documentation while it works, email you when a long task finishes, or pull context from your Google Drive — capabilities it wouldn't have on its own.

Schedule recurring coding tasks

The combination of headless mode + scheduling is where this gets powerful. Tasks that would require you to remember, open a terminal, and run a command can happen automatically:

Prompt

Create a daily agent that runs Claude Code at 6am to check for failing tests in myproject. Text me if anything breaks.

Prompt

Create a weekly agent that runs every Monday at 2am. Launch Codex on myproject: "Check for outdated dependencies. Update any that have non-breaking updates available." Open a PR with the changes.

Prompt

Create a weekly agent on Fridays at 5pm. Run Gemini CLI on myproject: "Review all code changed this week. Summarize the changes, flag any potential issues, and rate the overall code quality." Email me the review.

Your Zo runs these on schedule, whether your laptop is open or not. You wake up to PRs, test results, and code reviews — done overnight by agents that never sleep.

Getting started

Start with Claude Code — it's already installed:

Prompt

Run Claude Code headlessly on my project at /home/workspace/Code/myproject with the prompt "Read the codebase and summarize the architecture"

Once you see how it works, try scheduling it. Then install Codex or Gemini CLI and experiment with chaining. Your Zo runs them all the same way.

More tutorials

How Zo Runs AI Coding Agents for You | Zo Computer