-
Notifications
You must be signed in to change notification settings - Fork 399
MCP retain lacks agent_name parameter — experience fact_type classification unreachable #823
Description
Summary
The experience fact_type fix from #775 (commit 00961156) is unreachable via MCP retain. The extraction pipeline classifies first-person content as experience only when agent_name is passed to extract_facts_from_text(), but the MCP retain tool has no way to pass this parameter. All MCP retains are treated as user-narrated, so first-person agent experiences still get classified as world/observation.
Evidence
Retained via MCP retain on 0.4.22 (1f03f436):
Content: "I discovered a race condition in Hindsight MCP session handling
during container restart. The MCP client held a stale session ID that the
new container didn't recognize... I fixed it by catching the error and
reconnecting via ToolSearch..."
Result:
fact_type: observation — "The user discovered a race condition..."
fact_type: world — "User learned that stateful MCP connections..."
fact_type: world — "User fixed the race condition..."
Note the content says "I" but the extracted facts say "the user" / "User" — the extraction pipeline doesn't know an AI agent is speaking.
Meanwhile, the tests in test_fact_extraction_agent_experience.py all pass agent_name="coding-agent" to extract_facts_from_text(), which is what triggers the correct classification.
Root Cause
The MCP retain tool accepts content, context, tags, metadata, etc. — but no agent_name or speaker field. Without this, the extraction prompt has no signal that the narrator is an AI agent, so it defaults to treating the content as user-narrated and classifies actions as world/observation about "the user."
Suggested Fix
Add an optional agent_name (or speaker/narrator) parameter to the MCP retain tool. When set, pass it through to extract_facts_from_text() so the experience classification logic from #775 activates.
This would make the fix accessible to any MCP client where an AI agent retains its own experiences — which is arguably the primary use case for experience classification.
Environment
- Image:
ghcr.io/vectorize-io/hindsight:latest(sha256:1f03f436, 0.4.22) - LLM: Groq
openai/gpt-oss-20b - Client: Claude Code via MCP (stdio transport)