Skip to content

Memory Types

shared.memory_types

Typed memory — 13 categories with per-type retention/decay/boost policy.

13 types: instruction, fact, decision, goal, preference, commitment, relationship, observation, rule, todo, question, hypothesis, context.

Each type has its own: - default_importance (auto-fill on save) - decay_rate (0 = never decays) - never_archive flag - requires_expires_at flag - boost_on_keywords for retrieval

MemoryKind

Bases: str, Enum

Source code in shared/memory_types.py
class MemoryKind(str, enum.Enum):
    INSTRUCTION = "instruction"
    FACT = "fact"
    DECISION = "decision"
    GOAL = "goal"
    PREFERENCE = "preference"
    COMMITMENT = "commitment"
    RELATIONSHIP = "relationship"
    OBSERVATION = "observation"
    RULE = "rule"
    TODO = "todo"
    QUESTION = "question"
    HYPOTHESIS = "hypothesis"
    CONTEXT = "context"

get_policy

get_policy(kind)

Get policy for a kind. Unknown kinds fall back to FACT.

Source code in shared/memory_types.py
def get_policy(kind: MemoryKind | str) -> TypePolicy:
    """Get policy for a kind. Unknown kinds fall back to FACT."""
    try:
        k = MemoryKind(kind) if isinstance(kind, str) else kind
    except ValueError:
        k = MemoryKind.FACT
    return _REGISTRY[k]

kind_for_text

kind_for_text(text)

Best-effort heuristic for auto-classification. Returns FACT if nothing matches.

Source code in shared/memory_types.py
def kind_for_text(text: str) -> MemoryKind:
    """Best-effort heuristic for auto-classification. Returns FACT if nothing matches."""
    tl = text.lower()
    for kind, kws in _KEYWORD_MAP:
        if any(kw in tl for kw in kws):
            return kind
    return MemoryKind.FACT