会话事件契约 —— 变更事件 · 哈希链日志 · 投影重建

会话事件契约 —— 变更事件 · 哈希链日志 · 投影重建 由 Archify 生成的架构图。 Runtime 写点 · BaseAgentRuntime · CodeAct · 架构组件 Runtime 写点 BaseAgentRuntime · CodeAct Mutation 事件 · USER_INPUT 等 6 类变更事件 · 架构组件 Mutation 事件 USER_INPUT 等 6 类变更事件 HashChainedEventLog · sha256 链 · append-only · 架构组件 HashChainedEventLog sha256 链 · append-only SessionEventProjector · deriveItems 折叠重建 · 架构组件 SessionEventProjector deriveItems 折叠重建 AgentSession · restore() · compact · replace · 架构组件 AgentSession restore() · compact · replace AgentMemory · 运行态缓存 · 直写保持 · 架构组件 AgentMemory 运行态缓存 · 直写保持 Harness 补丁点 · resume · fork · setItems · 架构组件 Harness 补丁点 resume · fork · setItems 一致性回归 · project(log) == memory.items · 架构组件 一致性回归 project(log) == memory.items ① mutation 事件 ② 直写运行态 ③ append + 哈希链 ④ fold 事件流 ⑤ SESSION_RESTORED ⑥ 补丁经 restore() ⑦ 投影 items ⑧ 运行态 items

契约不变量

  • • 每次 memory 变更必产生对应追加事件
  • • 模型可见内容 ⟺ 已记录事件
  • • 一致性测试断言 投影(log) == 运行态快照

restore() 统一漏斗

  • • resume / fork / harness setItems 补丁全经 restore()
  • • 漏斗内自动追加 SESSION_RESTORED,无需逐点补埋
  • • HashChainedEventLog 重封印后仍可 append

投影而非旁路

  • • io-capture 仍是旁路录制;事件日志才是契约镜像
  • • fork / 审计 / eval 数据集从同一事件流重建
  • • compact 改写经 restore() 路径同样落 SESSION_RESTORED