Skip to main content

A modern 4-Stage Synthetic Memory

Project description


SynMem – 4-Stage Synthetic Memory

Overview

SynMem is a production-grade, multi-stage synthetic memory framework inspired by real cognition. Built for AI Agents, LLMs, Voice Assistants and more with advanced automation.

Stages:

  1. Perception – Immediate, in-memory (RAM) context
    • Optional, not required
  2. Sensory – Short-lived, per-user episodic memory
  3. STM (Short-Term Memory) – Active conversation/session memory
  4. LTM (Long-Term Memory) – Persistent archive

Key Features

  • Direct, 4-stage architecture:

    • Perception (RAM) Sensory (Per User) → STM (All Users) → LTM (All Users)
  • Thread-safe singleton: One instance per process, all operations safe for concurrency.

  • Configurable: All limits, expirations, are adjustable.

  • No vendor lock-in: Plug into any agent, LLM, or workflow.

  • No required maintenance: Maintenance/cleanup is optional but recommended. Run in a background thread no lock-in or forced schedules.

  • Bonus: Image storage and expiry: Store/expire/archive images and metadata if needed—totally optional.


Why SynMem?

Most “memory” modules just log history or dump to a database. SynMem is layered, time-aware, and models real-world cognition.

  • Perception: Working context—ephemeral, in-memory, no disk. (Optional Use)
  • Sensory: Fast, expiring, per-user buffer.
  • STM: Recent active memory, rolls into LTM automatically.
  • LTM: Archive—retrieve by date, user, or content.
  • Image: Use if you need; never required.

You control all layouts, all workflows.


API Highlights

Perception (RAM only):

mem.savePerception("live context chunk")
mem.retrievePerception()   # FIFO, up to limit
mem.clearPerception()

Sensory / STM / LTM:

mem.saveSensory("input", "response", "user", mem.senDir)
mem.retrieveSensory(mem.getDir(mem.senDir, "user.db"))
mem.saveConversationDetails("input", "response", "user", mem.stmUserConversationDetails)
mem.retrieveConversationDetails("user", [mem.stmUserConversationDetails, mem.ltmUserConversationDetails])

Bonus: Images (if needed):

mem.saveCreatedImage("subject", image_data, mem.stmCreatedImages, mem.stmCreatedImageDetails)

Maintenance (Optional, Recommended)

  • Why? For auto-cleanup, auto-archival, and expired memory removal.
  • Not required for operation.
  • Enable any time—runs in the background so no blocking.

If you don’t enable maintenance, expired items will accumulate until you remove them.


Plug and Play

  • No schemas, no boilerplate.
  • Use with any LLM/agent plug-N-play and go.

FAQ

Q: Is perception persistent? A: No, it is always RAM-only.

Q: Do I need maintenance? A: No, but it’s strongly recommended for any long-running use.

Q: What if I don’t use image storage? A: Ignore all image APIs—they’re bonus, not core.


Code Examples

You can find code examples on my GitHub repository.


License

This project is licensed under the Apache License, Version 2.0. Copyright 2025 Tristan McBride Sr.


Acknowledgements

Project by:

  • Tristan McBride Sr.
  • Sybil

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

synmem-0.0.2.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

synmem-0.0.2-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file synmem-0.0.2.tar.gz.

File metadata

  • Download URL: synmem-0.0.2.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for synmem-0.0.2.tar.gz
Algorithm Hash digest
SHA256 dff65cd3377b27531aba37fd18aa1e09abaf06a0d2e33aaac393e9dbc54b81a4
MD5 a3aa441d96fcf2fa1e20b5e680679e84
BLAKE2b-256 0735945e6331f65dfa8f2994ce9b4bf17213e0945a1dd526e7cd3e631ce4ae8d

See more details on using hashes here.

File details

Details for the file synmem-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: synmem-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for synmem-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9ab6d7ef963eb2f55806a9fb39c8449ed7edb27658556a03004b12a4f86f7309
MD5 f46784bee30f0e5a6d171215bdac8639
BLAKE2b-256 c5899f7d1b32db60e7c0760124283d6956b448a497970f810df35313822fce57

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