# Portabilität: SYSTEM
# Zuletzt validiert: 2026-02-08
# Nächste Prüfung: 2026-05-08
# Ressourcen: [session_snapshots table, hub/snapshot.py]

BACH SNAPSHOT SYSTEM
====================

STAND: 2026-02-08

Session-Snapshots sichern den exakten "State of Mind" einer KI-Session. 
Dies ermöglicht das Laden eines Kontexts in eine neue Instanz oder 
das Fortsetzen nach einem Absturz/Shutdown.

BEFEHLE
-------
  bach --snapshot create [name]  Aktuellen Status sichern.
  bach --snapshot list           Verfügbare Snapshots (auto & manuell).
  bach --snapshot load [ID]      Stellt Working Memory & Tasks wieder her.
  bach --snapshot delete <ID>    Entfernt alte Snapshots.

KONZEPT: DER STATE-TREE
-----------------------
Ein Snapshot in BACH besteht aus folgenden Komponenten:
1. SESSION-ID: Aktueller Session-Kontext
2. OPEN TASKS: Welche Tasks aktiv/offen waren (bis zu 10)
3. RECENT MEMORY: Letzte Working Memory Einträge (letzte 5)
4. SNAPSHOT-METADATEN: Timestamp, Type (auto/manual), Name

UNTERSCHIED ZU ANDEREN SYSTEMEN
-------------------------------
- MEMORY: Wichtiges Wissen (langfristig).
- LOGS: Was getan wurde (historisch).
- SNAPSHOT: Wo wir gerade stehen (operativ).

AUTOMATIK
---------
Snapshots können automatisch oder manuell erstellt werden. Der snapshot_type
unterscheidet zwischen 'manual' (via --snapshot create) und 'auto' (potentiell
via --shutdown). Die Implementierung unterstützt beide Typen.

DATENBANK
---------
Tabelle: `session_snapshots` (system/db/schema.sql, Zeile 226-239)
Felder:
  - id, session_id, snapshot_type, name
  - snapshot_data (JSON: enthält open_tasks, recent_memory, created_at)
  - working_memory, open_tasks, active_files (separate JSON-Felder, optional)
  - token_usage, context_hash, notes
  - created_at (Timestamp)

BEISPIELE
---------
  bach --snapshot create "Vor Grossumbau"  # Manuelles Backup
  bach --snapshot list                     # Status prüfen
  bach --snapshot load 42                  # ID 42 wiederherstellen
  bach --snapshot delete 42                # Snapshot 42 löschen

SIEHE AUCH
----------
  docs/help/memory.txt      Gedächtnis-Konsolidierung
  docs/help/maintain.txt    Integritäts-Prüfung
  bach --help startup  Session-Start
