Skip to content

hook

Manage instruction hooks — register them into agent settings files and run them to inject context at session start.

Register a hook into agent settings (Claude Code, Cursor, Codex). Idempotent — re-running with the same flags updates the hook if the pinned version differs.

Terminal window
npx cyberplace@<version> hook register \
--name commit-discipline \
--event SessionStart \
--extract AGENTS.md \
--heading "Commit Discipline"

Options:

FlagDescription
--name <name>Hook name (used for idempotency and logging)
--event <event>SessionStart (default) or PostToolUse
--file <path>Read instructions from a file
--glob <pattern>Glob pattern for dynamic instructions
--extract <path>Markdown file to extract a section from
--heading <heading>Section heading to extract (required with --extract)
--matcher <matcher>PostToolUse matcher (default: Write|Edit)
--root <path>Repo root
--dry-runPreview without writing
--verboseHuman-readable status on stderr
--format <format>text (default), agent, or json

Run a hook directly — injects the instruction content into the agent context. Called by the agent runtime at session start.

Terminal window
npx cyberplace@<version> hook run \
--extract AGENTS.md \
--heading "Commit Discipline"

Options:

FlagDescription
--name <name>Hook name (for logging and idempotency)
--file <path>Read instructions from a file
--glob <pattern>Glob files and inject their contents
--extract <path>Extract a section from a markdown file
--heading <heading>Section heading to extract (required with --extract)
--verboseHuman-readable status on stderr
FlagWhen to use
--fileSingle static instruction file
--globMultiple instruction files matched by pattern
--extractOne section from a larger markdown file (e.g. AGENTS.md)

Always pin the CLI version in registered hooks — never use @latest:

Terminal window
# Good — pinned
npx cyberplace@0.2.1 hook run --extract AGENTS.md --heading "Commit Discipline"
# Bad — resolves at runtime
npx cyberplace@latest hook run

Re-run hook register after upgrading the CLI to bump the stored version.