Skip to content

fix(recall): stabilize prompt-cache memory injection#375

Open
Ricky-7-Yan wants to merge 1 commit into
TencentCloud:mainfrom
Ricky-7-Yan:fix-issue-120-prompt-cache-recall-injection-v2
Open

fix(recall): stabilize prompt-cache memory injection#375
Ricky-7-Yan wants to merge 1 commit into
TencentCloud:mainfrom
Ricky-7-Yan:fix-issue-120-prompt-cache-recall-injection-v2

Conversation

@Ricky-7-Yan

Copy link
Copy Markdown

Description | 描述

Fixes #120.

Add explicit prompt-cache controls for TencentDB recall injection while keeping the default behavior backward compatible.

This PR keeps the TencentDB-side mitigation scoped:

  • Add recall.injectionMode with prepend as the backward-compatible default
  • Add opt-in append mode that emits dynamic L1 recall as OpenClaw appendContext
  • Add recall.showInjected so preserving <relevant-memories> in persisted history is explicit opt-in
  • Keep persisted history clean by default to avoid replaying stale dynamic recall blocks
  • Move OpenClaw recall shaping and injected-history stripping into a tested adapter helper
  • Document both options in the plugin manifest and README files

Cache impact | 缓存影响

  • Stable memory context remains in appendSystemContext
  • Dynamic L1 recall can stay out of the user prompt prefix with recall.injectionMode="append" on compatible OpenClaw hosts
  • Persisted history avoids dynamic recall growth by default with recall.showInjected=false

Related Issue | 关联 Issue

Fix #120

Change Type | 修改类型

  • Bug fix | Bug 修复
  • New feature | 新功能
  • Documentation update | 文档更新
  • Code optimization | 代码优化

Self-test Checklist | 自测清单

  • Verified locally | 本地验证通过
  • No existing features affected | 无影响现有功能

Verification | 验证

npx.cmd vitest run src/config.test.ts src/adapters/openclaw/recall-injection.test.ts
npx.cmd vitest run
npm.cmd run build
git diff --check

Results:

  • Targeted tests: 2 files / 8 tests passed
  • Full test suite: 6 files / 75 tests passed
  • Build passed
  • Whitespace check passed

@Maxwell-Code07

Copy link
Copy Markdown
Collaborator

Thank you for submitting this PR and participating in Tencent Rhino-bird Open-source Training Program!
We have successfully received your submission. The program is currently in full swing, and we will complete the Code Review for you as soon as possible. Please keep an eye on the status notifications for this PR so you can follow up promptly once the review feedback is provided.
Thanks again for your contribution and open-source spirit! 🚀

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.

prependContext + showInjected 导致 OpenAI-compatible provider 前缀缓存命中率退化 / Prompt cache hit rate regression

2 participants