Skip to content

docs(hooks): add a recipe for one project command at session start - #1002

Merged
runkids merged 1 commit into
mainfrom
runkids/session-start-recipe
Nov 24, 2026
Merged

runkids merged 1 commit into
mainfrom
runkids/session-start-recipe

Conversation

@runkids

@runkids runkids commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)
  • Approved feature or large change (the linked issue has the approved label)

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

  • New recipe how-to/recipes/session-start-command.md: one hooks.projects Entry that runs node scripts/status.mjs at session start and puts its stdout in the model context, with native bindings for Claude Code, Codex, Pi and OpenCode v1, plus an OpenCode v2 package variation. Listed in the recipes index and sidebar.
  • hooks sync --trust skips hooks written for hooks.projects (internal/hooks/codex_trust.go ignores 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's hooks.projects section links the recipe.

How the recipe was verified

Each binding was synced through hooks.projects + skillshare hooks sync -g and 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):

Agent From the project root From a subfolder Output in the model request
Claude Code added hook not loaded system message
Codex added added (command cds to the Git root) developer message
Pi added extension not loaded user message after the first prompt
OpenCode v1 added added system message
OpenCode v2 added added system prompt

Also checked: a script that exits 1 adds nothing (OpenCode v1), and a hooks.projects key 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 build in website/ (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

  • I've read CONTRIBUTING.md, including its AI-assisted contributions section
  • I've reviewed every line of the diff and can explain it
  • Tests included and passing (make check) — for code changes: docs-only, no code changed
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T10:28:59.404252Z bf78235 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@runkids
runkids merged commit e143749 into main Nov 24, 2026
9 checks passed
@runkids
runkids deleted the runkids/session-start-recipe branch November 24, 2026 11:12
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