Conceptsv3 featuresDelta-encoded episodes

Delta-encoded episodes

Mnemosyne is alpha, on the 3.6.x line, and the API can still change within 3.x.

The idea

Many episodes repeat an earlier one with small changes. Storing each in full duplicates the shared part. Mnemosyne links a similar episode to its nearest predecessor and stores what differs:

            ROOT: "Firmware 4.0 rollout"
           /             |              \
 "4.1 rollout"     "4.2 rollout"     "4.3 rollout"
 (Δ canary site)   (Δ docking fix)   (Δ rollback)
                         |
               "4.2.1 hotfix rollout"
               (Δ skipped canary)

How it works

Source: packages/core/src/cognitive/delta-episode.ts.

When an episode is about to be created, by POST /remember or by a session collapse:

  1. The narrative is embedded.
  2. The nearest existing episode is looked up.
  3. If its cosine is at least 0.85, the new episode becomes its child: parentEpisodeId points at it and deltaContent holds the difference between the new narrative and the parent’s full narrative.
  4. Otherwise the episode is created as a root.

Recall folds the chain from the root to the leaf (reconstructEpisode), so an episode hit carries the full narrative.

Fields

On MnemoEpisode (packages/types/src/primitives.ts):

FieldMeaning
parentEpisodeIdThe episode this one is a delta of
deltaContentWhat differs from the parent
isRoottrue when it has no parent
depthDistance from the root

Delta-linking needs an embedding provider. Without one, or when the embedding call fails, the episode is stored as a root.

See also