Skip to content

[Core] Add neutral session-state storage and migration #18

Description

@teseo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions