heading: ops-profile-memory-hygiene

text:
# ops-profile-memory-hygiene

- Repo URL: ssh://git@192.168.1.4:2222/qianliyun/ops-profile-memory-hygiene.git
- Local path: /Users/bot1/AI Work/02_projects/active/ops-profile-memory-hygiene
- Machine/Profile: bot1 / meow-chan
- Owner/Requester: 钱丽云
- Task type: ops / Hermes profile memory governance / cron
- Status: active
- Last updated: 2026-05-20T23:51:05+08:00
- Latest commit: e31be741704e76f743671afe43ccc1df3e46723d
- Related bots/profiles: meow-chan; source profiles from NAS KB approval queue

title: ops-profile-memory-hygiene


heading: Purpose

text:
## Purpose

为 NAS 共享知识库“多 profile 候选经验 → 三人审批 → 写入 NAS”流程补上后半段：审批包本身逐条列明 NAS 写入内容与后续 source agent/profile 记忆清洗范围；三人同意后，写入 NAS 并自动备份、exact-match 压缩对应 profile 的 `MEMORY.md`。

title: ops-profile-memory-hygiene


heading: Closed loop

text:
## Closed loop

1. 每日候选汇总 cron `f859bdb12387` 生成审批包前，先运行 `profile_memory_cleanup_after_nas.py --approval-preview --force`，为每个 operation 写入 `post_approval_memory_cleanup`。
2. HTML 详情页和飞书审批表单逐条展示：NAS 上会新增/更新什么，以及什么 agent/profile 的记忆会被对应清洗压缩。
3. 三位固定审批人全部 APPROVED 后，审批结果监控 cron `a3d332a1d4b8` 只按审批包写 NAS，并验证结果。
4. 如果审批包含 `approval_includes_memory_cleanup=true` / `memory_cleanup_authorization.auto_apply_after_nas_written=true`，监控任务会在 NAS 写入验证后自动执行 `--auto-apply-approved`。
5. Apply 前备份对应 profile 的 `MEMORY.md`；只替换 exact unchanged entries；不改 `USER.md`；无法精确匹配则跳过。

title: ops-profile-memory-hygiene


heading: Current authoritative description

text:
## Current authoritative description

The repo root `REPO_DESCRIPTION.md` is the source of truth for detailed evolving state.

title: ops-profile-memory-hygiene


heading: Runtime hooks

text:
## Runtime hooks

- Deployed script: `/Users/bot1/.hermes/profiles/meow-chan/scripts/profile_memory_cleanup_after_nas.py`
- Daily approval cron: `f859bdb12387` / `NAS共享知识库每日候选汇总-三人审批门禁` / 0 8 * * *
- Approval monitor cron: `a3d332a1d4b8` / `NAS共享知识库审批结果监控与合并执行` / every 10m
- Cleanup cron: `388e37df5449` / `NAS共享知识库写入后profile记忆自动瘦身` / every 30m / no_agent=true
- Plan output: `/Users/bot1/.hermes/profiles/meow-chan/state/profile_memory_cleanup_queue/`
- Report output: `/Users/bot1/AI Work/09_logs_reports/profile-memory-hygiene/`

title: ops-profile-memory-hygiene


heading: Safety

text:
## Safety

- Does not write NAS shared knowledge documents itself.
- Does not edit `USER.md`.
- Edits `MEMORY.md` only when the approved package explicitly includes cleanup authorization and NAS write verification has completed.
- Apply mode backs up `MEMORY.md` first and only replaces exact unchanged entries.

title: ops-profile-memory-hygiene


heading: Search keywords

text:
## Search keywords

profile memory cleanup, MEMORY.md 瘦身, NAS共享知识库, 审批包同时授权记忆清洗, approval_includes_memory_cleanup, auto_apply_after_nas_written, Hermes cron, meow-chan, 机器人记忆治理

title: ops-profile-memory-hygiene