Repository navigation
feat(agent-isolation): hook-manager contract, with prek as its first adapter - #1819
Merged
Merged
Conversation
…adapter The secure setup's prek integration (the install shim, the sandbox and host-only homes, the sandbox-lint checks) becomes one instance of a contract for git-hook managers: tools/hook-manager/README.md states the install-target, home and detection rules, and registry.json records how each manager satisfies them. - hook-manager-shim.sh replaces prek-shim.sh; it takes the tool from the name it is installed under (~/.claude/bin/<tool>) and applies the adapter's install strategy (git-dir-flag for prek). - The whole-user dispatcher gives each manager the repository uses its host-only home, and none to a repository that uses none. - sandbox-lint requires env.<HOME> and the default-home deny only for a project that uses the manager: a root config file, a tracked nested config (prek workspaces), or an installed hook that runs it. - tools/dev/sync-hook-managers.py validates the registry and writes it into the shim, the dispatcher and sandbox-lint (prek hook). - contract:hook-manager joins the label taxonomy, the validator and the vendor-neutrality policy. The contract lists the strategies the other managers need (pre-commit, lefthook, husky, overcommit, CaptainHook, and those that need none), from a source-level check of each, for follow-up adapters. Generated-by: Claude Opus 5
…ional Detection now decides only what is configured for a repository: the sandbox home a project's settings must carry, the shim, verify 19d. The default-home deny and the dispatcher's host home stay on for every registered manager. Both homes are per-user: a project without prek dropping the deny lets its sandboxed commands write the environments another project's terminal commits run, and a hook that reaches prek through a script would otherwise inherit the sandbox home in a bypassed command. Generated-by: Claude Opus 5
potiuk
enabled auto-merge (squash)
October 25, 2026 16:35
This was referenced Oct 25, 2026
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.
Summary
tools/hook-manager/,contract:hook-manager), so pre-commit, lefthook, husky and other managers can join by adding an adapter rather than another set of hand-written special cases.registry.jsonis the single source of truth;tools/dev/sync-hook-managers.py(a new prek hook) validates it and writes it into the shim, the whole-user dispatcher and sandbox-lint, which run where the registry is not available.prek.toml,.pre-commit-config.yaml,.pre-commit-config.yml), a tracked one sits below it (prek workspace mode), or an installed hook runs it (custom--config). Per-repository configuration (theenv.PREK_HOMEsandbox-lint requires, the shim, verify 19d) applies only then. The per-user protections, theEdit(~/.cache/prek/**)deny and the dispatcher's host-only home, stay on for every registered manager, since those homes are shared by every repository on the host.Type of change
.claude/skills/<name>/) — eval fixtures updated belowtools/<system>/*.md)tools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)prek, workflows, validators)Test plan
prek run --all-files --skip workspace-pytestpassestest_hook_manager_shim.py; dispatcher detection / fail-closed cases), sandbox-lint (uses_hook_manager, deny always required, home only where used), dev (test_sync_hook_managers.py), vendor-neutrality-score, skill-and-tool-validator, setup-preflightsetup-isolated-setup-verifyeval suite run on this branch and onmain.mainfails the same 4 cases (step-1 case-7, step-2 cases 3, 5, 6); this branch additionally failed case-3 (grader timeout) and case-6 (check 5, harness version floor), neither touching check 19, the only part of the skill changedenv.PREK_HOMEpart appliesRFC-AI-0004 compliance
Linked issues
Follow-up adapters (good first issues), each building on this contract:
Notes for reviewers (optional)
prek-shim.shis renamed tohook-manager-shim.sh; a host that installed the old script as~/.claude/bin/prekkeeps working.prek installwhile a globalcore.hooksPathis set, so the shim is required, not only convenient.plugins/magpie-setup/skills/isolated-setup-doctor/tests/test_probe_3_container_gateway.py) is reformatted: it was unformatted onmain, and the commit hook formats the wholepluginsmember.Generative AI disclosure: prepared with Claude Code (Claude Opus 5); reviewed by the submitter.
🤖 Generated with Claude Code