OpenProgram Docs

Memory introspection

Asked how its memory works, an agent with no answer in context searches the disk and describes whatever other harness it finds there. This page covers what each turn tells the model. The memory subsystem itself: Memory overview.

What each turn tells the model

QuestionAnswer todaySource
Do I have long-term memory?Impliedmemory_search, memory_get, memory_update in the deferred catalog; no sentence says so
Where is it on disk?Unknown<environment> states OS, shell, working directory and repository only
Is this block memory?Partlyfence_memory says recalled content; no owner or source
Complete or summary?UnknownRendered under a token budget; not stated
How do I see the rest?Yestool_search loads the three tools
Empty or broken?UnknownSee below
Harness or project?PartlyThe base prompt names OpenProgram; its state location is not stated

The memory block

fence_memory wraps both paths in <memory-context> with one note, written so recalled facts do not read as new requests.

PathContentLands in
ResidentEach layer's MEMORY.md: map, then core, general to specific (LocalMemoryBackend.system_prompt)System prompt, L1 order 30
Per-turn recallSearch results for the turn (search)Prefix inside the current user message

Fencing is not idempotent: sanitize_context removes a whole <memory-context> block, body included, so fencing twice returns an empty fence. Identity must replace the opening sentence, never add a wrapper.

Silent failures

LayerOn failure
_core_block, system_promptOSError: empty string, same as a file with nothing in it
ScopedBackend._readAny exception: empty string
_build_memoryAny exception: empty string
assemble_sectionsSkips a failing component; empty strings are dropped
build_system_promptFalls back to the agent's inline prompt

Under a required policy these raise MemoryPolicyError and end the turn. Otherwise require_or_empty records MEMORY_UNAVAILABLE and emits memory.degraded, which the model never sees.

StateModel seesShould conclude
memory.backend = noneNothingNothing; the user's decision
Empty workspaceNothingNo record yet; normal
Read failedNothingUnavailable; never "the user did not tell me"

Eight implementations

Says it has memoryTools by defaultEmpty or failedHost vs project
OpenProgramNames only3, deferredSilentName only
hermes-agentYes, most explicit1 (add, replace, remove)Silent when empty; tool calls reportYes: memory is about the user
openclawYes2All three visibleYes
opencodeModel-dependent0; read, write, grepSilentPaths only
pi-monoNo0SilentPaths only
claude-codeYes, with path0; files through generic toolsPlaceholder for subagents onlyYes: five source labels
codex-cliWhen enabled4, two switches offMissing memory silent; retired instructions announcedYes
weclawNo concept0Not applicableNo

pi-ai is a read-only snapshot of pi-mono's transport layer: no agent loop or prompt assembly, so every question is not applicable.

How each one injects and labels memory
InjectionLabel
hermes-agentVolatile section of a three-part prompt, snapshotted at session start (agent/system_prompt.py)Banner, title and live character count (tools/memory_tool.py)
openclaw# Project Context section, MEMORY.md last (agents/system-prompt.ts)Heading, per-file introduction, ## MEMORY.md; ## Memory Recall names the tool to call
opencodeOne prompt item; nested AGENTS.md as a read-tool suffix (session/instruction.ts, tool/read.ts)A path line; nested content in <system-reminder>
pi-mono<project_context> between identity and skills (core/system-prompt.ts)Tag and per-file path attribute; memory never named
claude-codeUsage guidance in the system prompt; content in a first synthetic user messageOuter <system-reminder>; each file labelled with path and owner and scope
codex-cliAGENTS.md in user-role fragments, memory summary in developer-role fragments# AGENTS.md instructions, <INSTRUCTIONS>; delimiter lines around the summary
weclawConfigured static string (agent/cli_agent.go)None
What a label should answerWho answers it
What is this block?claude-code, openclaw, hermes; OpenProgram only as recalled content
Who wrote it?claude-code is the most precise
How do I see more?openclaw, claude-code, hermes
How much is there now?hermes alone
Tools and failure handling in detail
  • openclaw's memory plugin is the default slot; its tool description makes recall mandatory and requires surfacing disabled=true to the user. Failed retrieval returns disabled, unavailable, a warning and an action. An empty workspace is declared normal in its bootstrap template.
  • hermes has no list action; every write returns the full list.
  • codex-cli has List, Read, Search and AddAdHocNote behind Feature::MemoryTool (off) and memories.dedicated_tools.
  • OpenProgram's memory writer is a detached session with its own system prompt and only the memory tools, so the host's CLAUDE.md never reaches it (runtime/conversation/memory_agent.py). The reading agent has no equivalent statement.

Changes

ChangeWhatWhereStatus
A. Catalog names memoryThree memory_* tools in the default set, deferredprograms/__init__.pyBuilt
B. Resident identityfence_core beside fence_memory, sharing sanitize_context; opens <memory>. Recall path unchangedstate/memory/backend.py, local_backend.pyNot built
C. Three statesOff: nothing. Empty: one line, healthy. Failed: one line, absence proves nothing_build_memoryNot built
D. Host<environment> names the harness and its state directoryenvironment_blockNot built
What the model would see after B and D
<memory>
[System note: this is your long-term memory, the always-on summary the
 memory subsystem keeps at ~/.openprogram/memory. It is written in the
 background, not by the user, and it is a summary under a token budget.
 Browse the rest with memory_get / memory_search.]
…rendered MEMORY.md…
</memory>

<environment>
OS: Darwin · Shell: bash (/bin/bash)
Harness: OpenProgram · its own state lives at ~/.openprogram (not the project you are working on)
…
</environment>

Cost per turn

OptionTokens
Three names in the catalog (chosen)8
Three schemas resident (rejected)About 1045: memory_search 208, memory_get 216, memory_update 621; rarely called
Prose identity (B and D)About 65, in the cached prefix
Empty or failed turn after COne status line replaces the resident block; net saving

Both are needed. The model trusts its tool list, which is cheap; prose answers what a name cannot: location, completeness, authorship.

Further out

TargetNeedsWhy not yet
Memory describes itself: name, root, topic count, last write, budget usedMemoryBackend.describe()The interface stays small; C covers failures
Each component declares its source, as Contents of {path} ({owner})An origin field; edits to every builder; every cached prefix invalidatesOne block causes the problem; untagged components (base, inline_prompt, current_date) can wait
context_status tool: what this turn saw, which block is memory, what was absentExpose context/token_accounting/breakdown.py to the modelA and C give the needed knowledge
Status lines carry checkable quantitiesdescribe(), as aboveDo with the first item, to change the interface once

Composition: what else is in each call

Last updated · 2026-11-25