概述
Gas Town是多智能体编排系统,让一个 AI 代理("Mayor")管理一批专门角色的子代理并行工作,解决复杂软件开发任务。
Gas Town 不会在代理重启时丢失上下文,而是将工作状态持久化到基于 Git 的钩子中,从而实现可靠的多代理工作流。
这解决了什么问题?
架构图
核心概念
The Mayor
主要 AI 协调员。市长是一个 Claude Code 实例,拥有关于您的工作区、项目和代理的完整上下文信息。 从这里开始 ——只需告诉市长您想要完成什么即可。
Town
工作区目录(例如 ~/gt/ )。包含所有项目、代理和配置。
Rigs
项目容器。每个设备都封装了一个 Git 仓库并管理其关联的代理。
Crew Members
在Rigs上的个人工作区。在这里进行实际操作。
Polecats
具有持久身份但会话短暂的工作代理。它们为执行任务而生成,会话在任务完成后结束,但身份和工作历史记录会保留。
Hooks
基于 Git 工作树的代理工作持久化存储。即使崩溃和重启也能保留数据。
Convoys
工作跟踪单元。将多个Beads捆绑在一起,分配给不同的agents。
Beads Integration
基于 Git 的问题跟踪系统,将工作状态存储为结构化数据。
Bead IDs (also called issue IDs)
采用前缀加 5 位字母数字的格式(例如, gt-abc12 、 hq-x7k2m )。前缀指示物品的来源或装备。诸如 gt sling 和 gt convoy 之类的命令接受这些 ID 来引用特定的工作项。
ps: Gastown词汇大全
安装
先决条件
Go 1.23+
Git 2.25+
Dolt 1.82.4+
Beads 0.55.4+
Sqlite3
Tmux 3.0+
Claude Code
设置
1.安装 Gas Town
brew install gastown
推荐使用 brew 安装,方便,但需要使用brew的官方源,使用清华源或阿里源可能无法找到gastown包。
npm install -g @gastown/gt
go install github.com/steveyegge/gastown/cmd/gt@latest
ps: 若是采用Go安装,请在 ~/.zshrc or ~/.bashrc 文件中增加:
export PATH="$PATH:$HOME/go/bin"2.创建工作空间
gt install ~/gt --git
cd ~/gt3.初始化工程
gt rig add myproject https://github.com/you/repo.git4.创建crew空间
gt crew add yourname --rig myproject
cd myproject/crew/yourname5.运行Mayor session
gt mayor attach运行如下图,即安装成功;若未能正确运行,请执行gt doctor自检安装环境,并验证先决条件。

使用指南
工作流
示例:功能开发
# 1. Start the Mayor
gt mayor attach
# 2. In Mayor session, create a convoy with bead IDs
gt convoy create "Feature X" gt-abc12 gt-def34 --notify --human
# 3. Assign work to an agent
gt sling gt-abc12 myproject
# 4. Track progress
gt convoy list
# 5. Monitor agents
gt agents常用工作流
1.Mayor Workflow 市长工作流
适合协调复杂的多议题工作
所需命令
# Attach to Mayor
gt mayor attach
# In Mayor, create convoy and let it orchestrate
gt convoy create "Auth System" gt-x7k2m gt-p9n4q --notify
# Track progress
gt convoy list2.极简模式
手动运行各个运行时实例。Gas Town 只负责跟踪状态。
gt convoy create "Fix bugs" gt-abc12 # Create convoy (sling auto-creates if skipped)
gt sling gt-abc12 myproject # Assign to worker
claude --resume # Agent reads mail, runs work (Claude)
# or: codex # Start Codex in the workspace
gt convoy list # Check progress3.Beads Formula Workflow (Beads Formula 工作流)
适合预定义、可重复的流程
公式是嵌入在 gt 二进制文件中的 TOML 定义的工作流程(源位于 internal/formula/formulas/ )。
示例文件 (internal/formula/formulas/release.formula.toml)
description = "Standard release process"
formula = "release"
version = 1
[vars.version]
description = "The semantic version to release (e.g., 1.2.0)"
required = true
[[steps]]
id = "bump-version"
title = "Bump version"
description = "Run ./scripts/bump-version.sh {{version}}"
[[steps]]
id = "run-tests"
title = "Run tests"
description = "Run make test"
needs = ["bump-version"]
[[steps]]
id = "build"
title = "Build"
description = "Run make build"
needs = ["run-tests"]
[[steps]]
id = "create-tag"
title = "Create release tag"
description = "Run git tag -a v{{version}} -m 'Release v{{version}}'"
needs = ["build"]
[[steps]]
id = "publish"
title = "Publish"
description = "Run ./scripts/publish.sh"
needs = ["create-tag"]
执行
# List available formulas
bd formula list
# Run a formula with variables
bd cook release --var version=1.2.0
# Create formula instance for tracking
bd mol pour release --var version=1.2.04.Manual Convoy Workflow(Manual Convoy 工作流)
适合直接控制工作分配
# Create convoy manually
gt convoy create "Bug Fixes" --human
# Add issues to existing convoy
gt convoy add hq-cv-abc gt-m3k9p gt-w5t2x
# Assign to specific agents
gt sling gt-m3k9p myproject/my-agent
# Check status
gt convoy show运行时配置
Gas Town 支持多种 AI 编码运行时。每个设备的运行时设置位于 settings/config.json 中。
{
"runtime": {
"provider": "codex",
"command": "codex",
"args": [],
"prompt_mode": "none"
}
}命令参考
工作区管理
gt install <path> # Initialize workspace
gt rig add <name> <repo> # Add project
gt rig list # List projects
gt crew add <name> --rig <rig> # Create crew workspaceAgent 设置
gt agents # List active agents
gt sling <bead-id> <rig> # Assign work to agent
gt sling <bead-id> <rig> --agent cursor # Override runtime for this sling/spawn
gt mayor attach # Start Mayor session
gt mayor start --agent auggie # Run Mayor with a specific agent alias
gt prime # Context recovery (run inside existing session)
gt feed # Real-time activity feed (TUI)
gt feed --problems # Start in problems view (stuck agent detection)实践: 通过此设置将Agent指向deepseek, 使用如下命令:
// 首先增加Agent deepseek-XXX, 注意 deepseek-XXX 一定为可执行命令!
gt config agent set deepseek-XXX "deepseek-XXX --dangerously-skip-permissions"
// 以上运行成功后,运行此命令查看agent列表中是否有我们指定的deepseek-XXX
gt config agent list
// 将 deepseek-XXX 设置为默认 Agent
gt config default-agent deepseek-XXXConvoy (Work Tracking)
gt convoy create <name> [issues...] # Create convoy with issues
gt convoy list # List all convoys
gt convoy show [id] # Show convoy details
gt convoy add <convoy-id> <issue-id...> # Add issues to convoyConfiguration
# Set custom agent command
gt config agent set claude-glm "claude-glm --model glm-4"
gt config agent set codex-low "codex --thinking low"
# Set default agent
gt config default-agent claude-glmBeads Integration
bd formula list # List formulas
bd cook <formula> # Execute formula
bd mol pour <formula> # Create trackable instance
bd mol list # List active instancesActivity Feed
gt feed 启动了一个交互式终端仪表板,用于实时监控所有代理活动。它将 Beads 活动、代理事件和合并队列更新整合到一个三面板的 TUI 中。
仪表板
Gas Town 包含一个用于监控工作区的 Web 控制面板。该控制面板必须在 Gas Town 工作区(总部)目录内运行。
# Start dashboard (default port 8080)
gt dashboard
# Start on a custom port
gt dashboard --port 3000
# Start and automatically open in browser
gt dashboard --open仪表盘以单页概览的形式呈现工作区中的所有动态:代理、队列、钩子、队列、问题和升级。它通过 htmx 自动刷新,并包含一个命令面板,可直接从浏览器运行 gt 命令。
以上我们完成了Gastown的初步创立和使用。
ps: 测试平台为Macmini4,其余平台请在官方文档中额外参考补充。
评论