Skip to content

Research tmux-continuum parity for headless autosave #702

Description

@tony

Goal

Research tmux-continuum parity for pure-Python, headless autosave and startup restore behavior that does not require TPM, shell plugin loading, or status-right mutation. The target consumers are libtmux, tmuxp, and libtmux MCP/CLI surfaces.

A first experimental slice exists as a one-shot autosave gate: callers pass an engine, archive path, optional persisted state path, interval, and clock; libtmux decides whether to save and then delegates to the workspace archive API. This issue tracks the remaining parity and OS integration research.

Upstream baseline

Research questions

  • Should libtmux provide only a one-shot autosave_once() primitive, or also a small scheduler loop usable by CLIs/TUIs/MCP servers?
  • What should the persisted autosave state format contain beyond last_saved_at: interval, selected sessions, socket identity, archive path, error counters, and last failure?
  • How should startup restore be represented safely for headless callers: explicit command, opt-in config, environment variable, tmux hook, system service, launchd agent, or downstream responsibility?
  • How should libtmux avoid cross-server archive clobbering for -L / -S sockets without relying on shell process-count heuristics?
  • What OS integration should live in libtmux versus downstream packages: Linux systemd user units, macOS launchd, BSD rc/cron, Cygwin/MSYS task scheduler, and container/CI modes?

MVP/sprint proposal

  1. Keep libtmux core as a headless one-shot API: should_autosave, autosave_once, read_autosave_state, write_autosave_state.
  2. Add a tiny CLI/TUI/MCP-friendly wrapper that prints what happened: skipped, saved, next eligible save, archive path, and selected sessions.
  3. Add socket-aware state keys so independent tmux servers do not overwrite each other's archives by default.
  4. Add startup-restore as an explicit opt-in command first, not an implicit daemon side effect.
  5. Research OS service templates as downstream recipes, not hard dependencies.

Tradeoffs

  • A one-shot primitive is easiest to test headlessly and embed in tmuxp/MCP, but callers must schedule it themselves.
  • A built-in scheduler loop improves batteries-included UX, but it needs lifecycle, logging, lock, and shutdown semantics.
  • Avoiding status-right mutation removes a major upstream fragility, but loses tmux-native periodic execution unless users configure a hook or external scheduler.
  • Boot integration is platform-specific. Keeping it outside the libtmux core avoids surprising daemon behavior and keeps the API portable.

Acceptance criteria

  • Document a parity matrix against tmux-continuum v3.1.0.
  • Decide whether libtmux owns a scheduler loop or only exposes one-shot primitives.
  • Define socket-aware autosave state and archive naming rules.
  • Define safe startup restore UX and halt/guard semantics.
  • Validate the first implementation on Linux and macOS, with notes for BSD and Cygwin/MSYS feasibility.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions