Rebuilding a Go AI Assistant with Claude Code Agent Teams
The article walks through how the author refactored the Go‑based AI assistant GoClaw by leveraging Claude Code's Agent Teams feature, detailing the motivation, architecture comparison, configuration steps, team role assignments, and practical tmux integration to achieve a more modular and reliable agent module.
Background
GoClaw is a personal AI assistant written in Go that runs on a local server and exposes services via WebSocket/HTTP. It supports multiple messaging channels (Telegram, WhatsApp, Feishu, QQ, Slack, etc.). The initial codebase was copied from nanobot [1] (a 4 000‑line Python project) and later influenced by picoclaw [2]. Early versions frequently failed to complete tasks, aborting when a tool call failed. Adding a reflection step—where the LLM checks task completion after each iteration and repeats until the goal is met—improved reliability but left GoClaw still lagging behind OpenClaw’s capabilities.
Claude Code Agent Teams
Claude Code introduced an Agent Teams feature (see https://code.claude.com/docs/en/agent-teams) that lets multiple Claude Code instances collaborate, share a task list, exchange messages, and manage context centrally. A session acts as the team lead, assigning work and aggregating results, while teammates operate with independent context windows.
Key Concepts
Agent Team : Several independent Claude Code agents working together on complex problems.
Subagent : A single helper created by a lead agent to execute an isolated task and return a summary.
Team Lead : The coordinating agent that creates and manages the team.
Teammate : Independent Claude Code instances with their own context windows.
Shared Task List : A common pool of tasks that any member can claim, update, or complete.
Delegate Mode : The lead only delegates and coordinates; it does not write code itself.
Split‑pane Mode : Uses tmux or iTerm2 to display each teammate in a separate terminal pane.
Plan Approval : The lead must approve a teammate’s plan before execution, providing risk control.
Agent Teams vs. Subagents (Structural Comparison)
Context Window : Subagents have independent windows but report results back to the lead; Agent Teams keep windows independent without automatic aggregation.
Communication : Subagents only report to the lead; Agent Teams allow direct peer‑to‑peer messaging.
Collaboration Model : Subagents are centrally controlled; Agent Teams use a self‑organizing shared task list.
Suitable Scenarios : Subagents excel at single, isolated tasks; Agent Teams are better for multi‑faceted, collaborative problems.
Setup and Configuration
Update Claude Code to the latest release.
Edit ~/.claude/settings.json and enable the experimental flag:
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}Restart the terminal and start a new Claude Code session. Prompt the model in natural language to create a team, e.g., “Create a team to explore CLI tool design: one member for UX, one for architecture, and one as a skeptic.”
Choose a display mode: in-process: All teammates run inside the main terminal; switch between them with Shift+Up/Down . split-pane: Each teammate gets its own tmux or iTerm2 pane.
The default teammateMode is auto, which selects split-pane when running inside tmux and falls back to in-process otherwise. To force a mode, set "teammateMode": "in-process" in settings.json or launch with --teammate-mode in-process.
Reconstructing GoClaw’s Agent Module
Using the team workflow, Claude Code was instructed to study OpenClaw’s pi agent design and then redesign GoClaw’s agent package. Four roles were defined for the AI team:
@researcher : Analyzes OpenClaw and the pi‑agent source, extracting design patterns.
@architect : Produces a redesign of GoClaw’s agent module based on the researcher’s findings.
@implementer : Writes the Go code according to the architect’s blueprint.
@tester : Executes unit and integration tests to validate the implementation.
The team executed these steps autonomously, requiring only human provision of time and budget. The resulting agent module mirrors OpenClaw’s functionality, with only minor manual adjustments needed.
Practical Tips for Multi‑Agent Development
When using split-pane mode, enable mouse support in tmux for easy pane switching and resizing: set -g mouse on Installing tmux (e.g., brew install tmux on macOS) allows the split-pane layout to appear automatically after the team is created. Each pane shows the live output of a teammate, while the lead pane can monitor progress and issue additional tasks.
References
nanobot: https://github.com/HKUDS/nanobot
picoclaw: https://github.com/sipeed/picoclaw
BirdNest Tech Talk
Author of the rpcx microservice framework, original book author, and chair of Baidu's Go CMC committee.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
