feat: session recovery toolset (orphan detector + /recover)

Reconstructs session logs from Claude Code transcripts when a session
crashes or is closed before /save. Two entry points:

- /recover <uuid|latest> : manual, Claude-reviewed reconstruction
- detect_orphaned_sessions.py : scheduled scan that auto-builds logs for
  substantive, unsaved, not-yet-recovered transcripts (banner-marked
  RECOVERED-UNVERIFIED), commits them, and posts a #bot-alerts FYI.

recover_session.py is the shared engine: Python extracts the verbatim
command/config/reference timeline; Ollama drafts prose-only narrative.
Machine-local ledger (.claude/state/) prevents reprocessing. Reviewed:
git add scoped to own files, ledger written only after successful push,
per-uuid idempotency, --max cap for unattended runs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 18:33:07 -07:00
parent e8144a862e
commit eed3ece2c7
9 changed files with 1897 additions and 0 deletions

3
.gitignore vendored
View File

@@ -18,6 +18,9 @@ tmp-remediation/
.claude/coord-broadcasts-seen
.claude/scheduled_tasks.lock
# Session-recovery ledger (machine-local — transcripts are per-machine)
.claude/state/
# /autotask command — kept local/undistributed (Syncro is the default PSA; Autotask is opt-in).
# Remove this line to distribute /autotask to the fleet. See .claude/memory/feedback_psa_default_syncro.md
.claude/commands/autotask.md