OpenProgram Docs

Write strategy comparison

Mechanisms: Memory subsystem illustrated. Authoritative text: Overview. Missing features stay listed, because not building one is a choice.

Where the claims come from
FrameworkSource
claude-codePublic documentation; what it leaves unsaid reads Undocumented
Other third partiesCode snapshots in references/, with recorded lines
codex-cliIts snapshot is an internal build larger than the public version, so some capabilities are absent from public releases

Where our design fits

DimensionOpenProgramSame asDiffers
StorageFiles onlyclaude-codeopenclaw adds an index, hermes external services
Who writesAn agent outside the conversationcodex, openclawhermes relies on the main model remembering
What is writtenOriginals and distilled factsclaude-code, codex, pi-monoOnly ours footnotes each statement to its source
RetrievalBM25 by defaulthermes, codex—
Resident blocktopics/core.md rendered into MEMORY.md within 2000 tokensSeparates canonical content from budget, as claude-code, codex, openclawDeletes nothing
Nightly organizationYescodex, openclawWriting without organizing grows without end
Session structureDAG inside one sessionpi-monoThe others are linear or fork into new files
CursorA workspace marker on each nodeNoneFollows from the session structure, see Branches

Marker placement, fork traversal and recovery: Written marker, with diagrams in architecture section 04.

Is there long-term memory

FrameworkMemoryForm
claude-codeYesFiles only: MEMORY.md index, topic files
codex-cliYes, off by default~/.codex/memories/: MEMORY.md, summary pages, skill directory, session summaries; SQLite only schedules two-stage distillation
openclawYesMEMORY.md is canonical; SQLite is a rebuildable index of vector nearest neighbours and full-text ranking
hermes-agentYesMEMORY.md and USER.md; eight optional hosted services, one at a time
OpenProgramYesMarkdown workspace: topics/ and MEMORY.md; footnotes link chat messages
opencodeNoUser-written AGENTS.md or CLAUDE.md; no memory tool
pi-monoNoJSONL session tree for replay and branching; only AGENTS.md crosses sessions
pi-aiNoProvider SDK, 12 files, no session concept; the caller owns the message array
weclawNoWeChat bridge storing an opaque session id; the launched process owns memory

Classify by whether content returns to context. weclaw saves pasted URLs as Markdown, but no prompt reads them back. codex, opencode and pi-mono keep full transcripts that nobody distills or reads across sessions: storing originals is not memory.

Verified locations
FrameworkLocation
codex-climemories/write/src/lib.rs:116-118
state/memory_migrations/0001_memories.sql:1-35
Default off: features/src/lib.rs:996-999
openclawsrc/memory/root-memory-files.ts:4,8
extensions/memory-core/src/memory/manager-db.ts:10
.../manager-search.ts:148
opencodepackages/opencode/src/session/instruction.ts:60-68
Entire tool/ directory listed
hermes-agenttools/memory_tool.py:56-60,138-173
agent/memory_manager.py:258-280
pi-aiNo repository-wide grep matches; only OAuth credentials persist
pi-monopackages/coding-agent/src/core/session-manager.ts:428-436
weclawagent/cli_agent.go:25,226-231
OpenProgramopenprogram/state/memory/store.py

When writes happen

FrameworkTiming
claude-codeClaude writes during the session; when is undocumented
codex-cliFire-and-forget task at turn start; exits on low quota, handles only sessions idle over six hours, deduplicated by a database lease that records the watermark on completion
openclawCron, default daily 03:00; short-term entries promoted by six weighted criteria; no in-session writes
hermes-agentThe model calls a tool whenever it chooses; a background agent reminds it every ten turns
OpenProgramChecked each turn; writes at 16k tokens (8k, 16k or 32k by setting), writes the rest after 30 idle minutes, reorganizes at 03:00
pi-monoNo memory writes; original events persist synchronously
opencode, pi-ai, weclawNo writes

Three of four writers work outside the conversation, because memory edits add a call and distract the model from the task.

Verified locations
FrameworkLocation
codex-cliapp-server/src/request_processors/turn_processor.rs:578-591
memories/write/src/start.rs:23-81
memories/write/src/phase1.rs:149-187
openclawsrc/memory-host-sdk/dreaming.ts:17,36-39
extensions/memory-core/src/dreaming.ts:163-187
opencodeNo memory tools under tool/
hermes-agenttools/memory_tool.py:619-686
agent/conversation_loop.py:429-439
agent/background_review.py:34-43
pi-monopackages/coding-agent/src/core/agent-session.ts:515
OpenProgramopenprogram/state/memory/local_backend.py
openprogram/state/memory/session_watcher.py
openprogram/state/memory/scheduler.py

What is written

StoredWhoEffect
Originals onlyopencode, weclawKept to resume a conversation. In a new one they are effectively absent.
Distilled facts onlyhermes-agentSmall and fast. Tool text says: "Do not store logs; search past sessions for those." A wrong fact has no source to check.
Bothclaude-code, codex-cli, pi-mono, OpenProgramOriginals are append-only, facts may be rewritten. Only ours footnotes each statement to /s/<session>#<msg>.

codex distills twice: per-session into raw memories and a summary, then an agent without network or approval prompts rewrites MEMORY.md, summary pages and skill directories from those and a workspace diff. Writing and organizing are separate roles, like ours, but split by pipeline stage rather than time.

How unwritten content is identified

FrameworkFormStored in
hermes-agentNone; the model writes when it chooses. Persistence uses an integer index, compaction scans body markers.—
weclaw, pi-aiNone; weclaw has only a hard message-count cutoff—
codex-cliInteger timestamp watermark per session fileSQLite task table with lease and retry count
claude-codeUndocumented—
pi-monoOne entry id, firstKeptEntryId, scan backwardCompaction records in the transcript
opencodeMessage-level summary: true and a tail_start_idOn the messages
openclawEntry promotedAt timestamp plus an HTML deduplication comment, cross-checkingOn entries and in the MEMORY.md body
OpenProgramWorkspace marker memory_written_scriptorium on each node; inspect back from the branch tip to the first marked nodeSession node metadata
Verified locations
FrameworkLocation
codex-clistate/memory_migrations/0001_memories.sql:3,7,17-31
memories/write/src/phase1.rs:149-187
openclawextensions/memory-core/src/short-term-promotion.ts:84,1602-1612,1666-1669,1737
opencodepackages/opencode/src/session/message-v2.ts:535-586
.../compaction.ts:386,437-442
hermes-agentagent/agent_init.py:1026
agent/context_compressor.py:37-51,1215-1226
pi-monopackages/coding-agent/src/core/session-manager.ts:67-77,315-422
weclawagent/http_agent.go:151-154
OpenProgramopenprogram/state/memory/writing.py

Branches and restarts

m1 m2 m3 m4 m5 m6 Main branch, written b4 b5 b6 New branch, pending Shared prefix, one session id
  1. Shared prefixm1 m2 m3, one session id
  2. Main branch, writtenm4 m5 m6
  3. New branch from m3, pendingb4 b5 b6
Cursor on that DAGResult for the new branch
Position: written through 6b4, b5, b6 have indices 4, 5, 6 and are skipped
One id: written through m6m6 never appears on this branch
Per-node markerb4, b5, b6 are unmarked: pending. m1 to m3 carry markers, so inspection stops there.

Session structure

FrameworkBranchingImplementation
claude-codeYes, most complete/branch copies the session; /rewind rewinds conversation, files or both; subagents write separate files
codex-cliYescodex fork and TUI edits of earlier prompts create threads, source unchanged
openclawSubagents onlyDispatch can inherit the parent transcript or start clean; no old-message edit found
opencodeCopy; rewind deletesfork deep-copies. revert sets a marker, and the next prompt permanently deletes later messages, so editing an old message is irreversible unless forked first.
hermes-agentYes/branch copies into a session linked by parent id; compaction also makes child sessions, and /resume follows the chain to the latest
pi-monoTreesEditing an old message creates a sibling branch; leaving one can keep a generated summary
OpenProgramDAGsReasking, retrying and spawning agents branch from intermediate points; branches under one session id share prefixes
weclawNoOne session per WeChat contact; /new deletes the old one
pi-aiNo sessions—
Verified locations
FrameworkLocation
codex-clithread-store/src/types.rs:183-190
tui/src/app_backtrack.rs:7-8
rollout/src/recorder.rs:97-98
openclawsrc/agents/tools/sessions-spawn-tool.ts:190,307,343-344
Message editing: no grep matches
opencodepackages/opencode/src/session/session.ts:733-774
.../revert.ts:100-134
.../prompt.ts:1155-1159
hermes-agentcli.py:6682-6809
agent/conversation_compression.py:381-397
hermes_state.py:1851-1869
pi-monopackages/agent/src/harness/agent-harness.ts:788-812
.../branch-summarization.ts:200-262
weclawmessaging/handler.go:340-345
OpenProgramopenprogram/state/store/session/session_store/branches.py

The cursor after a fork

FrameworkCursor scope after a forkPrefix extracted again
codex-cliNew thread_id, the cursor table's primary keyYes, all of it; only Phase 2 consolidation merges semantically
claude-codeUndocumented—
openclawNew session, flush markers cleared on purposeYes; comments prefer repetition to omission from equal hashes
opencodeNew ids; tail_start_id translated through a lookup tableNo
hermes-agentNew session; index advanced by hand to the copied lengthNo. Compaction-created sessions reset to 0 because they start empty.
pi-monoNo cursor needed: walk leaf to nearest common ancestorNo; traversal excludes it
OpenProgramUnchanged; markers read back from the current tipNo
pi-ai, weclawNo forks; weclaw's /new clears the session—

Index and timestamp cursors need one line per scope, so they change scope at a fork, and that works because their forks copy content. Our forks copy nothing, so we record identities. pi-mono's alternative needs a comparison branch for every traversal; memory asks what is unwritten in the session and has no second branch to compare.

Verified locations
FrameworkLocation
codex-clithread-store/src/types.rs:78-79,97
state/memory_migrations/0001_memories.sql:1-12
state/src/runtime/memories.rs:104-108
memories/write/src/phase1.rs:290
openclawsrc/auto-reply/reply/session.ts:756-767,793-799
src/config/sessions/types.ts:370-371
src/auto-reply/reply/memory-flush.ts:117-123
opencodepackages/opencode/src/session/session.ts:748-758,767-769
.../compaction.ts:244-248
hermes-agentcli.py:6701-6705,6744-6756,6776-6777
agent/agent_init.py:1026
agent/conversation_compression.py:379-380,407-408
pi-monopackages/agent/src/harness/compaction/branch-summarization.ts:87-97
packages/agent/src/harness/agent-harness.ts:737-834
weclawagent/http_agent.go:76-78
OpenProgramopenprogram/state/memory/writing.py

Retrieval

PathWhoHowCost
Inject everythingopencode, pi-monoAll of AGENTS.md enters the system prompt; the model greps for finer detailNo infrastructure; large files exhaust the budget
KeywordOpenProgram, hermes, codexOurs: BM25, five results each turn, no model call (1 to 10 by setting; embedding, hybrid and agent are options). hermes: SQLite full-text session search. codex: line-by-line substring.Fast and explainable; paraphrases may miss
VectoropenclawNearest neighbours combined with full-text ranking; a subagent also searches before the user turn and inserts conclusionsEmbeddings, indexes, rebuilds: over half of 20,000-plus lines

Resident content when full

BlockLimitWhen fullDisclosure
claude-code MEMORY.md200 lines or 25KBThe rest does not load at session startError telling Claude to rewrite the index
claude-code CLAUDE.md4 MiB; under 200 lines advisedA file over 4 MiB is skipped—
codex-cliProject AGENTS.md 32 KiB shared; summary 2500 tokens; global unlimitedCut at the remaining-byte boundaryLog entry only
openclaw MEMORY.md10000 charactersRemoves only automatically promoted paragraphs, oldest first; handwritten text staysReturns removed dates
openclaw startup layer12000 per file, 60000 total characters75% head, 25% tail. AGENTS.md: 45% head, 35% regex-selected key lines, 15% tail.System-prompt warning, by default every time
hermes-agent2200 and 1375 charactersRejects the write; the model frees space with replace or removeUsage and limit returned to the model
OpenProgram2000 tokens, counted with tiktokenRenders paragraphs in file order until the next does not fit. topics/core.md is not changed.Reports what was left out; it stays searchable
opencode, pi-monoAGENTS.md unlimited, confirmed——
pi-ai, weclawNo block; weclaw has a fixed configured prompt——
Verified locations
FrameworkLocation
codex-clicore/src/config/mod.rs:211
core/src/agents_md.rs:94,116-124
ext/memories/src/lib.rs:16
openclaw MEMORY.mdextensions/memory-core/src/memory-budget.ts:25,100-164
short-term-promotion.ts:1719,1762
openclaw startupsrc/agents/pi-embedded-helpers/bootstrap.ts:88-89,96-102,158-165
opencodepackages/opencode/src/session/instruction.ts:91-93,155-169
hermes-agenttools/memory_tool.py:149,295-306,359-366
pi-monopackages/coding-agent/src/core/system-prompt.ts:61-68
weclawconfig/config.go:28
OpenProgramopenprogram/state/memory/management/config.py
openprogram/state/memory/runtime/derived_views.py
openprogram/state/memory/management/block_views.py

Maintenance and new facts after saturation

FrameworkCanonical sourceMaintenanceAfter saturation
claude-codeTopic files; MEMORY.md is only an indexClaude is reminded to shorten the index near a limitThe write succeeds; Claude is told to rewrite the index
codex-cliSQLite, then raw-memory file, then memory_summary.mdFull rewrite at session start with six-hour cooldown; prunes entries unused for 30 daysRewritten each round; 2500-token cut at injection
openclawMEMORY.md, hence ownership-based trimmingDaily 03:00 cron after the dream pipelineOldest automatic text trimmed first; writes continue
hermes-agentThe file itselfNone, the only oneThe main model must first make room
OpenProgramtopics/core.md; the block in MEMORY.md is derivedRebuilt with other derived views after every installed transaction; nightly organization edits Topics onlyTopics still accept writes; over-budget content stays retrievable
opencode, pi-monoHandwritten fileNot applicableNo limit
Lessons on trimming
LessonFor us
Line counts cannot limit long linesNot adopted: another write-path gate would still exclude stable facts. Ours counts tokens at rendering.
Trim by ownership, not ageNot adopted: it matters when the file is the sole copy. Our block is derived, so omission destroys nothing.
Limit all relevant contentcodex omits global AGENTS.md; claude-code stops a CLAUDE.md only at 4 MiB
Disclose truncationcodex only logs it, so user and model never know. Ours reports it.

The decision and rationale: What to adopt after comparison, section 02.

Verified locations
FrameworkLocation
codex-clistate/src/runtime/memories.rs:21
memories/write/src/phase2.rs:139-166
memories/write/src/phase1.rs:110-133
ext/memories/src/lib.rs:16
openclawsrc/memory-host-sdk/dreaming.ts:17
extensions/memory-core/src/memory-budget.ts:25,100-164
.../short-term-promotion.ts:1706-1727
hermes-agenttools/memory_tool.py:149,295-306
No matches: consolidate, distill, prune, compact, dream
opencode, pi-monopackages/opencode/src/session/instruction.ts:60-93
packages/coding-agent/src/core/resource-loader.ts:57-100

Implementation size

FrameworkLines, no testsCovers
openclaw34,000Vectors, full-text, dream pipeline, promotion ranking. Two alternative backends add 12,000, excluded.
OpenProgram11,600All of openprogram/state/memory/: writing, transactions, retrieval, topic format, nightly organization. None is compaction.
codex-cli8,900 + 3,700Two-stage distillation and read path. About 60,000 transcript and fork lines are not memory.
hermes-agent2,800 + 2,400Eight optional service plugins total 11,600, all off by default
pi-mono5,000Session tree and compaction, the same logic twice; 0 long-term memory
opencode1,550Compaction and storage; 0 long-term memory
weclaw200Session-id bookkeeping
pi-ai0—

Vectors, embedding caches, index rebuilds and hybrid ranking dominate openclaw. Maintaining an index, not having memory, is the divide.

Practices worth borrowing

FromPracticeOurs
codex-cliWriter lease from a SQLite table with retry counts and last watermark; checks quota firstCross-process write lock, one-second timeout; the idle watcher keeps failures by the scope of their cause (conversation, memory, sign-in) in ingest-state.json; failures reach writer status and a memory_writer_failed frame
codex-cliThe model embeds a hidden marker naming memory it used; the server counts it and strips it. Counts rank content at organization.Not built; nightly organization merges by content
openclawDeduplication in two copies that check each otherNode marks alone; Topic footnotes name the same messages without cross-checking
pi-monoA generated summary on leaving a branchNot built

Implementation status

StatusItems
Implementedtopics/core.md as canonical resident source, per-node workspace markers, live-branch enumeration at session boundaries, Topic footnotes preserving Source references
Not yetIndex-free selection from Topic self-descriptions, retrieval usage as organization input, direct writer notification on head changes instead of post-turn thresholds or the idle watcher
Last updated · 2026-11-25