The idea: a notebook, not a transcript

Conversation history records what was said. Memory stores selected facts, decisions, evidence, and lessons that can help future work. A wiki is a browsable document collection. Use memory for small reusable facts and a wiki for source material you want to search and cite.

Try session-scoped memory:

mini-a memoryusersession=true

Give the agent a task with a useful preference, then inspect /stats memory. The preset creates a local session memory channel. memoryuser=true instead supplies both session and global stores for reuse across sessions.

Memory is selective: a fact in the chat is not proof that it became a durable memory. Reflection may run after the answer in a background queue. Use the manager to inspect what was actually saved:

mini-a memoryman=true

Configure the same custom channels in the manager if your session used them. See retention and memory controls.

Working Memory

For long-running or multi-step goals, Mini-A can maintain a structured working memory that persists key findings, decisions, and evidence across tool calls and even across sessions. Working memory drastically increases reasoning coherence on long tasks while saving context window costs.

mini-a goal="Deep code analysis of auth module" usememory=true

Memory is organized into 8 typed sections:

Section What is stored
facts Confirmed facts and verified findings discovered during the run
evidence Direct observations, benchmarks, and tool outputs worth keeping
decisions Design/workflow choices made and their underlying rationale
risks Identified risks, sub-agent errors, or validation blockers
openQuestions Unresolved questions to follow up on or clarify
hypotheses Candidate approaches or theories under consideration
artifacts Excerpts of generated files, configurations, or schemas
summaries Condensed narrative summaries of completed milestones

Core Mechanics: Compaction & Deduplication

  • Fingerprint Deduplication (memorydedup=true): Near-duplicate entries in the same section are automatically suppressed based on an 85% word-overlap similarity fingerprint, keeping the store clean.
  • Automatic Compaction (memorycompactevery=8): Every 8 appends, Mini-A runs a compaction pass. It keeps section sizes under memorymaxpersection (default: 80) and the total store size under memorymaxentries (default: 500).
  • Priority Eviction: If compaction needs to prune entries to fit limits, it prioritizes keeping higher-value sections. The eviction order (least important to prune first) is: decisions > evidence > risks > facts > summaries > hypotheses > openQuestions > artifacts.

Scope & Persistence

Working memory operates across two independent scopes:

  1. Session Scope: Scoped strictly to the current conversation ID or namespace.
  2. Global Scope: A shared store accessible by any agent session pointing at the same channel.

OpenAF Channel Definitions

By default, memory is held in-process (RAM-only). You can persist it across runs by passing standard OpenAF channel definitions to memorych (global store) and memorysessionch (session store):

# Persist global memory to a local JSON file channel
mini-a goal="Analyze AWS server configurations" \
  usememory=true \
  memorych="(name: my_mem, type: file, options: (file: '/tmp/mini-a-global.json'))"

# Persist global memory to a shared Redis channel
mini-a goal="Distil system requirements" \
  usememory=true \
  memorych="(name: redis_mem, type: redis, options: (host: 'redis.internal', port: 6379, key: 'mini-a-global-memory'))"

Scope Routing (memoryscope)

Use memoryscope to control how stores are accessed:

  • session: Current run/session only (reads and writes isolated).
  • global: Shared store only.
  • both (Default): Reads from both global and session memory. Writes default to session first, then auto-promote to global at session end.

Convenience Presets

To avoid manually writing channel definitions, Mini-A provides two local-development shortcuts:

1. Developer Workspace Preset (memoryuser=true)

Activates working memory, creates ~/.openaf-mini-a/ automatically, and sets up separate file-backed global and session channels. It also:

  • Defaults memorypromote="facts,decisions,summaries" to automatically carry facts, decisions, and summaries over to the global store at the end of the session.
  • Defaults memorystaledays=30 to run a staleness sweep, marking entries older than 30 days as stale (which are pruned first during compaction).
mini-a goal="audit code security" memoryuser=true

2. Isolated Local Preset (memoryusersession=true)

Activates working memory, creates ~/.openaf-mini-a/, registers a local file channel for the session store, but forces memoryscope=session. This lets you keep local history of your session without promoting any facts or decisions to your shared global store.

mini-a goal="sandbox testing" memoryusersession=true

How is memory presented to the LLM? Controlled by memoryinject:

Full Context Mode (memoryinject=full)

Embeds the entire, compact snapshot of all working memory entries directly in the system prompt on every step. While useful for short tasks, it can bloat context windows on long-running tasks.

Dynamic Search Mode (memoryinject=summary)

Only injects per-section entry counts into the prompt (e.g., workingMemory: { facts: 12, decisions: 3 }), reducing the prompt space used by memory. The reduction depends on the entries and model.

The agent is equipped with a built-in memory_search action. When it needs to recall past facts or decisions, it calls memory_search programmatically:

{
  "thought": "I need to review our past database indexing decisions before refactoring",
  "action": "memory_search",
  "params": {
    "query": "indexing",
    "section": "decisions",
    "limit": 5
  }
}
  • query (string, required): Keyword string to match against entry content.
  • section (string, optional): Filter results to a specific section (e.g., facts, decisions).
  • limit (number, optional, default: 10): Maximum results to return.

Relevant Durable Memory (memoryinject=relevant - Default when enabled)

Starts from the same compact counts as summary, then injects up to memoryrelevantcap (default 8) non-stale durable entries that match the goal. This avoids repeatedly searching for established preferences and validated procedures without exposing transient tool observations on every run.

Deliberate durable memory

With usememorywrite=true (the default), the model can use memory_write to save typed knowledge deliberately. It accepts a required kind (preference, environment, procedure, pitfall, or reference) and value, plus optional stable key, tags, and ttlDays.

Writes remain session-scoped at first. A model-authored record only becomes global after the same keyed record is confirmed in two separate runs, protecting the durable store from one-off or untrusted content. Set memorywritemax (default 20) to bound writes per run, or disable the action with usememorywrite=false.

For a human-readable, versionable global store, set memorymd=true on memorych:

mini-a goal="capture repository conventions" usememory=true \
  memorymd=true \
  memorych="(name: mini_a_global, type: file, options: (file: './agent-memory.json'))" \
  memorysessionch="(name: mini_a_session, type: file, options: (file: '/tmp/mini-a-session.json'))"

The channel contains a generated MEMORY.md index and one Markdown record per memory entry, including YAML front matter for metadata. Memory compaction removes evicted records too, so tune the normal memory limits for long-lived stores.

End-of-run reflection

Models rarely call memory_write on their own, so memoryreflect=true (the default with usememory=true) adds one reflection call at the end of a successful run that used at least memoryreflectmin (default 2) tool or shell calls. The call uses memoryreflectmodel, then OAF_REFLECT_MODEL, then the low-cost model, then the main model.

memoryreflectmode Behavior
background (default) Queue a snapshot under ~/.openaf-mini-a/reflection-queue; console and web sessions consume it once foreground work is idle
sync Reflect before the run returns (can delay completion)

In background mode, a one-shot CLI run processes at most one older job after printing its output and leaves the current job queued. Failed jobs stay inspectable after three attempts, and malformed files are renamed .invalid. The queue keeps up to 256 job files and never evicts pending ones. Use persistent memory channels if reflection must span CLI invocations. memoryreflect=false disables both queueing and consumption.


Interactive Memory Manager TUI (memoryman=true)

Mini-A includes an interactive Terminal User Interface (TUI) to inspect, manage, search, and prune memory stores manually.

# Open the memory manager using the default user-local channels
mini-a memoryman=true usememory=true memoryuser=true

# Open the memory manager targeting custom channels and a session namespace
mini-a memoryman=true usememory=true \
  memorych="(name: g, type: file, options: (file: '/tmp/global.json'))" \
  memorysessionch="(name: s, type: file, options: (file: '/tmp/session.json'))" \
  memorysessionid="demo-session"

TUI Features:

  • ๐Ÿ“Š Summary: Displays per-section entry counts, unresolved open questions, and stale counters.
  • ๐Ÿ“ƒ List entries: Browses all entries in a specific section, with options to filter by stale or unresolved status.
  • ๐Ÿ”Ž Inspect entry: Displays full payload details, including creation timestamps, confirmation counts, and tags.
  • ๐Ÿงฝ Delete by ID: Manually deletes a single memory entry.
  • โณ Delete older than: Batch prunes memory by relative age (e.g., 30d, 12h, 90m) or specific dates.
  • ๐Ÿ” Search entries: Keyword searches across entry values, IDs, and tags.
  • ๐Ÿงฐ Maintenance: Manually triggers compaction, sweeps stale global entries, or clears the store.
  • ๐Ÿ’พ Export snapshot: Exports a clean JSON backup of the active memory store.

Programmatic Embedding API

If you are embedding the Mini-A SDK inside your own Javascript/OpenAF applications, you can manage the working memory subsystem programmatically:

var agent = new MiniA();

// Start the agent with memory enabled
agent.start({
  goal: "Refactor legacy parser",
  usememory: true,
  memoryuser: true
});

// 1. Manually promote specific session entries to the global store
agent.promoteSessionMemory("decisions", ["entry-id-1", "entry-id-2"]);

// 2. Clear session memory for a given session
agent.clearSessionMemory("my-session-id");

// 3. Trigger auto-promotion & staleness sweeps programmatically
// (Done automatically at the end of the session when 'memorypromote' is configured)
agent._autoPromoteSessionToGlobal();

// 4. Find near-duplicate entries in global memory
var match = agent._globalMemoryManager.findNearDuplicate("facts", "Authentication is handled by Keycloak");
if (match) {
  // Clear the stale status by refreshing confirmation count
  agent._globalMemoryManager.refresh("facts", match.id);
}

// 5. Sweep stale global entries older than N days
var markedCount = agent._globalMemoryManager.sweepStale(30);

See Configuration โ†’ Working Memory for the full parameter reference.

Optional embeddings

Set OAF_EMBED_MODEL to an independent embedding configuration to add hybrid retrieval to already enabled history and skill discovery. This requires an OpenAF runtime supporting $gpt(chatConfig, embeddingConfig); unsupported runtimes retain lexical search.

export OAF_EMBED_MODEL='(type: ollama, model: embeddinggemma-2)'
mini-a usehistory=true historyvm=true useskills=true

Embeddings do not enable history or skills. History remains scoped to the active conversation branch and is recalled when requested. Use historyembeddings=off or skillsembeddings=off to disable an integration; history search mode=exact retains prior matching behavior. Explicit skill requests are unchanged.

embeddingmaxcalls=9 bounds each search to eight missing content vectors plus a query vector. Cold searches report partial semantic coverage and progressively fill the cache. Failures preserve lexical results; three consecutive failures trigger a 60-second cooldown. Text eligible for embedding is sent to the configured provider. Vectors are cached at <conversation>.historyvm/embeddings.db and ~/.mini-a/cache/skill-embeddings.db; stop Mini-A before deleting caches to rebuild them.

/stats, JSON exports and Advanced Statistics report calls, cache hits, failures, time and provider-reported usage separately from generative tokens. Missing usage is shown as unavailable. Wiki embeddings remain an evaluation facility and are not enabled in ordinary wiki ingestion/search; configuring this model does not switch wiki retrieval to vectors.