You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maka's durable storage is mid-migration and currently dual-tracked:
Already SQLite (canonical, but gated):runtime_events (runtime.sqlite) and session_metadata + agent-graph tables (sessions.sqlite).
Still file/JSONL: run headers and the AgentRunEvent stream (FileAgentRunStore, writeAtomic + appendJsonl), interaction, shell-run, task-ledger, artifact, pricing, automation, message-receipt, plan, deep-research (all File*Store).
The sqliteCanonical switch is conditional: CLI uses agentGraphEnabled || MAKA_RUNTIME_SQLITE_CANONICAL=1; Desktop uses only the env flag and defaults to JSONL for runtime events.
On a shared root, Desktop (JSONL) and CLI (SQLite) can diverge and rely on import-on-open to reconcile. This is a migration state, not a steady state, and it is the kind of debt that gets harder to remove as users accumulate.
Desired outcome
One SQLite authority is the single canonical writer for every structured durable store. Specifically:
run header, AgentRunEvent stream, interaction, shell-run, task-ledger, artifact, pricing, automation, message-receipt, plan, and deep-research are backed by SQLite;
the sqliteCanonical switch and every legacy JSONL / file write path are removed;
a one-time, idempotent import-on-open remains so existing roots migrate their legacy data into SQLite without losing sessions;
CLI, Desktop, and Headless all use the same SQLite-backed store implementations;
the existing importLegacyRuntimeEventJsonlTree and importLegacySessionMetadataTree importers are kept (and extended to the newly migrated stores) as the only legacy read path.
This is a breaking change to storage internals. It is acceptable now while the user base is small; it gets harder later.
Open questions to resolve in this issue
Session transcript bodies.#1370 deliberately left StoredMessage transcript payloads as JSONL (non-goal). Should this issue override that and move transcript bodies into SQLite too, or keep them as the one remaining append-only file store? Decide with a concrete plan for compaction, large-text row storage, and DB size/vacuum if moving them.
Single workspace database.runtime.sqlite and sessions.sqlite are two separate SQLite authorities today. #1370 already flagged "avoid two independently coordinated SQLite authorities." Decide whether the remaining stores extend one of these or a single renamed workspace-state database, and document the cutover.
Proposed scope
Add SQLite schemas and transactional read/write APIs for each remaining store, preserving current API semantics for callers.
Remove the sqliteCanonical flag and all ongoing JSONL / file write paths for migrated data.
Extend the one-time import-on-open to each newly migrated store; keep it idempotent, restart-safe, and fail-closed on corrupt input.
Wire CLI, Desktop, and Headless through the same SQLite-backed implementations.
Resolve the two open questions above.
Acceptance criteria
run header, AgentRunEvent, interaction, shell-run, task-ledger, artifact, pricing, automation, message-receipt, plan, and deep-research read/write through SQLite.
The sqliteCanonical switch and all legacy JSONL / file write paths for migrated data are removed.
Existing roots import their legacy data into SQLite once, idempotently, and remain readable after restart.
CLI, Desktop, and Headless share one SQLite-backed store implementation per domain.
Crash/failpoint tests cover migration and multi-row mutations for each migrated store.
Open questions (transcript, single-DB) are decided and documented.
No production dual-writer ambiguity remains for migrated data.
Non-goals
Solving the multi-open ownership race. Two processes sharing one SQLite DB still produce double terminal facts, double turns, and broken ledger invariants, because that is an application-layer ownership problem, not a storage problem. That is tracked by the Runtime Host work (#853, #1167).
Changing the RuntimeEvent or Tool Journal schema semantics.
Remote/distributed storage or cloud CAS.
Context
#1370 / #1371 established the SQLite metadata foundation and explicitly deferred transcript bodies and the single-DB question.
This issue closes the remaining dual-track debt while the user base is small.
Problem
Maka's durable storage is mid-migration and currently dual-tracked:
runtime_events(runtime.sqlite) andsession_metadata+ agent-graph tables (sessions.sqlite).AgentRunEventstream (FileAgentRunStore,writeAtomic+appendJsonl),interaction,shell-run,task-ledger,artifact,pricing,automation,message-receipt,plan,deep-research(allFile*Store).sqliteCanonicalswitch is conditional: CLI usesagentGraphEnabled || MAKA_RUNTIME_SQLITE_CANONICAL=1; Desktop uses only the env flag and defaults to JSONL for runtime events.On a shared root, Desktop (JSONL) and CLI (SQLite) can diverge and rely on import-on-open to reconcile. This is a migration state, not a steady state, and it is the kind of debt that gets harder to remove as users accumulate.
Desired outcome
One SQLite authority is the single canonical writer for every structured durable store. Specifically:
AgentRunEventstream,interaction,shell-run,task-ledger,artifact,pricing,automation,message-receipt,plan, anddeep-researchare backed by SQLite;sqliteCanonicalswitch and every legacy JSONL / file write path are removed;importLegacyRuntimeEventJsonlTreeandimportLegacySessionMetadataTreeimporters are kept (and extended to the newly migrated stores) as the only legacy read path.This is a breaking change to storage internals. It is acceptable now while the user base is small; it gets harder later.
Open questions to resolve in this issue
#1370deliberately leftStoredMessagetranscript payloads as JSONL (non-goal). Should this issue override that and move transcript bodies into SQLite too, or keep them as the one remaining append-only file store? Decide with a concrete plan for compaction, large-text row storage, and DB size/vacuum if moving them.runtime.sqliteandsessions.sqliteare two separate SQLite authorities today.#1370already flagged "avoid two independently coordinated SQLite authorities." Decide whether the remaining stores extend one of these or a single renamed workspace-state database, and document the cutover.Proposed scope
sqliteCanonicalflag and all ongoing JSONL / file write paths for migrated data.Acceptance criteria
AgentRunEvent,interaction,shell-run,task-ledger,artifact,pricing,automation,message-receipt,plan, anddeep-researchread/write through SQLite.sqliteCanonicalswitch and all legacy JSONL / file write paths for migrated data are removed.Non-goals
#853,#1167).RuntimeEventor Tool Journal schema semantics.Context
#1370/#1371established the SQLite metadata foundation and explicitly deferred transcript bodies and the single-DB question.简体中文
问题
Maka 的持久化存储处于迁移中途,目前是双轨:
runtime_events(runtime.sqlite)和session_metadata+ agent-graph 表(sessions.sqlite)。AgentRunEvent流(FileAgentRunStore,writeAtomic+appendJsonl),以及interaction、shell-run、task-ledger、artifact、pricing、automation、message-receipt、plan、deep-research(全是File*Store)。sqliteCanonical开关是条件性的: CLI 用agentGraphEnabled || MAKA_RUNTIME_SQLITE_CANONICAL=1;Desktop 只认 env,默认仍走 JSONL。同一 root 上 Desktop(JSONL)和 CLI(SQLite)会分叉,靠打开时 import 对齐。这是迁移态,不是稳态,且越晚越难删。
期望结果
单一 SQLite authority 作为所有结构化持久 store 的唯一 canonical writer:
AgentRunEvent流、interaction、shell-run、task-ledger、artifact、pricing、automation、message-receipt、plan、deep-research都走 SQLite;sqliteCanonical开关和所有遗留 JSONL / 文件写路径;importLegacyRuntimeEventJsonlTree和importLegacySessionMetadataTree保留(并扩展到新迁的 store)作为唯一遗留读路径。这是存储内部的 breaking change。趁现在用户少可以做,越晚越难。
需在本 issue 内解决的 open question
#1370有意把StoredMessagetranscript 正文留 JSONL(列为 non-goal)。本 issue 要不要覆盖该决定、把正文也搬进 SQLite,还是保留它作为唯一剩下的 append-only 文件 store?若搬,需给出 compaction、大文本行存、DB 体积/vacuum 的具体方案。runtime.sqlite和sessions.sqlite是两个独立 SQLite authority。#1370已提"避免两个独立协调的 SQLite authority"。决定剩余 store 是扩展其中一个、还是用单个重命名的 workspace-state DB,并记录切换方式。范围
sqliteCanonical开关和所有已迁数据的 ongoing JSONL / 文件写路径。验收标准
AgentRunEvent、interaction、shell-run、task-ledger、artifact、pricing、automation、message-receipt、plan、deep-research经 SQLite 读写。sqliteCanonical开关和所有已迁数据的遗留 JSONL / 文件写路径已删除。不在范围
#853、#1167)。RuntimeEvent或 Tool Journal schema 语义。背景
#1370/#1371建立了 SQLite metadata 基础,并明确推迟了 transcript 正文与单 DB 问题。