Skip to content

Memory layer for AI agent orchestrators with adaptive forgetting, stronger retrieval.

License

Notifications You must be signed in to change notification settings

Ashish-dwi99/Engram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Engram
Engram

The Personal Memory Kernel for AI Agents

Hit a rate limit in Claude Code? Open Codex — it already knows what you were doing.
Create a task? Memory picks the best agent automatically.
One memory kernel. Shared across every agent. Bio-inspired forgetting. Zero cold starts.

Python 3.9+ MIT License Tests GitHub Stars

Quick Start · Why Engram · How It Works · Packages · Changelog · Docs


Dashboard

Engram Dashboard Demo
Kanban board, memory inspector, agent coordination, and chat.

Individual views

Kanban Board
Kanban board — drag-and-drop task management across statuses

Agent Coordination
Agents tab — memory-based orchestration with semantic routing and capability matching

Memory Browser
Memory browser — search, inspect, and manage the shared memory store

Chat Interface
Chat — describe a task and the agent creates it on the board, or just chat


Research Highlights

~45% less storage   |   +26% retrieval accuracy   |   +12% multi-hop reasoning

Based on FadeMem (arXiv:2601.18642) — biologically-inspired forgetting for efficient agent memory.


Quick Start

pip install engram-memory          # 1. Install
export GEMINI_API_KEY="your-key"   # 2. Set one key (or OPENAI_API_KEY, NVIDIA_API_KEY)
engram install                     # 3. Auto-configure Claude Code, Cursor, Codex

Restart your agent. Done — it now has persistent memory across sessions and agents.

Want the dashboard + orchestration?

pip install -e "./engram-orchestrator"
pip install -e "./engram-bridge[web,orchestrator]"
engram-bridge --channel web        # Open http://127.0.0.1:8200

Why Engram

Every AI agent you use starts with amnesia. But the real pain isn't just forgetting — it's what happens when you switch agents and when you have to decide which agent to use.

The cold-start problem

You're 40 minutes into a refactor with Claude Code. You've touched six files, picked a migration strategy, mapped out the remaining TODOs. Then you hit a rate limit. Or your terminal crashes. Or you just need Codex for the next part. So you switch — and the new agent has zero context. You re-paste file paths, re-explain decisions, re-describe the plan. Half the time the new agent contradicts something you'd already decided.

The routing problem

You have three agents configured: Claude Code for deep reasoning, Codex for fast scaffolding, a custom agent for CI. A bug comes in. Which agent handles it? You pick manually every time. When agents finish, the next task sits idle until you notice. You are the orchestrator — and you shouldn't have to be.

Engram fixes both. It's a Personal Memory Kernel — one memory store shared across all your agents.

For handoffs: when Claude Code pauses, it saves a session digest. When Codex picks up, it loads that digest and continues where you left off. No re-explanation. No cold starts.

For orchestration: agents register their capabilities as memories. When a task arrives, Engram semantically matches it against agent capabilities and auto-routes it to the best available agent. Memory is the orchestrator — no separate routing service, no manual assignment, no YAML configs mapping tasks to agents.

Problem Typical approach Engram
Switch agents = cold start Manual copy-paste Handoff bus — auto session digests + resume
Who handles this task? You pick manually Semantic capability matching — auto-route
Agent at capacity? Task sits idle Load-aware routing with CAS claim/release
Nobody forgets Store everything forever Ebbinghaus decay — ~45% less storage
Single retrieval path One embedding per memory 5 retrieval paths per memory (EchoMem)
No episodic memory Vector search only CAST scenes — time/place/topic clustering
No consolidation Store everything as-is CLS sleep cycles — episodic to semantic distillation
No real-time coordination Polling or nothing Active memory signal bus — agents see each other instantly
Concurrent access Single-process locks sqlite-vec WAL — multiple agents, one DB

How It Works

Engram has three layers — memory, coordination, and communication:

Passive Memory — the long-term store

Memories fade via Ebbinghaus decay, get promoted from short-term to long-term through repeated access, and are encoded through multiple retrieval paths (paraphrase, keywords, implications, question-form). Sleep cycles distill episodic conversations into durable semantic facts.

Active Memory — the real-time signal bus

Agents post ephemeral state ("editing auth.py", "build failing") that other agents see instantly. Signals auto-expire. Important ones get consolidated into long-term storage.

Memory-as-Orchestrator — the coordination layer

Agent capabilities are stored as memories: "claude-code: Advanced coding agent. Expert at Python, TypeScript, debugging." When a task arrives, Engram runs a semantic search over these capability memories, filters by agent availability and capacity, scores candidates, and assigns the task — all through the same memory infrastructure used for everything else. Coordination events (routed, claimed, released) are themselves stored as memories, creating a searchable audit trail.

No new database tables. No separate routing service. The same Memory.add() / Memory.search() that stores user conversations also stores agent profiles and routes tasks.

Handoff

When an agent pauses (rate limit, crash, tool switch), it saves a session digest: task summary, decisions made, files touched, TODOs remaining. The next agent loads it and continues. If no digest was saved, Engram falls back to parsing the conversation logs automatically.

The memory stack at a glance
Layer What it does
FadeMem Ebbinghaus-curve decay, SML/LML dual layers, promotion on access
EchoMem 5 retrieval paths per memory (paraphrase, keywords, implications, Q-form)
CategoryMem Auto-discovered hierarchical categories with retrieval boosting
CAST Scenes Episodic narrative memory — time, place, topic clustering
CLS Distillation Sleep-cycle replay: episodic to semantic fact extraction
Multi-trace Benna-Fusi model — fast/mid/slow decay traces per memory
Intent routing Episodic vs semantic query classification
Orchestrator Agent registry + semantic task routing + CAS claim/release
Handoff bus Session digests, checkpoints, JSONL log fallback
Active Memory Real-time signal bus with TTL tiers

Packages

Engram is five pip-installable packages:

engram-memory ← engram-bus ← engram-orchestrator ← engram-bridge ← engram-enterprise
   (core)        (comms)       (routing)             (dashboard)     (governance)

engram-memory — Core Memory Engine

The main package. Memory CRUD, semantic search, decay, echo encoding, categories, episodic scenes, MCP server, CLI.

pip install engram-memory
pip install "engram-memory[openai]"     # OpenAI provider
pip install "engram-memory[ollama]"     # Ollama (local, no key needed)
pip install "engram-memory[all]"        # everything
from engram import Engram

memory = Engram()
memory.add("User prefers Python over TypeScript", user_id="u1")
results = memory.search("programming preferences", user_id="u1")

18 MCP tools — memory CRUD, semantic search, episodic scenes, profiles, decay, session handoff. One command configures Claude Code, Cursor, and Codex:

engram install

engram-bus — Agent Communication Bus

Real-time agent-to-agent coordination. Key/value with TTL, pub/sub messaging, handoff sessions and checkpoints. Zero external dependencies — stdlib only.

pip install engram-bus
from engram_bus import Bus

bus = Bus()
bus.put("status", "refactoring auth", agent="planner", ttl=300)
bus.publish("progress", {"step": 3, "total": 5}, agent="worker")

Full documentation →

engram-orchestrator — Memory-as-Orchestrator

Agents register capabilities as memories. Tasks auto-route to the best agent via semantic search. No new DB tables — everything is a memory.

pip install -e "./engram-orchestrator"
from engram_orchestrator import Coordinator, AgentRegistry
from engram.memory.main import Memory
from engram_bus import Bus

memory = Memory(config=...)
bus = Bus()
coordinator = Coordinator(memory, bus, config)

# Agents register capabilities — stored as searchable memories
coordinator.registry.register(
    "claude-code",
    capabilities=["python", "typescript", "debugging", "code-review"],
    description="Advanced coding agent for deep reasoning tasks",
    agent_type="claude", model="claude-opus-4-6",
)

# Tasks auto-route via semantic matching
coordinator.start()  # subscribes to bridge.task.created bus events

# Or route manually
coordinator.router.route(task_id)           # single task
coordinator.router.route_pending()          # batch all unassigned

# Agents claim tasks atomically (CAS)
coordinator.claim(task_id, "claude-code")   # returns None if already claimed
coordinator.release(task_id, "claude-code")

Three classes, one idea:

Class Purpose
AgentRegistry Store/query agent capability profiles as memory_type="agent" memories
TaskRouter Build query from task → semantic search → filter by availability → score → assign
Coordinator Ties registry + router + bus events. CAS claim/release. Event logging as memories

engram-bridge — Dashboard + Channel Adapters

Talk to your coding agents from a browser or Telegram. Kanban board, task management, live WebSocket streaming, and the coordination dashboard.

pip install -e "./engram-bridge[web,orchestrator]"
engram-bridge --channel web

The web dashboard at http://127.0.0.1:8200 includes:

  • Board — Kanban with drag-and-drop, projects, statuses, tags
  • Agents — Coordination dashboard: agent registry, semantic routing, event log
  • Memory — Browse and search the memory store
  • Chat — Direct agent interaction with live streaming

See screenshots above for a visual tour.

7 coordination REST endpoints under /api/coordination/:

Endpoint Description
GET /agents List agents with capabilities + status
POST /agents/{name}/register Register/update capabilities
GET /agents/match?q=... Semantic capability search
POST /route/{task_id} Route task to best agent
POST /route-pending Batch-route all unassigned
POST /claim/{task_id} Atomic CAS claim
GET /events Coordination event log

Full documentation →

engram-enterprise — Governance Layer

Policy enforcement, provenance tracking, acceptance gates, async operations, and authenticated REST API. Built on top of engram-memory and engram-bus.

pip install engram-enterprise
from engram_enterprise import PersonalMemoryKernel

kernel = PersonalMemoryKernel()

Full documentation →


Integrations

engram install    # auto-configures everything

One command sets up MCP config for Claude Code, Cursor, and Codex. It also deploys the Claude Code plugin — a hook that proactively injects relevant memories before every prompt, plus periodic background checkpoints that survive rate limits.

Works with any tool-calling agent via REST: engram-api starts a server at http://127.0.0.1:8100.


Repo Structure

├── engram/                  # engram-memory — core Python package
│   ├── core/                #   decay, echo, category, scenes, distillation, traces
│   ├── memory/              #   Memory class (orchestrates all layers)
│   ├── llms/                #   LLM providers (gemini, openai, nvidia, ollama)
│   ├── embeddings/          #   embedding providers
│   ├── vector_stores/       #   sqlite-vec, in-memory
│   ├── db/                  #   SQLite persistence
│   ├── api/                 #   REST API endpoints
│   ├── mcp_server.py        #   MCP server (18 tools)
│   └── cli.py               #   CLI interface
├── engram-bus/              # engram-bus — agent communication
│   └── engram_bus/          #   bus, pub/sub, handoff store, TCP server
├── engram-orchestrator/     # engram-orchestrator — memory-as-orchestrator
│   └── engram_orchestrator/ #   registry, router, coordinator
├── engram-bridge/           # engram-bridge — dashboard + channel adapters
│   └── engram_bridge/       #   bridge, channels (web + telegram), coordination shim
│       └── channels/web-ui/ #   React dashboard (Vite + shadcn/ui)
├── engram-enterprise/       # engram-enterprise — governance layer
│   └── engram_enterprise/   #   kernel, policy, provenance, async, API + auth
├── plugins/                 # Claude Code plugin (hooks, commands, skill)
├── tests/                   # Test suite (300+ tests)
├── pyproject.toml           # engram-memory package config
└── install.sh               # One-line installer

Contributing

git clone https://github.com/Ashish-dwi99/Engram.git
cd Engram

# Core
pip install -e ".[dev]"
pytest

# Bus
pip install -e "./engram-bus[dev]"
cd engram-bus && pytest

# Orchestrator
pip install -e "./engram-orchestrator"

# Bridge (web dashboard)
pip install -e "./engram-bridge[web,orchestrator]"
cd engram-bridge/engram_bridge/channels/web-ui && npm install && npm run build

# Enterprise
pip install -e "./engram-enterprise[dev]"
cd engram-enterprise && pytest

License

MIT — see LICENSE.


One memory. Every agent. Zero cold starts. Automatic routing.

GitHub · Issues · Changelog · Docs

About

Memory layer for AI agent orchestrators with adaptive forgetting, stronger retrieval.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •