feat: 自优化4大链路补齐

1. GapDetector 自动接入 recall 路径
   - MissRecorder callback → RecallPipeline
   - 0 结果时自动 RecordMiss(query)
   - server.go 中 gapDetector 初始化后挂载

2. Dashboard 持久化到 Redis
   - EnableRedisPersistence() 启动时加载
   - persist() 每次 mutate 后同步 13 个计数器到 Redis HASH
   - 重启不丢指标

3. PassiveValidator 接入 commit 路径
   - 新记忆提交后自动 P1/P2/P3 匹配验证
   - 复用 Validator.Validate 逻辑

4. VPropagator 接入 feedback/correct
   - 用户修正时记录决策 V 值
   - 使用 user_correct 来源 + success 结果

Closes: 10% 缺失代码 + 40% 缺失链路
This commit is contained in:
xiaowei
2026-05-30 11:27:27 +08:00
parent 064046f6da
commit bceb5fb059
5 changed files with 126 additions and 2 deletions
+7
View File
@@ -107,6 +107,10 @@ func NewServer() http.Handler {
gapDetector := selfoptimize.NewGapDetector(emb, ldb)
gapAPI := routes.NewGapAPI(gapDetector)
routes.InitGapRepair(gapDetector) // 共享同一个 GapDetector
// G1a: 挂缺隙记录器(0 结果 → 自动记录 miss)
api.Pipeline.SetMissRecorder(func(query, namespace string) {
gapDetector.RecordMiss(query + " [" + namespace + "]")
})
feedbackAPI := routes.NewFeedbackAPI(ldb)
// 遗忘器:支持按 Agent 类型设置衰减率
@@ -184,6 +188,9 @@ func NewServer() http.Handler {
// ─── CO_OCCURS 追踪器 ───────────────────────
storage.CoOccurTrackerInstance = storage.NewCoOccurTracker(nil)
// ─── Dashboard 持久化到 Redis(restart 不丢指标)───
selfoptimize.EnableRedisPersistence()
// ─── V 值传播器(竞争性架构核心)─────────────
vPropagator := selfoptimize.VProp
// 在蒸馏完成回调中记录 V 值