Skip to content

feat(zero): carry standalone hook merge fragments in agents.json (ZERO-445) - #62

Merged
spencercharest merged 2 commits into
mainfrom
spencer/zero-445-hooks-merge-fragments
Jul 2, 2026
Merged

feat(zero): carry standalone hook merge fragments in agents.json (ZERO-445)#62
spencercharest merged 2 commits into
mainfrom
spencer/zero-445-hooks-merge-fragments

Conversation

@spencercharest

@spencercharest spencercharest commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

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-code and codex now carry the literal hook config fragment under standalone.hooks.merge, with ${ZERO_HOOKS_DIR} standing in for the CLI's staged ~/.zero/hooks dir. 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 in plugins/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 equal hooks.json modulo the ${CLAUDE_PLUGIN_ROOT}/hooks${ZERO_HOOKS_DIR} rewrite.
  • make minor bump: 1.6.0 → 1.7.0.

Compatibility / ordering

  • The released CLI (1.13.0) validates this matrix fine — merge is an unknown field it ignores, format stays for its required-field schema — and keeps using its hooks.json fetch. Verified locally by running 1.13.0 against this matrix.
  • Merge this before the CLI PR ships in a release: the new CLI registers hooks only from these fragments (it fails loudly if the matrix has none).
  • Kiro now carries a real fragment (~/.kiro/agents/zero.json, the Kiro custom-agent shape): agentSpawn ↔ SessionStart and userPromptSubmit map 1:1 (timeout_ms fields). auto-approve-zero.sh is deliberately omitted — Kiro's preToolUse can 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 in zero-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).
  • Warp intentionally has no hooks block: hooks there are an open, unimplemented feature request (warpdotdev/warp#7834); Warp keeps skills + MCP only.

🤖 Generated with Claude Code

spencercharest and others added 2 commits July 2, 2026 11:48
…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>
@spencercharest
spencercharest marked this pull request as ready for review July 2, 2026 19:58
@spencercharest
spencercharest merged commit 36469bc into main Jul 2, 2026
4 checks passed
@spencercharest
spencercharest deleted the spencer/zero-445-hooks-merge-fragments branch July 2, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant