让编程助手记住过往错误,避免重复踩坑,提升开发效率。
PROJECTMEM: A Local-First, Event-Sourced Memory and Judgment Layer for AI Coding Agents
- 用纯文本事件日志记录开发过程,可复现且不可篡改。
- 每次会话节省5000-20000个令牌,减少重复调试。
- 适合注重安全、可审计的本地化编程场景。
AI编程助手已承担越来越多的软件开发工作,但从会话中重新读取项目文件、重推先前决策,尤其是重复失败的调试尝试,仍造成巨大开销,每会话耗时约5000-20000个令牌。我们提出projectmem,一个开源、本地优先的记忆与判断层,将开发过程记录为不可变的纯文本事件流(包括问题、尝试、修复、决策与笔记),并通过模型上下文协议(MCP)生成紧凑、对大模型友好的摘要。该系统还引入确定性预动作检查机制,在代理执行前预警重复失败的修复或修改已知脆弱文件。我们将其视为“记忆即治理”:记忆不仅回答问题,更干预后续行为。系统全程离线运行,无遥测数据,其不可变日志亦可作为可追溯、可审计的开发凭证。projectmem以三依赖的Python包形式发布,含14个MCP工具、19条命令行指令和37个自动化测试,经两个月自研实践在10个项目中共记录207条事件验证有效。源码:https://github.com/riponcm/projectmem。
原文摘要 · Abstract (English)
AI coding assistants now support a growing share of software work, from quick scripts to production applications. Yet these agents remain largely stateless: each new session re-reads project files, re-derives prior decisions, and - most costly - may repeat debugging attempts that already failed. Reconstructing this context can consume an estimated 5,000-20,000 tokens per session; the bottleneck is often not model capability but missing project memory. We present projectmem, an open-source, local-first memory and judgment layer for AI coding agents. projectmem records development as an append-only, plain-text event log of typed events - issues, attempts, fixes, decisions, and notes - and deterministically projects that log into compact, AI-readable summaries served through the Model Context Protocol (MCP). Beyond storage, projectmem adds a deterministic pre-action gate that warns an agent before it repeats a previously failed fix or edits a known-fragile file. We frame this as Memory-as-Governance: memory that does not merely answer the agent but acts on its next action. The system runs fully offline with no telemetry; its immutable log also serves as a provenance trail for reproducible, auditable AI-assisted development. projectmem ships as a three-dependency Python package (14 MCP tools, 19 CLI commands, 37 automated tests) and is evaluated through a two-month self-study across 10 projects comprising 207 logged events. Source code: https://github.com/riponcm/projectmem.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。