How the Proactive Memory Lifecycle Extracts User Intent Without Explicit Commands in memU

The proactive memory lifecycle in memU uses a route_intention configuration flag to bypass explicit retrieval confirmation while employing LLM-driven sufficiency prompts to scan conversations for implicit intent signals, automatically extracting and recording user goals even when no "remember this" command is issued.

The proactive memory mode in NevaMind-AI/memU enables continuous monitoring of conversations to infer hidden user intent without requiring explicit commands. Unlike reactive systems that wait for direct "remember this" instructions, this proactive memory lifecycle analyzes dialogue context through specialized retrieval configurations and LLM-driven sufficiency checks. By combining workflow automation with intent-aware prompts located in the prompt templates, memU silently captures task plans, habits, and preferences as they emerge naturally in conversation.

Core Components of the Proactive Memory System

Three primary components work together to enable implicit intent extraction: a configuration flag that disables explicit routing checks, a workflow step that forces retrieval eligibility, and prompt templates that instruct the LLM to detect unspoken intent.

RetrieveConfig.route_intention Flag

The RetrieveConfig.route_intention boolean flag controls whether the system performs an explicit "do you need retrieval?" check before proceeding. When set to False in src/memu/app/settings.py (lines 90-92), the engine skips the separate intention-routing prompt and proceeds directly to the next retrieval stage. However, the underlying LLM still evaluates the query for implicit intent during subsequent sufficiency checks.


# From src/memu/app/settings.py (lines 90-92)

class RetrieveConfig(BaseModel):
    route_intention: bool = True  # Set to False for proactive mode

    # ... other fields

RetrieveMixin._rag_route_intention Workflow Step

The RetrieveMixin._rag_route_intention method in src/memu/app/retrieve.py (lines 28-38) implements the workflow step that normally decides whether a query requires retrieval. When route_intention is False, this method short-circuits: it copies the original query to rewritten_query, marks needs_retrieval=True, and allows later stages (category, item, and resource retrieval) to run automatically without user confirmation.


# Conceptual flow from src/memu/app/retrieve.py (lines 28-38)

def _rag_route_intention(self, state):
    if not self.config.route_intention:
        # Proactive mode: force retrieval and preserve original query

        state.rewritten_query = state.original_query
        state.needs_retrieval = True
        return state
    # ... standard intention routing logic

Proactive Intent Prompt Templates

The sufficiency check prompts embedded in src/memu/prompts/memory_type/profile.py (line 88) and related files contain explicit "proactive intent" rules. These prompts instruct the LLM to extract content only when the user shows strong proactive intent, effectively training the model to recognize signals like "I'll do X" or "let's plan Y" even without explicit memory commands. The methods _rag_category_sufficiency and _rag_item_sufficiency invoke these prompts to evaluate whether the current context satisfies the user's underlying goals.

Step-by-Step Intent Extraction Workflow

The proactive memory lifecycle follows a continuous monitoring loop that transforms conversational turns into structured memory entries:

  1. Conversation Initiation: The user sends a message turn to MemoryUser.retrieve, which receives a list of query objects representing the dialogue history.

  2. Workflow Activation: RetrieveMixin.retrieve builds a workflow state and selects the retrieve_rag workflow name.

  3. Intention Routing Bypass: The first step executes _rag_route_intention. Because route_intention=False in proactive configurations, the method short-circuits (as implemented in src/memu/app/retrieve.py lines 28-38) and forces needs_retrieval=True while keeping the original query untouched.

  4. LLM Sufficiency Evaluation: The workflow proceeds to category and item steps. The LLM sufficiency checks (_rag_category_sufficiency and _rag_item_sufficiency) call the LLM with prompts containing the rule "Do not extract content … unless the user shows strong proactive intent." This forces the model to scan the user-assistant dialogue for implicit intent signals.

  5. Query Rewriting and Retrieval: When the LLM judges that the current context is insufficient, it rewrites the query (for example, extracting "what the user asked the agent to do") and the retrieval continues, pulling relevant memory items via _rag_build_context.

  6. Automatic Memory Assembly: The final response assembles extracted records without the user ever issuing a direct "remember" command, enabling features like automatic task-tracking or "memory-of-the-day" summaries.

Implementing Proactive Memory Extraction

To enable the proactive memory lifecycle, configure a MemoryUser instance with route_intention disabled and sufficiency checks enabled. The following example from examples/proactive/memory/config.py (lines 52-56) demonstrates this configuration:

from memu import MemoryUser

# Configuration for proactive mode

retrieve_cfg = {
    "method": "rag",
    "route_intention": False,   # Disables explicit "need retrieval?" check

    "sufficiency_check": False,
    "item": {"enabled": True, "top_k": 10},
}

memory_user = MemoryUser(
    retrieve_config=retrieve_cfg,
    memorize_config={},  # Standard memorization configuration

)

# Conversation without explicit "remember this" commands

chat = [
    {"role": "user", "content": "I need to set up a CI pipeline for my project."},
    {"role": "assistant", "content": "Sure, we can start with a GitHub Actions workflow."},
    {"role": "user", "content": "Also, I want to add automated tests for the API."},
]

# Retrieve monitors turns and extracts intent automatically

result = await memory_user.retrieve(chat)
print(result["memories"])  

# Output contains items like "User wants CI pipeline" and "User wants automated tests"

Why It Works Without Explicit Commands

The proactive memory lifecycle eliminates the need for explicit "remember this" commands through three architectural mechanisms:

  • Configuration-Driven Bypass: Setting route_intention=False in src/memu/app/settings.py tells the engine to always treat the query as needing retrieval, removing the friction of a separate intention prompt while maintaining evaluation accuracy.

  • LLM-Driven Intent Detection: The sufficiency-check prompts in src/memu/prompts/memory_type/profile.py embed proactive-intent rules that train the model to recognize implicit signals such as future plans, commitments, or preferences stated in natural dialogue.

  • Reference-Aware Retrieval: When item-level sufficiency checks fail, the engine follows [ref:ITEM_ID] citations (enabled via RetrieveItemConfig.use_category_references) to pull related memories that contextualize the user's unstated needs.

Summary

  • The proactive memory lifecycle in memU monitors conversations continuously without requiring explicit "remember" commands.
  • Setting route_intention=False in RetrieveConfig bypasses the explicit retrieval confirmation step, forcing needs_retrieval=True automatically.
  • The _rag_route_intention method in src/memu/app/retrieve.py (lines 28-38) implements this short-circuit logic.
  • LLM sufficiency checks (_rag_category_sufficiency, _rag_item_sufficiency) use prompts from src/memu/prompts/memory_type/ to detect implicit intent signals in dialogue.
  • The system extracts and records user goals automatically, enabling proactive features like task tracking and habit monitoring.

Frequently Asked Questions

What is the difference between proactive and reactive memory modes in memU?

Reactive mode requires explicit commands such as "remember this" or "save that" to trigger memory storage, while proactive mode uses the route_intention=False configuration to continuously monitor conversations. In proactive mode, the LLM evaluates every turn for implicit intent through sufficiency checks, extracting goals and plans without explicit user instructions.

How does the route_intention flag affect the retrieval workflow?

When route_intention is set to False in src/memu/app/settings.py, the _rag_route_intention method in src/memu/app/retrieve.py skips the standard "do you need retrieval?" evaluation. Instead, it immediately sets needs_retrieval=True and preserves the original query, allowing the category and item retrieval stages to execute automatically while the LLM still evaluates intent during sufficiency checks.

Which prompt files contain the proactive intent extraction rules?

The proactive intent rules reside in the memory type prompt files, specifically src/memu/prompts/memory_type/profile.py (line 88) and related sufficiency check templates. These prompts instruct the LLM to extract content only when detecting "strong proactive intent" in the conversation, effectively defining the criteria for implicit goal recognition.

Can the proactive lifecycle capture intent from multi-turn conversations?

Yes, the proactive lifecycle processes entire conversation histories passed to MemoryUser.retrieve. The _rag_build_context method assembles context across multiple turns, while the sufficiency checks evaluate the cumulative dialogue. When combined with reference tracking via RetrieveItemConfig.use_category_references, the system can connect current statements to previously mentioned topics, extracting complex intents that develop over extended interactions.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →