Skip to content

feat(managed): session hooks for Claude Code, Codex, Cursor and Pi - #431

Merged
aroff merged 1 commit into
mainfrom
feat/managed-hooks-four-agents
Oct 17, 2026
Merged

aroff merged 1 commit into
mainfrom
feat/managed-hooks-four-agents

Conversation

@aroff

@aroff aroff commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Implements specs/managed-session-hooks-prd.md (ADR-0016, third amendment): managed session-start hooks for exactly four agents, Claude Code, Codex CLI, Cursor and Pi.

What changes

  • Dependencies: aikit (aikit-sdk, aikit-evals, aikit-skillopt) moves to goaikit/aikit f91c37f (feat(sdk): session hooks for Codex, Cursor and Pi goaikit/aikit#194), and cli-framework to 388e97b (chore(deps): bump aikit to f91c37f aroff/cli-framework#188), so Cargo.lock holds one aikit copy.
  • Which agents get a hook:
    • HOOKED_AGENTS = claude, codex, cursor, pi. Every other agent, Gemini CLI included, is reached by the timer alone.
    • Apply removes a FastSkill hook left in any of those other agents.
  • How the hook is built: from argv (SessionHook::from_argv); aikit derives the shell command.
  • Approval notes: printed for a hook that is added or changed when the agent asks for approval, so Codex users are told again after the hook changes.
  • Refusals: an agent file FastSkill can't change is a warning in the apply report, not an error. Examples: a Codex config.toml with its own hooks table, or a Pi extension FastSkill didn't write.
  • managed hooks --system:
    • JSON for Claude Code and Cursor, TOML for Codex (requirements.toml);
    • Pi: "no administrator-level location; the machine-wide timer covers it";
    • --json carries agent, file, format, text and present.
  • Notices: systemMessage for Claude Code and Codex, additional_context for Cursor, plain text for Pi.
  • Docs and status:
    • updated webdocs/cli-reference/managed-command.mdx, webdocs/security/managed-machines.mdx and CHANGELOG;
    • ADR-0016's third amendment is marked accepted and implemented, and the PRD implemented (2026-10-17).

Verified on real installs (test managed source, temporary homes)

Agent Version Hook ran on Notice (sign-in lapsed)
Claude Code 2.1.302 new session, --continue SessionStart:startup says: FastSkill: sign-in needed… under the banner
Codex CLI 0.163.0 new session, codex resume, after trusting it in /hooks ↳ Hook · FastSkill: sign-in needed…
Cursor CLI 2026.10.16-e3cb207 a new chat at process start, interactive and -p reaches the model only; the model quoted it when asked
Pi 1.3.0 start, /new, /resume; not /reload Warning: FastSkill: sign-in needed…; silent in -p
  • In each case:
    • enroll printed the approval step only where there is one;
    • the last-apply time moved on each session start;
    • unenroll removed the hook.
  • Gemini removal: on a home enrolled by 0.9.273 with Gemini CLI, the next apply removed the Gemini hook and left the user's other settings as they were.
  • Known gaps (documented):
    • the Cursor CLI doesn't run sessionStart for /clear, --resume or --continue;
    • Cursor's IDE wasn't checked;
    • Pi installs that use PI_CODING_AGENT_DIR get no hook;
    • only Codex CLI is claimed, not its IDE extension.

Gate

  • cargo fmt --all --check and cargo clippy --workspace --all-targets --all-features -- -D warnings: clean.
  • ./scripts/run-tests.sh: all passed.
  • Modified-file coverage: managed.rs 94.3%, managed_hooks.rs 100%, hooks.rs 100%.

🤖 Generated with Claude Code

Managed apply now registers its session-start hook for exactly four
agents: Claude Code, Codex CLI, Cursor and Pi. Every other agent, Gemini
CLI included, is reached by the timer alone, and apply removes a
FastSkill hook still registered for one of them.

- Hooks are built from argv; aikit derives the shell command.
- Approval notes print for a hook that is added or changed.
- An agent file FastSkill can't change is a warning, not an error.
- `managed hooks --system` prints TOML for Codex and says Pi has no
  administrator-level location; `--json` carries agent, file, format,
  text and present.
- aikit moves to f91c37f and cli-framework to 388e97b.

Implements specs/managed-session-hooks-prd.md and accepts the third
amendment of ADR-0016.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aroff
aroff enabled auto-merge (squash) October 17, 2026 13:20
@aroff
aroff merged commit 616bfe8 into main Oct 17, 2026
15 checks passed
@aroff
aroff deleted the feat/managed-hooks-four-agents branch October 17, 2026 13:36
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.

2 participants