Show HN: 我用持久化 Markdown 文件解决了 Claude Code 的上下文漂移问题

3作者: Tanishq03335 个月前
我一直在使用 Claude Code 构建 SaaS 产品,但一直遇到同样的瓶颈:它能写出精彩的代码,但 20 分钟后就会忘记你的数据库模式,并开始重写已经运行的代码。 问题不在于模型的记忆力,而在于会话之间没有持久的项目上下文。第二天再来,Claude 对昨天构建的内容一无所知。 我的解决方案:强制 Claude 在每次操作前读取项目的真实文件。 我构建了一个多智能体系统,预先创建持久的上下文文件: * PROJECT.md - 你要构建什么,商业模式,核心功能 * REQUIREMENTS.md - 数据库模式,身份验证流程,API 结构,边缘情况 * ROADMAP.md - 带有成功标准的构建阶段 * STATE.md - 当前位置,已完成的工作,待处理的任务 工作原理: * AI 产品经理会提出大多数开发人员会跳过的问题: * “资金如何流转?” * “如果用户在月中取消会发生什么?” * + 任何特定于你的 SaaS 的边缘情况 * 根据你的回答创建 Markdown 文件。 * Claude Code 在编写任何代码之前都会读取这些文件。 * 无需猜测。不会忘记模式,因为它被明确记录了。 * 每个任务都会生成执行器智能体,每个智能体都会读取相同的上下文文件。 * 它们并行构建,但永远不会破坏已经运行的内容。 * 验证器智能体在每个阶段后根据成功标准进行测试。 * 如果出现问题,则生成调试器智能体,并附带持久的调查文件。 结果: 使用该系统在 30 天内构建了 3 个产品: * 分析仪表板:13 小时 * 反馈小部件:18 小时 * 内容日历:9 小时 没有上下文漂移。没有“Claude 忘记了我的身份验证系统”的情况。只有一致的构建。 最大的区别: * 星期六:使用 Claude 构建身份验证 * 星期日:回来,描述下一个功能 * Claude 读取 REQUIREMENTS.md,看到现有的身份验证模式 * 构建新功能,不触及身份验证 * vs. Claude 重写所有内容的正常体验。 我将其打包为 PropelKit(Next.js 样板 + AI PM 系统,可自动创建这些文件)。但核心概念,持久的 Markdown 上下文,适用于任何 Claude Code 设置。 试用一下:[https://propelkit.dev](https://propelkit.dev) 智能体架构使用 Claude Sonnet/Opus(可配置)并行思维来生成多个智能体,所有智能体都从相同的真实文件读取。很乐意回答有关实施的问题。
查看原文
I&#x27;ve been using Claude Code to build SaaS products, and kept hitting the same wall: it writes brilliant code for 20 minutes, then forgets your database schema and starts rewriting working code. The problem isn&#x27;t the model&#x27;s memory, it&#x27;s that there&#x27;s no persistent project context between sessions. Come back tomorrow and Claude has zero knowledge of what it built yesterday. My solution: Force Claude to read project truth files before every action. I built a multi-agent system that creates persistent context files upfront: PROJECT.md - What you&#x27;re building, business model, core features REQUIREMENTS.md - Database schema, auth flows, API structure, edge cases ROADMAP.md - Build phases with success criteria STATE.md - Current position, completed work, pending tasks How it works:<p>AI Product Manager asks questions most developers skip:<p>&quot;How does money flow through this?&quot; &quot;What happens when users cancel mid-month?&quot; + Any Edge cases specific to your SaaS<p>Creates the markdown files from your answers. Claude Code reads these files before writing ANY code. No guessing. Can&#x27;t forget the schema, it&#x27;s literally documented. Executor agents spawn per task, each reading the same context files. They build in parallel but never break what&#x27;s already working. Verifier agent tests against success criteria after each phase. If broken, spawns debugger agent with persistent investigation files.<p>Results: Built 3 products in 30 days using this system:<p>Analytics dashboard: 13 hours Feedback widget: 18 hours Content calendar: 9 hours<p>No context drift. No &quot;Claude forgot my auth system&quot; moments. Just consistent builds. The biggest difference: Saturday: Build auth with Claude Sunday: Come back, describe next feature Claude reads REQUIREMENTS.md, sees existing auth schema Builds new feature without touching auth vs. the normal experience of Claude rewriting everything. I packaged this as PropelKit (Next.js boilerplate + AI PM system that creates these files automatically). But the core concept, persistent markdown context, works with any Claude Code setup.<p>Try it: <a href="https:&#x2F;&#x2F;propelkit.dev" rel="nofollow">https:&#x2F;&#x2F;propelkit.dev</a><p>The agent architecture uses Claude Sonnet&#x2F;Opus (configurable) parallel thinking to spawn multiple agents that all read from the same truth files. Happy to answer questions about the implementation.