Skip to content

3-Tier Memory Architecture

.md

Dewee implements progressive memory retrieval (internal/memory/):

  1. Working Memory (L0): Active conversation buffer loaded directly in turn context.
  2. Episodic Memory (L1): Vectorized session summaries stored in PostgreSQL with pgvector embeddings, retrieved via semantic similarity.
  3. Semantic Memory (L2): Knowledge Graph entities and relations extracted across long-running sessions.
Terminal window
# Search agent memory
dewee memory search --agent <agent-id> --query "deployment architecture"
# Re-index all memory documents
dewee memory index-all --agent <agent-id>

Memory facts are short, typed statements an agent keeps about a person or a thing, for example “the user’s employer is Acme”. Each fact has a subject, a predicate (with an optional qualifier for multi-valued slots), a value, and the time window it is valid for. The agent uses current facts when it answers. Both the PostgreSQL and the SQLite edition keep facts.

Every fact records where it came from: the conversation summary, channel message, or memory document it was learned from, or the operator who stated it. Each fact also has a verification level (stated, confirmed or inferred) and a confidence. When a newer value replaces an older one, the old fact is kept as history, so you can always see what the agent believed and when.

When a new value conflicts with a fact the agent already trusts more, the new value is stored as disputed instead of replacing it. Disputed facts wait for an operator:

  • Accept makes the disputed value current. The old value becomes history.
  • Reject discards the disputed value and keeps the current one.

You can review facts in the dashboard (Memory page, Facts tab) and in the customer app (Memory page, Facts tab, for workspace memory managers). Both let you filter by user, subject, predicate, status and a point in time, and open a fact to see its sources and history.

  • Delete removes one wrong fact from use. The record stays, marked deleted, for audit.
  • Forget permanently erases every fact about one user, or about one subject. Use it for erasure requests. It is available from the API and the CLI.

Deleting a reviewed channel-memory item also erases the facts learned from it.

Terminal window
# Review: list disputed facts, then inspect one with its sources and history
dewee memory facts list --agent <agent> --status disputed
dewee memory facts get --agent <agent> <fact-id>
# Resolve a dispute, or delete a wrong fact
dewee memory facts resolve --agent <agent> <fact-id> --action accept
dewee memory facts delete --agent <agent> <fact-id> --yes
# State a fact as the operator
dewee memory facts assert --agent <agent> --user <user-id> --subject user --predicate employer --value Acme
# Erase everything known about one user
dewee memory facts forget --agent <agent> --user <user-id> --yes

Every command accepts --json. delete and forget require --yes.