Kind
implement
Goal
Store session state by agent, surface, session, and cwd in a neutral location while preserving existing Claude state.
Non-goals
- Changing policy time windows.
- Adding host adapters.
- Deleting legacy state automatically.
Invariants
- Concurrent sessions do not overwrite each other.
- Stale-state handling remains deterministic.
- Legacy Claude state can be read during migration.
- Migration is idempotent and recoverable.
Behavioral contract / States
New sessions create a namespaced state record. Existing Claude state is read through a compatibility path and can be migrated once. Corrupt or stale records produce a safe diagnostic and never silently reset active work.
Scope surface
State helpers in Python/Node, hook/wrapper call sites, migration fixtures, and tests.
Acceptance
- Test two simultaneous sessions with different IDs and cwd values.
- Test stale, missing, corrupt, and legacy state records.
- Run: python3 -m pytest tests/test_guard.py -v, node --test tests/test_guard.mjs, and bash tests/test_install.sh.
- Provide a documented rollback procedure that leaves legacy Claude state intact.
Split triggers
- A host needs a state backend other than local files.
- Cross-process locking differs materially between runtimes.
Dependencies / Parent
Blocked by: #1, #2
Parent Epic: #15
Kind
implement
Goal
Store session state by agent, surface, session, and cwd in a neutral location while preserving existing Claude state.
Non-goals
Invariants
Behavioral contract / States
New sessions create a namespaced state record. Existing Claude state is read through a compatibility path and can be migrated once. Corrupt or stale records produce a safe diagnostic and never silently reset active work.
Scope surface
State helpers in Python/Node, hook/wrapper call sites, migration fixtures, and tests.
Acceptance
Split triggers
Dependencies / Parent
Blocked by: #1, #2
Parent Epic: #15