Billing implements reserve -> commit -> refund against bl_quota and bl_ledger with row-level locking and idempotency keys; the refund commits on its own transaction so a failed request cannot silently keep a user's quota. Task implements the unified task centre over the state machine. Identity issues and resolves users. Remaining domains are placeholders whose READMEs state what belongs there and what must not.
26 lines
901 B
Markdown
26 lines
901 B
Markdown
# `packages/memory/` — 记忆系统(占位)
|
||
|
||
架构 §8.4。与 `packages/profile` 配合:`profile` 管表,这里管策略。
|
||
|
||
## 读(注入)
|
||
|
||
```
|
||
get_memory_snapshot(user_id, budget_tokens)
|
||
→ 优先级:L0 身份 > L1 画像 > L2 显式偏好 > L5 衣橱 > L3 事件
|
||
→ 过滤 status=active 且 confidence >= 阈值
|
||
→ 裁剪到预算内(≤ 500 token,FR-MEM-04)→ 缓存(hash 变更才重建)
|
||
```
|
||
|
||
## 写
|
||
|
||
| 来源 | 置信度 | 行为 |
|
||
| --- | --- | --- |
|
||
| 显式(用户明确说的) | 0.95 | 立即生效,回执告知「已记住」 |
|
||
| 报告产出 | 诊断置信度 | 写 L1 |
|
||
| 行为推断(隐式) | 累积证据 | 达阈值生成 `pending_confirm`,确认后才 active |
|
||
|
||
## 铁律
|
||
|
||
**用户在「我的记忆」页面的编辑拥有最高优先级,且不可被自动覆盖**
|
||
(FR-MEM-05/07)。所有变更写 `pf_memory_event` 留痕。
|