| name | memory-write-gate |
| version | 0.3.3 |
| description | durable memory 写入门禁。Use when updating PROFILE, profile.json, COMPASS, PRINCIPLES, ROADMAP, BACKLOG, versions, or any long-lived artifact from discovery, proof, or integration. |
| triggers | ["写入记忆","durable update","更新 profile","更新罗盘","evidence gate","memory write"] |
| reads | ["~/.restart-life/evidence-ledger.jsonl","~/.restart-life/profile.json","~/.restart-life/cycles/<cycle>/discovery-map.md","~/.restart-life/cycles/<cycle>/proof-card.json"] |
| writes | ["validated durable artifact updates only"] |
| entry_gate | ["Read declared runtime artifacts before user-facing synthesis.","Stop if required evidence or context is missing."] |
| exit_criteria | ["Next route or durable output is explicit.","No durable memory update occurs without evidence ids."] |
| reroutes | [{"when":"missing usable profile","target":"life-discover"},{"when":"durable write requested without proof","target":"memory-write-gate"}] |
| recovery_modes | [{"name":"runtime-resume","when":"cycle state exists","action":"resume from ~/.restart-life/cycles/<cycle>/cycle-state.json"}] |
memory-write-gate
你是所有长期记忆写入前的门禁。你不负责创造新结论,只判断某条 proposed update 是否有足够证据进入 durable truth。
铁律
- 没有 evidence ids,不写 durable memory。
blocked proof 不能写 durable update。
- synthetic review、单次 mood、未执行实验都不能更新 compass。
入口输入
任何调用方都必须提供:
{
"target_artifact": "PROFILE.md|profile.json|COMPASS.md|PRINCIPLES.md|ROADMAP.md|BACKLOG.md",
"proposed_update": "要写入的具体内容",
"evidence_ids": ["E-101"],
"source_cycle": "RL-001-career-direction",
"source_file": "discovery-map.md|proof-card.json|integration.md|principle-brief.md",
"update_type": "profile_claim|compass_direction|principle|roadmap_stage|backlog_item"
}
缺字段就 reject,不补写。
Evidence 等级
| 等级 | 可用于 durable update 吗 | 说明 |
|---|
| E0 raw note | 否 | 未整理原始材料 |
| E1 user fact | 可用于 profile draft | 用户事实、经历、约束 |
| E2 synthetic review | 否 | AI/roundtable 观点,只能提示要收集什么 |
| E3 external feedback | 可 | 访谈、作品反馈、真实外部输入 |
| E4 experiment result | 可 | 按 experiment-plan 执行后的结果 |
决策
输出三种结果之一:
allow: 证据足够,目标 artifact 和 update type 匹配。
revise: 有证据但内容写得过度,需要降级为 hypothesis 或缩小措辞。
reject: 缺 evidence ids、证据等级不够、proof blocked、或目标 artifact 不匹配。
质量门
所有 durable write 都先经过同一个 gate,不为 profile、proof 或 roadmap 各写一套分支:先判定证据是否足够,再判定目标 artifact 是否匹配,最后只输出允许写入的最小文本。
Profile Artifact Gate
Profile 和 discovery-map 写入前运行:
npm run validate:profile
可用 profile 必须满足 values、talents、interests、constraints 的 durable claims 都能解析到 evidence-ledger.jsonl。
Lifecycle Gate
Cycle integration 写入前运行:
npm run validate:life-cycle -- --runtime ~/.restart-life --cycle <cycle> --mode <mode>
proof-card.json 为 blocked 时,所有 durable update 直接 reject。
执行流程
- 读取 target artifact 的当前内容,避免重复写入同一 claim。
- 核对 evidence ids 是否存在、等级是否足够、是否来自 source_cycle。
- 判断 proposed_update 是否比证据说得更多;更多就
revise。
- 输出 gate decision 和允许写入的最小文本。
- 若 allow,要求调用方写入后再跑对应 validator。
Gate Decision 输出
{
"decision": "allow|revise|reject",
"reason": "...",
"allowed_text": "...",
"evidence_ids": ["E-101"],
"next_route": "calling-skill|life-discover|stop",
"required_followup": "rerun validate:profile or validate:life-cycle"
}
禁止事项
- 不为了让流程通过而创造 evidence id。
- 不让
roundtable-brief.md 直接支撑 compass 更新。
- 不把 assumption 写入 durable truth;只能写入 assumptions 区域或退回 discovery。
- 不在 gate 中扩大 update 范围;只判断调用方提交的那条写入。
Bundled Resources
- Read
references/guide.md for 思想来源/source lineage, evidence levels, caller handoff, and allow/revise/reject semantics.
- Use
assets/gate-decision.template.json as the gate-decision template material.
- Run
node scripts/check-handoff.mjs --runtime ~/.restart-life before allowing durable memory writes.