claustrum — deliberate divergences¶
Almost everything claustrum does is byte-identical to the reference daemon. This file is the catalog of the exceptions: the behaviours that knowingly change a frame or an action. It also gives the rules that gate each one.
The catalog table has one row per divergence. The rules come first, because they decide which shape an entry can take: always-on or opt-in.
Per-method wire facts (params, result field order, error texts) live in
PROTOCOL.md and on the pages under protocol/. The history of the
reference builds is in REFERENCE-BUILDS.md.
claustrum follows the reference build 87375cc7, except its terminal. An
entry names the build of a measurement where the build matters. A measurement of the reference that names no build was made
on 4c111e86 or an earlier build. A fact read from
claustrum's code is marked "from the code".
The one hard rule¶
Byte-identical JSON-RPC frames are the product. A divergence needs a reason. Matching does not. "Off by default" means byte-identical, not almost byte-identical. An opt-in entry that is not active leaves the wire exactly as the reference leaves it. The out-of-scope list at the end gives the changes we will never make.
How we decide (the rules)¶
The standard, in priority order:
- Claude Desktop must keep working. Claustrum is a drop-in. If Desktop can reach a behaviour, and matching the reference keeps Desktop working, we match. How ugly the reference's behaviour is does not matter.
- Match by default. A wart Desktop tolerates is the contract, not a bug. The burden of proof is always on the divergence.
- A divergence earns ALWAYS-ON only if one of three conditions holds, or by the exception in rule 4. (a) Two things hold together. The reference's behaviour on that path is not a frame at all: an unbounded wait, unbounded memory, or unrecoverable data loss. And no honest caller can observe the difference. (b) The trigger itself is unreachable on an honest path. (c) The trigger is reachable, but both binaries fail the operation and the only delta is diagnostic text.
- Anything else that changes an honest-path frame is OPT-IN, default off, or it does not ship. The one exception is a maintainer decision that an entry is always-on. That entry gives the date of the decision and a reopen trigger.
Corollaries:
- Keeping a wart does not mean hiding it. We match the wart and we document it, so a user can see the edge before it causes damage.
- "The reference does it too" is a reason to match, never a reason to call it safe. D2 is the standing counter-example: the reference wipes a home directory, and we still refuse to do it.
- Every always-on divergence owes a reopen trigger: the observation that makes us take it back out. Without one it is a preference, not a decision.
Reading the clauses¶
Clause (a) is an AND. The second half is where thresholds fail. A bound is a threshold, and a threshold cannot tell a hostile input from one that is only slow or large. So an honest input trips it too. The test:
When the guard fires on an honest input, who pays, and can they decline?
Take an honest input that is reachable, and a guard that the caller cannot turn off. Then always-on is not justified, however the reference behaves on the hostile path. That is why CT-6, CT-7 and CT-8 are options, off by default. D2 passes both halves: the home wipe is unrecoverable data loss, and no honest caller has a use for it. A caller can still reach that path by accident, which is what the guard is for.
Clause (b) is used by D6 and D8, and each has its own trigger. D6 rests on an observed value plus a measured accepted set. So read it as unenumerated, not established. Rule 2 puts the burden on the divergence.
Clause (c) is narrow, and no entry uses it today. An error.code is not
diagnostic text, because a client branches on it. On-disk state that a caller can
files.stat is not diagnostic text either.
The "Desktop owns the argv" premise¶
Each opt-in entry rests on one driver claim: Claude Desktop owns the daemon's argv
on -serve and -install, so the claustrum.conf key is the knob an operator
can reach. ARCHITECTURE.md → Driver claims and their
provenance has the evidence
and the reopen trigger. A route to the argv would make a flag-only opt-in enough
for Desktop-driven hosts. It would not moot the config key, which serves every
other driver.
Conventions for opt-in entries¶
These hold for each opt-in entry:
- A flag and a matching
claustrum.confkey. The key is the knob an operator can reach (see the argv premise above). For each key that has a flag, the precedence is an explicit CLI flag, then the config file, then the default. - The default is off, which is the zero value. A disabled bound bypasses its guard
entirely: a cap of
0skips itsio.LimitReader. A download bound of0ishttp.Client{Timeout: 0}, the stdlib's own "no timeout". Never use a huge-but-finite value instead. Thecap+1arithmetic defines the boundary, and a huge value invents a new one. For a deadline, a cancel path that is not armed makes the timeout false by construction. - No opt-in bound is a hang detector. Each one is a threshold that an honest slow or large input trips too. That is why they are off by default.
- At the shipped defaults, the bounds of the
--versionrun, of a managed launcher run, of the download and of thelddlibc probe are bounds of the reference, not divergences. INSTALL.md → -install has each value. Two clocks are claustrum's own: the wait of up to 2 s for the output of a stopped launcher run, and the 0.2 s bound of the Windows rename retry. The stdlib transport clocks (net.Dialer{Timeout: 30s},TLSHandshakeTimeout: 10s) apply on-cli-urlonly. They are always-on, unnumbered, and not probed on the reference.
Catalog¶
One row for each live or deferred entry. "On-wire" means the entry changes a JSON-RPC reply frame or its text. "Off-wire" means it changes a file, a log, a signal, a child environment, a folder or a transport only. A note in brackets names what changes. Default "off" means a flag, a key or the caller turns it on. "Always-on" means no switch. "None" and "not built" mark the deferred idea CT-4.
| ID | Summary | Wire | Default | OS |
|---|---|---|---|---|
| D2 | Refuse a destructive path that is or holds $HOME |
on-wire | always-on | all |
| D6 | -cli-version is one path component |
off-wire (-install output) |
always-on | all |
| D8 | Refuse a file link at remote-server.log after a failed rename (Windows). The git-shadow sweep writes nothing through a link |
off-wire | always-on | all |
| D15 | Verify a lock holder before a signal | off-wire | always-on | macOS |
| D20 | Wait 50 ms and read again before the group SIGKILL of a leader that reads as gone |
off-wire | always-on | Linux, macOS |
| D22 | Refuse a worktree locked in the .git folder of baseRepo on remove |
on-wire | always-on | Linux, macOS |
| D23 | A child's environment block is in name order | off-wire (child environment, visible in stream output) | always-on | Windows |
| D24 | In a create rollback, keep a folder that replaced the registration. On Windows, run no git call after a .git file swap |
on-wire (the index-placement text, and the Windows .git swap) |
always-on | all |
| D27 | Keep a stale entry whose record names a path that exists | on-wire | always-on | Windows |
| CT-1 | wantPid adds pid and startTime |
on-wire | off (the caller asks) | all |
| CT-2 | -keep-children keeps the child tree at shutdown |
off-wire | off | all |
| CT-3 | The claustrum.conf config file |
off-wire | off (no file) | all |
| CT-4 | Hardened token persistence, a deferred idea | none | not built | none |
| CT-5 | -listen-pipe named-pipe transport |
off-wire (same frames) | off | Windows |
| CT-6 | Cap files.extract_tar output size |
on-wire | off (0) |
all |
| CT-7 | Cap the -install CLI size |
off-wire (-install output) |
off (0) |
all |
| CT-8 | Bound the -install download |
off-wire (-install output) |
off (0) |
all |
In the CT headings "opt-in" means "off unless somebody asks for it": CT-1 and CT-3 have no flag and no key. With the default off, CT-6, CT-7 and CT-8 are the parity position, so they are options, not divergences (the maintainer's decision of 2026-11-13).
Entries¶
D2 · Refuse a home directory as a destructive path target (always-on)¶
- Behavior.
homeguard.WipesHomeDir(internal/homeguard/homeguard.go) refuses a target that is the home directory or contains it. It resolves a relative path withfilepath.Absand then compares the text. It does not resolve symbolic links. On Windowsfilepath.Absdrops a dot or a space after a name, so home with a dot or a space after it is refused too. A path under home stays allowed, because~/.claude/…is the install path of the daemon. Home comes fromos.UserHomeDir:HOME, orUSERPROFILEon Windows. With that variable unset or empty, nothing is refused (from the code). The guard runs before these deletes: files.extract_tar, before the wipe ofdestDir. The reply starts withdestDir must not be or contain the home directory:. A folder at the last name ofdestDirthat is home or a parent folder of it is refused by identity too. On Linux and macOS that covers a path through a link above the last name. On Windows it covers the\\?\prefix and the 8.3 name of home. The maintainer approved this delete path on 2026-10-10. files.extract_tar has the two other tests of claustrum's own and their texts.git.worktree_remove. Since7d193f89the reference first refuses aworktreePaththat is not strictly insidebaseRepo. So withoutworktreeRootthe guard fires for a repository that is an ancestor of home. WithworktreeRootit is the active home guard. WithoutworktreeRootit tests paths behind Windows junctions too. With and withoutworktreeRoot, the leaf folder is tested by identity too.- Each rollback delete of
git.worktree_create, and from the code its stale step before the add. The leaf folder is tested by identity too. A refused leaf stays and changes the text of a kept branch. The exception is the registration delete of a create that holds no git directory and accepted no registration. It tests thegitdirrecord and the registrations directory instead. The guard also covers the cleanup of old.claude-new-worktree-*entries and the two staging removes. A refused entry stays. - The deletes inside the folder
git-shadowof the daemon. -install, before the tree delete of a folder at the CLI path. The reply iscli path must not be or contain the home directory: "<path>". The folder test is by identity too (homeguard.FolderHoldsHome). The sweeps and the prunes skip such an entry (cliEntryHoldsHome).89cb6289removed an empty home folder there.- Reference. It wipes home for
"destDir":"~"and answers{"success":true}(measured on7d193f89).-installremoves home as a tree and puts the CLI file there (measured with-cli-zston Linux, macOS and Windows). Not measured:-cli-url, a mount of a parent folder of home, a home folder that does not exist, a hard link, Unicode normalization forms, a case-sensitive volume on macOS and a UNC path. For the last name..., claustrum and5fd08069answerclean destDir: RemoveAll ...: invalid argumenton Windows, which is parity. No measured staging entry of the reference held home, so that guard is claustrum's own. - Systems and switch. Linux, macOS and Windows. Always on, no switch.
- Cost. A caller that names home, or a folder that holds it, gets a refusal.
On Windows claustrum refuses a
destDirwith the\\?\prefix and a dot or a space after its last name. There5fd08069extracts into the folder with no dot or space, and89cb6289into the folder with the exact name. - Rule. Rule 3 clause (a). The home wipe is unrecoverable data loss. No
honest caller has a use for it, but a caller can reach it by accident. On
2026-08-02 an in-repo fuzzer sent
"destDir":"~"to a live daemon and destroyed the maintainer's home directory. The old gateIsAbs && !homeguard.IsFilesystemRootpassed it. Before7d193f89,"worktreePath":".."from a daemon in home reachedos.RemoveAllon the parent of home. That is why the guard resolves a relative path. It is not a security boundary: the socket and the token already grantprocess.spawn(SECURITY.md). It stops the accidental, generated or mistyped path. - Reopen trigger. An honest caller that names a destructive target that is
or contains a home directory. Or a client that needs a Windows
destDirwith the\\?\prefix and a dot or a space after its last name. - Pointers. files.extract_tar,
git.worktree_remove,
INSTALL.md → -install,
internal/files/homeguard_test.go(thewipeDestDirseam keeps the suite safe against an unfixed tree) andinternal/install/install.go(stageAndInstall).
D6 · -cli-version must name a single path component (always-on)¶
- Behavior. The install clears the CLI path,
<cli-dir>/<version>, with anos.RemoveAll. claustrum refuses a version that is.or.., or that holds/or\, withcli version "…" must be a single path component. Nothing is written or removed at a path built from the version, and the blob stays. A last component that is a symbolic link stays legal, becauseos.RemoveAllunlinks it. INSTALL.md → -install has the cache hit that comes first and the sweeps that are not behind this rule. - Reference. No such rule. With
-cli-version ../xand a blob it installs to<parent>/x, outside the cli-dir (Linux, macOS and Windows). With../victimit destroys the target. - Systems and switch. Linux, macOS and Windows. Always on, no switch.
- Cost. None for a bare version:
1.0.86, a commit sha andlatestare measured as accepted. - Rule. Rule 3 clause (b). The real client passes bare version strings. The
evidence is an observed value plus a measured accepted set, not an
enumeration. A lexical containment test was not taken, because it accepts
link/1.0.0through an intermediate symlink. AnEvalSymlinkstest only adds a TOCTOU window. - Reopen trigger. Desktop passes a
-cli-versionthat is not a single path component. - Pointers.
internal/install/install.go.
D8 · claustrum refuses a file link at remote-server.log after a failed rename on Windows, and the git-shadow sweep writes nothing through a link (always-on)¶
- Behavior.
- Windows: if the rename of the log to
.oldand the fresh create both fail, the launcher judges the entry byLstat. A regular file is truncated with no owner test. A file symbolic link fails the start withpermission denied(DAEMON.md → Daemon log). - The
git-shadowsweep: a symbolic link with a folder name of this host goes with one plain remove, and on Windows a junction too. Nothing is written in the target. - Reference. On Windows
5fd08069writes through a file symbolic link when a folder at.oldstops the rename (measured on Windows). With no folder there,87375cc7and13047a51rename the link to.oldand write nothing through it, as claustrum does (measured on Windows). No row measured13047a51with a stopped rename. Its sweep makes an empty lock file in the target of a link (Linux, macOS and Windows). - Retired part. The log part on Linux and macOS is retired. claustrum follows
13047a51there, which replaces the entry and never writes through it (measured on Linux and macOS). - Systems and switch. Windows for the log, Linux, macOS and Windows for the sweep. Always on, no switch.
- Cost. None in the deployed socket folder.
- Rule. The maintainer's decision of 2026-10-19, after
5fd08069truncated a file of another user and the target of a planted link. Rule 3 clause (b): the deployed socket folder (~/.claude/remote/) is per-user and not world-writable. So no honest start reaches the refusal, and no honest sweep meets a planted link. The maintainer's decision of 2026-11-28 to follow13047a51retired the log part on Linux and macOS. - Reopen trigger. A deployment that puts the socket folder somewhere shared,
a Windows row of a stopped rename on
13047a51or a later build, or the reference making no lock file through a link. - Pointers.
detach_windows.go(openDaemonLogAt,openHeldDaemonLog) andinternal/git/gitshadowsweep.go(sweepLink).
D15 · Verify a run-dir lock holder is our serve process before signalling it (macOS)¶
- Behavior. Before a new
-servedaemon or-stopsignals a live holder of the run-dir lock, it verifies that the holder is one of our own-serveprocesses for this socket. On macOS claustrum reads the argument vector withsysctl KERN_PROCARGS2. It signals no other pid. The daemon then serves without run-dir ownership, and-stopprintssurvivor. - Reference. On Linux it verifies the command line of the holder too, so
Linux is parity. On macOS it sends
SIGTERMto the recorded pid unverified, also to a holder that is not a serve process (measured on macOS). On macOS its-stopsignals any live holder whose record says roleserveon the node of this host:SIGTERM, thenSIGKILL4 s later to a holder that ignores it. - Systems and switch. macOS. Always on, no switch.
- Cost. None on the honest path: the live holder wrote its own pid into the record, so the check passes and the predecessor is evicted. A holder that cannot be inspected, or is not a serve process, stays alive where the reference signals it.
- Rule. Rule 3 clause (a). A signal to an unverified pid is unrecoverable harm. A crash can leave a stale record whose pid an unrelated process reuses, and a foreign process can hold the flock. No honest caller gains from skipping the check.
- Reopen trigger. The reference adds the same holder check on macOS (then
this is parity). Or a legitimate macOS holder that
KERN_PROCARGS2cannot read, reported as a failed handover. - Pointers. DAEMON.md → Run-dir lock.
The host cleaner has its own gate, which is parity
(Signals of the cleaner,
endIdleDaemon). Code:internal/runlock/daemon_runlock_unix.go(holderSignalRefusal,StopRunDirHolder),internal/runlock/daemon_runlock_darwin.go(realIsServeCmdline,procArgv) andinternal/runlock/daemon_runlock_linux.go.
D20 · Wait for a settle before the group SIGKILL of a leader that reads as gone (Linux and macOS)¶
- Behavior. At a
-servestart the daemon ends the child groups of a dead predecessor:SIGTERMto the group, then a wait of 2 s. A leader can read as gone in that wait while its group still answers. claustrum then waits 50 ms and reads the leader again before the groupSIGKILL. A leader that is alive again takes the record test. A leader that fails that test gets no more signals. No frame changes. With the wait, claustrum did not end the child that replaces its program (measured on Linux and macOS). - Reference.
89cb6289sends thatSIGKILLwithin 5 ms of theSIGTERM(measured on Linux). So a child that replaces its program onSIGTERMis sometimes ended on Linux, and was not ended on macOS (measured on Linux and macOS). It also sends a groupSIGKILLin some runs where the child ends onSIGTERM(measured on Linux). claustrum sends none there. - Systems and switch. Linux and macOS. Always on, no switch. The 50 ms is claustrum's own value.
- Cost. The group
SIGKILLcomes about 50 ms later. A reap whose groups all end on theSIGTERMreturns one wait later. A program replacement that takes longer than 50 ms still gets theSIGKILL. No measured run shows that. - Rule. Rule 3 clause (a). A
SIGKILLto a live process that is no longer the recorded child cannot be taken back, the same shape as D15. On the honest path the outcome stays inside what the reference shows. The child that replaces its program stays alive, as in most runs of the reference. A group whose leader exits still gets itsSIGKILL. Only the time of one signal moves, off the wire. - Reopen trigger. A measurement shows the reference waiting before that
SIGKILL(then this is parity). Or a child outlived a daemon restart because it replaced its program. - Pointers. DAEMON.md → Child records and the reap
and
internal/childrec/childreap.go(settleGone,reapGoneLeader).
D22 · Refuse a worktree locked in the .git folder of baseRepo on remove (always-on)¶
- Behavior.
git.worktree_removerefuses a worktree that is locked in the.gitfolder ofbaseRepo, and deletes nothing. The removal can read its entries from another git directory. Then claustrum also reads<baseRepo>/.git/worktrees, with no git call, with and withoutworktreeRoot. A folder there that it cannot read gives the lock-check refusal, and nothing is deleted. A missing folder counts as not locked. On Linux and macOS a gone worktree whose locked entry sits behind a linked<git dir>/worktreesgets success, and its branch goes. That follows5fd08069(measured on Linux), by the maintainer's decision of 2026-10-14. - Reference. In the plain state it refuses with the same text.
89cb6289answers success in four states. S is a worktree locked in T, the.gitfolder ofbaseRepo, and X is another repository: - a daemon
GIT_DIRandGIT_COMMON_DIRof X: it deletes the folder of S, and the entry in T with itslockedfile stays - a daemon
GIT_DIRof X alone: it deletes the folder of S baseRepo<T>/missing/..with no foldermissing: it deletes the folder of S with"branchKept":true. This state is not measured on Windows- the
GIT_DIRandGIT_COMMON_DIRstate with the folder of S gone: it deletes nothing. claustrum answers a gone-worktree lock refusal
On Linux, with worktreeRoot in the GIT_DIR states, 89cb6289 answers the
could not verify text, or success with the folder gone. It deletes nothing,
and claustrum answers the locked refusals (measured on Linux). Not measured: a daemon GIT_COMMON_DIR of a third
repository, and a worktrees folder that cannot be read.
With a daemon GIT_DIR that names a missing path, b3081b51 deletes the
folder of S and answers success (measured on Linux). claustrum answers the
locked refusal there when a locked entry in the .git folder of baseRepo
has a gitdir record that names S (which lock
counts).
- Systems and switch. Linux and macOS. Always on, no switch. On Windows
c9125eb8 and 4c111e86 refuse in the first, second and fourth state. On
4c111e86 the frames and the disk equal those of claustrum (measured on
Windows).
- Cost. In these states claustrum sends success:false with a locked text,
and a folder stays that the reference deletes. A caller must unlock the
worktree first. Each state needs a daemon GIT_DIR, a baseRepo spelled
through a missing name, or a folder removed by hand. No measurement shows a
client that reaches one of them.
- Rule. Rule 4, by the maintainer's decision of 2026-10-03. A lock is the
user's own instruction not to delete, and a deleted folder cannot be taken
back. The same decision keeps one gap: a baseRepo with no .git folder of
its own, such as a subfolder of T, a linked worktree or a submodule. With a
daemon GIT_DIR of another repository, claustrum does not read the lock there
and deletes the locked worktree. The reference is not measured there.
- Reopen trigger. A caller that needs the removal of a locked worktree in
these states. Or a measurement that shows the reference refusing there (then
this is parity).
- Pointers. git.worktree_remove
and internal/git/worktreeremove.go (lockedInBaseRepo).
D23 · The environment block of a child is in name order (Windows)¶
- Behavior. On Windows claustrum gives a child its environment block in name
order:
process.spawn, the git children and-install. - Reference. It does not sort the block. Go sorts it since 1.26, and the
reference builds use go1.25.14. A claustrum build with go1.25.14 matched the
order of
5fd08069(measured on Windows). - Systems and switch. Windows. Always on, no switch.
- Cost. A child sees its variables in another order.
- Rule. Rule 4, by the maintainer's decision of 2026-10-13: claustrum stays on Go 1.26. Go 1.26.9 fixed standard library advisories of go1.25.14, one in the folder handles of the Windows file guards (GO-2026-6604).
- Reopen trigger. The reference moves to Go 1.26 or newer.
- Pointers.
internal/supervisor/process.go.
D24 · In the create rollback, keep a folder that replaced the new registration and run no git call after a .git file swap¶
- Behavior. The tests after the add can accept the registration of the new
worktree. Then
git.worktree_createtakes the identity of that folder and holds it open until it answers. While that handle is open, a new folder cannot get that identity. If the open fails, the identity comes from a stat of the path (not measured). With a staged add the identity is that of the staging folder, held open from its mkdir to the rename. - A folder that takes the name of the entry right after the rename fails the create, and it and the moved folder stay.
- A rollback deletes the registration in one case only: the folder at the path still has that identity. The test runs through the root that the delete opened. It adds no text, and the branch step runs.
- After a failed
rev-parse --show-toplevel, the rollback deletes the one new entry of the listing after the add, by the identity from that listing. A sibling registration moved to that name stays.5fd08069deletes it (measured on Linux). - The placement of the index has the same test. On a mismatch it places nothing and answers a failed checkout with a text of its own (git.worktree_create).
- If git gave no answer to
rev-parse --absolute-git-dir, the guard does not run.
On Windows, after a swap of .git to a file that names a second repository,
claustrum runs no git call and changes nothing there. Its undo text says that
the branch still exists. On Linux and macOS, after a link at .git right
before the add, the branch that git made through it stays, unless the link
names the held git directory (claustrum's own, not measured). After the staged
add moved the hold, the branch step deletes only a branch with the tip that
this call made (be1c1ca5 not measured in this state). On Windows a locked file that
cannot be removed keeps the whole entry (the maintainer's choice of
2026-11-01).
- Reference. A process renames the new registration and puts another folder
at its name before the rollback. On Linux and macOS 89cb6289 removes that
folder, which can be the registration of a live sibling worktree. On Windows
5fd08069 deletes it too. The frames are equal, and on Linux and macOS the
leaf and the branch go on both sides. On Windows, after the .git
swap, 5fd08069 runs the branch step in the second repository. It deletes a
branch of the same name there that main reaches, or keeps it with
branchKept. The frames differ. be1c1ca5 removes the folder that replaced
a moved entry, and the branch behind the link, with equal frames. On Windows
it keeps only locked (measured on Linux and Windows).
- Systems and switch. Linux, macOS and Windows. The .git file swap is
Windows only, and the link at .git is Linux and macOS only. Always on,
no switch.
- Cost. A replaced folder stays that the reference removes, and no frame
differs. The registrations folder must change between the add and the
rollback to reach the guard. After a .git swap the frame differs, and a branch can stay that
5fd08069 deletes. Not measured: the guard at the index placement, and a
replaced folder with a daemon GIT_DIR of another repository.
- Rule. Rule 4, by the maintainer's decision of 2026-10-07: the guard
refuses the loss of the registration of another worktree. The decision of
2026-10-19 adds the .git swap, where the harm is a branch deleted in the
repository that the file names. On 2026-10-28 the maintainer approved
following the reference for the staged add, with these guards kept.
- Reopen trigger. A measurement that shows the reference keeping such a
folder. Or a decision to match its disk for a replaced folder. Or a decision to
run the branch step in the repository that the .git file names.
- Pointers. git.worktree_create.
D27 · Keep a stale entry whose record names a path that exists (Windows)¶
- Behavior. On Windows the stale step of
git.worktree_createcompares thegitdirrecord of each entry with the new leaf without regard to letter case. Before it deletes a matched entry, it tests the path that the record names, as written, withLstat. If that path exists, the entry stays. Linux and macOS compare exactly, so the missing leaf already proves the entry stale. In the state below claustrum keeps the entry, andW1stays on its branch. - Reference. On Windows a folder
.claude\worktreeswith case sensitivity on holds a live worktreeW1, and a client createsw1.5fd08069deletes.git\worktrees\W1before the add and answers success.W1then reads the records ofw1, and its own branch is no longer checked out (measured on Windows). - Systems and switch. Windows. On-wire, always on, no switch.
- Cost. In that state the create answers
{"success":true,"path":"<repo>\\.claude\\worktrees\\w1","sourceBranch":"main","branch":"b1"}and registersw1as.git\worktrees\w11(measured on Windows). No cost where the folder of a stale entry is gone (from the code). ALstatthat fails with another error than "does not exist" keeps a stale entry too, and then the add fails. - Rule. Rule 4, by the maintainer's decision of 2026-10-18. The reference destroys the records of a live worktree in a state that a client can reach.
- Reopen trigger. A measurement that shows
5fd08069with the same test. - Pointers. git.worktree_create.
CT-1 · Opt-in wantPid (pid + startTime) on spawn/reattach¶
- Behavior.
process.spawnandprocess.reattachaccept an optional"wantPid":true. The result of a spawn, and of a reattach that finds the process, then also haspidandstartTime. - Reference. Without
wantPidthe frame is byte-identical to the reference. - Systems and switch. All systems. The caller sends
"wantPid":true. There is no flag and no key. - Cost. None stated.
- Rule. Optional-param extension. A client can detect a reused pid or an
orphan. An older daemon ignores the parameter, and an older client never sees
the members. So a client can send
wantPidon every request. - Reopen trigger. None.
- Pointers. process.spawn has what
startTimemeans. Also process.reattach andinternal/rpc/results.go.
CT-2 · Opt-in -keep-children serve flag¶
- Behavior. Off the wire. Without the flag, a graceful shutdown (
-stop,server.shutdown,SIGTERM,SIGINTor the self-exit) ends the children. With the flag it leaves them running and logs one line with their count. On Windows a killed daemon leaves the trees too (claustrum's own). A child with a pending farewell gets its signal. The new daemon does not re-adopt them. A client can find them again through the CT-1pidandstartTime. - Reference.
89cb6289has no such flag and exits with code 2 on it. - Systems and switch. All systems.
-keep-childrenor thekeep-childrenkey. - Cost. The survivors lose their stdio, so only a child that tolerates a
dead stdin and stdout lives on (not measured on Windows). On Linux and macOS
the shutdown removes the records of the kept children (claustrum's own). So the reap of the next start
sends them no signal. That covers the processes of the process table only.
A process whose
ida later spawn took keeps its record, and the next start ends it. The host cleaner does not read the records. It ends an orphaned Claude Code group, a kept one too (not measured with the flag). On Windows a child whose start returns after the shutdown began is ended also with the flag (from the code). - Rule. Off-wire extension.
- Reopen trigger. None.
- Pointers. flags.md → Flags of claustrum alone has the log line, the stdio and Windows.
CT-3 · Opt-in claustrum.conf config file¶
- Behavior.
claustrum.confis an optionalkey = valuefile with#comments, in the folder that holds the binary. Each key butversion-overridemirrors a flag. The flags table lists each key, the deprecated ones too. Each key that sets something turns on, or tunes, a behavior that is off by default. The deprecated keys set nothing and log one warning. - Fail-safe: a missing file, a file that cannot be read and a path that is no
regular file, a link too, give stock behavior. claustrum reads at most the
first 64 KiB. It ignores an unknown key and an invalid value. A problem of the
file never fails the start. A
wire-logpath that cannot be opened does fail it. A duration usestime.ParseDuration, which refuses a bare number other than zero. A zero in any spelling means off. version-override: set it to the commit SHA that the desktop client pins, and the client stops uploading the reference each session. The value is 40 or 64 hex digits, claustrum prints it in lower case, and any other value does nothing. flags.md → -version has the output and how the client reads it. The key also sets the version that the place check expects (claustrum's own).- Reference. None stated.
- Systems and switch. All systems. Create the file.
- Cost. A wrong digit still turns a cap or a deadline on:
10for0on a cap,10sfor0son the deadline. - Rule. The opt-in mechanism itself.
- Reopen trigger. None.
- Pointers.
config.go.
CT-4 · Opt-in hardened token persistence — deferred idea¶
- Behavior. Not built. The idea: a
claustrum.confkey such aspersist-token = false, or an owner-only DACL ondaemon.tokenon Windows, or both. It is for an operator who prefers a smaller on-disk token window over reconnect. Without the key the daemon stays stock. - Reference. The default matches the reference.
- Systems and switch. None. Not built.
- Cost. None stated.
- Rule. Deferred, because there is no demand. The socket folder is per-user in the real deployment.
- Reopen trigger. None.
- Pointers. DAEMON.md → Token
persistence has the file and its
two caveats, and
internal/tokenfile/tokenpersist.go.
CT-5 · Opt-in -listen-pipe Windows named-pipe transport¶
- Behavior. On Windows,
-servealso serves the same JSON-RPC dispatch over a named pipe, beside theAF_UNIXsocket, with the same frames and the same"auth". Other systems ignore the flag and log a warning. A setup failure is not fatal, and the socket still serves. - Reference. None stated.
- Systems and switch. Windows.
-listen-pipeor thelisten-pipekey. - Cost. None stated.
- Rule. Additive transport. A Windows client that cannot use an
AF_UNIXsocket can attach. Pythonasynciois the example: its Windows loop supports named pipes. - Reopen trigger. None.
- Pointers. PROTOCOL.md → Named-pipe
transport has the name, the
file rules and the DACL. Also
pipetransport.goandpipetransport_windows.go.
CT-6 · Opt-in files.extract_tar size cap¶
- Behavior.
MaxExtractBytescaps the extraction output. An over-cap extraction returns{"success":false,"fileCount":0,"error":"extraction size limit exceeded"}and removes the truncated entry. - Reference. No cap. It completed a 629 MB extraction (measured on
5db5e4a). - Systems and switch. Linux, macOS and Windows. Default
0, off. Turn it on with-max-extract-bytes <n>or themax-extract-byteskey. Off bypassesio.LimitReader. - Cost. A cap fails an honest extraction above it.
- Rule. Rule 4. The reference answers a frame, not an unbounded wait, and Desktop owns the argv.
- Reopen trigger. An operator's cap that refuses a legitimate extraction, or the default that lets a size bomb through in normal use.
- Pointers. files.extract_tar
and
internal/files/methods_files.go.
CT-7 · Opt-in -install CLI size cap¶
- Behavior.
install.MaxCLIBytescaps the decompressed CLI (decompressing: decompressed CLI exceeds <n> bytes) and the download body (download failed: response exceeds <n> bytes). - Reference. On 4c111e86 a single-segment zstd frame that declares over
512 MiB gives
decompressing: decompressed size exceeds configured limiton-cli-zstand-cli-url(measured on Linux, macOS and Windows). On-cli-zsta frame with a 128 KiB window installs at 2 GiB (measured on Linux, macOS and Windows), and a frame with a 1 GiB window givesdecompressing: window size exceeded(measured on Linux). claustrum with the cap off gives the same answers. At 5db5e4a a 629 MB download body reaches the run test of the new CLI. - Systems and switch. Linux, macOS and Windows. Default
0, off. Turn it on with-max-cli-bytes <n>or themax-cli-byteskey. Off bypasses bothLimitReaders. claustrum streams the download into the staging file and hashes it in the same pass, so "cap off" does not mean unbounded memory. The memory of the streamed decode is not measured. - Cost. A cap below the free space replaces a disk-full report with the
cap's own message, so the user loses the free-space hint. That cost turns on
the
cliErrordriver claim (ARCHITECTURE.md). A cap that fires before the disk fills also skips the second prune andcliRemoved. - Rule. Rule 4. The reference answers a frame, not an unbounded wait, and Desktop owns the argv.
- Reopen trigger. Desktop stops treating a disk-full message as terminal, which removes the cost.
- Pointers. INSTALL.md → -install
and
internal/install/install.go(fetchCLI,zstdDecompress).
CT-8 · Opt-in -install CLI download bound¶
- Behavior.
http.Client{Timeout: install.DownloadTimeout}bounds the whole download, the body read too. So a real body that needs six minutes trips it, as a black hole does. With the bound off, the transport clocks of the conventions still apply, so a SYN-black-holed host fails at 30 s. - Reference. No bound on the total exchange in the measured window. A valid
blob that took about 324 s to arrive installed (measured on
5db5e4a). Two 60 s limits are parity and always on: the wait for the response headers (Linux and Windows), and a body that sends no byte for 60 s. A bound below 60 s fires first, and no measurement covers that pair. - Systems and switch. Linux, macOS and Windows. Default
0, off:http.Client{Timeout: 0}is the stdlib's own "no timeout". Turn it on with-cli-download-timeout <dur>or thecli-download-timeoutkey. - Cost. An honest slow download fails under the bound.
- Rule. Rule 4. Desktop owns the argv.
- Reopen trigger. An operator with the bound set reports an honest slow download that it failed.
- Pointers. INSTALL.md → -install
and
internal/install/install.go(fetchCLI).
Retired entries¶
A retired entry is a divergence that the reference made moot, or one that the
maintainer retired to follow the reference. D3, D10 and D12 moved to the
options instead, and their flags still work. An entry links to the home of its rule
where it has one. Its number is not reused. A retired
flag and its claustrum.conf key are still accepted and set nothing. Either one
logs one warning in the mode of the flag, -serve or -install. A duration flag
whose value does not parse fails the flag parse with exit 2 (from the code).
D1 · Verify the -cli-zst blob against a supplied checksum (retired)¶
claustrum checks a supplied -cli-checksum against the -cli-zst blob, as the
reference does: see INSTALL.md → -install.
D3 · The files.extract_tar size cap (moved)¶
It is now CT-6.
D4 · files.read refuses a file that is not regular (retired)¶
files.read refuses a path that is not a regular file with no switch, as the
reference does: see files.read.
D5 · Deadline on the git calls (retired)¶
The git calls have the time limits of the reference, always: see Time limits of git calls.
D7 · -cli-version must not collide with the install temp sweep (retired)¶
A version with a sweep name, such as .fetch-1, installs and stays in that run,
as on the reference: see INSTALL.md → -install.
D6 still applies to every version.
D9 · Namespace-wide params binding (retired)¶
A method ignores a member that another method of its namespace reads, as the reference does: see PROTOCOL.md → Params presence and typing.
D10 · The -install CLI size cap (moved)¶
It is now CT-7.
D11 · Deadline on the <cli> --version run of -install (retired)¶
D11 made a deadline on that run opt-in, and claustrum now stops it at the 30 s and 120 s of the reference, always: see INSTALL.md → -install.
D12 · The -install download bound (moved)¶
It is now CT-8.
D13 · -install verified the checksum before decompressing (retired)¶
claustrum decompresses into the staging file first, as the reference does, so a body that is no zstd archive answers the decoder text. The checksum test comes before the chmod, the clear and the rename (claustrum's own): see INSTALL.md → -install.
D14 · Deadline on the ldd --version libc probe (retired)¶
The ldd probe has the 5 s bound of the reference, always: see
INSTALL.md → -install.
D16 · git.status of a linked worktree returned the status on Windows (retired)¶
On Windows, with no user excludes file, the status call of git.status passes NUL
as the reference does (c9125eb8, measured on Windows). Git for Windows 2.55 then stops it, and the reply is the
reference's exit status 128: see git.status.
D17 · An abandoned lsof run on macOS (retired)¶
On macOS an idle daemon whose lsof run SIGKILL cannot end gets no SIGTERM
and keeps its run dir, as on the reference. Its pass time matches (measured on macOS):
see DAEMON.md → The lsof reads.
D18 · -cli-version must not start with .blob- (retired)¶
The prune counts version files only, as on the reference. claustrum writes no
.blob- file now, and it accepts a version that starts with .blob-.
D19 · Refuse a junction between baseRepo and the leaf on remove (retired)¶
The maintainer retired it on 2026-11-23 to follow the reference. A Windows remove now answers success there, deletes the branch and keeps the folder behind the junction. The registration goes only when its record names the leaf as the caller spelled it: see git.worktree_remove.
D21 · A second daemon on a live socket appends to remote-server.log (retired)¶
On Windows the launcher truncates a held log, and each daemon writes at its own offset, as on the reference: see DAEMON.md → Daemon log.
D25 · Answer "unavailable" for the peer check and serve every caller (retired)¶
On Linux claustrum checks the namespaces of each caller with the frames of the reference: see server.capabilities.
D28 · Send no group SIGKILL after the exit of a child that a shutdown asked to end (retired)¶
The maintainer retired it on 2026-11-28 to follow the reference. On Linux and macOS a plain
stream-json spawn that ends on the shutdown SIGTERM gets one group SIGKILL after its exit.
A member of its group with no pipe then ends (87375cc7 and 13047a51, measured on Linux and
macOS): see server.shutdown.
Candidates considered but not taken¶
In each of these claustrum can be friendlier than the reference, and matching the reference costs something real. We record them so the code can point somewhere durable. No decision is implied, and nothing here is shipped or scheduled.
- Conditional
-stopsocket unlink. After a failed connect,-stopremoves the socket path, unless it printssurvivor, as the reference does. Thatos.Removedoes not check the kind of the path, so a regular file or an empty directory at the-socketpath goes too. Astat-first variant that removes only a socket keeps those two kinds, and it is a divergence. - Fail fast on a missing
-servetoken source. The check runs in the detached child, so the launcher reports its accept timeout after about 12 s. The real reason reaches only the log of the child. That is reference parity. A check in the parent answers at once and names the actual problem: a better operator experience, and a divergence.
Explicitly out of scope (would break compatibility)¶
- Changing method names, params, result field order, error codes, or the stream-frame shape.
- Replacing the in-band
"auth"scheme. - Adding required new params to existing methods. The sanctioned exception is an optional, gracefully-ignored param whose result fields vanish by default. That is the CT-1 pattern. It leaves the default frame byte-identical, and it degrades both ways.
Any of these needs a deliberate, documented protocol version bump.