- claude-sessions: registry manager with list/recover/spawn/resume/register/gc and interactive menu - claude-sessions-shutdown: graceful systemd shutdown handler - install-systemd.sh: idempotent service installer for new machines - config/systemd/user/claude-sessions-save.service: versioned service definition - README + CONTEXT updated
2.6 KiB
2.6 KiB
Session Log -- 2026-10-12
Summary
Built a full Claude Code session lifecycle management system: claude-sessions registry manager, claude-sessions-shutdown graceful shutdown script, /exit-session skill, systemd shutdown service, and registry auto-population in claude-tmux. Also extended the skills install script to support all profiles at once.
Decisions
- Decision: Separate
claude-tmux(primitive spawner) fromclaude-sessions(lifecycle manager) -- Rationale: clean separation of concerns;claude-tmuxdoes one job,claude-sessionsprovides the management layer and delegates back toclaude-tmuxfor spawning. - Decision: Session IDs backfilled lazily by
gcrather than at registration time -- Rationale: Claude Code assigns the UUID when the process starts, afterclaude-tmuxhas already calledregister. Backfill scans for the most recent.jsonlcreated afterspawned_at. - Decision: Systemd service uses
RemainAfterExit=yes+ no-opExecStart-- Rationale: the service exists solely to runExecStopat shutdown;RemainAfterExitkeeps it "active" so systemd triggers the stop handler. - Decision:
install.sh --all-profilesloops over~/.claudeand all~/.claude-*dirs -- Rationale: profiles are auto-discovered from the filesystem rather than reading profiles.yaml, so new profiles are picked up automatically.
Gotchas Discovered
- [skills] Symptom:
echo "" | claude-sessions recover --days 1returned 0 results -- Fix:echo ""pipes a newline that causes the subprocess to see non-TTY stdin AND closes it immediately; the scan itself worked fine. Always test with heredoc<<'EOF'\nEOFor without piping when testing non-interactive behavior. - [skills] Symptom: ANSI escape codes in f-string padding broke column alignment -- Fix: compute padding on the plain string first, then wrap the padded result with color codes;
f"{colored:<32}"counts escape bytes toward the width.
Key Context
claude-sessionslives inclaude-foundations/scripts/, symlinked to~/sbin/claude-sessionsclaude-sessions-shutdownlives alongside it, symlinked to~/sbin/claude-sessions-shutdown- Systemd service:
~/.config/systemd/user/claude-sessions-save.service(source of truth:config/systemd/user/in this repo) /exit-sessionskill installed in all 7 profiles viacustom-claude-skills/scripts/install.sh --all-profilesclaude-tmuxnow callsclaude-sessions registerafter every spawn (non-fatal if claude-sessions absent)
Process Notes
- Three repos committed this session:
custom-claude-skills,claude-foundations,small-scripts— all unpushed (SSH key not loaded at session end)