OpenProgram Docs

Management comparison

DimensionClaude CodeOpenCodeOpenClawOpenProgram
Design philosophyFile as data, append-onlyRelational database, structured queriesRegistry + transcriptAppend-only session log + DAG + registry
Listing performanceSlowest (scan directory + read files)Fastest (database index)Fast (read one JSON file)Fast (in-memory resident registry)
Metadata richnessLow (title + a few status markers)Medium (10 fields)Highest (around 70 fields)Medium (around 20 fields)
Maintenance capabilityNoneNoneMost complete (expiry/capacity/rotation/budget)Startup repair and quarantine; no expiry or cap
Concurrency capabilityWeak (single-process writes)Strong (SQLite WAL)Medium (file lock + queue)Medium (per-session locks, one writer per log, single worker)
Branching capabilityYes (DAG, UI does not expose it)NoneNoneYes (DAG, UI can switch)
Channel supportNoneNoneYes (full routing fields)Yes (channel/account_id/peer)
Archive/pinNoneNoneNoneYes (pinned/archived/group)
Crash recoveryNo automatic recoveryNot needed (single process)No automatic recoveryStartup status repair, runs continued from the journal, registry rebuilt from logs
Empty-shell protectionNot needed (file is content)Not needed (data exists on INSERT)Not neededImmediate first append + startup quarantine
Storage Format
Claude CodeOpenCodeOpenClawOpenProgram
Storage mediumFilesystem (one JSONL per session)SQLite database (single file opencode.db)JSON registry (sessions.json) + one JSONL per sessionOne directory per session holding append-only JSONL logs + JSON registry (.chats-index.json)
Metadata locationMixed into the JSONL (ai-title, custom-title, mode, and other entries)sessions table (10 fields)The SessionEntry in sessions.json (around 70 fields)meta.patch lines in the session log; .chats-index.json caches a summary
Message locationSame JSONL file (user, assistant entries)Dedicated messages table + parts column (JSON array)Dedicated <id>.jsonl transcript filenode.* lines in the session log (DAG)
File snapshotsfile-history-snapshot entries in the JSONLDedicated files table (path, content, version)None.file-recovery/<session_id>/<turn>/ per-turn undo recovery; a session can also work in a Git worktree
Storage path~/.claude/projects/<slug>/<uuid>.jsonl<data_dir>/opencode.db<state>/agents/<id>/sessions/sessions.json + <id>.jsonl<state>/projects/<project_id>/chats/<id>/ (main.jsonl, agents/, …) + <state>/projects/.chats-index.json
Metadata/message separationNot separated, all in one fileSeparated (different tables)Separated (different files)Same log, separate line types; the registry holds summaries
Session Metadata Fields
Field categoryClaude CodeOpenCodeOpenClawOpenProgram
idJSONL filename (UUID)sessions.id (UUID)sessionIdid (UUID)
TitleTwo separate entries, aiTitle + customTitleSingle sessions.title fielddisplayName + labelSingle title field
Title prioritycustomTitle > aiTitle > summaryHint > firstPrompt > idLast value writtendisplayName > labelLast value written; a typed title locks it (_user_titled)
Created timetimestamp of the first message in the JSONLsessions.created_atstartedAtcreated_at
Updated timeFile mtime or sidecarsessions.updated_at (trigger-driven)updatedAt (written by the application layer)updated_at (written by the application layer)
Message countNonesessions.message_count (trigger-driven +1/-1)NoneNone
token statsNone (present in usage but not aggregated)prompt_tokens / completion_tokens / costinputTokens / outputTokens / totalTokens / estimatedCostUsd / cacheRead / cacheWrite / contextTokensNone (accounted in usage.db)
Run statusstatus in ~/.claude/sessions/<pid>.json (idle/busy)Nonestatus (running/done/failed/killed/timeout)status enum (idle/running/needs_input/done/failed/interrupted/cancelled), repaired on startup
Parent/child relationshipsNoneparent_session_id (child sessions used for title generation and tasks)spawnedBy / parentSessionKey / spawnDepth (0=main, 1=subagent, 2=sub-subagent)No session field; a Job records parent_session_id
Channel/sourceNoneNonechannel / groupId / origin (includes label/provider/surface/chatType/from/to/nativeChannelId/accountId/threadId) + lastChannel / lastTo / lastAccountId / lastThreadIdsource / channel / account_id / peer_display / peer_id
Model/configmode, permission-mode entries in the JSONLNone (runtime state)providerOverride / modelOverride / modelOverrideSource / authProfileOverride / thinkingLevel / fastMode / verboseLevel, etc.A settings record per conversation branch in session metadata (Agent, model, effort, permission mode); additional working directories per session
Compactionsystem:compact_boundary entry (preTokens/postTokens/preservedSegment)summary_message_id points to the summary messagecompactionCount / compactionCheckpoints array (each entry has tokensBefore/tokensAfter/summary)compactionSummary message node (a special node in the DAG, source="compaction")
Project bindingImplicitly bound via the directory path (projects/<slug>/)NoneNone (implicit via the agent directory)project_id field + placement under projects/<project_id>/chats/
Git branchgitBranch field in the JSONLNoneNoneDAG branches (head_id + branches map)
PreviewNo dedicated field (firstPrompt extracted from the tail when listing)NoneNonepreview (registry field, updated on append_message)
Archive/pin/groupNoneNoneNonepinned / archived / group
Unread markerNoneNoneNoneunread (set when a background run completes, cleared on open)
Queue policyNoneNonequeueMode (7 modes: steer/followup/collect/interrupt, etc.) / queueDebounceMs / queueCap / queueDropNone
Subagent roleNoneNonesubagentRole (orchestrator/leaf) / subagentControlScopeNone
HeartbeatNoneNonelastHeartbeatText / lastHeartbeatSentAt / heartbeatTaskStateNone
Memory flushNoneNonememoryFlushAt / memoryFlushCompactionCount / memoryFlushContextHashNone
CLI bindingNoneNonecliSessionIds / cliSessionBindings / claudeCliSessionIdNone
Auto-naming markerNone (inferred from whether a customTitle entry exists)None (inferred from an isDefaultTitle regex)None_auto_titled (no re-truncation), _user_titled (lock), _title_gen_count
Session Listing
Claude CodeOpenCodeOpenClawOpenProgram
MechanismScan directory + read file tailsSQL queryRead sessions.jsonRead the .chats-index.json registry
IndexNoneDatabase indexThe registry itselfRegistry (.chats-index.json)
Detailed flowreaddir → stat to get mtime → sort by mtime descending → batch-read tail content (32 per batch) → string-search to extract title and other fieldsSELECT * FROM sessions WHERE parent_session_id IS NULL ORDER BY created_at DESCfs.readFileSync → JSON.parse → return the entire Record<string, SessionEntry>On startup, read .chats-index.json into memory → list_sessions() is a pure in-memory traversal
Read volumeRead tail content of each file (string search, no JSON.parse)One SQL statementOne fileOne file (on startup), pure in-memory thereafter
FilteringScans only the current project directory (implicit per-project filtering)WHERE parent_session_id IS NULL (filters out child sessions)NoneArchived rows hidden by default; field filters
SortingBy file mtime descendingORDER BY created_at DESCThe caller sorts on its ownIn memory, by updated_at descending
PaginationNoneNoneNonelimit + offset
SearchNoneNoneNoneNone
CacheOptional sidecar .ccr-tip.json (stores last event ID + update time, avoids reading file content)SQLite page cache (8MB)mtime + fileSize used to decide whether to re-read (TTL 45 seconds)Resident in memory (write operations update memory + disk in sync)
Timeout protectionYes (listing timeout fallback)Not neededNot neededNot needed
ComplexityO(n) file I/OO(log n) database queryO(1) file read + O(n) in-memory traversalO(n) in-memory traversal (no disk access)
Session Creation
Claude CodeOpenCodeOpenClawOpenProgram
Entry points1: create the JSONL file3: Create (normal) / CreateTitleSession (title child session) / CreateTaskSession (task child session)1: add a key to the store inside updateSessionStore3: dispatcher.process_user_turn / channel handler / session_context
ID generationUUID filenameUUID / "title-" + parentId / toolCallIDsessionKey"local_" + uuid; session_context mints session_<id>
RegistrationNo registration needed (discovered by scanning the directory)Queryable automatically after a database INSERTWritten to sessions.jsonWritten to the .chats-index.json registry
Event notificationNonepubsub CreatedEventNoneNone (creation is not broadcast; the frontend discovers it via list_sessions)
AtomicityFile creation is itself atomicINSERT ... RETURNING database transactionread-modify-write inside a file lockDispatcher and channel append the first message right after creation; session_context creates on enter
Empty-shell protectionNone (session = file, content exists on creation)None (a title is required on INSERT)NonePartial: immediate first append; startup quarantines log-less shells
Session Deletion
Claude CodeOpenCodeOpenClawOpenProgram
MethodDelete the JSONL fileDELETE FROM sessions WHERE id = ?Delete the key from sessions.jsondelete_session records a delete intent, removes the directory, drops the registry row
Cascade cleanupDeletes a single file only (metadata and messages live in the same file)ON DELETE CASCADE automatically clears messages and filesManually archive the transcript file (archiveSessionTranscripts, not a direct delete)Session directory + .file-recovery/<id> + run tables
Event notificationNonepubsub DeletedEventNoneWebSocket session_deleted broadcast
Session Resume
Claude CodeOpenCodeOpenClawOpenProgram
MethodRead the whole JSONL, rebuild the message chain via uuid/parentUuid, restore state such as mode/permissionMode/titleSQL query for session + messages, ordered by created_atRead the transcript JSONL, restore the message sequenceget_branch(session_id, head_id) walks back along the parent_id chain in the DAG and returns a linear message sequence
Compaction handlingThe retained range is determined from the preservedSegment of the compact_boundary entryIf summary_message_id != "", skip all messages before that messageRestore from compactionCheckpointsThe compactionSummary node becomes the new branch start; old messages are kept in the DAG but are not on the active branch
Compaction (Context Compression)
Claude CodeOpenCodeOpenClawOpenProgram
TriggerManual + automaticManualAutomatic (by token threshold)Manual (/compact) + automatic (context.auto_compact_percent)
ImplementationAppend a system:compact_boundary entry to the JSONLGenerate a summary with a dedicated summarizeProvider, write it as a new message, and point summary_message_id at itGenerate a summary, record a checkpoint (tokensBefore/tokensAfter/summary), update compactionCountLLM generates a summary → write a compactionSummary node (source="compaction") → reattach the retained tail messages under the summary node → move head_id
Recorded informationtrigger/preTokens/postTokens/preservedSegment/durationMssummary_message_idcompactionCount + the compactionCheckpoints arraySummary content lives in the node content; tokens_before/tokens_after live on the summary node
Old messagesKept in the JSONL, with preservedSegment marking which are activeKept in the database, skipped before the summary on loadKept in the transcriptKept in the DAG (append-only), but not on the active branch
Active Process Tracking
Claude CodeOpenCodeOpenClawOpenProgram
MechanismA dedicated ~/.claude/sessions/<pid>.json fileNone (single-process TUI)The status field of SessionEntrystatus field (session metadata + registry)
Fieldspid, sessionId, cwd, startedAt, version, kind (interactive), entrypoint (cli), status (idle/busy), updatedAt, name, bridgeSessionId—status (running/done/failed/killed/timeout), runtimeMs, abortedLastRunstatus (idle/running/needs_input/done/failed/interrupted/cancelled)
Crash recoveryThe file lingers after the process exits (requires external cleanup)—status may get stuck at running (no automatic recovery)Registry load resets running → idle; run reconciliation marks a row still running interrupted
Relationship to session listingNot involved in listing—Involved in listing (status is part of SessionEntry)Involved in listing (status is in the registry)
Concurrency Control
Claude CodeOpenCodeOpenClawOpenProgram
MechanismFile level (single-process writes; multiple processes coordinate via pid files)SQLite WAL mode + 8MB page cacheFile lock (lockfile) + in-process FIFO queuePython locks + inter-process session locks + one writer per log file
Lock granularityPer JSONL fileDatabase levelPer sessions.json filePer session; separate registry state and write locks
In-processSingle-threadedHandled by SQLiteFIFO queue serializes writes to the same storePathPer-session RLock; SessionStore._lock guards maps and the LRU cache only
Cross-processpid file marker (sessions/<pid>.json)Built into SQLitelockfile exclusive lock (stale detection 30 minutes + PID liveness check)worker.lock owns runs; inter-process session locks; each process has its own log file
Lock timeout/watchdogNoneNone (SQLite busy timeout)Watchdog patrols every 60 seconds, hold timeout 5 minutesNone
Data Maintenance
Claude CodeOpenCodeOpenClawOpenProgram
Expiry cleanupNoneNonepruneStaleEntries: entries not updated in 30 daysNone; archived sessions stay until deleted
Capacity limitNoneNonecapEntryCount: at most 500 entries, deleting the oldest when exceededNone
File rotationNoneNonerotateSessionFile: rotate sessions.json when it exceeds 10MB, keeping the 3 most recent backupsNone
Disk budgetNoneNoneenforceSessionDiskBudget: optional, cleans up by total disk usageNone
Archive on deleteNone (deletes the file directly)None (CASCADE deletes directly)Yes (transcript file is archived rather than deleted directly)None (deletes the directory directly)
Maintenance mode——"warn" (default, warn only) / "enforce" (actually execute)—
updated_at maintenanceImplicit (file mtime)SQLite trigger-drivenWritten by the application layerWritten by the application layer when a message is appended; metadata-only writes do not advance recency
message_count maintenanceNot trackedSQLite trigger-driven +1/-1Not trackedNot tracked
Title (Naming)
Claude CodeOpenCodeOpenClawOpenProgram
Auto-namingAsynchronous LLM generation after the first turnForked asynchronous LLM generation after the first turn (dedicated title agent)None (set displayName manually)At replies 1, 6, 16, 40 (also 2, 3 after small talk): first-line truncation on the first, background LLM title each time
Manual namingA custom-title entry overridesNone (no rename feature)Set displayName / labelUI rename / /rename / agent rename tool
LLM regenerationNoneNoneNoneAuto rename or /rename with no argument
Injection protectionWrapped in <session> tags + a "treat as data" instructionNone (the title agent's prompt is concatenated directly)—Wrapped in <session> tags + a "treat as data" instruction
Language followingThe prompt requires using the conversation's languageThe prompt requires using the conversation's language—The prompt requires using the conversation's language
Post-processingJSON schema structured outputStrip <think> tags, take the first non-empty line, truncate to 100 characters—JSON schema structured output; Unicode trim; 80-code-point guard
Idempotency markerNone (inferred from whether an ai-title entry already exists)Inferred from an isDefaultTitle regex—_auto_titled bool; _user_titled lock
Race protectionNoneNone—The background thread checks that the title is still the truncated value before writing
Title broadcastNone (the frontend re-reads the JSONL)None (the TUI reads the database directly)—WebSocket session_updated {id, title}
Message Storage Model
Claude CodeOpenCodeOpenClawOpenProgram
StructureLinear JSONL (a tree can be built via uuid/parentUuid)Flat table (ordered by session_id + created_at)Linear JSONLDAG (each message has a parent_id, supports branching)
BranchingYes (parentUuid supports a tree structure, but the UI does not expose it)NoneNoneYes (head_id + branches map, the UI can switch branches)
Message IDuuid (per message)id (per message)No explicit ID (by line order)id (per message)
Message format{type, message: {role, content}, uuid, parentUuid, timestamp, ...}{id, session_id, role, parts, model, created_at, ...}{role, content, ...}{id, role, content, parent_id, timestamp, ...}
JSONL Entry Types (Claude Code only)
TypePurpose
userUser message (includes uuid, parentUuid, timestamp, cwd, gitBranch)
assistantAssistant reply (includes usage, model, requestId)
attachmentAttachment (file, image)
systemSystem event (subtypes: turn_duration / away_summary / compact_boundary / api_error / local_command / informational / bridge_status / scheduled_task_fire)
ai-titleLLM auto-generated title
custom-titleUser-set title
agent-nameAgent name
last-promptLast prompt position (leafUuid)
modeConversation mode (normal/plan/...)
permission-modePermission mode
file-history-snapshotFile snapshot (used for revert)
bridge-sessionBridge session ID
queue-operationQueue operation

Data model

Last updated · 2026-11-25