Skip to main content

Mental Models

User-curated summaries that provide high-quality, pre-computed answers for common queries.

What Are Mental Models?

Mental models are saved reflect responses that you curate for your memory bank. When you create a mental model, Hindsight runs a reflect operation with your source query and stores the result. During future reflect calls, these pre-computed summaries are checked first — providing faster, more consistent answers.

Why Use Mental Models?

BenefitDescription
ConsistencySame answer every time for common questions
SpeedPre-computed responses are returned instantly
QualityManually curated summaries you've reviewed
ControlDefine exactly how key topics should be answered

Hierarchical Retrieval

During reflect, the agent checks sources in priority order:

  1. Mental Models — User-curated summaries (highest priority)
  2. Observations — Consolidated knowledge
  3. Raw Facts — Ground truth memories

Mental models are checked first because they represent your explicitly curated knowledge.


Create a Mental Model

Creating a mental model runs a reflect operation in the background and saves the result:

# Create a mental model (runs reflect in background)
result = client.create_mental_model(
bank_id=BANK_ID,
name="Team Communication Preferences",
source_query="How does the team prefer to communicate?",
tags=["team", "communication"]
)

# Returns an operation_id - check operations endpoint for completion
print(f"Operation ID: {result.operation_id}")

Parameters

ParameterTypeRequiredDescription
namestringYesHuman-readable name for the mental model
source_querystringYesThe query to run to generate content
tagslistNoTags for filtering during retrieval
max_tokensintNoMaximum tokens for the mental model content
triggerobjectNoTrigger settings (see Automatic Refresh)

Automatic Refresh

Mental models can be configured to automatically refresh when observations are updated. This keeps them in sync with the latest knowledge without manual intervention.

Trigger Settings

SettingTypeDefaultDescription
refresh_after_consolidationboolfalseAutomatically refresh after observations consolidation

When refresh_after_consolidation is enabled, the mental model will be re-generated every time the bank's observations are consolidated — ensuring it always reflects the latest synthesized knowledge.

# Create a mental model with automatic refresh enabled
result = client.create_mental_model(
bank_id=BANK_ID,
name="Project Status",
source_query="What is the current project status?",
trigger={"refresh_after_consolidation": True}
)

# This mental model will automatically refresh when observations are updated
print(f"Operation ID: {result.operation_id}")

When to Use Automatic Refresh

Use CaseAutomatic RefreshWhy
Real-time dashboards✅ EnabledStatus should always be current
Policy summaries❌ DisabledPolicies change infrequently, manual refresh preferred
User preferences✅ EnabledPreferences evolve with new interactions
FAQ answers❌ DisabledAnswers are curated, should be reviewed before updating
tip

Enable automatic refresh for mental models that need to stay current. Disable it for curated content where you want to review changes before they go live.


List Mental Models

# List all mental models in a bank
mental_models = client.list_mental_models(bank_id=BANK_ID)

for mental_model in mental_models.items:
print(f"- {mental_model.name}: {mental_model.source_query}")

Get a Mental Model

# Get a specific mental model
mental_model = client.get_mental_model(
bank_id=BANK_ID,
mental_model_id=mental_model_id
)

print(f"Name: {mental_model.name}")
print(f"Content: {mental_model.content}")
print(f"Last refreshed: {mental_model.last_refreshed_at}")

Response Fields

FieldTypeDescription
idstringUnique mental model ID
bank_idstringMemory bank ID
namestringHuman-readable name
source_querystringThe query used to generate content
contentstringThe generated mental model text
tagslistTags for filtering
last_refreshed_atstringWhen the mental model was last updated
created_atstringWhen the mental model was created
reflect_responseobjectFull reflect response including based_on facts

Refresh a Mental Model

Re-run the source query to update the mental model with current knowledge:

# Refresh a mental model to update with current knowledge
result = client.refresh_mental_model(
bank_id=BANK_ID,
mental_model_id=mental_model_id
)

print(f"Refresh operation ID: {result.operation_id}")

Refreshing is useful when:

  • New memories have been retained that affect the topic
  • Observations have been updated
  • You want to ensure the mental model reflects current knowledge

Update a Mental Model

Update the mental model's name:

# Update a mental model's metadata
updated = client.update_mental_model(
bank_id=BANK_ID,
mental_model_id=mental_model_id,
name="Updated Team Communication Preferences",
trigger={"refresh_after_consolidation": True} # Enable auto-refresh
)

print(f"Updated name: {updated.name}")

Delete a Mental Model

# Delete a mental model
client.delete_mental_model(
bank_id=BANK_ID,
mental_model_id=mental_model_id
)

Use Cases

Use CaseExample
FAQ AnswersPre-compute answers to common customer questions
Onboarding Summaries"What should new team members know?"
Status Reports"What's the current project status?" refreshed weekly
Policy Summaries"What are our security policies?"

Next Steps

  • Reflect — How the agentic loop uses mental models
  • Observations — How knowledge is consolidated
  • Operations — Track async mental model creation