设定一个自然语言目标,自动完成设计->实施->测试->验证的完整闭环——面向 1 亿+ GitHub 开发者,无需切换工具链。
loop-copilot extends GitHub Copilot Chat into a fully autonomous, end-to-end development loop using the Copilot SDK SessionHooks extension system.
- Full closed-loop workflow — design bubble (brainstorm -> research -> plan) + implementation bubble (plan -> task -> code -> review -> test -> verify)
- Bun-compiled CLI binary — single-file executable, cross-platform, zero npm dependencies at runtime
- Copilot SDK SessionHooks integration — PreToolUse allow/deny/ask decision matrix with modifiedArgs and additionalContext
- P0/P1/P2 issue routing — automatic fallback: redesign (P0), fix-at-design-or-impl level (P1), patch (P2)
- convergence_counter with fast-path early termination — CR >= 2 with no new issues triggers early exit
- 6-method auth chain — P1-P6 priority auto-detection with BYOK fallback
- State persistence —
state.jsonsurvives compaction and session restarts; Default-FAIL contract
# Clone and build
git clone https://github.com/PerryLink/loop-copilot.git
cd loop-copilot
bun install
bun run src/index.ts
# Or build standalone binary
bun build --compile --target=bun src/index.ts --outfile loop-copilot
./loop-copilot --goal "Write a Python CLI weather tool"Requirements: Bun >= 1.0.0, GitHub Copilot extension installed in your editor, Copilot API access token.
A: Copilot Chat is one-turn-at-a-time — you ask, it answers, you decide what to do next. loop-copilot automates the entire loop: it drives Copilot through 11 phases (design, implement, test, verify), routes failures back to the right phase, tracks convergence, and stops only when verification passes or the turn limit is hit. You set a goal; Copilot does the rest.
A: The Copilot SDK exposes four hook points — SessionStart, PreToolUse, PostToolUse, SessionEnd. loop-copilot registers handlers at each point to inject context (CLAUDE.md skeleton + state.json), intercept dangerous operations (allow/deny/ask), audit tool outputs, and enforce the G6 hard verification gate. Without hooks, the loop has no way to enforce safety or track state across Copilot sessions.
A: loop-copilot's 6-method auth chain auto-detects available credentials in priority order (P1: Copilot subscription token, P2: GitHub token, P3-P6: various OAuth/env methods). If none are found, you can use the BYOK (Bring Your Own Key) fallback by setting COPILOT_API_KEY in your environment.
- loop-superpowers — pure Skill mini-loops for Claude Code
- loop-opencode — closed-loop driver for OpenCode CLI
- loop-codex — dual-channel (JSON-RPC + CDP) driver for Codex Desktop
- loop-cursor — closed-loop driver for Cursor IDE SDK
- loop-deepseek — self-built ReAct agent loop for DeepSeek API
- loop-ollama — self-built ReAct agent loop for local Ollama models
- loop-antigravity — closed-loop driver for Google Antigravity / Gemini
- loop-openclaw — multi-agent loop config generator for OpenClaw Gateway
Apache License 2.0 — see LICENSE for full text.
Copyright 2026 Perry Link
English | 中文
设定一个自然语言目标,自动完成 设计 → 实施 → 测试 → 验证 的完整闭环 —— 面向 1 亿+ GitHub 开发者,无需切换工具链。
loop-copilot 将 GitHub Copilot Chat 的交互模式扩展为全自动的端到端开发闭环,基于 Copilot SDK SessionHooks 扩展系统。
- 完整闭环工作流 —— 设计气泡(头脑风暴 → 调研 → 方案)+ 实施气泡(计划 → 任务 → 编码 → 审查 → 测试 → 验证)
- Bun 编译 CLI 二进制 —— 单文件可执行,跨平台,运行时零 npm 依赖
- Copilot SDK SessionHooks 集成 —— PreToolUse allow/deny/ask 决策矩阵,支持 modifiedArgs 和 additionalContext
- P0/P1/P2 问题路由 —— 自动回退:重新设计(P0)、在设计或实施阶段修复(P1)、打补丁(P2)
- 收敛计数器 + 快速通道提前终止 —— CR >= 2 且无新问题时触发提前退出
- 6 方法认证链 —— P1-P6 优先级自动检测,支持 BYOK 回退
- 状态持久化 ——
state.json在压缩和会话重启后依然存活;Default-FAIL 合约
# 克隆并构建
git clone https://github.com/PerryLink/loop-copilot.git
cd loop-copilot
bun install
bun run src/index.ts
# 或构建独立二进制文件
bun build --compile --target=bun src/index.ts --outfile loop-copilot
./loop-copilot --goal "Write a Python CLI weather tool"依赖要求:Bun >= 1.0.0,编辑器中安装 GitHub Copilot 扩展,Copilot API 访问令牌。
A:Copilot Chat 每次只处理一轮——你问,它答,你决定下一步。loop-copilot 自动化了整个循环:它驱动 Copilot 经历 11 个阶段(设计、实施、测试、验证),将失败路由回正确阶段,追踪收敛情况,仅在验证通过或达到轮次上限时才停止。你设定目标,Copilot 完成剩下的工作。
A:Copilot SDK 暴露了四个钩子点 —— SessionStart、PreToolUse、PostToolUse、SessionEnd。loop-copilot 在每个点上注册处理程序,用于注入上下文(CLAUDE.md 骨架 + state.json)、拦截危险操作(allow/deny/ask)、审计工具输出,以及强制执行 G6 硬验证闸门。没有钩子,循环就无法在 Copilot 会话之间强制执行安全策略或追踪状态。
A:loop-copilot 的 6 方法认证链会按优先级自动检测可用凭证(P1:Copilot 订阅令牌,P2:GitHub 令牌,P3-P6:各种 OAuth/环境变量方法)。如果都未找到,可以通过设置 COPILOT_API_KEY 环境变量使用 BYOK(自带密钥)回退方案。
- loop-superpowers —— 面向 Claude Code 的纯 Skill 迷你循环
- loop-opencode —— OpenCode CLI 闭环驱动
- loop-codex —— Codex Desktop 双通道(JSON-RPC + CDP)驱动
- loop-cursor —— Cursor IDE SDK 闭环驱动
- loop-deepseek —— 面向 DeepSeek API 的自建 ReAct 代理循环
- loop-ollama —— 面向本地 Ollama 模型的自建 ReAct 代理循环
- loop-antigravity —— Google Antigravity / Gemini 闭环驱动
- loop-openclaw —— OpenClaw Gateway 多代理循环配置生成器
Apache License 2.0 —— 详见 LICENSE 文件。
Copyright 2026 Perry Link