缰绳
A. Gemini CLI 扩展,为结构化软件开发添加了三个专门的子代理: 调查, 计划, 审查.
Reins没有让一个代理在一次对话中完成所有事情,而是将工作分成有明确交接的重点阶段,每个阶段都有专门构建的MCP工具集作为支持。
所得
| 代理 | 角色 | 关键工具 |
|---|---|---|
| 调查员 | 深入调试和根本原因分析。只读。 | Serena(LSP)、Hashline、Docker MCP、grep |
| 规划器 | TDD实施计划,包括规范+计划文件。 | Serena,Context7(文档),顺序思维 |
| 审稿人 | 根据规范/计划审查实施情况。在浏览器和容器中验证。 | Serena、Hashline、剧作家(浏览器)、Docker MCP |
主Gemini代理协调工作流程:它创建编号的计划目录,委托给子代理,并保存他们的输出。A. current symlink总是指向活动计划,因此代理永远不需要硬编码的路径。
.gemini/plans/
current -> 2 # symlink to active plan
1/
investigation.md
spec.md
plan.md
review.md
2/ ...快速开始
git clone https://github.com/LuisDee/reins.git ~/.gemini/extensions/reins
cd ~/.gemini/extensions/reins
bash setup.sh就是这样。安装脚本会检测您的操作系统(macOS或Linux),并将:
- 检查并安装必备组件(node、bun、uv、Docker MCP插件)
- 将MCP服务器配置合并到现有配置中
~/.gemini/settings.json--您现有的服务器和设置将被保留,缰绳只会添加缺失的内容 - 预缓存所有MCP服务器,以便快速启动
- 安装Playwright的Chromium(包括Linux上的系统依赖程序)
- 将代理定义复制到
~/.gemini/agents/ - 运行烟雾测试以确认所有负载
先决条件
- macOS (自制)或 Linux (Ubuntu/Debian)
- Node.js 18+(macOS:
brew install node,Linux:sudo apt install nodejs npm) - Docker引擎 (macOS: ,Linux:
sudo apt install docker.io) - Gemini CLI (
npm install -g @google/gemini-cli)
如果缺少以下内容,安装脚本将自动安装:
用法
在任何项目中启动Gemini CLI并使用代理:
调查一个bug
> @investigator The /api/upload endpoint returns 500 when files are > 10MB.
> Here's the error log: [paste log]调查员跟踪代码路径,确定根本原因,并返回结构化报告。主代理将其保存到 .gemini/plans/current/investigation.md.
计划修复
> @planner Fix the upload size handling based on the investigation规划者阅读调查,通过Context7研究最佳实践,通过顺序思维的方法进行推理,并写道 spec.md + plan.md.
实施(您+主代理)
主代理逐步执行计划,使用Hashline进行精确的文件编辑,使用Serena进行代码导航。您批准每一项更改。
审查
> @reviewer Review the upload fix against the spec and plan审阅者根据实际代码检查每个规范目标和计划任务,并可选择通过Playwright在浏览器中进行验证,或通过Docker MCP检查容器。返回结构化的通过/失败报告。
无头Linux/程序员工作区
Reins在无头Linux服务器上工作 编码员 工作空间:
- 剧作家 默认情况下,Chromium在无头模式下运行,不需要X11或显示服务器。在Linux上,安装脚本会自动安装所需的系统库(
libnss3,libatk-bridge2.0-0等等)。如果你击中SIGTRAP集装箱环境中的崩溃,setCHROMIUM_FLAGS=--no-sandbox或跑步--cap-add=SYS_ADMIN.
- Docker MCP 仅适用于Docker引擎,不需要Docker桌面。安装脚本下载 预构建的插件二进制文件 并将其安装到
~/.docker/cli-plugins/在Linux上,它设置DOCKER_MCP_IN_CONTAINER=1绕过桌面功能检查。将此添加到您的shell配置文件中以实现持久性:
export DOCKER_MCP_IN_CONTAINER=1- 编码器端口转发 --如果审阅者需要验证web UI,Playwright可以通过以下方式连接 `localhost:
`.Coder的原生端口转发使服务无需额外配置即可访问。
手动设置
如果你不想使用 setup.sh:
- 克隆仓库 作为双子座的延伸:
git clone https://github.com/LuisDee/reins.git ~/.gemini/extensions/reins- 复制代理 到您的用户级代理目录:
mkdir -p ~/.gemini/agents
cp ~/.gemini/extensions/reins/agents/*.md ~/.gemini/agents/- 安装Docker MCP插件:
# macOS (if using Docker Desktop 4.48+, you already have it)
# Linux — download the binary:
curl -fsSL https://github.com/docker/mcp-gateway/releases/download/v0.40.0/docker-mcp-linux-amd64.tar.gz | tar xz
mkdir -p ~/.docker/cli-plugins
mv docker-mcp ~/.docker/cli-plugins/docker-mcp
chmod +x ~/.docker/cli-plugins/docker-mcp
# Linux only — bypass Desktop check:
export DOCKER_MCP_IN_CONTAINER=1- 创建
~/.gemini/settings.json使用settings.template.json作为基地。将占位符路径替换为系统二进制文件的绝对路径:
# Find your paths
which npx # e.g. /usr/local/bin/npx
which bunx # e.g. /usr/local/bin/bunx or ~/.bun/bin/bunx
which uvx # e.g. /usr/local/bin/uvx or ~/.local/bin/uvx
which docker # e.g. /usr/local/bin/docker替换 __NPX__, __BUNX__, __UVX__,以及 __DOCKER__ 在具有这些路径的模板中。
- 安装Playwright浏览器 (系统依赖于Linux):
# Linux only — system dependencies:
sudo npx playwright install-deps chromium
# All platforms:
npx playwright install chromiumMCP服务器
| 服务器 | 用途 | 运行时 |
|---|---|---|
| 塞雷娜 | 基于LSP的代码导航(查找符号、引用、概述) | Python(uv) |
| Hashline | 基于锚点的文件读取和编辑(行哈希引用) | Bun |
| 背景7 | 库文档查找 | 节点 |
| 顺序思维 | 规划前的结构化推理 | 节点 |
| 剧作家 | UI验证的浏览器自动化 | 节点 |
| 容器日志、检查、通过MCP协议进行健康检查 | Docker引擎 |
项目结构
reins/
agents/
investigator.md # Deep investigation agent
planner.md # TDD planning agent
reviewer.md # Code review agent
GEMINI.md # Extension context (workflow + orchestration protocol)
gemini-extension.json
settings.template.json
setup.sh # One-command installer (macOS + Linux)运作原理
关键设计决策:
- 默认情况下,代理是只读的。 调查员和审阅者无法编写文件或运行shell命令。计划者只能写信给
.gemini/plans/current/这可以防止意外修改。 - 没有shell访问权限。 容器交互通过Docker MCP的结构化协议,而不是
run_shell_command浏览器验证通过Playwright MCP。这为代理提供了所需的功能,而没有外壳逃逸风险。 - 主要代理人负责策划。 它创建计划目录,管理
current符号链接,并持久化通过以下方式返回的子代理输出complete_task. - 刀具路径是明确的。 每个代理的前端都列出了它可以访问的MCP工具,强制分离关注点。
卸载
# Remove agents
rm ~/.gemini/agents/{investigator,planner,reviewer}.md
# Remove extension
rm -rf ~/.gemini/extensions/reins
# Remove Docker MCP plugin (optional)
rm ~/.docker/cli-plugins/docker-mcp
# To remove reins MCP servers from settings.json, edit the file manually
# and remove the lsp, hashline, context7, sequential-thinking, playwright,
# and docker entries from mcpServers (keep any servers you added yourself).许可证
麻省理工学院
