Macroscope found a bypass in the shared-home refusal: the guard
canonicalized the *base* directory, but a base can canonicalize to
itself while its `userdata` or `dev` subdirectory is a symlink into
`~/.t3`. The base comparison then passes and the seed destructively
replaces the real shared database — the exact accident the guard exists
to refuse. Reproduced with a symlinked fixture before fixing.
The database path is what gets opened, so it is what gets checked now:
canonicalize the resolved db path and refuse when it lies under the
canonical shared home. The same-source check moves to db paths for the
same reason. Guard ordering shifts after state-dir resolution, which the
guard now depends on; the missing-target check runs first either way.
Verified all three ways: the symlinked base is refused with the shared
database untouched, a direct --to at the shared home is still refused,
and a legitimate worktree seed still succeeds.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>