Repository navigation
Closed
Labels
capability:platformFramework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap)contract:hook-managerTool capability: git-hook managers under the secure setup (install target, sandbox / host homes)family:ci.github workflows, prek, validatorsfamily:docsDocs, MISSION.md, READMEsfamily:setupsetup-* skillsfamily:toolstools/*good first issueGood for newcomerssubstrate:action-guardTool substrate: deterministic pre-tool-use command guardssubstrate:framework-devTool substrate: build / validate / eval the framework itselfsubstrate:sandboxTool substrate: agent isolation, egress control, settings audit
Description
The hook-manager contract (#1819) defines how the secure agent setup integrates a git-hook manager: where its install puts the hook, how its home is split between sandboxed and host runs, and how the setup detects that a repository uses it.
prek is the only adapter so far.
This issue adds lefthook (Go, also distributed through npm).
What the source says (lefthook v2.2.2)
- Install target.
lefthook installwrites togit rev-parse --path-format=absolute --git-path hooks(internal/git/wrapper/paths.go:7-14), which honourscore.hooksPathand resolves the common dir in a linked worktree.
Before writing, it readscore.hooksPathwith scopedgit config --localand--globalreads, and refuses when one is set:
core.hooksPath is set globally to '…' Custom hooks paths are not supported by default.(internal/command/install.go:511-589). - Two flags to watch.
--forceinstalls into the global directory, over the dispatcher (Installing hooks anyway in '%s').
--reset-hooks-pathrunsgit config --global --unset-all core.hooksPath(install.go:592-606), which removes the whole-user setup. - Fix.
GIT_CONFIG_GLOBAL=/dev/null lefthook install: the scoped global read sees nothing, and--git-path hooksthen resolves to the common dir.
AGIT_CONFIG_COUNToverride does not help: scoped reads ignore it. - Trigger. The CLI, plus an npm
postinstallthat runslefthook install(packaging/registries/npm/lefthook/postinstall.js; skipped underCI).
A~/.claude/bin/lefthookshim does not catch the npm path, because npm putsnode_modules/.binfirst onPATH.
lefthook runalso re-syncs hooks when the config changes; with a global path set it only logsSkipping hook sync(install.go:159-230). - Home. None. Remote configs are cloned into
<git-path info>/lefthook-remotes(internal/git/remote.go:21-23), inside.git, so there is no home split. - Generated hook. Honours
LEFTHOOK=0,LEFTHOOK_BIN,LEFTHOOK_VERBOSE; embedsos.Executable()as a fallback (internal/templates/hook.tmpl,templates.go:39-55); the hook name is baked in and it does not depend on$0, so it is safe behind the dispatcher. - Detection. Configs
lefthook.yml,lefthook.yaml,.lefthook.yml,lefthook.toml,lefthook.jsonand their-localvariants: confirm the exact list frominternal/config/before writing it into the registry.
What to do
- Add a
hide-global-configinstall strategy to the shim and the generator, if hook-manager: add a pre-commit adapter #1820 has not already; add a shim test. - Add the
lefthookadapter totools/hook-manager/registry.jsonwith nohome, and runtools/dev/sync-hook-managers.py. - Add an agent-guard guard that blocks
lefthook install --reset-hooks-path(and-r) andlefthook install --forcewhen the globalcore.hooksPathis the framework's. - Document the npm
postinstallgap in the contract's adapter table: the shim covers the CLI only.
Optionally propose a fix (for example, the session-start hook noticing hooks in the shared dir that are not the dispatcher).
Acceptance
lefthook installthrough~/.claude/bin/lefthooksucceeds under a globalcore.hooksPathand writes to the common dir, including in a linked worktree.- The guard blocks the two destructive flags, with a test.
prek run --all-files --skip workspace-pytestand the affected tests pass.
Metadata
Metadata
Assignees
Labels
capability:platformFramework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap)contract:hook-managerTool capability: git-hook managers under the secure setup (install target, sandbox / host homes)family:ci.github workflows, prek, validatorsfamily:docsDocs, MISSION.md, READMEsfamily:setupsetup-* skillsfamily:toolstools/*good first issueGood for newcomerssubstrate:action-guardTool substrate: deterministic pre-tool-use command guardssubstrate:framework-devTool substrate: build / validate / eval the framework itselfsubstrate:sandboxTool substrate: agent isolation, egress control, settings audit
Activity
Anurag-S1ngh commentedon Oct 26, 2026
Hi, I'd like to take this issue. Could you assign it to me?
potiuk commentedon Oct 26, 2026
Go ahead. We do not assign issues.