Skip to main content

AI memory that decays, degrades, and drifts the way human memory does

Project description

MemoryLayer

AI memory that decays, degrades, and drifts the way human memory does.

Install

pip install memorydrift
pip install "memorydrift[embed]"
pip install "memorydrift[full]"

Quickstart

from memorylayer import MemoryStore, MemoryLayer

store = MemoryStore(auto_embed=True)

store.write("I saved the blacksmith's son", emotional_weight=0.9, age_at_encoding=28)
store.write("The dragon was defeated in the northern tower", emotional_weight=0.7)

for r in store.retrieve():
    print(r.display_content)   # "I clearly remember: I saved the blacksmith's son"
    print(r.decay.fidelity)    # VIVID / CLEAR / FADED / VAGUE / FEELING

Spreading activation fires automatically — semantically similar memories surface together.

What makes it different

Every other AI memory system is a key-value store. MemoryLayer implements the neuroscience:

Human memory property MemoryLayer
Emotional memories last longer emotional_weight stretches halflife up to 3×
Details fade before the gist Fidelity degrades: VIVID → CLEAR → FADED → VAGUE → FEELING
Rehearsal keeps memories strong repetition_count boosts stability (spaced repetition)
Related memories surface together Spreading activation via semantic embeddings
Weak memories drift on recall Reconsolidation: content rewrites toward current context
Childhood memories are hazy Age-at-encoding: childhood amnesia + reminiscence bump (Rubin 1997)
Sleep consolidates the day simulate_sleep() adds replay repetitions, tags CLEAR+ for promotion

Memory layers

Layer Halflife Use for
WORKING ~1 hour Active conversation context
EPISODIC 1 year Events and experiences
SEMANTIC 5 years Facts and knowledge
PROSPECTIVE 3 days Intentions that fade if unacted on
IDENTITY Forever Core beliefs and self-concept

Advanced API

from memorylayer import (
    # Prospective memory — intentions
    write_intention, complete_intention, get_overdue_intentions,

    # Collective memory — shared events, per-entity emotional weight
    CollectiveMemoryStore,

    # Sleep consolidation
    simulate_sleep, SleepSession,

    # Reconsolidation — memory drift on recall
    reconsolidate_sync,
)

# Prospective memory
store = MemoryStore()
intention = write_intention(store, "Call the lawyer", due_in_days=3)
complete_intention(store, intention.id)   # converts to episodic on completion

# Collective memory
shared = CollectiveMemoryStore()
event = shared.write_event(
    "The team won the championship",
    participants={"alice": 0.95, "bob": 0.40},   # alice scored; bob watched
)
alice_memories = shared.recall_for("alice")       # stronger than bob's

# Sleep consolidation
result = simulate_sleep(store, SleepSession(quality=0.85, duration_hours=7.5))
print(f"Strengthened: {result.memories_strengthened}")

Fidelity levels

When a memory is retrieved, its content is automatically degraded to match its strength:

VIVID    (> 0.70)  "I clearly remember: she smiled at the coffee shop."
CLEAR    (0.45–)   "I remember: something about a coffee shop."
FADED    (0.22–)   "I vaguely recall: she smiled."
VAGUE    (0.08–)   "I have a faint sense that: she smiled…"
FEELING  (0.03–)   "I don't remember what happened, but I remember warmth and joy."
FORGOTTEN(< 0.03)  [not returned — the memory is gone]

Patent

MemoryLayer implements three novel mechanisms filed with the Indian Patent Office (June 2026):

  1. Emotionally-modulated decay floor — high-emotion memories asymptotically approach a floor rather than decaying to zero.
  2. Fidelity-degraded retrieval — content specificity decreases proportionally to computed temporal strength.
  3. Post-retrieval reconsolidation — weak memories are rewritten toward current context on each recall.

Author: Mounica Goriparti · mounica.goriparti@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memorydrift-3.0.2.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

memorydrift-3.0.2-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file memorydrift-3.0.2.tar.gz.

File metadata

  • Download URL: memorydrift-3.0.2.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for memorydrift-3.0.2.tar.gz
Algorithm Hash digest
SHA256 fa7858725cedf8d7aa9b59472ceabce9d39f7b87c9fb4756755a3a80810c10f4
MD5 7f10c7ceb79a08837a00f58036020163
BLAKE2b-256 dc1962caa0f860d0b518a4d5dafdba5aa841d14ae7b75fc1686d8e0a2d8e4ca5

See more details on using hashes here.

File details

Details for the file memorydrift-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: memorydrift-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for memorydrift-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d83432a0cc68d13dc76c752738991fdbbdb6241d3d2bd59e0791f36a479d4edd
MD5 f741bd7f9970f4774e65074b589ee910
BLAKE2b-256 4c41d3302015e04371d60626a4ac7e1af9ccf7ccee16e1e4b83b2e1992a517b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page