[Bug]: short important memories may never reach long-term memory before commit in OpenClaw auto-capture flow
Bug Description
OpenViking long-term memory currently depends on session commit/extraction, which is understandable for latency/cost reasons. However, in the official OpenClaw plugin auto-capture flow, ordinary conversation content is first appended to an OV session and then auto-commit only happens when pending_tokens reaches commitTokenThreshold (default 20000).
This means many short but important user facts never enter long-term memory for a long time, even if the model replies with "I remember" / "stored" in natural conversation. From user perspective this looks like memory loss, but the extraction pipeline was never actually triggered.
This is not just a local integration mistake:
- OpenViking server memory extraction is commit-driven by design (
/sessions/{id}/commit-> background phase 2 extraction) - OpenClaw plugin afterTurn currently skips commit when pending_tokens < commitTokenThreshold
- default plugin threshold is 20000, which is too high for many real chat scenarios
Related issues suggest adjacent symptoms already exist:
- #969 OpenClaw Plugin Usage Issues Tracker
- #630 OpenClaw + OpenViking Memory Extraction Issue (0 Memories Returned)
- #1410 memories_extracted returns empty dict after extraction path runs
The main issue reported here is narrower: even before extractor quality is discussed, short important memories can stay in session indefinitely because no commit is triggered.
Steps to Reproduce
- Use OpenViking with the official OpenClaw plugin in autoCapture mode.
- Keep the default plugin configuration (commitTokenThreshold = 20000).
- Start a normal chat session and send one or several short but important memory-worthy messages, for example:
- "Remember a long-term fact: my current main project is OpenViking integration with OpenClaw"
- "My communication preference is concise and technical"
- Observe plugin behavior in afterTurn: messages are appended into the OV session.
- Check the code path / logs: commit is skipped while pending_tokens < commitTokenThreshold.
- Search long-term memory immediately or even after several short turns.
Result: the information may still exist only in session storage, not in long-term memory, because extraction has not run.
Expected Behavior
Expected behavior:
- It is reasonable that OpenViking does not run synchronous extraction on every turn.
- But explicit long-term memory intent or small important memory facts should have a timely asynchronous path to enter long-term memory.
- The system should not rely on a single very high token threshold as the only practical auto-commit trigger for ordinary chat.
- Users should not see frequent cases where the model says it has remembered something but the long-term memory pipeline was never triggered.
Actual Behavior
Actual behavior:
- Long-term memory extraction is commit-driven.
- In the OpenClaw plugin auto-capture flow, normal afterTurn processing appends messages into OV session first.
- If pending_tokens is below commitTokenThreshold, commit is skipped and extraction does not run.
- With the default threshold (20000), many realistic short sessions or short critical facts never enter long-term memory in time.
- This creates a user-visible mismatch: the conversation may imply "remembered", while persistent memory is still absent.
Relevant source references:
- openviking/session/session.py: commit_async archives immediately and runs phase 2 extraction in background
- openviking/server/routers/sessions.py: /{session_id}/commit
- extensions/openviking/context-engine.ts: afterTurn skips commit below threshold
- extensions/openviking/config.ts: DEFAULT_COMMIT_TOKEN_THRESHOLD = 20000
Minimal Reproducible Example
Error Logs
OpenViking Version
0.3.10.dev11
Python Version
3.11
Operating System
Windows
Model Backend
None
Additional Context
Minimal example:
- Start OpenClaw with the official OpenViking plugin defaults.
- Ensure autoCapture=true and commitTokenThreshold=20000.
- Send one short explicit memory-worthy fact in a fresh session.
- Observe that afterTurn appends the message into OV session but does not commit because pending_tokens is still below threshold.
- Query long-term memory immediately: nothing is available yet because extraction never ran.
This reproduces the design gap without requiring extractor failure.
We worked around this on the integration side with an explicit memory skill.
Instead of relying only on auto-capture + delayed commit/extraction, explicit user intents such as:
- "remember this long-term fact"
- "write this into long-term memory"
are routed to a dedicated memory skill that:
- classifies the memory type,
- writes it through a stable path,
- verifies the write result immediately.
This does not replace fixing the upstream design gap, but it makes important long-term memories reliable in practice.
From our investigation, the key problem is not only extractor failure. With the official OpenClaw plugin defaults, ordinary chat messages can stay in session for a long time without entering long-term memory, because extraction only runs after commit, and auto-commit is gated by a high token threshold.
This means an explicit memory-worthy fact can be acknowledged by the model but still remain unavailable in long-term memory if commit has not happened yet.
Related upstream signals:
- #969 OpenClaw Plugin Usage Issues Tracker
- #630 OpenClaw + OpenViking Memory Extraction Issue (0 Memories Returned)
- #1410 Memory extraction LLM executes successfully but memories_extracted returns empty dict
Reference implementation: https://github.com/EasionF/openviking-agent-skills
Looking into the memory commit flow — I want to trace where short important memories are buffered versus persisted to long-term storage before commit finalization.
I've been looking into this — I want to trace the auto-capture path and see why short important memories can miss long-term persistence before commit. Happy to send a fix.
💡 推荐一个相关的开源项目:CausaMem — 永久性记忆,因果记忆系统
https://github.com/MaiHHConnect/MHH-Causality-Memory
- 让 AI Agent 记住 200 万字符
- 13 维因果推理(前因后果自动推断)
- 四层结构 + Wiki 人类可读
- 双引擎搜索(向量 + FTS5 + 因果链)
- 情绪追踪(10 种状态)
或许可以作为参考 🌟
Closing this as not planned / by design for the remaining auto-capture behavior.
#2775 has mitigated the original fixed-threshold problem by switching OpenClaw auto-commit from a hard commitTokenThreshold=20000 style threshold to commitTokenThresholdRatio, so integrations can tune when normal afterTurn auto-capture commits.
For explicit durable-memory intent such as “remember/save/store this long-term fact”, the supported reliable path is now memory_store, which writes the fact and triggers commit(wait=true) instead of waiting for best-effort auto-capture.
The ordinary afterTurn auto-capture path remains batching/threshold based and does not guarantee immediate long-term-memory extraction for every short turn. That behavior is intentional for cost/latency reasons; use memory_store or a lower/zero commit ratio when immediate extraction is required.