Problem Description
When a new OpenClaw session starts, the memos-local-openclaw-plugin's auto-recall mechanism (before_agent_start hook) injects relevant memories from all historical sessions into the agent's context via memory_search. This causes the agent to:
- Act unprompted — sees historical context (e.g., a cron job misconfiguration from a previous session) and takes action without the user's first instruction
- Mix up session contexts — references facts from other sessions as if they were from the current session
- Give contextually inappropriate responses — starts a conversation with information the user never provided in this session
Specific example
- User starts a new session and says nothing yet
- Auto-recall fires, finds a chunk from a different session (task_id A) about "a-stock-trader-pro投递配置问题"
- Agent sees this as relevant, and without being asked, reports the cron configuration issue and asks the user to confirm
- User is confused — they haven't said anything, yet the agent is already responding to something from an old conversation
This violates the expected turn-taking behavior: the user's first message should trigger the agent's action, not the memory system's auto-injection.
Expected Behavior
In a new session where the user has not yet spoken:
- Auto-recall may run, but the agent should treat injected memories as background knowledge only
- The agent should not proactively act, query, or reply based solely on auto-recalled memories
- The agent should wait for the user's first instruction before taking any action
- If the agent needs to reference a recalled memory, it should explicitly note the source (e.g., "根据之前的会话...")
Root Cause Analysis
The issue stems from how auto-recall is integrated into the agent loop:
- The
before_agent_start hook runs memory_search with the user's message and injects results into the agent's context
- When the user hasn't said anything in a new session, the "user's message" may be empty or a system greeting
- Auto-recall still returns historical chunks that are topically relevant from other sessions
- The agent's system prompt does not have a clear instruction to only use recalled memories passively (as background) and not act on them without user prompting
Proposed Solutions (Pick One or Combine)
Option A: Session-level memory scope (recommended)
Add a session-aware flag to auto-recall. When a session is freshly started (first user message in a new session), auto-recall results should be tagged as "background only". The agent's system prompt should include:
If injected memories are from a previous session, treat them as background knowledge only. Do not act on them unprompted. Wait for the user's first instruction.
Option B: Suppress auto-recall on empty/first-turn messages
If the user's message is empty (new session, no user input yet), skip auto-recall injection entirely, or inject with a special marker that tells the agent "these memories are from previous sessions — do not act on them."
Option C: Agent instruction in system prompt
Add a clear instruction to the agent's system context when memories are injected:
[memory_search results from auto-recall — these are from PREVIOUS sessions.
Treat as background knowledge only. Do not proactively act or reply.
Wait for the user to send a message before taking any action.]
Environment
- Plugin:
@memtensor/memos-local-openclaw-plugin v1.0.9
- OpenClaw: (latest)
- Node.js: >=22
- OS: macOS
Additional Context
This issue is particularly problematic because:
- Users expect a fresh session to start with a clean slate until they speak
- The agent appears to "know things unprompted" which breaks the conversational flow
- It makes the agent seem like it's "jumping ahead" or "not listening" to the current user
- Cross-session memory should enhance future conversations, not trigger unprompted actions in new ones
Relevant code area: before_agent_start hook + auto-recall injection logic in index.ts / plugin-impl.ts.
Severity: Medium — degrades user experience and trust in the memory system, but does not cause data loss or system failure.
Problem Description
When a new OpenClaw session starts, the memos-local-openclaw-plugin's auto-recall mechanism (
before_agent_starthook) injects relevant memories from all historical sessions into the agent's context viamemory_search. This causes the agent to:Specific example
This violates the expected turn-taking behavior: the user's first message should trigger the agent's action, not the memory system's auto-injection.
Expected Behavior
In a new session where the user has not yet spoken:
Root Cause Analysis
The issue stems from how auto-recall is integrated into the agent loop:
before_agent_starthook runsmemory_searchwith the user's message and injects results into the agent's contextProposed Solutions (Pick One or Combine)
Option A: Session-level memory scope (recommended)
Add a session-aware flag to auto-recall. When a session is freshly started (first user message in a new session), auto-recall results should be tagged as "background only". The agent's system prompt should include:
Option B: Suppress auto-recall on empty/first-turn messages
If the user's message is empty (new session, no user input yet), skip auto-recall injection entirely, or inject with a special marker that tells the agent "these memories are from previous sessions — do not act on them."
Option C: Agent instruction in system prompt
Add a clear instruction to the agent's system context when memories are injected:
Environment
@memtensor/memos-local-openclaw-pluginv1.0.9Additional Context
This issue is particularly problematic because:
Relevant code area:
before_agent_starthook + auto-recall injection logic inindex.ts/plugin-impl.ts.Severity: Medium — degrades user experience and trust in the memory system, but does not cause data loss or system failure.