解决AI编程中上下文爆炸和规范漂移问题,让代码与规范自动对齐。
The Spec Growth Engine: Spec-Anchored, Code-Coupled, Drift-Enforced Architecture for AI-Assisted Software Development
- 用可机器读取的规范图结构,分离设计与契约,明确代码归属路径。
- 通过垂直切片生长协议,优先实现最难部分,避免上下文过载。
- 引入漂移门机制,规范与代码不一致时拒绝合并,适合团队协作开发。
AI编程代理虽显著提升实现速度,但存在两种结构性失效:(1) 上下文爆炸——代理需一次性处理整个仓库,导致上下文窗口溢出,输出质量下降;(2) 静默规范-代码漂移——代码演化而规范未更新,差异在修复成本高昂时才被发现。我们提出Spec Growth Engine,一种轻量级框架,通过可机器读取的规范图(节点显式分离合约与设计)、脊柱上下文组装器(将代理上下文限定于所有权路径)、垂直切片生长协议(强制最难部分优先实现)以及漂移门(使规范与代码不一致成为合并阻塞条件),综合信息隐藏、C4架构、架构决策记录(ADR)、骨架行走、反思模型与健康度函数等成熟软件工程原则,构建一个轻量、代码耦合、机器强制的系统,无需像RUP或MDA这类重型框架的开销。
原文摘要 · Abstract (English)
AI coding agents dramatically accelerate implementation speed but introduce two structural failure modes that existing spec-driven approaches do not fully solve: (1) context explosion -- the agent must reason over an entire repository at once, degrading output quality as the context window fills; and (2) silent spec-code drift -- code evolves, the specification does not, and the divergence becomes invisible until it is costly to repair. We present the Spec Growth Engine, a lightweight framework that addresses both failure modes through a machine-readable spec graph whose nodes carry explicit contract/design separation, a Spine context assembler that scopes agent context to an ownership path, a vertical-slice growth protocol that enforces hardest-first ordering, and a drift gate that makes spec-code divergence a blocking merge condition. The design synthesises well-established software engineering principles (Parnas information hiding, C4, ADRs, Walking Skeleton, Reflexion Models, Fitness Functions) into a lean, code-coupled, machine-enforced whole -- without the overhead of heavy-weight frameworks such as RUP or MDA.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。