Skip to content

fix(memo,context): 重构 memo 语义去重为批量决策,优化 tool content 摘要保留头尾关键信息#610

Closed
Yumiue wants to merge 2 commits intomainfrom
microcampact_fix
Closed

fix(memo,context): 重构 memo 语义去重为批量决策,优化 tool content 摘要保留头尾关键信息#610
Yumiue wants to merge 2 commits intomainfrom
microcampact_fix

Conversation

@Yumiue
Copy link
Copy Markdown
Collaborator

@Yumiue Yumiue commented May 10, 2026

Summary

  • 将 memo 自动提取的语义去重从逐条决策ResolveDecision)升级为批量决策ExtractDecisions),一次 LLM 调用同时完成提取与去重
  • 上下文投影中的 tool content 摘要策略从纯截断改为头尾保留(head-tail excerpt),避免遗漏尾部关键错误信息

Changes

memo 语义去重批量化

  • 新增 DecisionExtractor 接口,接收 existing []ExtractionCandidate 由 LLM 在一次调用中输出 create/update/skip 决策数组
  • LLMExtractor 同时实现 DecisionExtractor(主路径)和 DecisionResolver(降级路径),提示词注入既有记忆快照
  • AutoExtractor.extractAndStore 优先走 DecisionExtractor 批量路径,旧 Extractor 实现退化为逐条 ResolveDecision 以保持兼容
  • 移除已废弃的 ExtractRecentMessages 配置字段
  • 补充 TestLLMExtractorExtractDecisionsIncludesExistingCandidates 等测试

context micro compact 头尾保留

  • sanitizeProjectedToolContent / sanitizeRawToolContent 改为调用 sanitizeToolExcerpt,保留头部 300 字符 + 尾部 300 字符
  • BuildMemoExtractionMessagesForModel 排除 RoleSystem 消息,避免框架注入的元数据污染记忆提取

Test plan

  • go test ./internal/memo/... 通过
  • go test ./internal/context/... 通过
  • go test ./internal/app/... 通过
  • go build ./... 通过

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@Yumiue Yumiue closed this May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant