tmux-python / tmux-python/libtmux

Research tmux-continuum parity for headless autosave

Open
#702 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
1.2k
Forks
127
Avg merge
2h 13m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing one-shot autosave API and compare its behavior with tmux-continuum v3.1.0, especially continuum.tmux, scripts/continuum_save.sh, and scripts/continuum_restore.sh. Trace the current libtmux archive and state entry points, then document the parity matrix and decisions for scheduling, socket-aware state, restore guards, and OS integration. Done means the acceptance criteria are documented and the remaining implementation boundaries are explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, cli, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.