🚀 反重力发射台
一个包含电池的多代理编排模板,用于构建人工智能驱动的开发环境 计划第一纪律, 抗幻觉保护措施,以及 持久内存.
该模板诞生于谷歌DeepMind Antigravity生态系统,为人工智能代理提供了一个生产就绪的脚手架,这些代理在编码前进行规划,在发货前进行验证,并在过程中学习。
______________________________________________________________________
📖 目录
______________________________________________________________________
💡 为什么是这个模板?
大多数AI编码助手 反应式 --你问,他们生成,你调试结果。此模板翻转该模型:
| 传统人工智能编码 | 反重力模板 |
|---|---|
| 立即生成代码 | 先计划,代码秒 |
| Hallucinate API和库 | 核实每一项索赔 使用工具 |
| 忘记会话之间的上下文 | 双层存储器 (Serena+OpenMemory) |
| 单一通用药剂 | 7名专业代理 有明确的界限 |
| 无质量门 | 自动验证 在每个阶段 |
| 上下文窗口会随着时间的推移而降级 | 每个任务的新上下文 --零上下文腐烂 |
核心原则
- 计划模式至高无上 --没有计划就没有代码。期间。
- 抗幻觉 --标记的每个索赔
[VERIFIED],[INFERRED],或[UNCERTAIN] - 渐进复杂性 --从5项基本技能开始,根据需要扩展到10+
- 循环中的人类 --计划、规范和验证阶段的审批门
- 持久状态 --计划和决策在IDE重启和上下文窗口重置后仍然有效
______________________________________________________________________
🏗 建筑
┌────────────────────────────────────────────────────────────────┐
│ YOUR IDE (VSCode) │
│ "Command Center" │
├────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐│
│ │ .context/ │ │ .planning/│ │ .serena/ │ │ .agent/ ││
│ │ Grounding │ │ Lifecycle │ │ Session │ │ Brain ││
│ └───────────┘ └───────────┘ └───────────┘ └───────────┘│
│ │ │ │ │ │
│ │ PROJECT active 7 Agents │
│ │ ROADMAP task-board 11 Skills │
│ │ STATE ADRs 7 Flows │
│ │ │ │ │ │
│ └───────────────┼───────────────┼───────────────┘ │
│ │ │ │
│ └───────┬───────┘ │
│ │ │
│ ┌──────────┴──────────┐ │
│ │ MCP Servers │ │
│ │ (9 integrations) │ │
│ └─────────────────────┘ │
└────────────────────────────────────────────────────────────────┘四大支柱:
.context/--接地层。将技术栈和编码标准注入每种药物中,以防止幻觉。.planning/--项目生命周期。PROJECT.md,ROADMAP.md,STATE.md--跨越里程碑。 *(来自GSD)*.serena/--会议协调。主动代理白板和临时切换。.agent/--大脑。代理、技能、工作流、规则和配置。
设计意识: .context/design_system.md 将UI代理与您的实际设计标记(颜色、排版、布局)结合起来。从Google Stitch或Figma中自动提取。______________________________________________________________________
📁 目录结构
your-project/
├── .agent/ # 🧠 The Brain
│ ├── .shared/ # Cross-cutting standards
│ │ └── lessons-learned.md # Accumulated project knowledge
│ ├── agents/ # 7 specialist personas
│ │ ├── pm-agent/ # Requirements → Plans
│ │ ├── architect-agent/ # Codebase mapping & patterns (NEW)
│ │ ├── frontend-agent/ # React / Tailwind
│ │ ├── backend-agent/ # FastAPI / PostgreSQL
│ │ ├── mobile-agent/ # Flutter
│ │ ├── qa-agent/ # Testing & Security
│ │ └── debug-agent/ # Root Cause Analysis
│ ├── skills/ # 11 executable capabilities
│ │ ├── _shared/ # Shared protocols & utilities
│ │ ├── git_manager/ # + atomic commit protocol
│ │ ├── code_review_enforcer/
│ │ ├── test_driven_development/
│ │ ├── docs_updater/
│ │ ├── dependency_manager/
│ │ ├── database_schema_manager/
│ │ ├── api_contract_validator/
│ │ ├── deployment_orchestrator/
│ │ ├── observability_configurator/
│ │ ├── security_hardening/
│ │ └── skill_creator/ # Meta-skill: generates new skills
│ ├── workflows/ # Orchestration patterns
│ │ ├── coordinate.yaml # Discuss → Plan → Execute → Verify
│ │ ├── orchestrate.yaml # Parallel agents
│ │ ├── plan.yaml # XML-structured task planning
│ │ ├── quick.yaml # Fast path for small tasks (NEW)
│ │ ├── map-codebase.yaml # Brownfield analysis (NEW)
│ │ ├── review.yaml # Multi-agent code review
│ │ └── debug.yaml # Incident response
│ ├── rules/ # Governance
│ │ ├── manager.md # Master system prompt
│ │ ├── security-policy.yaml
│ │ └── code-quality-gates.yaml
│ └── config/ # Configuration
│ ├── mcp_servers.json
│ ├── user-preferences.yaml
│ └── skill-selection.yaml
│
├── .planning/ # 📋 Project Lifecycle (from GSD)
│ ├── PROJECT.md # Vision, goals, constraints
│ ├── ROADMAP.md # Phased execution plan
│ ├── STATE.md # Real-time project state
│ └── research/ # Codebase maps, phase research
│
├── .serena/ # 💾 Session Coordination
│ ├── active_plan.md # Ephemeral agent whiteboard
│ ├── architectural_decisions.md # Immutable ADR log
│ ├── memories/ # Persistent agent memory
│ └── task-board.md # Shared agent handoffs
│
├── .context/ # 🎯 Grounding Layer
│ ├── tech_stack.md # "Use FastAPI, not Django"
│ ├── coding_standards.md # "snake_case for Python"
│ └── design_system.md # Colors, typography, layout (NEW)
│
├── AGENTS.md # Master system prompt (3-layer)
└── README.md # ← You are here______________________________________________________________________
🚀 入门指南
先决条件
- 18+(对于MCP服务器,通过
npx) - python 3.12+(用于后端代理)
- Gemini API密钥或兼容LLM提供程序
- Git
快速开始
# 1. Clone or copy the template into your project
git clone https://github.com/your-org/antigravity-template.git my-project
cd my-project
# 2. (Optional) Initialize oh-my-ag orchestration framework
npx oh-my-ag init
# 3. (Optional) Install essential skill bundle
npx antigravity-awesome-skills --bundle essentials
# 4. Verify your setup
npx oh-my-ag doctor
# 5. Customize grounding files for YOUR project
# Edit .context/tech_stack.md with your actual stack
# Edit .context/coding_standards.md with your conventions安装后的第一步
\[!注意\] 如果你跑oh-my-ag doctor,您可能会看到以下警告 全局MCP配置 “未配置”。这是意料之中的,因为这个项目使用了一个自包含的 本地配置 在.agent/mcp.json。您可以放心地忽略这些警告。
- 编辑
.context/tech_stack.md--用您实际的技术选择替换默认值 - 编辑
.context/coding_standards.md--设定团队惯例 - 审查
.agent/config/skill-selection.yaml--从以下内容开始essentials-only模式 - 配置MCP服务器 --更新
.agent/config/mcp_servers.json使用您的凭据
______________________________________________________________________
🎮 如何驾驶它
核心循环:讨论→ Plan → 执行→ 验证
该模板实施了一个有纪律的开发周期,其灵感来自 GSD协议。以下是典型功能请求的流程:
YOU: "Add user authentication with JWT"
│
▼
┌──────────────────┐
│ Phase 1: DISCUSS │ PM Agent asks targeted questions:
│ (PM Agent) │ "Session storage or cookies?"
└────────┬─────────┘ Creates {phase}-CONTEXT.md
│ ✅ You're satisfied
▼
┌──────────────────┐
│ Phase 2: PLAN │ Architect maps codebase patterns.
│ (Architect+PM) │ PM creates atomic XML task plans.
└────────┬─────────┘ QA verifies plans against requirements.
│ ✅ You approve the plan
▼
┌──────────────────┐
│ Phase 3: EXECUTE │ Dev Agents implement in parallel waves.
│ (Dev Agents) │ Fresh context per task. Atomic commits.
└────────┬─────────┘
│ Tests run automatically
▼
┌──────────────────┐
│ Phase 4: VERIFY │ QA runs full suite + walks you through
│ (QA Agent) │ manual verification of each deliverable.
└────────┬─────────┘ If issues → auto-creates fix plans.
│ ✅ You sign off
▼
✨ MERGE关键命令
| 你想做什么 | 怎么做 |
|---|---|
| 全功能流水线 | npx oh-my-ag workflow:run coordinate "Add user profiles" |
| 映射现有代码库 | npx oh-my-ag workflow:run map-codebase |
| 快速临时任务 | npx oh-my-ag workflow:run quick "Fix dark mode toggle" |
| 开始规划功能 | npx oh-my-ag agent:spawn pm-agent "Plan user authentication" |
| 探索代码库 | npx oh-my-ag agent:spawn architect-agent "Map the auth module" |
| 构建后端 | npx oh-my-ag agent:spawn backend-agent "Implement JWT auth endpoints" |
| 构建前端 | npx oh-my-ag agent:spawn frontend-agent "Create login page" |
| 运行测试 | npx oh-my-ag agent:spawn qa-agent "Run full test suite" |
| 调试问题 | npx oh-my-ag agent:spawn debug-agent "Investigate login timeout error" |
使用CLI别名
在中配置快捷方式 .agent/config/user-preferences.yaml:
npx oh-my-ag plan "Add shopping cart" # alias → pm-agent
npx oh-my-ag explore # alias → architect-agent (map-codebase)
npx oh-my-ag build "Create cart API" # alias → backend-agent
npx oh-my-ag ui "Build cart component" # alias → frontend-agent
npx oh-my-ag test "Verify cart flow" # alias → qa-agent
npx oh-my-ag debug "Cart total is wrong" # alias → debug-agent
npx oh-my-ag quick "Fix button color" # alias → quick workflow______________________________________________________________________
🤖 七名特工
| 代理 | 角色 | 它做什么 | 它不会做什么 |
|---|---|---|---|
| PM代理 | 产品经理 | 编写计划、API合同、ADR、运行讨论阶段 | 编写实施代码 |
| 建筑师代理 | 探索者 *新* | 映射代码库、发现模式、验证架构 | 修改代码——只读和咨询 |
| 前端代理 | UI专家 | React组件、Tailwind、可访问性 | 修改后端或数据库 |
| 后端代理 | API专家 | FastAPI端点、迁移、JWT | 修改前端代码 |
| 移动代理 | 跨平台 | Flutter小部件,存储资产 | 修改web代码 |
| QA代理 | 质量门 | TDD脚手架、安全审计、性能测试 | 编写实现代码 |
| 调试代理 | 诊断师 | 铁律:任何修复前的根本原因、4阶段协议、回归测试 | 随机尝试修复(“霰弹枪调试”) |
每个代理人都有:
SYSTEM_PROMPT.md--角色定义、职责、约束CAPABILITY_MANIFEST.yaml--用于编排的机器可读功能
______________________________________________________________________
⚡ 十一项技能
技能是通过轻量级按需加载的模块化功能 SKILL.md 路由器(每个约1KB)。 *(注: skills/ 目录可能包含其他内部或元技能,如 commit 和 orchestrator 超出下面的核心列表。)*
| 技能 | 触发因素 | 它提供了什么 |
|---|---|---|
git_manager | 提交、推送、分支、PR | 常规提交、秘密飞行前、分支自动化 |
code_review_enforcer | 审查、lint、审计 | ESLint/Ruff统一报告、复杂性分析 |
test_driven_development | 测试、TDD、覆盖范围 | 红绿重构执行、片状测试隔离 |
docs_updater | docs,自述文件,changelog | 保持changelog格式,自动生成API文档 |
dependency_manager | 依赖关系、漏洞 | 许可证合规性、Snyk扫描、更新批处理 |
database_schema_manager | 迁移、模式、表 | 临时迁移、回滚安全、漂移检测 |
api_contract_validator | 合约、openapi、规范 | 突破性变更检测、消费者驱动测试 |
deployment_orchestrator | 部署、发布、金丝雀 | 金丝雀部署、自动回滚、升级门 |
observability_configurator | 度量、日志记录、跟踪 | OpenTetry、基于SLO的警报、结构化日志记录 |
security_hardening | 安全、秘密、IAM | STRIDE威胁建模、秘密检测、OWASP检查 |
skill_creator *(META)* | 创造技能、新技能、脚手架 | 自我复制 --从自然语言描述中生成新技能 |
渐进式收养
从开始 仅限必需品 模式(5种技能),随着项目的成熟而扩展。这 skill_creator 元技能允许您按需生成自定义技能:
# .agent/config/skill-selection.yaml
mode: essentials-only # Start here
active_skills:
- git_manager
- code_review_enforcer
- test_driven_development
- docs_updater
- dependency_manager______________________________________________________________________
🔌 MCP集成
九个模型上下文协议服务器使代理能够与外部工具进行交互:
| MCP服务器 | 用途 | 默认模式 |
|---|---|---|
| 文件系统 | 读/写/搜索本地文件 | 读/写 |
| Git | 状态、差异、日志、提交 | 读/写 |
| 速贝 | 数据库、身份验证、存储管理 | 通过服务角色密钥 |
| PostgreSQL | 直接SQL查询 | 只读 默认情况下 |
| GitHub | 问题、PR、存储库管理 | 通过个人访问令牌 |
| 线性 | 问题跟踪 | 通过API密钥 |
| Snyk | 漏洞情报 | 通过令牌 |
| OpenMemory | 长期跨项目内存 | 通过API密钥 |
| 史迪奇 | Google Stitch设计代码管道 | 通过API密钥 |
| 层 | 机制 | 范围 | 示例 |
|---|---|---|---|
| 短期的 (瑟琳娜) | .serena/ markdown文件 | 当前会话 | “前端正在等待后端API” |
| 长期 (OpenMemory) | 通过MCP建立矢量/图形数据库 | 跨项目,永久 | “用户更喜欢黑暗模式”→ 在下一个项目中被记住 |
在中配置 .agent/config/config.yaml (指向 .agent/mcp.json).所有机密引用环境变量(${VAR_NAME}).
______________________________________________________________________
🔄 工作流
| 工作流 | 模式 | 用途 |
|---|---|---|
| 协调 | 讨论→ Plan → 执行→ 验证(顺序) | 标准功能实现 |
| 快 *新* | 轻量级计划→ 执行→ 验证 | 错误修复、配置更改、小功能 |
| 地图代码库 *新* | 并行代码库分析 | 布朗菲尔德项目,特征前探索 |
| 编排 | 并行代理执行 | 独立工作流 |
| 计划 | XML结构化任务规划+研究 | 前期需求分析 |
| 回顾 | 多代理代码审查 | 合并前质量检查 |
| 调试 | 结构化诊断+三击规则 | 漏洞调查 |
上下文腐烂预防 *(来自GSD)*
在执行过程中,每个XML ` 运行在a **新上下文窗口** (约20万个代币纯粹用于实现)。这可以防止上下文填满时发生的质量下降。每个任务也有自己的 **原子git提交** --清洁 git bisect` 以及独立的可恢复性。
三击规则
调试时,系统允许 3次修复尝试 如果第三次尝试失败:
- 停止 --不再盲目重试
- 日志 调查结果
lessons-learned.md - 升级 --请求全方位的人工干预
这可以防止困扰传统人工智能助手的无限重试循环。
______________________________________________________________________
🛡 治理与安全
自动审批层
| 层级 | 示例 | 批准 |
|---|---|---|
| 安全 | 文件读取、目录列表、git状态 | ✅ 自动批准 |
| 已登录 | 文件写入、git提交、开发依赖安装 | ✅ 自动批准+审核日志 |
| 需要批准 | 新文件创建、受保护的分支推送、数据库迁移、生产部署 | ⏳ 人工审批 |
| 禁止 | 生产数据库写入、秘密修改、基础设施破坏 | ❌ 从未批准 |
安全策略
- 秘密侦查:基于Regex的扫描块提交包含API密钥、令牌、密码
- 输入验证:强制执行参数化查询,无字符串连接SQL
- 访问控制:最小特权原则;MCP默认为只读
- 审核日志记录:JSON格式,SHA-256防篡改链,90天保留期
代码质量门
合并前必须通过所有代码:
- ✅ Linting(Ruff/ESLint)——零错误
- ✅ 格式化(黑色/预处理)
- ✅ 类型检查(mypy/tsc)——严格模式
- ✅ 测试覆盖率≥80%
- ✅ 每个函数的圈复杂度\
WebSocket notification channel src/notifications/ws_channel.py ws connect + receive test message
Resend email integration src/notifications/email.py send test email, check delivery
... (6 tasks total)
Execute phase: → Each task runs in fresh context (prevents context rot) → Each task gets atomic commit: "feat(phase-1): add ws channel" → Parallel where possible, sequential where dependent
Verify phase: → QA Agent runs all checks → 5/6 pass, 1 fails → auto-generates fix plan → re-executes → ✅
______________________________________________________________________
## ⚙️ 配置
### 环境变量
创建一个 `.env` file(永远不要提交此内容):
LLM
GEMINI_API_KEY=your-gemini-key
Database
SUPABASE_SERVICE_ROLE_KEY=your-supabase-key DATABASE_URL=postgresql://localhost:5432/mydb
Integrations (optional)
GITHUB_TOKEN=ghp_... LINEAR_API_KEY=lin_api_... SNYK_TOKEN=your-snyk-token OPENMEMORY_API_KEY=your-openmemory-key STITCH_API_KEY=your-stitch-key
### 自定义代理模型
在 `.agent/config/user-preferences.yaml`:
model_routing: pm-agent: "gemini-2.5-pro" # Planning needs deep reasoning architect-agent: "gemini-2.5-pro" # Codebase analysis frontend-agent: "gemini-2.5-pro" # Code generation backend-agent: "gemini-2.5-pro" # Code generation qa-agent: "gemini-2.5-pro" # Security analysis debug-agent: "gemini-2.5-pro" # Complex diagnosis mobile-agent: "gemini-2.5-pro" # Code generation
### 技能包
|捆绑|技能|最适合|
|--------|--------|----------|
| `essentials-only` |git、review、TDD、docs、deps |单人开发、新项目|
| `team-standard` |Essentials+DB、API、部署|团队环境|
| `full` |全部10项技能|企业、生产系统|
______________________________________________________________________
## 🤝 贡献
欢迎投稿!方法如下:
1. **分叉** 仓库
1. **创建** 特征分支(`feature/my-new-skill`)
1. **跟随** 模板自身的约定(常规提交,TDD)
1. **提交** 带有描述和相关问题的PR
### 添加新技能
1. 创建 `skills/your_skill/SKILL.md` 使用标准前体
1. 添加a `resources/` 包含详细文档的目录
1. 在中注册触发模式 `skills/_shared/skill-routing.md`
1. 更新 `config/skill-selection.yaml` 掌握新技能
### 添加新代理
1. 创建 `agents/your-agent/SYSTEM_PROMPT.md`
1. 创建 `agents/your-agent/CAPABILITY_MANIFEST.yaml`
1. 定义明确的界限(它能做什么和不能做什么)
1. 如果代理参与管道,则更新工作流文件
______________________________________________________________________
## 🙏 致谢与确认
该模板由多个来源合成,归功于原始创作者和社区:
### 核心框架与灵感
- **[谷歌DeepMind——反重力](https://deepmind.google/)** --此模板所基于的反重力代理编码生态系统
- **[GSD(完成任务)](https://github.com/gsd-build/get-shit-done)** --T CHES的元提示、上下文工程和规范驱动开发系统。集成的关键模式:讨论阶段、XML任务格式、原子提交、每个任务的新上下文、快速模式、映射代码库、, `.planning/` 生命周期
- **[哦,天哪](https://github.com/nicholasoxford/oh-my-ag)** --多代理CLI工作流的社区编排框架(181+⭐)
- **[Serena记忆协议](https://github.com/ralf-life/serena)** --使用人类可读markdown文件的持久内存系统
- **[OpenMemory](https://github.com/mem0ai/mem0)** --通过矢量/图形数据库实现长期跨项目记忆
### 研究与设计文件
- **“构建终极反重力代理”** --分析oh my ag、Serena Memory和生态系统的架构报告
- **“终极谷歌反重力代理模板”** --企业级规范,涵盖10项技能、7个代理、治理和CI/CD集成
- **“构建探索的人工智能代理”(YouTube)** --带有ReAct循环和文件系统导航工具的Explorer Agent模式
- **“终极构建”蓝图** --将反重力+GSD融入“任务控制”范式的综合文件
### 标准和协议
- **[模型上下文协议(MCP)](https://modelcontextprotocol.io/)** --Anthropic的工具集成开放协议
- **[常规承诺](https://www.conventionalcommits.org/)** --结构化提交消息规范
- **[保存变更日志](https://keepachangelog.com/)** --变更日志格式标准
- **[应用安全项目](https://owasp.org/)** --安全最佳实践(前10名,ASVS)
- **[跨步](https://learn.microsoft.com/en-us/azure/security/develop/threat-modeling-tool-threats)** --微软的威胁建模框架
### 社区
- **[反重力惊人的技能](https://github.com/nicholasoxford/antigravity-awesome-skills)** --社区技能登记
- **[化学 AI](https://www.kimi.com/)** --为执行摘要和代币预算分析提供研究协助
### 建造于
- **不锈钢的** --模板合成、实现和测试
______________________________________________________________________
## 📄 许可证
此模板按原样提供,供您在项目中使用。有关具体条款,请参阅个人技能和依赖许可证。
______________________________________________________________________
Plan first. Verify everything. Ship with confidence.
Built with the Antigravity Agent ecosystem 🚀