awe docs

Memory in depth

How conversations become memory

This page is for developers and for anyone debugging memory. It explains how awe turns a conversation into stored facts, how to see whether that is working, and the commands that repair or test it. For what memory is and how to use it, start with awe-memory.md.

The path of a fact

  1. A message is saved. Every turn in the console chat, a texted conversation, a skill run or a connected chat app is written to gateway_messages in MCP-servers/awe-console/gateway.db.
  2. It is queued. The background service groups new messages by conversation and records each group as a work item in the extraction_queue table of awe-core.db.
  3. A model reads it. A worker claims an item, sends that part of the conversation to your AI model with awe’s extraction prompt, and gets back short tagged facts. Each fact also comes with a few questions it answers.
  4. It is written down. The facts are appended to today’s file in .awe/workspace/memory/ and indexed into memory.db, together with their questions. The questions are stored as search keys, so a later question can match a question instead of having to match a statement.

The service checks for new work every 60 seconds, and also right after an assistant reply lands, so a new fact is usually searchable within about a minute.

Coding tools connected through hooks take a second route: prompts are buffered during the session and extracted when it ends. See claude-code-hooks.md. Imported chat exports are extracted by the same code on their own queue.

What is not read

  • Conversations from connected chat apps (Slack, Telegram, Discord, WhatsApp, iMessage), unless Index channel messages is on in the console under Settings, Memory tuning.
  • The scheduled check-in’s own conversation.
  • The last message of a conversation while it is still waiting for its reply.

Work item states

State Meaning
pending Waiting for a worker
extracting A worker has it. If the worker dies, the item is picked up again after 15 minutes
done Read. New messages in the same conversation make it pending again
failed The model call or a write failed. It is retried after 1 minute, then 5 minutes, 25 minutes, 2 hours, and every 12 hours after that. The error is kept on the row
skipped Put off on purpose, with a reason. awaiting_reply means the last message has no answer yet. It is read when the reply arrives, or after an hour if none does

A failure is always a row you can see. Nothing is skipped silently.

What a stored fact looks like

A fact is one or two plain sentences that make sense on their own. Each has one tag:

Tag For
IDENTITY Who you are: name, family, home, life details
PREF How you like things done
DECISION A choice and its reason
DONE, PLANNED, ISSUE Work finished, intended, or broken
GOTCHA, DEAD_END, PATTERN Lessons: a trap, an approach that failed, one that works
METRIC, DEPENDENCY, EXAMPLE, RESEARCH A measurement, something relied on, a sample, a finding

DIGEST is written only by mem digest.

Where a fact came from (its scope, such as web for the console chat or import:chatgpt), its tag and its project are stored in columns of memory_chunks, not in the fact’s text. The dated text files keep those stamps so that a person can read them.

Is it working?

./awe-core mem extract-status
./awe-core mem extract-status --json
./awe-core mem config

extract-status prints the count of items in each state, how many facts have been written, how long ago the last cycle finished, the newest failing conversations with their errors, and a warning when the oldest waiting item is more than an hour old. If awe is set to call Anthropic directly with a model name that does not exist, it says so here. mem config shows which model does the extracting.

Two more places to look:

  • .awe/extractor.log: one JSON line per cycle.
  • .awe/system.log: warnings from the background service, repeated every cycle while something is failing.

./awe-core findings reports a stalled or falling-behind extractor as a finding. See proactive-loops.md.

Run it by hand

./awe-core mem extract-gateway
./awe-core mem extract-gateway --batches 25 --sleep-secs 30

The first line runs one cycle now. The second works through a backlog, for example after connecting a chat app that already has a long history. Each cycle reads up to 200 messages.

To see what the model makes of a transcript without storing anything, pipe a JSONL transcript into ./awe-core mem test-extract.

Repair jobs

Each of these can be stopped and run again. It picks up where it left off.

Command What it does Uses your AI model
mem keygen --batches N Writes search questions for facts that have none. The service also does this in the background Yes
mem reextract --batches N Reads old conversations again with the current extractor, to recover facts an older version missed. --status shows how much is left. Results go to .awe/workspace/memory/reextract/ Yes
mem reembed Strips old header and stamp text out of stored facts and indexes them again. --dry-run previews, --revert restores the originals No
mem reembed --swap-model Re-indexes every fact for the search model named by AWE_MEMORY_EMBED_MODEL No
mem backfill-tags --apply Fills in the tag column from each fact’s text. Without --apply it only counts No
mem backfill-event-time Fills in when each fact was true, from the date in its file name. --dry-run No
mem reindex-refs Rebuilds the links between notes and the files they mention No

Tests

These grade memory on your own install and change no memories. The ones marked use your AI model.

Command What it measures Passes when
mem bench-extract Whether extracted facts have the right shape, on built-in sample conversations. Uses your AI model Reported only
mem bench-extract --recall Whether extraction catches the facts a careful reader would. Uses your AI model At least 70% caught, and nothing extracted from the samples that hold no facts
mem bench-extract --recall --backends claude,anthropic The same, once per provider, side by side Every provider is within 20 points of the best
mem health Picks random stored facts, writes fresh questions for them and searches. Uses your AI model. Misses are saved to .awe/health-regressions.json and tried again next time Reported only. The result varies from run to run because the sample is random
mem retrieval-bench A fixed list of questions in .awe/retrieval-golden.json (--init creates it). --db <file> grades a copy of memory so that two runs compare like with like 90% of questions find their fact
mem inject-bench The facts awe would insert into another AI tool. See memory-follows-you.md Right facts inserted, silence when it does not know, no private fact shared
mem hygiene How many stored facts fail to stand on their own Reported only

bench-extract grades writing facts down. health and retrieval-bench grade finding them again.

Settings

Set these in .env in the awe folder.

Setting Default What it does
AWE_MEMORY_EXTRACTION_PROVIDER auto Which model extracts. auto uses the model chosen for chat. Other values include claude, anthropic, openai, google, groq, deepseek, xai, mistral and ollama. The same choice can be made in memory.toml under [extraction]
AWE_EXTRACT_INTERVAL_SECS 60 How often the service checks for new work. The lowest allowed value is 10
AWE_MEMORY_EXTRACT_TIMEOUT_SECS 60 How long one model call may take. Allowed range 10 to 900. Raise it to clear a backlog of very long conversations
AWE_EXTRACT_ORPHAN_GRACE_SECS 3600 How long an unanswered last message waits for its reply
AWE_KEYGEN_ENABLED on 0 turns off the background job that writes search questions
AWE_KEYGEN_MAX_PER_CYCLE 30 Facts given questions per cycle
AWE_KEYGEN_QUESTIONS_PER_FACT 5 Questions per fact, from 1 to 8
AWE_RECALL_BENCH_ATTEMPTS 2 Tries per sample in bench-extract --recall, from 1 to 4
AWE_PROCESS_TIMEOUT_SECS 90 A command that makes no progress for this long is stopped. The long-running mem jobs on this page are exempt
AWE_STRUCTURED_MODE on off stops awe asking providers to enforce the shape of a reply. See structured-output.md