Skip to content

mecatui: persist session + event log by default (durable local store) #79

Closed

Description

@JAORMX

Summary

mecatui should persist the session conversation + durable event log by default for the local experience. Today it hardcodes the in-memory memstore, so nothing about a session survives the process — there is no black box to inspect after something goes wrong, and the cloud-native Phase 1 rehydration path has nothing to restore from.

Current state

  • cmd/mecatui/main.go:353 deliberately runs the in-memory store: "the embedded server store is the in-memory memstore (no StoreDir), so nothing persists across restarts."
  • cmd/mecatui/config.go exposes no session --store-dir flag (only --memory-dir, which is the memory store — a different thing). So a durable session store can't even be opted into from the TUI.
  • What does persist today: the memory store (~/.local/share/mecatui/memory), the user-model store, and the model selection (~/.local/state/mecatui/models.yaml). The session/event store does not.

Why

  • Debuggability (primary). jsonlstore already triples as SessionStore + ToolCallRecorder + EventLog (a .events.jsonl sidecar). With it on, every turn's EvResult{stop,usage}, EvNoProgress, and EvCompaction are on disk — turning "it got stuck, why?" into a grep. This is the prerequisite for debugging the empty/truncated-turn bug (filed separately).
  • Posture. The project's stated default posture is "enable every free + local feature by default; only external/config/trust-gated stays off." A durable session store is free and local, so defaulting it ON is consistent.
  • Unlocks resume. Cloud-native Phase 1 rehydrateSession already restores a persisted session at the run-entry seam — a durable store makes "resume my last session" possible (see scope note).

Proposed shape (minimal)

  • Default cfg.StoreDir to $XDG_STATE_HOME/mecatui/sessions (mirror resolveMemoryDir), dir mode 0700.
  • Add a --store-dir override and a --no-store / --ephemeral opt-out (consistent with --no-memory).
  • Engine side needs no change: internal/app/build.go:1482 already flips memstore→jsonl on a non-empty StoreDir.

Decide as part of this (don't ship a footgun)

  1. Retention/GC for main sessions. childGC prunes child snapshots but "main sessions are never touched." A default durable store accumulates main sessions + cumulative .events.jsonl forever — needs an age/count retention policy.
  2. Privacy. The EventLog stores already-redacted events, but the SessionStore persists the raw conversation (tool args, file contents) in plaintext JSONL. Acceptable for a single-user local box (parity with ~/.claude), but warrants a one-line disclosure in --help/docs.
  3. Concurrency. Confirm jsonlstore is safe for two concurrent mecatui processes sharing the dir.

Scope

This issue = the durable store + black box only. An actual resume affordance (session picker UI) is a separate, larger follow-up; the store is its prerequisite.


Filed from a live debugging session (mecatui + deepseek/deepseek-v4-flash over OpenRouter).

Activity

  1. added
    tui
    on Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions