feat(zero): carry standalone hook merge fragments in agents.json (ZERO-445) - #62
Merged
Merged
Conversation
…O-445)
Add the literal per-host hook config fragment under standalone.hooks.merge
(claude-code, codex) with ${ZERO_HOOKS_DIR} standing in for the CLI's staged
~/.zero/hooks dir. The CLI's standalone init deep-merges this fragment and
derives which hook scripts to fetch from its script references — retiring the
CLI-side JSON_HOOK_FORMATS gate and the separate hooks.json fetch, so a new
JSON-config host (any shape) becomes a matrix-only change.
The fragments duplicate the declarations the plugin ships in hooks/hooks.json
(two consumers of one shape); a new CI check keeps them in lockstep.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Kiro CLI registers hooks inside a custom-agent JSON (~/.kiro/agents/zero.json, kiro.dev/docs/cli/custom-agents/configuration-reference): agentSpawn maps to SessionStart and userPromptSubmit maps 1:1; timeouts are timeout_ms. auto-approve-zero.sh is omitted — Kiro's preToolUse can only allow/block, it has no permission-decision output, so the script is dead weight there. Warp stays hook-less on purpose: hooks are an open, unimplemented feature request (warpdotdev/warp#7834). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Part of ZERO-445 — the deferred "Option 2" from the agents.json work. Companion CLI PR: piedotorg/zero#730.
What
plugins/zero/agents.json:claude-codeandcodexnow carry the literal hook config fragment understandalone.hooks.merge, with${ZERO_HOOKS_DIR}standing in for the CLI's staged~/.zero/hooksdir. The CLI deep-merges this fragment into the host's config file and derives which hook scripts to fetch+stage from the fragment's${ZERO_HOOKS_DIR}/<name>references — no separate list, no CLI-side format knowledge..github/workflows/hooks-fragment-sync.yml: the fragments duplicate the declarations the plugin ships inplugins/zero/hooks/hooks.json(two consumers of one shape — the ticket's known tradeoff). This check keeps them in lockstep: each shared-shape fragment must equalhooks.jsonmodulo the${CLAUDE_PLUGIN_ROOT}/hooks→${ZERO_HOOKS_DIR}rewrite.make minorbump: 1.6.0 → 1.7.0.Compatibility / ordering
mergeis an unknown field it ignores,formatstays for its required-field schema — and keeps using itshooks.jsonfetch. Verified locally by running 1.13.0 against this matrix.~/.kiro/agents/zero.json, the Kiro custom-agent shape):agentSpawn↔ SessionStart anduserPromptSubmitmap 1:1 (timeout_msfields).auto-approve-zero.shis deliberately omitted — Kiro'spreToolUsecan only allow/block (no permission-decision output), so it would be dead weight. Note the scoping difference: Kiro hooks are per-agent, so they fire inzero-agent sessions rather than globally. Untested against a real Kiro install — verified only via the CLI's generic merge (file written correctly end-to-end).hooksblock: hooks there are an open, unimplemented feature request (warpdotdev/warp#7834); Warp keeps skills + MCP only.🤖 Generated with Claude Code