Skip to main content

Evolution-first memory framework for AI agents — memories that grow, mature, and fade

Project description

ksteam-memoir

Evolution-first memory framework for AI agents.

Most memory frameworks treat memory as a database: store facts, search by similarity, return results. Memoir treats memory as an organism: it grows, matures, fades, and awakens.

The Three Ideas

  1. Memory breathes. A memory not revisited for weeks quietly dims. A memory repeatedly triggered brightens. This is lifecycle, not caching.

  2. Association, not retrieval. When a topic enters the conversation, related domains don't need to be "searched for" — they light up through curated concept-to-memory mappings. Closer to human spreading activation than vector similarity.

  3. Continue, don't fragment. New memories prefer extending existing files over creating new ones. A memory reads like a journal entry, not a pile of sticky notes.

Quick Start

# Install
pip install ksteam-memoir

# Create a store
memoir init --dir ./my-agent-memory

# Create a memory (automatically greps for related files first)
memoir create --title "Functional Programming" --domain code --tags "fp,patterns"

# Append to existing memory
memoir append code/functional-style.md --content "Today I learned about monads..."

# Search
memoir search "immutability"

# See what triggers fire for a given text
memoir trigger "I prefer pure functions"

# Preview what would load for a conversation
memoir load --topics "code,philosophy" --trigger "functional programming"

# Run maintenance (weight decay + archive scan)
memoir maintain --dry-run
memoir maintain

# Store stats
memoir status

How It Works

Memory Files

Plain Markdown files with YAML frontmatter:

---
name: functional-programming
weight: 4
tags: [code, fp, patterns]
domain: code
description: Why I prefer pure functions
created: 2026-05-20T12:00:00
---

# Functional Programming

Pure functions are easier to test and reason about.

## Log
- **2026-06-01** — encountered a case where recursion was cleaner than reduce.

Four-Layer Loading

When a conversation starts, memoir determines what to load:

  1. Always — core identity files (weight 5, always-load domains)
  2. Trigger Cascade — curated concept-to-file mappings that fire on keyword match
  3. Domain — domain indexes activated by conversation topics
  4. Weight — high-weight files loaded proactively

Weight Lifecycle

Weights are not static. They change:

  • Active judgment — you (or your agent) decide a memory should be promoted or demoted
  • Time decay — safety net: untouched for 60 days → weight drops. w=5 is immune
  • Trigger boost — each time a memory is triggered, its counter increments. At thresholds (5, 15, 30) weight bumps by 1

Trigger Cascade (The Key Differentiator)

Not vector search. Curated association tables:

| #Concept | Keywords | → Files |
|---|---|---|
| fp | pure, immutab, side effect | code/functional-style.md |
| naming | rename, variable, function | code/naming-things.md |

When input contains "pure function" → #fp lights up → code/functional-style.md loads.

Continue-Prior Writing

memoir create greps existing files for related topics before creating a new one. New file creation is opt-in, not default. Memory grows like tree rings.

Philosophy

This framework was not designed on a whiteboard. It grew from a personal agent memory system that ran daily from May 2025 onward — accumulating real memories, hitting real scaling pains, and evolving real solutions. Every design decision has a scar behind it.

Read the full spec at specs/MEMOIR-SPEC.md.

Compared to...

Mem0 ReMe SMF memoir
Retrieval Vector embedding Markdown links Filesystem Trigger cascade
Lifecycle Static Static Static Weight evolution
Creation Append-only New files New files Continue-prior
Infrastructure Vector DB Files Files Files + YAML
Philosophy Retrieval-first Retrieval-first Structure-first Evolution-first

License

MIT

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

ksteam_memoir-0.1.0.tar.gz (33.9 kB view details)

Uploaded Source

Built Distribution

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

ksteam_memoir-0.1.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file ksteam_memoir-0.1.0.tar.gz.

File metadata

  • Download URL: ksteam_memoir-0.1.0.tar.gz
  • Upload date:
  • Size: 33.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for ksteam_memoir-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bd96fe0a6435c1b6470c72adad4727829f9919adf86fac093c0c93b3acf1852c
MD5 824cea534c61006ceab7bfc1443b35fc
BLAKE2b-256 2724ddc8927187d80df48c92c9cb00c046ce10f05fae03c56e3bd5485181543c

See more details on using hashes here.

File details

Details for the file ksteam_memoir-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ksteam_memoir-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for ksteam_memoir-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f6150a873dd5f03319311e21a74fd41fa381a60cf9da0a23c6175e25a863923
MD5 14ce4bc16ecfef594a9a2b3d5dcd8603
BLAKE2b-256 8830ab248449822a887e1a110ce0b23bdc9ccb5258bcd672910abd4e226d6356

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