Memory Schema Models (schemas/memory.py)

MIRIX · ai, AI / Agents, memory, schema, pydantic, context, archival

Schemas for various memory structures, context window overview, and archival/recall memory handling in Mirix.

# Source: https://github.com/mperkins0155/MIRIX | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
from typing import TYPE_CHECKING, List, Optional

from jinja2 import Environment, Template, TemplateSyntaxError
from pydantic import BaseModel, Field

# Forward referencing to avoid circular import with Agent -> Memory -> Agent
if TYPE_CHECKING:
    from mirix.schemas.agent import AgentState

from mirix.constants import CORE_MEMORY_BLOCK_CHAR_LIMIT
from mirix.schemas.block import Block
from mirix.schemas.message import Message
from mirix.schemas.openai.chat_completion_request import Tool
from mirix.schemas.user import User as PydanticUser


class ContextWindowOverview(BaseModel):
    """

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key