简介
多智能体并行编码协调器,通过 Mayor 自动拆分任务、管理状态并合并代码,适合复杂多文件开发场景。
原始描述
Multi-agent coding orchestrator using Gas Town (gt) and Claude Code. Use for ANY non-trivial coding task — multi-file changes, new features, refactors, bug fixes, anything involving code that needs to compile/run/test. Delegates work to parallel Claude Code agents (polecats) with git-backed persistent state, work tracking (beads), and coordination. Use when a task involves more than a single file edit or quick script.
中文使用说明 来自收录源
核心用法
Gastown 是一个基于 Gas Town (gt) CLI 和 Claude Code 的多智能体编码编排系统,通过 Mayor 统一入口协调并行开发。
工作流程:
- 任务委托:通过
gt mayor attach(交互式)或gt mayor mail "任务描述"(非交互式)向 Mayor 描述需求 - 自动拆分:Mayor 将任务拆分为 beads(工作项),创建 convoy(工作队列),并 sling(分配)给 polecats(子智能体)
- 并行执行:每个 polecat 遵循
mol-polecat-work9 步生命周期:加载上下文→创建分支→预检测试→实现→自审→运行测试→清理→准备评审→提交销毁 - 自动合并:Refinery 代理负责将分支合并回 main,用户禁止直接推送
关键 CLI:
gt convoy list/status— 监控工作队列gt agents list --all— 查看所有智能体bd show <bead-id>— 检查具体任务状态
显著优点
- 真正的并行开发:多 polecats 同时处理不同 beads,大幅提升复杂任务效率
- 状态持久化:基于 git 的状态管理,支持断点续传
- 标准化生命周期:9 步强制流程确保代码质量(测试、自审、清理)
- 防冲突设计:分支隔离 + Refinery 统一合并,避免直接操作 main 的风险
- 自然语言接口:无需学习复杂 CLI,直接描述需求即可
潜在局限
- 环境门槛高:需预装 gt、bd、claude、tmux 3.0+、Go 1.23+ 五类组件
- 学习曲线陡峭:概念繁多(Mayor/Rig/Polecat/Convoy/Bead/Refinery/Witness)
- 调试复杂:多 tmux 会话并行,问题定位需熟悉
tmux capture-pane等命令 - 单点依赖:Mayor 故障时需
--hook-raw-bead紧急绕过,但会跳过生命周期保护 - 资源占用:多智能体并行对机器性能有要求
适合人群
- 需要同时修改多文件的中大型功能开发
- 涉及重构、bug 修复等需编译/测试的代码任务
- 团队协作场景下需标准化流程的代码审查
- 不适合:单文件快速编辑、纯研究任务、无需运行的脚本
常规风险
| 风险项 | 说明 |
|---|---|
| 生命周期绕过 | --hook-raw-bead 会跳过测试/自审步骤,仅应急使用 |
| 直接推送 main | 文档明确禁止,会导致 Refinery 合并冲突 |
| ICU 构建失败 | Go 安装时需 CGO_ENABLED=0 规避 |
| 会话僵死 | Claude Code 完成后可能冻结,需手动 kill tmux |
| 权限问题 | 无 sudo 时需改安装到 ~/local/go/ |
技能正文
name: gastown description: Multi-agent coding orchestrator using Gas Town (gt) and Claude Code. Use for ANY non-trivial coding task — multi-file changes, new features, refactors, bug fixes, anything involving code that needs to compile/run/test. Delegates work to parallel Claude Code agents (polecats) with git-backed persistent state, work tracking (beads), and coordination. Use when a task involves more than a single file edit or quick script.
Gastown — Multi-Agent Coding Orchestrator
Gastown coordinates multiple Claude Code agents to complete coding tasks in parallel with persistent state and work tracking.
When to Use
- Gastown: Multi-file changes, features, refactors, bug fixes, any code needing compile/run/test
- Sub-agents: Quick research, one-shot generation, simple file writes, non-coding tasks
- Direct exec: Single file edits, running commands, checking status
Prerequisites
gtCLI (Gas Town)bdCLI (Beads issue tracker)claudeCLI (Claude Code)tmux3.0+- Go 1.23+
Run scripts/setup.sh to install all prerequisites.
Setup (first time only)
# Install gt + bd
scripts/setup.sh
# Create workspace (if not done)
gt install ~/gt --git
cd ~/gt
# Add a project as a rig
gt rig add <name> <git-repo-or-local-path> --branch main
Core Workflow — Work Through the Mayor
The Mayor is your primary interface. Don't manually create beads and sling them — the Mayor handles formula resolution, rig bootstrapping, convoy coordination, and merge queue orchestration.
1. Tell the Mayor what you need
export PATH=$PATH:$HOME/local/go/bin:$HOME/go/bin
cd ~/gt
# Interactive session (best for complex tasks)
gt mayor attach
# Then describe the task in natural language.
# Mayor creates beads, convoys, assigns polecats, tracks progress.
# Non-interactive (fire and forget)
gt mayor mail "Refactor the voice pipeline into a reusable library"
The Mayor will:
- Break the task into beads (work items)
- Create a convoy to track them
- Sling beads to polecats with the proper
mol-polecat-workformula - Monitor progress and handle coordination
2. Monitor progress
# List convoys (work bundles)
gt convoy list
# Check convoy detail
gt convoy status <convoy-id>
# List all agents (including polecats)
gt agents list --all
# Peek at a polecat's current output
tmux capture-pane -t gt-<rig>-<polecat-name> -p | tail -30
# List tmux sessions
tmux list-sessions | grep gt-
# Check bead status
bd show <bead-id>
3. Results
Polecats follow the mol-polecat-work lifecycle:
- load-context — Read the bead, understand the task
- branch-setup — Create a working branch
- preflight-tests — Verify tests pass on main
- implement — Do the actual work
- self-review — Review own changes
- run-tests — Run tests, verify coverage
- cleanup-workspace — Clean up
- prepare-for-review — Prepare for merge
- submit-and-exit — Push to merge queue, self-destruct
The Refinery agent merges polecat branches back to main. You never push directly.
Anti-Patterns (Don't Do This)
| ❌ Don't | ✅ Do Instead |
|---|---|
bd create + gt sling manually |
Tell Mayor via gt mayor attach or gt mayor mail |
gt sling --hook-raw-bead |
Let Mayor apply mol-polecat-work formula automatically |
| Push to main directly | Let Refinery merge from the merge queue |
| Close beads manually | Polecats self-clean; Refinery closes after merge |
| Create polecats without Mayor | Mayor handles spawning and assignment |
--hook-raw-bead bypasses the 9-step lifecycle. Only use it if Mayor is actually down and you need emergency manual control.
Quick Reference
| Action | Command |
|---|---|
| Talk to Mayor (interactive) | gt mayor attach |
| Message Mayor | gt mayor mail "task description" |
| List convoys | gt convoy list |
| Convoy detail | gt convoy status <id> |
| List agents | gt agents list --all |
| Peek at polecat | tmux capture-pane -t gt-<rig>-<name> -p | tail -30 |
| List tmux sessions | tmux list-sessions | grep gt- |
| Check bead status | bd show <bead-id> |
Architecture
See references/architecture.md for full details on Mayor, Rigs, Polecats, Hooks, Convoys, Beads, Refinery, and Witness.
Troubleshooting
- Polecat not following lifecycle: Was it slung with
--hook-raw-bead? That skips formula application. Re-sling through Mayor. - Formula not resolving: Mayor may not have finished rig bootstrap. Wait for Mayor boot to complete, or run
gt formula listto verify formulas exist. - ICU build error on beads install: Use
CGO_ENABLED=0 go install ... - Polecat not showing in
gt agents list: Check tmux:tmux list-sessions | grep gt- - Need Go but no sudo: Install to
~/local/go/instead of/usr/local/ - Polecat session frozen after work: Claude Code sessions sometimes freeze post-completion. Check if work was committed, then kill the tmux session manually.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。
其他来源收录
同一技能在不同目录的原始页面: