Skip to content

docs(cli): document command hooks (hooks.yaml) - #293

Merged
edenreich merged 1 commit into
mainfrom
docs/command-hooks-287
Jun 28, 2026
Merged

edenreich merged 1 commit into
mainfrom
docs/command-hooks-287

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Closes #287

Adds a dedicated Command Hooks page documenting the .infer/hooks.yaml / ~/.infer/hooks.yaml feature (inference-gateway/cli#270), which runs user-configured shell commands at agent-loop hook points — the executable sibling of the system reminders shipped in inference-gateway/cli#669.

What's added

New page cli-hooks.md — wired into the nav + sidebar of the VitePress config, covering:

  • Where hooks live — project .infer/hooks.yaml / user ~/.infer/hooks.yaml, generated by infer init (default enabled: false).
  • Schema — enabled, hooks[].name / hooks[].hook / hooks[].command / hooks[].timeout (with the infer init default example).
  • Hook-point catalog — all 8 points (pre_session, pre_stream, post_stream, pre_tool, post_tool, pre_queue_drain, post_queue_drain, post_session), with post_session ("agent finished generating") called out as the primary deterministic post-processing point.
  • Authorization: the allow-list — every command is gated through the existing per-mode bash allow-list (tools.bash.mode.<mode>.allow); off-list commands are skipped and reported, never run (no new bypass of the secure-by-default model). Enabling unattended (CI) runs via the allow-list or INFER_TOOLS_BASH_ALLOW_APPEND (e.g. INFER_TOOLS_BASH_ALLOW_APPEND="gofmt.*").
  • Master switch — INFER_HOOKS_ENABLED=true env override.
  • Observability — the fire-and-observe hook_command stream event (name, exit code, duration, truncated output); output is not fed back into the conversation.
  • post_session CI post-processing example — gofmt / go test / notify hooks with a GitHub Actions env excerpt.
  • Security notes — secure by default, no conversation feedback, path protections, allow-list curation.

cli.md — adds a Configuration Files reference table listing all config files including the new hooks.yaml row (mirroring reminders.yaml), with a link to the new page.

Acceptance criteria

  • A docs page documents hooks.yaml (schema: enabled, hooks[].name/hook/command/timeout) with the infer init default example.
  • The allow-list authorization model is documented (off-list -> skipped; allow-list or INFER_TOOLS_BASH_ALLOW_APPEND to enable; secure-by-default headless).
  • The hook-point catalog and the post_session CI post-processing example are documented.
  • The configuration-files reference lists hooks.yaml.

Verification

  • bun run build (page renders at /cli-hooks/)
  • prettier --check .
  • markdownlint "**/*.md"

Add a dedicated Command Hooks page covering the .infer/hooks.yaml /
~/.infer/hooks.yaml feature (inference-gateway/cli#270), which runs
user-configured shell commands at agent-loop hook points.

The page documents:
- where hooks live and the infer init default (enabled: false)
- the schema: enabled, hooks[].name/hook/command/timeout
- the full hook-point catalog (pre_session, pre_stream, post_stream,
  pre_tool, post_tool, pre_queue_drain, post_queue_drain, post_session)
  with post_session as the primary deterministic post-processing point
- the authorization model: every command is gated through the existing
  per-mode bash allow-list; off-list commands are skipped and reported,
  never run (no new bypass of the secure-by-default model); enabling
  unattended runs via the allow-list or INFER_TOOLS_BASH_ALLOW_APPEND
- the INFER_HOOKS_ENABLED master switch env override
- the fire-and-observe hook_command stream event (no conversation feedback)
- a post_session CI post-processing example (gofmt, go test, notify)
- security notes

Wire the page into the nav and sidebar of the VitePress config and add a
hooks.yaml row to the Configuration Files reference table in cli.md
(mirroring reminders.yaml).

Closes #287
@inference-gateway-maintainer
inference-gateway-maintainer Bot requested a review from a team as a code owner June 28, 2026 21:18
@edenreich
edenreich merged commit 6d1d954 into main Jun 28, 2026
1 check passed
@edenreich
edenreich deleted the docs/command-hooks-287 branch June 28, 2026 21:23
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.6.114 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOCS] Document command hooks (hooks.yaml)

1 participant