Apus remembers things by writing plain Markdown files in your agent's workspace (default ~/.apus/workspace). The model only remembers what gets saved to disk; there is no hidden state.

How it works

Your agent has four memory-related files:

If you want your agent to remember something, just ask it: "Remember that I prefer TypeScript." It writes the note to the appropriate file.

What goes where

USER.md is the compact user-model layer. Write stable preferences and profile facts as imperative directives with observed-date and active/superseded metadata. When a preference changes, supersede it in place instead of appending a contradictory active directive. See User model.

MEMORY.md is the compact, curated layer for durable non-profile facts, standing decisions, and short summaries that should be available at the start of a session. It is not a raw transcript, daily log, or exhaustive archive.

memory/YYYY-MM-DD.md files are the working layer: detailed daily notes, observations, session summaries, and raw context that may still be useful later. These are indexed for memory_search and memory_get, but are not injected into the bootstrap prompt on every turn.

Over time, useful material from daily notes is distilled into MEMORY.md by the default dreaming sweep. The generated workspace instructions still encourage the agent to record durable facts as it works, while dreaming handles background consolidation. The default heartbeat prompt performs no memory maintenance on its own.

If MEMORY.md grows past the bootstrap file budget, Apus keeps the file on disk intact but truncates the copy injected into context. Treat that as a signal to move detailed material into memory/*.md, keep only a durable summary in MEMORY.md, or raise the bootstrap limits if you want to spend more prompt budget. Use /context list, /context detail, or apus doctor to see raw vs. injected sizes and truncation status.

Import from coding assistants

The Control UI can import existing local memory from Codex, Claude Code, and Hermes. Open Settings → Import Memory, choose the destination agent, review the detected files, and confirm the import. For the existing default agent, you can instead open Settings → Ask Apus and say import memory; this narrower chat wizard requires completed onboarding, copies only new detected memory, and reports per-source failures or possible partial copies. Apus copies only Markdown memory:

Imported files stay separate under memory/imports/codex/ and memory/imports/claude-code/, or memory/imports/hermes/ in the selected agent workspace. They are indexed for memory_search and available through memory_get; they are not merged into the agent's bootstrap MEMORY.md. The source files are left unchanged.

The preview marks destination conflicts. Enable Replace existing imports to replace those files; apply creates a verified pre-import backup and preserves item-level copies of overwritten files in the migration report.

Action-sensitive memories

Most memories are ordinary Markdown notes. Some affect what the agent should do later; for those, capture when it is safe to act on the note, not just the fact itself.

Capture that action boundary when a note involves:

A useful action-sensitive memory makes clear:

Memory can preserve approval context, but it does not enforce policy. Use Apus approval settings, sandboxing, and scheduled tasks for hard operational controls.

Example:

The API migration is being designed in another session. Future turns should
not edit the API implementation from this thread; use findings here only as
design input until the migration plan lands.

Another example:

A report from an untrusted source needs review before promotion. Future turns
should treat it as evidence only; do not store it as durable memory until a
trusted reviewer confirms the contents.

This is not a required schema for every memory; simple facts can stay concise. Use action-sensitive boundaries when losing timing, authority, expiry, or safe-to-act context could cause the agent to do the wrong thing later.

Use scheduled tasks for exact reminders, timed checks, and recurring work. Memory can still summarize the durable context around that work.

Memory tools

The agent has three tools for working with memory:

All three tools are provided by the active memory plugin (default: memory-core).

When session indexing is enabled, memory_search can also return session transcript hits. Their sessions/...jsonl paths are search references, not files that memory_get can read. Use sessions_search with distinctive text from the snippet (optionally scope sessionKey to the transcript ID), then pass its returned sessionKey, messageId, and sessionId to sessions_history for a bounded, sanitized excerpt. These tools enforce session visibility independently on each request. Memory-search line numbers are not session-history offsets.

The recall prompt recommends only enabled tools. Without session-history tools, report the excerpt limitation instead of reading raw transcript files. memory_get reports unsupported paths as read errors, not missing arguments or a globally disabled memory service. Memory-file reads and optional wiki reads keep their existing range, continuation, and partial-corpus semantics.

Memory search

When an embedding provider is configured, memory_search uses hybrid search: vector similarity (semantic meaning) combined with keyword matching (exact terms like IDs and code symbols). This works out of the box with an API key for any supported provider.

Apus uses OpenAI embeddings by default. Set memory.search.provider explicitly to use Gemini, Voyage, Mistral, Bedrock, DeepInfra, local GGUF, Ollama, LM Studio, GitHub Copilot, or a generic OpenAI-compatible endpoint.

See Memory search for how search works, tuning options, and provider setup.

Memory engines

Builtin (default)

SQLite-based. Works out of the box with keyword search, vector similarity, and hybrid search. No extra dependencies.

Honcho

AI-native cross-session memory with user modeling, semantic search, and multi-agent awareness. Plugin install.

LanceDB

LanceDB-backed memory with OpenAI-compatible embeddings, auto-recall, auto-capture, and local Ollama embedding support. Plugin install.

Knowledge wiki layer

If you want durable memory to behave more like a maintained knowledge base than raw notes, use the bundled memory-wiki plugin. It compiles durable knowledge into a wiki vault with deterministic page structure, structured claims and evidence, contradiction and freshness tracking, generated dashboards, compiled digests, and wiki-native tools (wiki_status, wiki_search, wiki_get, wiki_apply, wiki_lint).

memory-wiki does not replace the active memory plugin; the active memory plugin still owns recall, promotion, and dreaming. memory-wiki adds a provenance-rich knowledge layer beside it. You can browse the compiled wiki in the Control UI under Memory → Dreams → Diary → Memory Wiki (details).

Memory Wiki

Compiles durable memory into a provenance-rich wiki vault with claims, dashboards, bridge mode, and Obsidian-friendly workflows.

Automatic memory flush

Before compaction summarizes your conversation, Apus runs a silent turn that reminds the agent to save important context to durable memory. Memory Core saves to a workspace memory file. A selected memory plugin can supply its own persistence tools. This is on by default; set agents.defaults.compaction.memoryFlush.enabled: false to turn it off. Apus resolves when the flush runs from that host config and the active context window. The selected memory provider supplies the prompts and persistence target or tools. It inherits host timing unless it deliberately overrides an optional timing field.

The flush uses a private copy of the conversation, so its housekeeping messages never appear in later user turns, even if interrupted. Its writes to memory are still saved normally.

Memory Core's file flush requires writable workspace access. Sessions whose sandbox requires read-only or no workspace access skip the flush, including sessions with a persisted sandbox requirement that overrides the agent's configuration.

During that flush, write appends only to the daily note. Its content must contain only new text. Replayed whole notes and copied paragraphs are rejected without changing the file, so the model can retry with just the new entries. Reusing Markdown headings with new facts is allowed. This check compares text with normalized line endings; it does not deduplicate paraphrases or repair existing notes.

A native provider's tools-based flush does not require a writable workspace; other flush plans are not resolved for sessions that cannot write it. It exposes read, the provider's declared persistence tools, and optional read-only lookup tools, subject to normal tool policies. Those tools receive the source turn's memory audience and sandbox state. Missing lookup tools produce a warning but do not block a flush that can still persist. The flush is skipped if no valid audience or permitted persistence tool is available. It succeeds when a persistence tool completes without error or the agent returns NO_REPLY; lookup success alone does not complete the flush. Skipping or failing this optional step does not prevent compaction. Plugin authors can find the contract and retry identity in Pre-compaction memory flush.

To keep that housekeeping turn on a local model, set an exact override that applies only to the memory-flush turn (it does not inherit the active session's model fallback chain):

{
  "agents": {
    "defaults": {
      "compaction": {
        "memoryFlush": {
          "model": "ollama/qwen3:8b"
        }
      }
    }
  }
}

The memory flush gives the agent a chance to save important facts before compaction summarizes the conversation. Check your memory plugin's saved notes or records when you need to confirm that a fact was retained.

Dreaming

Dreaming is the default background consolidation path for memory. It collects short-term recall signals, scores candidates, and promotes only qualified owner or agent-derived items into long-term memory (MEMORY.md):

This background pattern follows the motivation behind sleep-time compute (arXiv:2504.13171). Provenance-aware reflection also follows the durable memory lessons of the Generative Agents research.

See Dreaming for phase behavior, scoring signals, and Dream Diary details.

Grounded backfill and live promotion

The dreaming system has two related review lanes:

Dreaming JSON journals from before July 2026 are no longer imported. The migration check leaves memory/.dreams/daily-ingestion.json, session-ingestion.json, short-term-recall.json, and phase-signals.json untouched. Existing SQLite state remains authoritative. If Doctor cannot establish canonical state, restore a backup from a July 2026 or newer release. An empty ingestion store without a previous migration acknowledgement is indistinguishable from unmigrated state; after verifying its SQLite state, back up and move the retired JSON file aside, then rerun apus doctor --fix.

Grounded backfill is useful for replaying older notes and inspecting what the system considers durable, without manually editing MEMORY.md.

apus memory rem-backfill --path ./memory --stage-short-term

The --stage-short-term flag stages grounded durable candidates into the same short-term dreaming store the normal deep phase already uses; it does not promote them directly. So:

To undo a replay without touching ordinary diary entries or normal recall state:

apus memory rem-backfill --rollback
apus memory rem-backfill --rollback-short-term

CLI

apus memory status          # Check index status and provider
apus memory search "query"  # Search from the command line
apus memory index --force   # Rebuild the index

Further reading

Related