## Why one type of memory isn't enough

Most AI memory tools store only facts — "user likes Python", "user lives in San Francisco." This is semantic memory, and it's useful but incomplete. Humans don't just remember facts. We remember _experiences_ and _skills_ too.

Mengram implements all three types of human memory for AI agents. Here's how each works and why it matters.

## Semantic memory: facts and knowledge

Semantic memory stores **what the AI knows** about a user, project, or domain. It's context-free — the facts exist independent of when or how they were learned.

```
# Semantic memories extracted automatically:
"User prefers TypeScript over JavaScript"
"User works at Acme Corp as a senior engineer"
"User's project uses PostgreSQL with pgvector"
"User prefers dark mode in all tools"
```

This is the baseline. Tools like [Mem0](/content/vs/mem0/index.html) and [Zep](/content/vs/zep/index.html) implement semantic memory well. But it's only the foundation.

## Episodic memory: events and experiences

Episodic memory stores **what happened** — specific events, decisions, and interactions with full context: when, where, and why.

```
# Episodic memories:
"On Feb 12, user spent 2 hours debugging a Redis connection timeout.\n Root cause was pool_max=2 under concurrent load. Fixed by increasing to 5."

"On Feb 10, user decided to migrate from REST to GraphQL\n after discovering N+1 query problems in the dashboard API."

"On Feb 8, user paired with Sarah on the auth refactor.\n They chose JWT over sessions for stateless scaling."
```

Episodic memory enables the AI to reference past events: "Last time you had a Redis issue, it was a pool size problem — want me to check that first?" This is the difference between a tool and a colleague.

## Procedural memory: workflows and skills

Procedural memory stores **how to do things** — step-by-step workflows that the AI learns from observing the user's patterns.

```
# Procedural memories:
"Deploy workflow: run tests → build Docker image → push to staging →\n smoke test → promote to production → notify #eng-deploys"

"Code review process: check for security issues first →\n verify test coverage → review naming conventions →\n suggest performance improvements last"

"Bug triage: reproduce locally → check error logs →\n identify affected users → create ticket → assign priority"
```

The critical feature of procedural memory is that it **evolves from failures**. When a deployment fails because the user forgot to run migrations, Mengram updates the procedure to include that step. The AI gets better over time.

## How all three work together

Consider a customer support agent with all three memory types:

- **Semantic:** "This customer is on the Pro plan, uses the React SDK, and prefers email over chat."
- **Episodic:** "Last week, this customer reported a billing issue that was resolved by applying a promo code."
- **Procedural:** "For billing issues: check subscription status → verify payment method → check for failed charges → escalate to billing team if unresolved."

With all three, the agent doesn't just have facts — it has _experience_ and _skills_. It knows the customer, remembers their history, and follows a proven resolution workflow.

## Using all three types with Mengram

```
from mengram import Mengram
m = Mengram(api_key="key")

# Add any conversation — Mengram auto-extracts all 3 types
m.add("Deployed to staging, but migrations failed. Had to rollback, run migrations manually, then redeploy.", user_id="alice")

# Search across all types
m.search("deployment process", user_id="alice")

# Cognitive Profile merges all types into one system prompt
profile = m.profile(user_id="alice")
```

Mengram automatically classifies and extracts all three memory types from natural conversation. No manual tagging required.
