Skip to content

feat(recall): cap injected memory context#71

Open
YOMXXX wants to merge 3 commits into
Tencent:mainfrom
YOMXXX:feat/recall-budget
Open

feat(recall): cap injected memory context#71
YOMXXX wants to merge 3 commits into
Tencent:mainfrom
YOMXXX:feat/recall-budget

Conversation

@YOMXXX
Copy link
Copy Markdown
Contributor

@YOMXXX YOMXXX commented May 21, 2026

Summary

  • Add recall.maxCharsPerMemory and recall.maxTotalRecallChars with defaults of 800 and 3000.
  • Apply the budget after L1 search and before <relevant-memories> injection, preserving score order while truncating oversized entries and dropping overflow.
  • Document the new guards in README, README_CN, and openclaw.plugin.json.
  • Keep the npm tarball under the existing 512KB Size Guard by shipping built runtime files instead of raw src/ and pointing OpenClaw to dist/index.mjs.

Test Plan

  • npm test
  • npm run build
  • npm pack --dry-run --json
  • git diff --check

Notes

YOMXXX added 2 commits May 21, 2026 22:35
Signed-off-by: 李冠辰 <liguanchen@xiaomi.com>
Signed-off-by: 李冠辰 <liguanchen@xiaomi.com>
@Maxwell-Code07
Copy link
Copy Markdown
Collaborator

Maxwell-Code07 commented May 22, 2026

感谢您如此及时地解决了 #70 的问题!我们会内部评估,有结论后会尽快反馈。

yuanrengu added a commit to yuanrengu/TencentDB-Agent-Memory that referenced this pull request May 25, 2026
- Move preExtractMemories to newMessages only (after background/new split)
  to prevent extracting memories from background context that should
  only serve as conversational context for the LLM

- Remove MEDIUM-confidence hints logging (hints not wired to LLM prompt;
  keeping types as interface for follow-up PR)

- Remove src/ from package.json files field to fix Size Guard limit
  (matches pattern from Tencent#76 and Tencent#71)

- Export callLlmExtraction and passesConfidenceCheck for testability

- Add pre-extractor.test.ts covering:
  - Background messages not pre-extracted
  - HIGH-confidence dedup via mergeExtractedMemories
  - Malformed JSON triggers exactly one retry
  - Confidence filtering does not reject valid persona/instruction
Comment thread package.json
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DO NOT modify this file, which might cause some problems. We have increased the limitation of Size Guard from 512KB to 2048KB.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in 8031ec0: restored package.json to match upstream/main and removed the manifest / extension entry changes from this PR. Fresh checks are green, including Size Guard under the updated 2048KB limit.

@YOMXXX
Copy link
Copy Markdown
Contributor Author

YOMXXX commented May 25, 2026

Thanks for the review. I restored package.json to match upstream/main and removed the package manifest / extension entry changes from this PR.

Fresh local verification after the update:

  • npm test
  • npm run build
  • npm pack --dry-run ✅ package size 647.5 KB, below the updated 2048 KB Size Guard limit.

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.

3 participants