Expand description
Opt-in, local repository identity; legacy JSONL discovery is unchanged.
Git’s common directory, NOT remotes, defines repository membership. A private
synaps-memory-identity.json there retains a random repository key
across moves. Schema (unknown fields rejected): {"version":2,"key": "p<16 lowercase hex>","initial_root":"/original/main","roots":["/original/main"]}.
key is p plus 16 random lowercase hexadecimal digits, never a path hash.
The reserved all-zero key and unreleased path-key version 1 are refused.
roots retains verified canonical historical paths
(including initial_root), bounded to 4096 entries and the marker to 1 MiB.
Readers must verify the current common Git directory and private marker/lock,
historical path hashes are migration candidates only, not canonical identity.
Registered worktrees are verified in both directions before
their path scopes are retained as migration candidates. No records are merged.
An explicit SYNAPS_PROJECT_ROOT bypasses Git entirely, just as in legacy
discovery. Without a discoverable main checkout (e.g. a bare/separate gitdir),
the common directory is the reported repository root. Concurrent workers
share the random key durably published under the common-directory lock.
Persistence requires Unix ownership/mode checks, pinned directory descriptors, an advisory lock, atomic publication and file/directory fsync. Git processes and marker lock acquisition each have a five-second timeout. Unsupported platforms fail closed for Git identity, not for legacy/non-Git scopes. A same-UID process can deliberately rewrite private state; this is not a sandbox against the host user. Copying a private marker copies identity; ordinary clones do not copy Git-private files. Never initialize identity in a live repo in tests.