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:
- Enable both episodic and semantic memory.
- Call
add_memory repeatedly for the same user/project, passing full
conversation context each time.
- Wait for semantic ingestion to run.
- 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
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
Memchineto ask around 40 questions over a small knowledgeset: 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:<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_memoryprocessing, not normal user-facing QA.Steps to reproduce
Possible minimal reproduction path:
add_memoryrepeatedly for the same user/project, passing fullconversation context each time.
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:
Environment
MemMachine commit: af5a1a3
Additional context
one LLM call.txt