Skip to main content

Reflect: Agentic Reasoning with Disposition

When you call reflect(), Hindsight runs an agentic loop that autonomously gathers evidence and reasons through the lens of the bank's disposition to generate contextual responses.


How It Works

Unlike simple retrieval, reflect is an agentic system that:

  1. Autonomously gathers evidence — The agent decides what information it needs and calls appropriate tools
  2. Uses hierarchical retrieval — Checks mental models first, then observations, then raw facts
  3. Applies disposition — Shapes reasoning based on the bank's personality traits
  4. Enforces directives — Hard rules that must be followed in all responses
  5. Cites sources — Returns which memories and observations were used

The Agentic Loop

The reflect agent runs in a loop with access to these tools:

ToolPurposePriority
search_mental_modelsUser-curated summariesHighest (check first)
search_observationsConsolidated knowledgeHigh
recallRaw facts (ground truth)Fallback
expandGet more context for a memoryAs needed
doneComplete with final answerWhen ready

The agent:

  • Must gather evidence before answering (guardrail prevents empty responses)
  • Runs up to 10 iterations to find relevant information
  • Validates citations — only IDs that were actually retrieved can be cited

Hierarchical Retrieval Strategy

The agent uses a smart retrieval hierarchy:

  1. Mental Models — User-curated summaries you've pre-computed for common queries
  2. Observations — Consolidated knowledge with freshness awareness
  3. Raw Facts — Ground truth for verification when observations are stale

Mental models are saved reflect responses that you create for frequently asked questions. They're checked first because they represent explicitly curated knowledge. See the Mental Models API for how to create and manage them.

If an observation is marked as stale, the agent automatically verifies it against current facts.


Why Reflect?

Most AI systems can retrieve facts, but they can't reason about them in a consistent way.

The Problem

Without reflect:

  • No consistent character: Same question gets different answers each time
  • No knowledge synthesis: System never connects related facts
  • No reasoning context: Responses don't reflect accumulated knowledge
  • Generic responses: Every AI sounds the same

The Value

With reflect:

  • Consistent character: A "detail-oriented, cautious" bank emphasizes risks and thorough planning
  • Evolving knowledge: Observations strengthen and adapt as evidence accumulates
  • Contextual reasoning: "Based on what I know about your team's remote work success..."
  • Differentiated behavior: Support bots sound diplomatic, code reviewers sound direct

When to Use Reflect

Use recall() when...Use reflect() when...
You need raw factsYou need reasoned interpretation
You're building your own reasoningYou want disposition-consistent responses
You need maximum controlYou want the bank to "think" for itself
Simple fact lookupForming recommendations

Example:

  • recall("Alice") → Returns all Alice facts and relevant mental models
  • reflect("Should we hire Alice?") → Agent gathers evidence about Alice, reasons about fit, returns answer with citations

Disposition Traits

When you create a memory bank, you can configure its disposition using three traits. These traits influence how the bank interprets information and reasons during reflect():

TraitScaleLow (1)High (5)
Skepticism1-5Trusting, accepts information at face valueSkeptical, questions and doubts claims
Literalism1-5Flexible interpretation, reads between the linesLiteral interpretation, takes things at face value
Empathy1-5Detached, focuses on factsEmpathetic, considers emotional context

Mission: Natural Language Identity

Beyond numeric traits, you can provide a natural language mission that describes the bank's identity and reasoning context:

client.create_bank(bank_id="architect-bank")
client.update_bank_config(
"architect-bank",
reflect_mission="You're a senior software architect - keep track of system designs, "
"technology decisions, and architectural patterns. Prefer simplicity over cutting-edge.",
disposition_skepticism=4, # Questions new technologies
disposition_literalism=4, # Focuses on concrete specs
disposition_empathy=2, # Prioritizes technical facts
)

The reflect mission frames how the agent reasons and responds:

  • Provides identity context: who the agent is and what it cares about
  • Shapes how disposition traits are applied in practice
  • Keeps reasoning consistent across conversations
Per-operation missions

The reflect mission only affects reflect(). To steer what gets extracted during retain(), use retain_mission. To control what gets synthesised into observations, use observations_mission.


Disposition Shapes Reasoning

Two banks with different dispositions, given identical facts about remote work:

Bank A (low skepticism, high empathy):

"Remote work enables flexibility and work-life balance. The team seems happier and more productive when they can choose their environment."

Bank B (high skepticism, low empathy):

"Remote work claims need verification. What are the actual productivity metrics? The anecdotal benefits may not translate to measurable outcomes."

Same facts → Different conclusions because disposition shapes interpretation.


Disposition Presets by Use Case

Different use cases benefit from different disposition configurations:

Use CaseRecommended TraitsWhy
Customer Supportskepticism: 2, literalism: 2, empathy: 5Trusting, flexible, understanding
Code Reviewskepticism: 4, literalism: 5, empathy: 2Questions assumptions, precise, direct
Legal Analysisskepticism: 5, literalism: 5, empathy: 2Highly skeptical, exact interpretation
Therapist/Coachskepticism: 2, literalism: 2, empathy: 5Supportive, reads between lines
Research Assistantskepticism: 4, literalism: 3, empathy: 3Questions claims, balanced interpretation

Directives: Hard Rules

While disposition traits influence reasoning style, directives are hard rules that the agent must follow. Directives are injected into the prompt and enforced in every response.

When to Use Directives

Use directives for constraints that must never be violated:

  • Compliance rules: "Never recommend specific stocks or financial products"
  • Privacy constraints: "Never share personal data with third parties"
  • Style requirements: "Always respond in formal English"
  • Domain guardrails: "Always cite sources when making factual claims"

Directives vs Disposition

AspectDispositionDirectives
NatureSoft influenceHard rules
EffectShapes interpretation and toneMust be followed exactly
ViolationAcceptable (it's a tendency)Not acceptable
ExampleHigh skepticism → questions claims"Never make medical diagnoses"
tip

Use disposition for personality and character. Use directives for compliance and guardrails.

See Memory Banks: Directives for how to create and manage directives.


What You Get from Reflect

When you call reflect():

Returns:

  • Response text — Disposition-influenced answer from the agent
  • based_on — Evidence used: memories, mental models, and directives that grounded the response
  • trace — Tool calls, LLM calls, and observations accessed (when include.tool_calls=True)
  • structured_output — Parsed response if response_schema was provided
  • usage — Token usage metrics

Example:

{
"text": "Based on Alice's ML expertise and her work at Google, she'd be an excellent fit for the research team lead position...",
"based_on": {
"memories": [
{"id": "mem-123", "text": "Alice has 5 years of ML experience", "type": "world"},
{"id": "mem-456", "text": "Alice worked at Google on search ranking", "type": "experience"}
],
"mental_models": [],
"directives": [
{"id": "dir-001", "name": "Formal Language", "rules": ["Always respond in formal English"]}
]
},
"usage": {"input_tokens": 1500, "output_tokens": 500, "total_tokens": 2000}
}

The agent automatically gathers evidence, validates citations, and generates a grounded response.


Why Disposition Matters

Without disposition, all AI assistants sound the same. With disposition:

  • Customer support bots can be diplomatic and empathetic
  • Code review assistants can be direct and thorough
  • Creative assistants can be open to unconventional ideas
  • Risk analysts can be appropriately cautious

Disposition creates consistent character across conversations while observations evolve with evidence.


Next Steps