DEV Community

Cover image for Pawz Engram biologically-inspired memory architecture for persistent AI agents
Gotham64
Gotham64

Posted on

Pawz Engram biologically-inspired memory architecture for persistent AI agents

What is Engram?

Most “agent memory” today is basically:

Bad Memory Patterns

Project Engram is our attempt to treat memory like a cognitive system instead of a dumping ground.

It’s a three-tier architecture inspired by how humans handle information:

  • Sensory Buffer (Tier 0): short-lived, raw input for a single turn
  • Working Memory (Tier 1): what the agent is “currently aware of” under a strict token budget
  • Long-Term Memory Graph (Tier 2): persistent episodic + semantic + procedural memory with typed edges

Engram is implemented in OpenPawz, an open-source Tauri v2 desktop AI platform. Everything runs local-first.

Read the full whitepaper: ENGRAM (Project Engram)

Why build this?

Flat memory stores tend to fail the same way:

  • everything competes equally (no prioritization)
  • nothing fades (stale facts stick around forever)
  • “facts”, “events”, and “how-to” get mixed into one blob pile
  • retrieval runs even when it shouldn’t (latency + context pollution)
  • security is often an afterthought

Engram’s core bet is simple:

Intelligent memory is not more memory — it’s better memory, injected at the right time and the right amount.

The Engram loop (the part we care about)

Engram is built around a reinforcing loop:

Engram Outline

  • Gate: decide if memory retrieval is needed at all (skip trivial queries)
  • Retrieve: hybrid search (BM25 + vectors + graph signals)
  • Cap: budget-first context assembly (no overflow, no dilution)
  • Skill: store “how to do things” as procedural memory that compounds
  • Evaluate: track quality (NDCG, precision@k, latency)
  • Forget: measured decay + fusion + rollback if quality drops

Architecture

Project Engram Memory

1) Three tiers, three time scales

Tier 0: Sensory Buffer

  • FIFO ring buffer for this turn’s raw inputs (messages, tool outputs, recalled items)
  • drained into the prompt and then discarded

Tier 1: Working Memory

  • priority-evicted slots with a hard token budget
  • snapshots persist across agent switching

Tier 2: Long-Term Memory Graph

  • Episodic: what happened (sessions, outcomes, task results)
  • Semantic: what is true (subject–predicate–object triples)
  • Procedural: how to do things (step-by-step skills with success/failure tracking)
  • memories connect via typed edges (RelatedTo, Contradicts, Supports, FollowedBy, etc.)

2) Hybrid retrieval (BM25 + vectors + graph) with fusion

Engram fuses multiple signals rather than betting on one:

  • BM25 for exactness and keyword reliability
  • Vector similarity when embeddings are available (optional)
  • Graph spreading activation to pull adjacent context

Then it merges rankings with Reciprocal Rank Fusion (RRF) and can apply MMR for diversity.

3) Retrieval intelligence (a.k.a. don’t retrieve blindly)

Engram uses:

  • a Retrieval Gate: Skip / Retrieve / DeepRetrieve / Refuse / Defer
  • a Quality Gate (CRAG-style tiers): Correct / Ambiguous / Incorrect

So weak results get corrected or rejected instead of injected as noise.

4) Measured forgetting + safe rollback

Forgetting is first-class:

  • decay follows a dual-layer model (fast-fade short memory vs slow-fade long memory)
  • near-duplicates are merged (“fusion”)
  • garbage collection is transactional: if retrieval quality drops beyond a threshold, Engram rolls back

That means storage stays lean without silently losing what matters.

5) Security by default

Engram encrypts sensitive fields before they hit disk:

  • automatic PII detection
  • AES-256-GCM field-level encryption
  • local-first storage design (no cloud vector DB dependency)

Some highlights:

  • sensory buffer + working memory caches
  • graph store + typed edges
  • hybrid search + reranking
  • consolidation + fusion + decay + rollback
  • encryption + redaction defenses
  • observability (metrics + tracing)

What’s next

A few “high-leverage” additions we are actively working toward:

  • proposition-level storage (atomic facts)
  • a stronger vector index backend (HNSW)
  • community / GraphRAG summaries for “global” queries
  • skill verification + compositional skills
  • evaluation harnesses (dilution testing + regression gates)

Read the full whitepaper

If any of this resonates, the full architecture, modules, schema, and research mapping.
And if you want to contribute, issues + PRs are welcome.
Star the repo if you want to track progress. 🙏
OpenPawz

OpenPawz — Your AI, Your Rules

A native desktop AI platform that runs fully offline, connects to any provider, and puts you in control. Private by default. Powerful by design.

favicon openpawz.ai

Top comments (0)