feat(agent): 经验记忆 - 按任务相关度排序召回,并过期清理待批准记忆

召回按主题、情境和中文双字命中加权;30天未处理的待批准记忆会在记录和压缩调度时过期,成功计数写入运行态以免事件窗口截断后误拦。
This commit is contained in:
ddcat666
2026-10-08 10:54:40 +08:00
parent 05f90caf78
commit 5acddb9ecb
7 changed files with 229 additions and 28 deletions

View File

@@ -217,12 +217,15 @@ func (s *Service) startAgentMemoryCompactScheduler() {
}
func (s *Service) dispatchDueAgentMemoryCompacts() {
now := time.Now()
if _, err := s.repo.ExpirePendingAgentLessons("", now.Add(-cloudAgentPendingLessonTTL), now, 500); err != nil {
log.Printf("agent memory pending cleanup: %v", err)
}
rows, err := s.repo.ScheduledAgentMemorySettings(50)
if err != nil {
log.Printf("agent memory compact schedule: %v", err)
return
}
now := time.Now()
started := 0
for index := range rows {
setting := rows[index]