Skip to content

[Bug]: Excessive background semantic/profile memory LLM calls #1453

Description

@wenhaocs

Describe the bug

MemMachine appears to trigger an unexpectedly large number of LLM calls for
semantic/profile memory ingestion after a relatively small amount of user
activity.

I used our internal product which integrates Memchine to ask around 40 questions over a small knowledge
set: 4 PDF files, each under 80 pages. I did not start any other jobs or run any
batch ingestion manually.

However, starting around midnight and continuing into the evening, the system
kept calling the LLM in the background and generated about $200 in model
costs.

A captured single LLM request shows that the call was not answering my PDF
question directly. It was a MemMachine profile/semantic memory extraction cal:

  • system prompt: "Your job is to handle memory extraction for a memory system..."
  • user prompt includes:
    • <OLD_PROFILE>{}</OLD_PROFILE>
    • <HISTORY>...previous assistant answer about Apple's gross margin...</HISTORY>

So the unexpected cost seems related to background semantic/profile memory
ingestion or repeated add_memory processing, not normal user-facing QA.

Steps to reproduce

Possible minimal reproduction path:

  1. Enable both episodic and semantic memory.
  2. Call add_memory repeatedly for the same user/project, passing full
    conversation context each time.
  3. Wait for semantic ingestion to run.
  4. Observe whether MemMachine repeatedly sends profile extraction prompts to the
    LLM even when there is no new user activity.

Expected behavior

After the pending memory ingestion backlog is processed, MemMachine should stop
calling the LLM while idle.

LLM calls for profile/semantic memory extraction should be bounded and
predictable. For a small document set and around 40 user questions, background
memory processing should not continue for many hours or generate very high
model costs.

Ideally MemMachine should also provide safeguards such as:

  • max background ingestion calls per project/user per time window
  • deduplication/idempotency for already-ingested messages
  • an option to disable automatic semantic/profile ingestion from MCP
  • cost/concurrency limits for background ingestion

Environment

MemMachine commit: af5a1a3

Additional context

one LLM call.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions