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.
翻译:基于大语言模型的编码代理日益依赖工具调用协议(如模型上下文协议MCP)在开发者工作站上读写文件。当写入因内容过滤器、截断或会话中断而失败时,代理通常无法获取结构化信号,既丢失草稿,又会因盲目重试浪费令牌。我们提出弹性写入系统——一种在代理与文件系统之间插入六层持久化写入表面的MCP服务器。六层包括:预检风险评分、事务性原子写入、断点续传分块、结构化类型错误、带外暂存存储以及任务连续性切换信封,各层相互正交且可独立采用。每层均对应一个具体的故障模式——这些模式源自2026年4月一次真实代理会话(其中内容安全过滤器静默拒绝了一段经清理的API密钥前缀文本)的观测结果。在撰写本论文过程中,我们还衍生出三个附加工具:分块预览、格式感知验证和日志分析。资源库包含186项测试用例用于验证各层正确性,与朴素基线和防御性基线的定量对比显示:恢复时间降低5倍,代理自我修正率提升13倍。弹性写入系统采用MIT开源许可证发布。