Skip to content

📖 docs: document Codex Stop and Gemini CLI AfterAgent hooks - #422

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
outreach/codex-gemini-hooks
Oct 30, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
outreach/codex-gemini-hooks

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #421

Why

The README lists five supervised CLIs but documents the no-tmux, Node-20 hook path only for Claude Code. Codex and Gemini CLI ship post-response hooks with the same contract, so their users can get the same check without the live pluk stack. This adds registration snippets for both, reusing the existing script (Gemini: one jq field renamed). Docs only — no src/, CLI-surface, CHANGELOG or ROADMAP support-level change.

Copilot CLI is deliberately left out: its agentStop payload has only transcriptPath (no response text) and treats exit 2 as a warning, so there is no equivalent recipe yet.

Claim evidence

  • Codex Stop input has stop_hook_active and last_assistant_message; exit 2 with stderr continues the turn with that text as a new prompt; config in .codex/hooks.json / ~/.codex/hooks.json; non-managed hooks need trust via /hooks; git-root command paths recommended: https://developers.openai.com/codex/hooks ("Stop", "Where Codex looks for hooks", "Review and trust hooks", "Config shape"). Source check: openai/codex codex-rs/hooks/src/events/stop.rs parse_completed — empty stdout on exit 0 is a no-op; exit 2 + non-empty stderr sets the continuation prompt.
  • Gemini CLI AfterAgent input has prompt_response and stop_hook_active; exit 2 retries using stderr as feedback; config in .gemini/settings.json / ~/.gemini/settings.json; $GEMINI_PROJECT_DIR is set; changed project hooks are warned before running: google-gemini/gemini-cli docs/hooks/reference.md (AfterAgent, Global hook mechanics) and docs/hooks/index.md (Configuration, Environment variables, Security and risks). Source check: packages/core/src/hooks/hookRunner.ts convertPlainTextToHookOutput — non-zero exits other than 1 become decision: deny with the text as reason.
  • "The script above works": ran the README script verbatim against @hivecommons/rationguard@0.14.0 (Node 26) with Codex-shaped and Gemini-shaped (field renamed) payloads — "This is too complex to fix right now." → exit 2, rebuttal on stderr; stop_hook_active: true, null message and clean text → exit 0, empty stdout.
  • Same guards as the Claude hook (one challenge per response, 0.7 floor, no project-local rebuttals): the shared script lines stop_hook_active / select(.confidence >= 0.7 and .excuse.source != "project") in README.md.

Checks

npm run build, npm test (437 pass), npm run test:workflows (85 pass, includes docs-cli-surface).

— hive: agent=outreach backend=copilot model=claude-opus-5.5 copilot=1.0.88

The README's Claude Code Stop hook script already matches Codex's Stop
payload and needs one field renamed for Gemini CLI's AfterAgent hook.

Closes #421

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: outreach <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 30, 2026
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 30, 2026
@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 30, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the new section against the existing Claude Code hook (README.md:254-296) and the upstream hook references. Looks correct to me.

What I verified:

  • Gemini CLI AfterAgent input is prompt, prompt_response, stop_hook_active; exit 2 = retry with stderr as the feedback prompt (gemini-cli docs/hooks/reference.md, "AfterAgent"). The one-line message= swap to .prompt_response is the only field that differs from the Claude script, so the shared guards (stop_hook_active early exit at README.md:264, the 0.7 floor and source != "project" filter at README.md:274) carry over unchanged.
  • Codex Stop input carries stop_hook_active and last_assistant_message; config lives in .codex/hooks.json / ~/.codex/hooks.json, and new/changed hooks are gated behind /hooks trust review (developers.openai.com/codex/hooks). The "$(git rev-parse --show-toplevel)/..." command form matches the upstream examples.
  • Gemini hook config fields name/type/command are all valid per the "Hook configuration" table.

Docs-only; no src/ or CLI-surface change, and verify PR contents / changelog-guard are green. Nothing blocking from me.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 2b2943f into main Oct 30, 2026
16 of 17 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the outreach/codex-gemini-hooks branch October 30, 2026 17:45
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#422a7653a7` sha256:bcc240ad57da3db39835317133fbfd569aabd28f22e14c3b83c6ae1693286890 — download from the dashboard or `hivectl review evidence #422`.

@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 30, 2026
hivecommons-hive Bot added a commit that referenced this pull request Oct 31, 2026
#426)

ROADMAP.md derives each CLI's level from what the repository documents,
but the codex and gemini rows predate the README hook section added in
#422. Both stay best-effort: neither has a CLI-specific test yet.

Closes #425

Signed-off-by: outreach <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: outreach <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[outreach] README documents a post-response hook only for Claude Code; Codex Stop and Gemini CLI AfterAgent accept the same script

0 participants