Repository navigation
6.4: Keep worktrees, clones and working folders out of the shared cache - #81
Merged
Merged
Conversation
…ared cache The shared /cache is readable from every container. Besides databases and keys, a worktree or clone of a private repository, a planning folder, a generated test key or a term list kept out of git is just as private. The baked CLAUDE.md, the README and docs/volume-reference.md now say so and name the places: /state/wt/<repo>/<branch> and /state/tmp for what must last, /scratch for throwaway work. volume-reference.md also shows how to move a git worktree to /state: `git worktree move` cannot cross volumes (rename fails with EXDEV), so copy it and run `git worktree repair` from the main repository; when the main repository moves too, repair where the old copies cannot be seen. state-unit.sh pins both. Claude-Session: https://claude.ai/code/session_01U97ssbeo9C37pqPiWMQ1BU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
#79 gave every container its own
/statevolume and moved databases and keys out of the shared/cache. A survey of one host's/cacheafterwards found the same leak in other forms: worktrees and clones of private repositories, planning folders, keys a test generated, and a private term list kept out of git, all readable from every container because a tool or a repository's notes told sessions to work under/cache.This PR documents that class and where it belongs, so new containers and tools stop recreating it:
claude-config/CLAUDE.md(the baked global notes): a worktree or clone of a repo, a planning folder or a test key is private too:/state/wt/<repo>/<branch>or/state/tmpif it must last,/scratch($TMPDIR, cleared at boot) if not.docs/volume-reference.md: the/cacherow says never a worktree, a clone or a working folder; a new section "Worktrees, clones and working folders" with the move recipe.git worktree movecannot cross volumes (rename fails with "Invalid cross-device link"), so the recipe copies the worktree and runsgit worktree repairfrom the main repository. When the main repository moves too, the repair must run where the old copies cannot be seen: while the old main repository exists,repairmends the old links instead of the new ones (both reproduced in a scratch repository, see below).README.md: the private-state paragraph names worktrees and working folders.test/state-unit.sh: pins the new CLAUDE.md line and the docs recipe.No code path changes. The entrypoint's boot scan from #79 stays as it is: these folders are not named after a container, so a boot banner could not say whose they are, and a scan for git checkouts under
/cachewould also flag public tool clones.Scope note: the moves and deletions on the owner's host, and the changes to the owner's own tools that wrote there, are the owner's steps, outside this repository.
How it was checked
bash test/state-unit.sh:state-unit: 51 passed, 0 failed(2 new checks).npm run -s lint:check-no-emdash: OK, lint rc 0.GIT_REPO_URLandGIT_REPOSunset; the session container sets them, and main fails the same 8 checks with them set).git worktree move <wt> /scratch/...across mounts:fatal: failed to move ... Invalid cross-device link.cp -athe worktree,git worktree repair <new>from the main repository:git worktree listshows the new path, an untracked file came along, and afterrm -rf <old>plusgit worktree prunethe new one stays.https://claude.ai/code/session_01U97ssbeo9C37pqPiWMQ1BU