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

```python
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.1.tar.gz (32.3 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.1-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memorydrift-3.0.1.tar.gz
  • Upload date:
  • Size: 32.3 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.1.tar.gz
Algorithm Hash digest
SHA256 96bba4f3c74e78f2db2d9e263488a36e78a95dbf975d0b5a1058bab2431b69c0
MD5 9e4a47df57df8d6d76f49d3c5f073100
BLAKE2b-256 a6271610b614b12d5108fcf6bcf8efa0ea86f233596ff24b9caf5797d315ca86

See more details on using hashes here.

File details

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

File metadata

  • Download URL: memorydrift-3.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f45872de7e6dd4980be367e4919e7922769b3e23cd5a372173f9d4ca5e6694ed
MD5 1f1eb3948739370eab091987262a5821
BLAKE2b-256 9e5bb897cfe3d12985bbd64d21d972143f1d4d479a7bc9501cc4151ebbdd2dfd

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