High-level memory facade for AI agents.

Wraps either ICognitiveMemoryManager or the standalone Memory facade with a simple API that hides PAD mood models, HEXACO traits, SQLite storage details, and internal architecture.

Accessors

  • get rawMemory(): undefined | StandaloneMemoryBackend
  • Access the underlying standalone Memory facade for advanced usage.

    Returns undefined | StandaloneMemoryBackend

Constructors

Methods

  • Initialize the cognitive-manager path. Only needed when constructing the legacy cognitive backend directly (not via AgentMemory.wrap() or AgentMemory.sqlite()).

    Parameters

    Returns Promise<void>

  • Store information in long-term memory.

    Parameters

    • content: string
    • Optional options: {
          type?: MemoryType;
          scope?: MemoryScope;
          scopeId?: string;
          sourceType?: MemorySourceType;
          tags?: string[];
          entities?: string[];
          importance?: number;
          currentMood?: PADState;
          contentSentiment?: number;
          perspectiveSource?: {
              eventId: string;
              eventHash: string;
          };
      }
      • Optional type?: MemoryType
      • Optional scope?: MemoryScope
      • Optional scopeId?: string
      • Optional sourceType?: MemorySourceType
      • Optional tags?: string[]
      • Optional entities?: string[]
      • Optional importance?: number
      • Optional currentMood?: PADState

        Live PAD mood for mood-congruent encoding. Omitted → neutral (no bias).

      • Optional contentSentiment?: number

        Content sentiment for the emotional-context tag. Omitted → falls back to importance (today's behavior).

      • Optional perspectiveSource?: {
            eventId: string;
            eventHash: string;
        }

        Set when encoding a subjective trace produced by PerspectiveObserver (@framers/agentos/memory/pipeline/observation/PerspectiveObserver). When this memory wraps a cognitive memory manager, the manager writes the source event's identifier and hash into the trace's MechanismMetadata and marks the trace perspective-encoded, so Reconsolidation halves its drift rate. A memory that wraps the standalone Memory facade ignores it.

        • eventId: string
        • eventHash: string

    Returns Promise<RememberResult>

    Example

    await memory.remember("User prefers dark mode");
    await memory.remember("Deploy by Friday", { type: 'prospective', tags: ['deadline'] });
  • Feed a conversation turn to the observational memory system. The Observer creates dense notes when the token threshold is reached.

    Parameters

    • role: "user" | "assistant" | "system" | "tool"
    • content: string
    • Optional options: {
          currentMood?: PADState;
          contentSentiment?: number;
      }
      • Optional currentMood?: PADState
      • Optional contentSentiment?: number

    Returns Promise<null | ObservationNote[]>

    Example

    await memory.observe('user', "Can you help me debug this?");
    await memory.observe('assistant', "Sure! The issue is in your useEffect...");
  • Record used/ignored retrieval feedback. Available only when backed by the standalone SQLite-first Memory facade.

    Parameters

    • traceId: string
    • signal: "used" | "ignored"
    • Optional query: string

    Returns void

  • Get a serializable snapshot of the memory graph for visualization. Returns nodes (traces), edges (associations), clusters, and aggregate stats.

    Returns Promise<MemoryGraphSnapshot>

    Graph snapshot suitable for JSON serialization

    Throws

    When backed by standalone SQLite (requires CognitiveMemoryManager)

  • Get spreading activation results from seed memories. Returns memories that are associatively connected to the seeds.

    Parameters

    • seedTraceIds: string[]

      IDs of seed traces to activate from

    • Optional opts: {
          maxDepth?: number;
          limit?: number;
      }

      Optional depth and limit controls

      • Optional maxDepth?: number
      • Optional limit?: number

    Returns Promise<{
        memoryId: string;
        activation: number;
    }[]>

    Throws

    When backed by standalone SQLite

  • Get all traces filtered by memory type.

    Parameters

    • type: MemoryType

      Memory type to filter by (episodic, semantic, procedural, prospective, relational)

    • Optional opts: {
          limit?: number;
          minStrength?: number;
      }

      Optional limit and minimum strength filter

      • Optional limit?: number
      • Optional minStrength?: number

    Returns Promise<ScoredMemoryTrace[]>

    Throws

    When backed by standalone SQLite

  • Get memory strength distribution by type. Returns count, average strength, decaying count, and flashbulb count per type.

    Returns Promise<Record<MemoryType, MemoryTypeStats>>

    Throws

    When backed by standalone SQLite

  • Get pairs of contradicting memory traces.

    Returns Promise<{
        traceA: string;
        traceB: string;
        type: string;
    }[]>

    Throws

    When backed by standalone SQLite

  • Get clusters of strongly associated memories.

    Parameters

    • Optional minSize: number

      Minimum cluster size (default 3)

    Returns Promise<{
        clusterId: string;
        memberIds: string[];
        density: number;
    }[]>

    Throws

    When backed by standalone SQLite

  • Get observation pipeline stats (pending notes, compression ratio, reflection count).

    Returns Promise<ObservationPipelineStats>

    Throws

    When backed by standalone SQLite

  • Force a reflection cycle (useful for testing / devtools). Triggers the Observer's note extraction and the Reflector's consolidation regardless of token thresholds.

    Returns Promise<{
        traces: number;
        superseded: number;
    }>

    Reflection result with typed traces, or empty result if no observer

    Throws

    When backed by standalone SQLite

  • Export full memory state as a serializable snapshot. Used for companion portability across worlds in wilds-ai.

    Returns Promise<CognitiveMemorySnapshot>

    Throws

    When backed by standalone SQLite

  • Import a memory snapshot (for character portability across worlds). Encodes each trace and registers prospective items.

    Parameters

    • snapshot: CognitiveMemorySnapshot

      Previously exported snapshot

    Returns Promise<{
        imported: number;
        conflicts: number;
    }>

    Count of imported traces and conflicts detected

    Throws

    When backed by standalone SQLite