arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.00822cs.SEcs.AI
收藏

ContextCov: 从代理指令文件中推导并强制执行可执行约束

ContextCov: Deriving and Enforcing Executable Constraints from Agent Instruction Files

University of Washington(华盛顿大学)

Reshabh K Sharma

AI总结:

ContextCov通过从代理指令文件中推导并强制执行可执行约束,解决代理在执行复杂软件任务时因上下文漂移导致的技术债务问题。

摘要:

随着大型语言模型(LLM)代理越来越多地执行复杂、自主的软件工程任务,开发者依赖自然语言代理指令(例如AGENTS.md)来强制执行项目特定的编码规范、工具链和架构边界。然而,这些指令是被动的文本。代理经常由于上下文限制或冲突的遗留代码而偏离这些指令,这种现象我们称之为上下文漂移。由于代理在没有实时人类监督的情况下运行,这些沉默的违规行为迅速累积成技术债务。为弥合这一差距,我们引入了ContextCov,一个将被动的代理指令转换为主动、可执行的护栏框架。ContextCov提取自然语言约束,并在三个领域合成执行检查:静态AST分析用于代码模式,运行时shell shim用于拦截禁止命令,以及架构验证器用于结构和语义约束。在723个开源仓库上的评估显示,ContextCov成功提取了超过46,000个可执行检查,其中99.997%的语法有效性,为安全、由代理驱动的开发提供了必要的自动化合规层。源代码和评估结果可在https://anonymous.4open.science/r/ContextCov-4510/上获得。

英文摘要:

As Large Language Model (LLM) agents increasingly execute complex, autonomous software engineering tasks, developers rely on natural language Agent Instructions (e.g., AGENTS.md) to enforce project-specific coding conventions, tooling, and architectural boundaries. However, these instructions are passive text. Agents frequently deviate from them due to context limitations or conflicting legacy code, a phenomenon we term Context Drift. Because agents operate without real-time human supervision, these silent violations rapidly compound into technical debt. To bridge this gap, we introduce ContextCov, a framework that transforms passive Agent Instructions into active, executable guardrails. ContextCov extracts natural language constraints and synthesizes enforcement checks across three domains: static AST analysis for code patterns, runtime shell shims that intercept prohibited commands, and architectural validators for structural and semantic constraints. Evaluations on 723 open-source repositories demonstrate that ContextCov successfully extracts over 46,000 executable checks with 99.997% syntax validity, providing a necessary automated compliance layer for safe, agent-driven development. Source code and evaluation results are available at https://anonymous.4open.science/r/ContextCov-4510/.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑