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.
packages/retrieval/ — 混合检索(占位)
架构 §8.3。进程内包,CPU + PostgreSQL。
待实现
一条 SQL 完成硬过滤 + 向量召回(这正是选 pgvector 的收益),再做 RRF 融合:
硬过滤(SQL WHERE) → 规则命中 → 向量召回(pgvector) → 关键词召回(tsvector)
→ 融合重排 → 输出知识片段 + 命中规则 ID + 图谱路径
重排权重(可配置,需用黄金集调参):
最终分 = 0.45×向量 + 0.2×关键词 + 0.25×规则权重 + 0.1×新鲜度
两条不能妥协的要求
- 硬过滤零漏(FR-KB-06):禁忌项不得出现在候选中。这不是排序问题, 是过滤问题 —— 不能靠权重压低,必须在 SQL 里排除。
- 规则命中要有明显加权:专业规则的可信度高于语义相似度,这是自建知识库 的意义所在。
- p95 < 200ms(NFR-PERF-06)。