2026-08-14-project-memory.md 3.6 KB

Project Memory Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: 为城市生命线项目创建仓库内的对话记忆库,并建立每次任务前读取、结束后更新、定期整理长期记忆的协作规则。

Architecture: 使用根目录 AGENTS.md 作为项目级入口,使用 memory/ 保存索引、长期记忆和按日期聚合的会话记录。全部采用 Markdown,不进入 Vite 构建,不增加运行时依赖。

Tech Stack: Markdown、Git、PowerShell 静态验证

Spec: docs/superpowers/specs/2026-08-14-project-memory-design.md

Global Constraints

  • 不修改 Vue/Vite 运行时代码。
  • 不增加 npm 依赖。
  • 不记录密码、Token、地图密钥或其他敏感值。
  • 每累计 5 次会话,或当日会话文件超过约 20 KB,整理一次长期记忆。

Task 1: 创建项目级记忆规则和目录说明

Files:

  • Create: AGENTS.md
  • Create: memory/README.md

Interfaces:

  • Consumes: docs/superpowers/specs/2026-08-14-project-memory-design.md
  • Produces: 后续协作者可执行的读取、写入、整理和隐私规则

  • [x] Step 1: 创建 AGENTS.md

写明以下强制流程:任务开始读取 memory/index.mdmemory/long-term.md;必要时读取最近会话;任务结束更新当天会话文件与索引;稳定决策写入长期记忆;禁止记录敏感信息。

  • Step 2: 创建 memory/README.md

包含目录职责、会话记录模板、五次会话整理周期、20 KB 整理阈值、归档规则和敏感信息边界。

  • Step 3: 验证规则文件存在且包含关键约定

Run:

Test-Path AGENTS.md
Test-Path memory/README.md
rg -n "memory/index.md|memory/long-term.md|每次|敏感|5 次|20 KB" AGENTS.md memory/README.md

Expected: 两个 Test-Path 均输出 Truerg 命中读取、更新、隐私和整理规则。

Task 2: 初始化索引、长期记忆和本次会话记录

Files:

  • Create: memory/index.md
  • Create: memory/long-term.md
  • Create: memory/sessions/2026-08-14.md
  • Modify: task_plan.md
  • Modify: progress.md

Interfaces:

  • Consumes: 已核实的项目探索结果和本次用户确认的记忆库约定
  • Produces: 后续对话可直接读取的项目上下文与会话历史

  • [x] Step 1: 创建 memory/index.md

记录项目名称、技术栈、核心入口、动态路由特征、当前已知风险、长期记忆链接和会话索引。

  • Step 2: 创建 memory/long-term.md

记录已经确认的稳定事实:项目定位、技术架构、启动方式、后端代理依赖、记忆库更新约定和敏感信息规则。

  • Step 3: 创建 memory/sessions/2026-08-14.md

记录本次项目探索、启动服务说明、记忆库设计决策、创建/修改文件、验证情况和后续待办。

  • Step 4: 更新规划记录

task_plan.md 的记忆库创建阶段标记完成,并在 progress.md 记录实施结果。

  • Step 5: 检查文件结构和敏感信息

Run:

Get-ChildItem memory -Recurse -File | Select-Object FullName
rg -n "VITE_BAIDU_MAP_AK\s*=|Bearer\s+[A-Za-z0-9]|password\s*=|token\s*=" AGENTS.md memory

Expected: 列出四个记忆文件;敏感信息扫描无匹配。

  • Step 6: 检查变更范围

Run:

git status --short
git diff --stat

Expected: 仅出现规划文档、AGENTS.mdmemory/ 和当前规划记录,不出现 src/package.json 或 Vite 配置变更。