Repository navigation
docs(hooks): add a recipe for one project command at session start - #1002
Merged
Merged
Conversation
Issue #974 asked how to run one read-only project script at session start in every Agent and get its output to the model, from a single hooks.projects Entry. The reference documents each binding type but gave no Pi or OpenCode example, and left the working directory, the output's destination and trust unanswered. The recipe gives one Entry with native bindings for Claude Code, Codex, Pi and OpenCode v1, plus an OpenCode v2 package. Each binding was run in the devcontainer against a capturing model endpoint, from the project root and from a subfolder, to record where the output lands in the model request and which start folders load the hook. The runs also showed that `hooks sync --trust` skips hooks written for hooks.projects (codex_trust.go ignores records with a project root), which the hooks reference and the built-in skill did not say, so both now do.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Type
proposals/only — see CONTRIBUTING.md)approvedlabel)Linked Issue
Part of #974. This covers the parts that could be verified in the devcontainer: Claude Code, Codex, Pi and OpenCode v1/v2 bindings, the working directory, where the output goes, and trust. Antigravity and the "what to commit" question are left for a follow-up.
What changed
how-to/recipes/session-start-command.md: onehooks.projectsEntry that runsnode scripts/status.mjsat session start and puts its stdout in the model context, with native bindings for Claude Code, Codex, Pi and OpenCode v1, plus an OpenCode v2packagevariation. Listed in the recipes index and sidebar.hooks sync --trustskips hooks written forhooks.projects(internal/hooks/codex_trust.goignores records with a project root). The hooks reference, its ja/ko/zh-Hans/zh-Hant copies and the built-in skill's hooks reference now say so. The reference'shooks.projectssection links the recipe.How the recipe was verified
Each binding was synced through
hooks.projects+skillshare hooks sync -gand run in the devcontainer against a local endpoint that captured the request each Agent sent to the model (Claude Code 2.1.278, Codex 0.155.1, Pi 1.6.0, OpenCode 1.19.6 and 2.4.1):cds to the Git root)Also checked: a script that exits 1 adds nothing (OpenCode v1), and a
hooks.projectskey that is a subfolder of a Git repo adds nothing for Codex or OpenCode, so the recipe requires the key to be the repository root. The YAML blocks in the page were asserted equal to the files used in those runs.Not covered: interactive/TUI sessions and the Agents' trust prompts (runs used per-run trust overrides), a second request in the same session, the timeout path, macOS and Windows.
Checks
pnpm run buildinwebsite/(devcontainer): passes for en, ja, ko, zh-Hans, zh-Hant. Last run before deleting one plain-text paragraph (no links).python3 scripts/ai-context.py check: ok.make check: not run; docs-only change (the built-in skill edit is a reference file, not code).Checklist
make check) — for code changes: docs-only, no code changed