让大模型编程代理在写文件时更稳定,避免因失败重试浪费资源。
Resilient Write: A Six-Layer Durable Write Surface for LLM Coding Agents
- 六层防护机制分别应对写入失败的六大常见问题。
- 实测恢复时间缩短5倍,自我纠错率提升13倍。
- 适合开发大模型编程工具的工程师和研究者使用。
基于大语言模型的编程代理越来越多依赖MCP等工具协议,在开发者工作站上读写文件。当写入失败(如内容过滤、截断或会话中断)时,代理通常无法获得结构化反馈,丢失草稿并盲目重试,浪费计算资源。本文提出Resilient Write,一个位于代理与文件系统之间的六层持久写入层。这六层——预飞行风险评分、事务性原子写入、可续写分块、结构化错误信息、带外暂存空间、任务连续性交接封装——彼此独立且可单独采用。每层对应2026年4月真实会话中观察到的一种具体故障模式,例如内容安全过滤器静默拒绝了包含脱敏API密钥前缀的草稿。使用该系统撰写本文过程中还衍生出三个辅助工具:分块预览、格式感知校验和日志分析。186项测试验证了各层正确性;定量对比显示,相比基线方案,恢复时间减少5倍,代理自修正率提升13倍。Resilient Write已开源,采用MIT许可证。
原文摘要 · Abstract (English)
LLM-powered coding agents increasingly rely on tool-use protocols such as the Model Context Protocol (MCP) to read and write files on a developer's workstation. When a write fails - due to content filters, truncation, or an interrupted session - the agent typically receives no structured signal, loses the draft, and wastes tokens retrying blindly. We present Resilient Write, an MCP server that interposes a six-layer durable write surface between the agent and the filesystem. The layers - pre-flight risk scoring, transactional atomic writes, resume-safe chunking, structured typed errors, out-of-band scratchpad storage, and task-continuity handoff envelopes - are orthogonal and independently adoptable. Each layer maps to a concrete failure mode observed during a real agent session in April 2026, in which content-safety filters silently rejected a draft containing redacted API-key prefixes. Three additional tools - chunk preview, format-aware validation, and journal analytics - emerged from using the system to compose this paper. A 186-test suite validates correctness at each layer, and quantitative comparison against naive and defensive baselines shows a 5x reduction in recovery time and a 13x improvement in agent self-correction rate. Resilient Write is open-source under the MIT license.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。