Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:24kchengYe MemoMind Core Response Models

From Leeroopedia
Knowledge Sources
Domains Memory_System, Data_Models
Last Updated 2026-10-28 00:00 GMT

Overview

Core Pydantic response models for memory operations — defines shared data structures used across the engine, API, and reflect agent including the fact type taxonomy.

Description

The response_models.py module defines `RecallResult`, `ReflectResult`, `MemoryFact`, `TokenUsage`, `LLMToolCall`, `ToolCallTrace`, `LLMCallTrace`, `EntityObservation`, `ObservationRef`, `DirectiveRef`, `DispositionTraits`, and `VALID_RECALL_FACT_TYPES` constant (world, experience, observation). These are internal models separate from API response models for stability — the core engine uses these, and the API layer converts from them.

Usage

Import these models when working with engine-level responses, building API serializers, or the reflect agent. The fact type taxonomy (world/experience/observation) is central to the memory architecture.

Code Reference

Source Location

  • Repository: MemoMind
  • File: engine/hindsight_api/engine/response_models.py
  • Lines: L1-376

Signature

VALID_RECALL_FACT_TYPES = frozenset(["world", "experience", "observation"])

class LLMToolCall(BaseModel):
    id: str
    name: str
    arguments: dict[str, Any]

class LLMToolCallResult(BaseModel):
    content: str | None
    tool_calls: list[LLMToolCall]
    finish_reason: str | None
    input_tokens: int
    output_tokens: int

class TokenUsage(BaseModel):
    input_tokens: int
    output_tokens: int

class DispositionTraits(BaseModel):
    skepticism: int      # 1-5
    literalism: int      # 1-5
    empathy: int          # 1-5

class MemoryFact(BaseModel):
    text: str
    fact_type: str
    # ... temporal fields, metadata

class RecallResult(BaseModel): ...
class ReflectResult(BaseModel): ...

Import

from hindsight_api.engine.response_models import (
    RecallResult, ReflectResult, MemoryFact, TokenUsage,
    LLMToolCall, LLMToolCallResult, DispositionTraits,
    VALID_RECALL_FACT_TYPES,
)

I/O Contract

Outputs

Name Type Description
VALID_RECALL_FACT_TYPES frozenset {"world", "experience", "observation"}
RecallResult BaseModel Search results with facts and metadata
ReflectResult BaseModel Reflection output with observations

Usage Examples

Using Response Models

from hindsight_api.engine.response_models import (
    RecallResult, VALID_RECALL_FACT_TYPES, DispositionTraits,
)

# Check valid fact types
assert "world" in VALID_RECALL_FACT_TYPES
assert "opinion" not in VALID_RECALL_FACT_TYPES  # deprecated

# Create disposition traits
traits = DispositionTraits(skepticism=3, literalism=4, empathy=2)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment