graph-memory icon indicating copy to clipboard operation
graph-memory copied to clipboard

Optimize LLM call volume with gated batched extraction

Open zhuyankarl opened this issue 7 months ago • 0 comments

SummaryThis PR adds call-count control for graph-memory's LLM-backed extraction/summary flow, aimed at reducing unnecessary LLM calls while keeping high-signal memory updates timely.Key changes:- Add an extraction gate that skips trivial acknowledgements and immediately extracts high-signal turns such as errors, user corrections, and explicit completion messages.- Add debounce, max-batch, interval flush, and session_end forced flush behavior for normal extraction batches.- Add a monthly virtual LLM call budget with dynamic daily allowance based on remaining calls and remaining days in the month.- Expose the new controls in openclaw.plugin.json and document them in README / README_CN.- Keep token limits optional; defaults focus on call-count control.- Add tests for extraction gating and monthly budget behavior.## ContextIn OpenClaw/CodePlan-style usage, memory extraction can otherwise run once per turn, which makes call count grow very quickly during active coding sessions. The new default flow is:- error / user correction / explicit completion: extract immediately- normal messages: debounce first- extractMaxBatchMessages: force extract- extractFlushIntervalMs: fallback flush- session_end: force flush pending messagesThis branch also includes the preceding session-end/community-maintenance improvements because the call-control patch builds on those touched areas and applying only the latest commit conflicts with current upstream main.## Validation- openclaw.plugin.json parsed successfully- npm test -> 91 tests passed- npm run build -> passed

Follow-up Validation Plan

We are also running this patch locally in an OpenClaw/CodePlan setup for a longer real-world validation window. After collecting enough usage data, we plan to follow up with before/after call-volume comparisons and any tuning changes needed based on actual deployment behavior.

zhuyankarl avatar Apr 25 '26 07:04 zhuyankarl