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
Session metadata is currently stored as line 1 of each per-session JSONL transcript. Every metadata update reads the session file and atomically rewrites the header together with the complete message history. Session listing also discovers directories and reads headers/tail previews from many files.
This couples mutable metadata to the append-oriented transcript and creates several problems:
metadata updates become proportional to transcript size;
metadata integrity and transcript corruption share one failure boundary;
filtering, ordering, revision-family lookup, recovery scans, and unread/status updates cannot use database indexes;
concurrent metadata changes rely on per-process file queues rather than database transactions/CAS;
Maka already has a workspace-local SQLite canonical store for RuntimeEvent facts and transactional tool boundaries. Session metadata should move onto the same durable storage foundation instead of remaining embedded in transcript JSONL headers.
Desired outcome
SQLite is the single canonical source of truth for all SessionHeader metadata, including:
identity and workspace/cwd fields;
lifecycle timestamps;
title, labels, flag, archive, status, and blocked-state fields;
parent/branch/revision lineage;
unread tracking;
backend, connection, model, thinking, permission, collaboration, and orchestration settings;
schema/version fields and any future session metadata.
The SessionStore API remains stable for callers, but create/read/list/update/archive/rename/remove operations are backed by transactional SQLite rows and indexed queries.
Stored messages/transcript payloads may remain append-oriented JSONL in this issue. They must no longer own the canonical session metadata header after migration. RuntimeEvent storage and AgentRun operational storage are separate concerns and must not become competing sources of session metadata truth.
Proposed scope
Add a versioned SQLite sessions schema covering every field in SessionHeader without lossy normalization.
Add normalized/indexed child storage where appropriate (for example labels), while preserving exact API semantics.
Make list/filter/sort and recovery enumeration query SQLite rather than walking session directories for metadata.
Preserve transcript preview behavior without requiring full transcript reads for metadata operations.
Provide an idempotent migration from existing JSONL line-1 headers.
Record migration provenance/high-water information so interrupted migrations can be resumed safely.
Select exactly one canonical metadata writer; do not indefinitely dual-write SQLite and JSONL.
Define explicit export/downgrade behavior for older Maka versions.
Wire CLI, Desktop, Headless, automations, and tests through the same SessionStore implementation.
Migration and compatibility requirements
Existing workspaces migrate without losing or changing any SessionHeader field.
Migration is transactional, restart-safe, and idempotent.
Malformed/corrupt headers fail closed with actionable diagnostics; they are not silently dropped.
The cutover must not expose a mixed catalog where some sessions are visible only through JSONL and others only through SQLite.
Removing or truncating the legacy JSONL header must happen only after the SQLite row is durably committed and validated.
Decide and document whether session metadata extends the existing workspace runtime.sqlite or uses a renamed/general workspace-state database; avoid two independently coordinated SQLite authorities.
Back up or provide a verified export path before making the migration sticky.
Acceptance criteria
Every current SessionHeader field round-trips through SQLite.
Fresh sessions use SQLite as their canonical metadata store.
Existing JSONL-backed sessions migrate idempotently and remain readable after restart.
SessionStore.create/readHeader/readHeaderSnapshot/list/listForRecovery/updateHeader/archive/unarchive/setFlagged/rename/markSessionReadThrough/remove use SQLite metadata.
Session list filtering, ordering, unread state, status, labels, and revision lineage have indexed/queryable coverage.
Metadata-only updates do not rewrite or scan the full transcript.
There is no production dual-writer ambiguity between SQLite and JSONL metadata.
Crash/failpoint tests cover migration and every multi-row metadata mutation.
CLI, Desktop, Headless, automation, and recovery integration tests pass.
Upgrade, export, backup, and downgrade limitations are documented.
Non-goals
Migrating StoredMessage transcript bodies to SQLite unless required for a safe metadata cutover.
Replacing the canonical RuntimeEvent or Tool Journal schema.
Problem
Session metadata is currently stored as line 1 of each per-session JSONL transcript. Every metadata update reads the session file and atomically rewrites the header together with the complete message history. Session listing also discovers directories and reads headers/tail previews from many files.
This couples mutable metadata to the append-oriented transcript and creates several problems:
Maka already has a workspace-local SQLite canonical store for RuntimeEvent facts and transactional tool boundaries. Session metadata should move onto the same durable storage foundation instead of remaining embedded in transcript JSONL headers.
Desired outcome
SQLite is the single canonical source of truth for all
SessionHeadermetadata, including:The SessionStore API remains stable for callers, but create/read/list/update/archive/rename/remove operations are backed by transactional SQLite rows and indexed queries.
Stored messages/transcript payloads may remain append-oriented JSONL in this issue. They must no longer own the canonical session metadata header after migration. RuntimeEvent storage and AgentRun operational storage are separate concerns and must not become competing sources of session metadata truth.
Proposed scope
sessionsschema covering every field inSessionHeaderwithout lossy normalization.Migration and compatibility requirements
SessionHeaderfield.runtime.sqliteor uses a renamed/general workspace-state database; avoid two independently coordinated SQLite authorities.Acceptance criteria
SessionHeaderfield round-trips through SQLite.SessionStore.create/readHeader/readHeaderSnapshot/list/listForRecovery/updateHeader/archive/unarchive/setFlagged/rename/markSessionReadThrough/removeuse SQLite metadata.Non-goals