OpenProgram Docs

Adoption and adaptation

What happens to each practice picked out by the framework comparison. Design: overview. Mechanisms: illustrated.

Four decisions

PracticeFromDecisionReason
Retrieval without an indexclaude-codeRejectedThe extra model call buys semantic lookup without an index. An index already exists, at finer than file granularity.
Trim resident content by ownershipopenclawAdapted, builtOwnership matters only when removal destroys content, so the resident section is derived instead.
Summarize a branch on leaving itpi-monoAdapted, builtThe goal stays, the summary node goes: session boundaries visit every live branch.
Lost cursor means nothing writtenclaude-codeAdopted, builtRepeated writes cost a bounded amount; a silent stop does not.

Retrieval without an index

OpenProgramclaude-code
SelectionIndex search before each turnA small model picks from a list of one-line file descriptions
Resultretrieval_top_k paragraphs (default 5, at most 10) with block IDs and footnotes, fenced into the promptFive filenames; the Agent then reads them
Extra model round trips per turn01, while the user waits
MaintainedBM25 and retrieval/embedding.py indexesNothing: no inverted index, vectors or cache, part of why its implementation is the smallest compared
Cut-offDropped only at lexical<=0 and adjustment<=0.02, so one shared word is a hit and an unrelated turn still gets paragraphsOmit uncertain matches, prefer empty (findRelevantMemories.ts)
PartDecision
The model callNot taken. It would pay every turn for what the index already does.
File descriptionsNot taken. Results are paragraphs, and a path such as topics/people/dave.md already describes its one topic. Strict parsing also rejects an introductory paragraph or blockquote (TopicFormatError: memory block ID required); only an HTML comment passes.
"Prefer empty"Taken as a minimum score for results.

Search time by workspace size

Topic bytesFirst searchNew process, cache on diskSame process, files unchanged
0.5 MB108 ms57 ms50 ms
3.35 MB584 ms413 ms342 ms
9.8 MB1832 ms1216 ms1101 ms

Synthetic workspaces in the real format, 12 blocks per file, mean of three runs on one machine. Parsing is cached by file signature, but every search rebuilds the scoring corpus, so time stays linear in bytes. That cost is local and fixable; an added model round trip can only be avoided.

Trimming resident content

The resident section is the core of MEMORY.md, rendered from topics/core.md.

openclawOpenProgram
Who writesAutomatic promotion and hand edits, in one fileWriters and people edit topics/core.md; the Runtime renders the section
Limit10000 charactersRender budget core_max_tokens, 2000
When fullRemoves oldest automatic paragraphs, keeps hand-written ones (memory-budget.ts)Renders in file order until the next paragraph does not fit; a heading left with nothing under it goes too
Removal destroys contentYes, so ownership must be trackedNo: the rest stays in the source, indexed and citing its evidence
RunsDuring writesAfter each write, with timeline/, recent_events.jsonl and relations.json
ReportsRemoved dates, to the callerRendered tokens and left-out block IDs, on last_core_block

To keep a paragraph resident, move it earlier in the file. No marker exists for this.

Why a derived section, and a budget rather than a limit that rejects
ConcernEffect
Block IDsEvery block ID present before an edit must survive it, or the transaction fails with block ID must not be removed. Trimming a file that holds the only copy of an ID cannot pass. Rendered IDs are always a copy of an ID in topics/.
A rejecting limitOne overflow would roll back the whole transaction, Topic changes included, and every later stable fact would be sent elsewhere, leaving the section frozen.
One file kindtopics/core.md follows the Topic contract. validate_writable_path refuses edits outside topics/**/*.md with READ_ONLY_PATH.
Old root core.mdpromote_legacy_core moves it into topics/ once.
ReorganizationThe organize prompt keeps topics/core.md to facts useful across most interactions; being past the budget is no reason to keep a paragraph. Size-based splitting skips this file.

Reporting whether anything changed

Reorganization rests on model judgment, and a model that finds nothing to do does nothing. reorganize returns changed_files beside topics, the count of files examined, so an empty list is visible.

Departed branches

shared prefix Current head always written Long branch left written at the token threshold One-turn retry below the threshold, skipped Rewound filtered out by get_branch
  1. Current headalways written
  2. Other live tipslong branch left: written at the token thresholdone-turn retry: below the threshold, skippedrewound: filtered out by get_branch

The idle watcher's forced write calls list_branches, skips archived branches, then get_branch(session_id, tip) for each. Written markers cover shared prefixes. Post-turn writes follow the head only.

Why not pi-mono's summary node (branch-summarization.ts)
PointReason
Destinationpi-mono has only session JSONL and AGENTS.md, so a summary is the only place abandoned statements can go. Here facts belong in Topic files; a node on the DAG has no footnotes or block IDs and cannot be retrieved.
Another locationCompaction summaries in context/summary already attach to the DAG, for the context window. A second kind is one more place to look.
No leave eventNeither head movement nor branch switching is an event. Head writes are spread across set_head, append_message, SessionNodeWriter.append, update_session and rewind, and SessionMemoryIndex.set_head discards the old value. Copying pi-mono would add an event and retain the old head for work that serves equally well at session end.
Deliberate abandonmentNeeds no inference: rewinding marks a segment rewound; its nodes stay in the graph and leave the conversation path.
Idle ruleshould_incremental_write also fires when anything is pending and the last message is an hour old, which every left branch satisfies. Non-head branches check the token threshold first, so one-turn retries are skipped.

Cursor fallback

ItemBehaviour
claude-codeThe cursor is a message UUID. If that message is gone, everything counts as unwritten, because returning zero messages would end extraction for the session.
Rule hereUnreadable accounting means nothing was written, never an exception that blocks writing for good. Rewriting a batch is bounded, and transactions merge paragraphs stating the same fact.
Node markersWritten state is a marker on session nodes (memory_written_scriptorium), so no cursor file can go unreadable. A missing marker causes repeated work.
runtime.jsonMissing, unparsable or the wrong shape: RuntimeStateStore.load returns empty state. The file counts toward the workspace revision, so restored content does not pair with newer state.
UpgradesA separate, one-time case with the same tradeoff: see written markers.

Change locations

Paths under openprogram/state/memory/. The rejected practice changes none.

PathRole
Derived core
runtime/derived_views.pyrender_core_block, promote_legacy_core
runtime/memory_guide.pyWrites the core between its markers in MEMORY.md
management/block_views.pyCalls the render after the other views
management/transaction.pyWritable paths
prompts/write.py, prompts/system.py, prompts/organize.pyDirect agents to topics/core.md
All branches at session boundaries
writing.py_eligible_session_branches, forced write loop
session_watcher.pyIdle entry, force=True
Unreadable state
runtime/state.pyload
Node markers
runtime/online.py, writing.pyMarker reads and writes at the _records boundary

Implementation status

StatusItems
ImplementedDerived core, all-branch writes at session boundaries, unreadable state as empty state, node markers, changed_files
Not yetA minimum result score; search that does not rebuild the scoring corpus; a writer notified directly by head changes (post-turn thresholds and the idle watcher trigger writes)
Last updated · 2026-11-25