Class ConsolidationLoop

Self-improving background consolidation loop with 6 ordered steps: prune, merge, strengthen, derive, compact, re-index.

All database operations use the async StorageAdapter API through the shared SqliteBrain connection. The run() method is async to accommodate both the database calls and the LLM-backed derive step.

Accessors

Constructors

Methods

Accessors

Constructors

  • Parameters

    • brain: SqliteBrain

      The agent's SQLite brain database connection.

    • memoryGraph: IMemoryGraph

      The memory association graph for co-activation and clustering.

    • Optional options: {
          llmInvoker?: ((prompt) => Promise<string>);
          embedFn?: ((texts) => Promise<number[][]>);
          personalityMutationStore?: PersonalityMutationStore;
          personalityDecayRate?: number;
      }

      Optional LLM invoker, embedding function, and personality mutation store for derive, merge, and decay steps respectively.

      • Optional llmInvoker?: ((prompt) => Promise<string>)

        LLM function for deriving insights from memory clusters.

          • (prompt): Promise<string>
          • Parameters

            • prompt: string

            Returns Promise<string>

      • Optional embedFn?: ((texts) => Promise<number[][]>)

        Embedding function for computing trace similarity.

          • (texts): Promise<number[][]>
          • Parameters

            • texts: string[]

            Returns Promise<number[][]>

      • Optional personalityMutationStore?: PersonalityMutationStore

        Optional personality mutation store for Ebbinghaus-style decay.

        When provided, each consolidation cycle decays all active personality mutations and prunes those whose strength falls below the threshold.

      • Optional personalityDecayRate?: number

        Decay rate subtracted from each personality mutation's strength per cycle. Mutations at or below 0.1 after decay are pruned.

        Default

        0.05
        

    Returns ConsolidationLoop

Methods