Skip to content

fix(memory): make Project Memory process-safe and identity-safe (MEM-PR-01) #233

Description

@LeXwDeX

Summary

Project Memory(/memory 与自动记忆)在多进程、身份升级、worktree 生命周期下存在数据丢失与静默覆盖风险:共享 global identity 下跨仓库泄漏、身份升级 FK 级联删除 workflow/permission、退役后写入重建孤儿 Home、跨进程写入静默覆盖、worktree 操作破坏性清理。

Required invariants

  1. 一个 Project 只有一份权威 Memory;退役后任何路径不得重建 Home。
  2. 身份升级(root→first remote、remote→remote)零数据丢失,冲突 fail-closed。
  3. 跨进程更新不静默覆盖(锁 + revision 校验)。
  4. global / 退役 identity 下 Memory fail-closed 惰性。
  5. worktree 生命周期不破坏 Memory 数据。
  6. 退役 TOCTOU class 关闭:fence 协议(key + dir + fence 内 liveness 复检)单一权威。

Acceptance criteria

  • 上述不变量各有一条公共行为级测试钉住;关键修复有 mutation 敏感性证据。
  • 全范围(origin/dev...分支,约 30 文件)Spec + Standards 双轴审查连续两轮无新 P1/P2。
  • opencode/core typecheck、lint 棘轮、领域测试全绿;PR 合并后 dev push 全量 CI 绿。
  • 不恢复已否决的 ProjectMemoryAuthority / 六阶段 journal / alias tombstone / opaque Revision / destruction guard;Memory source Home 不删除;.orDie 结构化错误传播为已批准延期项。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions