Skip to content

Recipe: one project command at session start in every Agent #974

Open

Description

@digitalflex-io

Scenario

A project has a small read-only script that prints a short status when there is something to act on, and prints nothing otherwise. I want every Agent I use in that project (Claude, Codex, Antigravity, Pi and OpenCode) to run it at session start and put its output in the session context, managed from one hooks.projects Entry in the global config.

What already works

  • hooks.projects maps the project root to its entries, with the same shape as hooks.entries (reference/commands/hooks.md, "Projects, conflicts and recovery").
  • Claude, Codex and Antigravity have SessionStart in the event catalog (internal/hooks/catalog.go), so a command binding covers them:
hooks:
  projects:
    ~/path/to/project:
      entries:
        session-status:
          description: Project status at session start
          bindings:
            claude: {events: {SessionStart: [{hooks: [{type: command, command: "node scripts/status.mjs", timeout: 30}]}]}}
            codex: {events: {SessionStart: [{hooks: [{type: command, command: "node scripts/status.mjs", timeout: 30}]}]}}
            antigravity: {events: {SessionStart: [{hooks: [{type: command, command: "node scripts/status.mjs", timeout: 10}]}]}}

What is missing

  1. Pi and OpenCode. They need native code (code, codeFile or an OpenCode v2 package). The docs say Skillshare does not generate a universal hook runtime, and the dashboard supplies no OpenCode starter code because the APIs differ. I agree with both. What I could not find is an example of a Pi extension and an OpenCode plugin (v1 file and v2 package) that run one command at session start and pass its stdout to the session. The only pointers are the events used in scripts/hooks/real-agents.sh (pi.on("session_start"), session.created).
  2. Working directory. I could not find from which directory each Agent runs a project hook command. If it is not the project root, a relative command like the one above breaks. It is unclear whether the recipe should use a {files} wrapper that changes to the project root first.
  3. Where the output goes. For each Agent it is unclear whether a session-start command's stdout reaches the model's context, is only shown to the user, or is dropped.
  4. Trust. Codex needs the project trusted and its new hooks reviewed in /hooks (see issue Proposal: opt-in trust for Skillshare-managed Codex project hooks #951 for the project-scoped trust proposal). The real-agents runbook says Antigravity loads .agents/hooks.json only for a folder trusted in an interactive session.
  5. Versioned settings. In a project, the Claude hook is written to .claude/settings.json, which some repos version for other settings. Sync merges and keeps unrelated settings, and "Matching content alone does not establish ownership". A note on whether the managed hooks key should stay uncommitted would help, so a second clone does not see it as an unowned hook.

Request

A recipe under how-to/recipes/, like the Git hooks one: one project command at session start in every Agent. It would contain one Entry with each Agent's native binding: command bindings for Claude, Codex and Antigravity, a Pi extension, and an OpenCode v1 file and v2 package. Around that Entry, it would cover the working directory, where the output goes in each Agent, the trust steps, and what to commit. I am not asking for a universal runtime or for event translation between Agents.

Environment: Linux, skillshare v0.30.11.

Activity

  1. changed the title [-]docs(recipes): one project command at session start in every Agent[/-] [+]Recipe: one project command at session start in every Agent[/+] on Nov 21, 2026
  2. self-assigned this
    on Nov 21, 2026
  3. added
    feature
    on Nov 21, 2026
  4. runkids commented on Nov 24, 2026

    @runkids
    Owner

    Thanks for the detailed write-up, it made this easy to test.

    #1002 adds the recipe for Claude Code, Codex, Pi and OpenCode (v1 file and v2 package). Each binding was run against a local endpoint that captured the model request, so the "where does the output go" answers come from what each Agent actually sent, not from their docs. A few things that came out of it:

    • Working directory: Claude Code and Pi only load project hooks when you start them in the project root. Codex loads them from a subfolder too, but runs the command there, so the recipe cds to the Git root first. {files} only expands in Git bindings, so it can't help here.
    • Antigravity: its hook events don't include a session start (PreInvocation runs before every model call), so the SessionStart binding in your example won't fire. I left it out of the recipe for now.
    • What to commit: not covered yet. One thing I noticed: the OpenCode v2 registration in .opencode/opencode.json is an absolute file:// path, so it won't carry over to another clone as-is.

    Do you version .claude/settings.json for other settings in the repo you have in mind? That would help decide what the recipe should recommend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions