Show HN:BlastLoop,一种面向 AI Agent 的结构优先编程方法
英文标题:🔶 Show HN: BlastLoop, a structure-first coding method for AI agents
BlastLoop 是 Ross Shaw 提出的 AI Agent 编程框架,将代码工作划分为 Blast、Mid、Inner 三个不同层级,并按 T1 结构审查、T2 缺陷与运维测试、T3 对抗测试的固定顺序进行验证。该方法主张先确保系统结构正确,再处理功能缺陷,最后进行攻击性测试;若 T3 发现结构问题,必须回到 T1 并由对应层级重构,而非局部修补。对开发团队而言,它试图解决 AI 编程 Agent 提速同时也加速错误扩散的问题,并可与 Spec Kit、vibe coding、红蓝测试等既有工作方式结合使用。
1.3 KB
95.5 KB
中文
BlastLoop 是 Ross Shaw 为 AI Agent 设计的一套实用编程框架:Blast、Mid 和 Inner 在不同层级编写代码,随后依次通过 T1 结构性测试、T2 缺陷/运维测试和 T3 对抗性测试。
**它为何存在:**AI 编程 Agent 能让团队更快,但也会让失败发生得更快。BlastLoop 将运维思维应用于 Agent 工作:每一项变更都由处于合适层级的负责人负责,每个结果在发布前都必须按固定顺序通过结构、运维和对抗性关卡。
**公开新闻通讯 / 公开文章现已发布。**更完整的 BlastLoop 说明见 WORLDWRIGHT 第 3 期:AI Did Not Remove Engineering Failure. It Made It Faster.
**版本:**1.0.0 **标语:**结构优先,功能其次,攻击第三。
在 5 分钟内将 BlastLoop 用于 AI 编程 Agent
- 将此仓库克隆到你希望获得 Agent 协助的项目中。
- 让你的 Agent 阅读
AGENTS.md。 - 根据工作的层级加载一条构建提示词:
- 让 Agent 在该层级编写代码。BlastLoop 不是先写规格、先做计划、再交给单一实现者的模式。构建层应在其自身职责范围内产出代码。
- 按顺序运行测试循环:
- 如果 T3 发现结构性问题,就从 T1 重新开始,将修正工作路由回 Blast、Mid 或 Inner,然后再次运行 T2 和 T3。
这就是完整的公开版本:加载正确的提示词,在正确的层级编写代码,然后按正确的顺序测试。
有关必需的交接包和路由规则,请参阅 docs/HANDOFFS.md。某个阶段可以从自身视角提出修复建议,但仍由对应层级的负责人决定并实施变更。
B / M / I:三个编程层级
Blast 编写系统级代码和结构。
当任务涉及仓库形态、服务边界、顶层接口、共享契约、部署结构或新能力骨架的变更时,使用 Blast。
Mid 编写子系统代码。
当任务规模大于局部补丁、但小于系统重构时,使用 Mid:例如功能切片、服务模块、集成接口,或子系统重构。
Inner 编写局部单元代码。
当任务仅限于少量文件、函数、测试或适配器时,使用 Inner。Inner 是 BlastLoop 中的局部单元层级:范围聚焦、所有权明确,并直接完成变更。
按以下顺序运行测试。
T1 寻找结构性问题:错误的边界、位于错误层级的逻辑、抽象泄漏、文件所有权被破坏、缺失的接口,或放错位置的横切关注点。
T1 不应像通用 Bug 修复器那样工作。它的职责是判断代码结构是否正确,并将修正工作路由回正确的编写者:Inner、Mid 或 Blast。
当结构已经可靠时,T2 会直接修复 Bug 和运维问题。
如果 T2 发现问题实际上属于架构层面,它会升级回 T1,而不是在局部位置掩盖问题。
T3 会攻击结果:边界情况、误用、竞态条件、异常输入、脆弱假设、安全态势、回滚路径和失败行为。
如果 T3 发现结构性问题,循环将按如下方式重启:
T3 - > T1 -> B/M/I 修正 -> T2 -> T3
这条重启规则很重要。结构性破坏应通过结构性方式修复,而不是作为局部 Bug 打补丁掩盖过去。
- **不是事实核查器。**BlastLoop 是编程与测试框架,不是事实判断引擎。
- **不是 GitHub Spec Kit。**Spec Kit 的流程是规格 -> 计划 -> 任务 -> 实现 -> 收敛。BlastLoop 则是多个编程层级加上分阶段测试循环。
- **不是一种相互竞争的“Agent 风格”。**BlastLoop 可以与 Spec Kit、vibe coding、聚焦的局部实现提示词或红蓝测试结合使用。这些方法可以置于某个层级或测试层之内;BlastLoop 则是对它们进行路由的结构优先循环。
- **不是多 Agent 组织架构图。**这一公开版本不定义管理层级、Bot 层级或私有自动化。
- **不只是红蓝测试。**对抗性测试仅是 T3,而不是整个方法。
可与其他 Agent 风格协作
BlastLoop 不要求使用单一编程风格或单一规划流派。
- Spec Kit 可以在代码编写前塑造规划过程。
- Vibe coding 或其他实现风格可根据范围在 Blast、Mid 或 Inner 中执行。
- 当任务适合时,聚焦的局部实现提示词可在 Inner 中使用。
- 红蓝测试天然适合放在 T3 的对抗性工作中。
BlastLoop 的职责是对工作进行路由:选择正确的层级,然后按顺序运行 T1 -> T2 -> T3。
如需简短的并列对比,请参阅 docs/COMPARISON.md。
MIT 许可证。参见 LICENSE。
English / 原文
BlastLoop is Ross Shaw's practical coding framework for AI agents: Blast , Mid , and Inner write code at different altitudes, then T1 structural , T2 bug/ops , and T3 adversarial test it in order.
Why it exists: AI coding agents make teams faster, but they also make failure faster. BlastLoop applies an operations mindset to agent work: each change has an owner at the right altitude, and every result passes structural, operational and adversarial gates in a fixed order before it ships.
Open newsletter / public write-up is live. Fuller BlastLoop explanation: WORLDWRIGHT Issue 3, AI Did Not Remove Engineering Failure. It Made It Faster.
Version: 1.0.0 Tagline: structure first, function second, attack third.
Use BlastLoop with an AI coding agent in under 5 minutes
- Clone this repo into the project where you want agent help.
- Point your agent at
AGENTS.md. - Load one build prompt based on the altitude of the work:
- Have the agent write code at that altitude. BlastLoop is not spec first, plan first, then one implementer. The build layer should produce code at its own scope.
- Run the test loop in order:
- If T3 finds a structural problem, restart through T1, route correction back to Blast, Mid, or Inner, then run T2 and T3 again.
That is the whole public cut: load the right prompt, write at the right altitude, then test in the right order.
See docs/HANDOFFS.md for the required handoff packet and routing rules. A stage may recommend a fix from its own vantage, but the owning altitude still decides and implements the change.
B / M / I: three coding altitudes
Blast writes system-level code and structure.
Use Blast when the job changes repo shape, service boundaries, top-level interfaces, shared contracts, deployment structure, or the skeleton of a new capability.
Mid writes subsystem code.
Use Mid when the job is bigger than a local patch but smaller than a system redesign: a feature slice, a service module, an integration surface, or a subsystem refactor.
Inner writes local unit code.
Use Inner when the job is contained to a few files, functions, tests, or adapters. Inner is the local-unit altitude in BlastLoop: focused scope, clear ownership, and direct completion of the change.
Run tests in this order.
T1 looks for structural issues: wrong boundaries, logic at the wrong altitude, leaky abstractions, broken file ownership, missing interfaces, or misplaced cross-cutting concerns.
T1 does not behave like a general bug fixer. Its job is to decide whether the code is shaped correctly and to route correction back to the right writer: Inner, Mid, or Blast.
T2 fixes bugs and operational issues directly when the structure is already sound.
If T2 discovers the issue is actually architectural, it escalates back to T1 instead of papering over the problem locally.
T3 attacks the result: edge cases, misuse, race conditions, weird inputs, brittle assumptions, security posture, rollback paths, and failure behavior.
If T3 finds a structural problem, the loop restarts like this:
T3 - > T1 -> B/M/I correction -> T2 -> T3
That restart rule matters. Structural breakage should be repaired structurally, not patched over as a local bug.
- Not a fact-checker. BlastLoop is a coding and testing framework, not a truth engine.
- Not GitHub Spec Kit. Spec Kit is spec -> plan -> tasks -> implement -> converge. BlastLoop is multiple coding altitudes plus a staged test loop.
- Not a competing "agent style." BlastLoop can work with Spec Kit, vibe coding, focused local implementation prompts, or red/blue testing. Those can sit inside an altitude or a test layer; BlastLoop is the structure-first loop that routes them.
- Not a multi-agent org chart. This public cut does not define management layers, bot hierarchies, or private automation.
- Not red/blue testing alone. Adversarial testing is T3 only, not the whole method.
Works with other agent styles
BlastLoop does not require one coding style or one planning school.
- Spec Kit can shape planning before code is written.
- Vibe coding or other implementation styles can operate inside Blast, Mid, or Inner, depending on scope.
- Focused local implementation prompts can be used inside Inner when they fit the task.
- Red/blue testing fits naturally in T3 adversarial work.
BlastLoop's job is to route the work: choose the right altitude, then run T1 -> T2 -> T3 in order.
See docs/COMPARISON.md for a short side-by-side.
MIT. See LICENSE.