agentleFS
adrijshikharadrijshikhar/catalyst/skills/hooks/SKILL.md

hooks

Skill0 starsChanged 3 months agoMITView on GitHub

Use for Catalyst's two plugin-native lifecycle hooks (PreCompact → handoff WRITE, SessionStart → auto-render brief on clear/compact (one-line announce on startup/resume)) — checking hook status, disabling or re-enabling a Catalyst hook, scaffolding new hooks, or linting hook scripts. Trigger phrases: 'hook status', 'disable a Catalyst hook', 'wire up handoff', 'ambient mode', '/hooks', 'hook scaffold', 'hook lint', 'author a hook'.

13 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If Claude Code makes lifecycle-aware skills first-class, much of hooks becomes vestigial.

    line 69

“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

hooks

Wires Catalyst into the lifecycle of Claude Code, Codex and GitHub Copilot via one root hooks.json. Both hooks run from the plugin cache — nothing to install.

What the hooks do

HookEventWhat it triggers
PreCompact-handoff-write.shAbout to /compactAsks Claude to invoke handoff WRITE before compaction destroys state
SessionStart-handoff-read.shNew session opensDetects <branch>.json in the centralized store. Auto-renders on clear/compact; prompts handoff READ on startup/resume

Both hooks are POSIX bash + jq, and fail-open on infrastructure errors (missing jq, no git repo).

Setup

None — hooks are active as soon as the plugin is installed.

Disabling a hook

/hooks disable precompact
/hooks disable sessionstart

Writes hooks.precompact_prompt / hooks.sessionstart_resume to false in .catalyst/config.json — the only state (a legacy .claude/catalyst.json is still read when no canonical file exists, never written). /hooks enable <hook> reverses it. Falsy, case-insensitive: false, 0, no, off. Anything else — including the word "disabled" — is truthy; the hook stays enabled.

Authoring and linting

/hooks new PostToolUse my-custom-checker
/hooks lint hooks/SessionStart-handoff-read.sh

new scaffolds hooks/<event>-<name>.sh: stdin JSON, jq check, exit-code semantics, fail-open default, TODO marker. lint checks matcher breadth (.*/empty), set -euo pipefail, jq check, fail-open behavior, event-prefix naming, bash -n syntax, and hardcoded paths instead of $CLAUDE_PROJECT_DIR. Exit code 0 = clean.

Commands

CommandWhat it does
/hooks statusReport the two hooks and their state (deterministic, zero tokens)
/hooks enable <precompact|sessionstart>Turn an advisory hook back on
/hooks disable <precompact|sessionstart>Turn an advisory hook off
/hooks new <event> <name>Scaffold a new hook from template
/hooks lint <path>Validate a hook script

Composition with other Catalyst skills

  • Both hooks are registered by the root hooks.json — nothing is installed or uninstalled.
  • handoff modes are what the lifecycle hooks invoke — the hooks are messengers, not a reimplementation.
  • Multiple PreToolUse / PostToolUse hooks compose: most-restrictive wins (deny > defer > ask > allow).

Hook contract reference

See hooks/README.md for stdin/output shape, exit codes, matcher conventions.

Anti-patterns

  • Editing .claude/settings.json or .catalyst/config.json by hand for hook state. Use /hooks commands.
  • Writing a hook that depends on Python/Node, or skipping set -euo pipefail. POSIX bash + jq only; the strict mode catches typos that would otherwise silently misfire.
  • Returning JSON without hookEventName. Claude Code, Codex and Copilot use it to route output; missing it means the decision is ignored.

Model evolution

If Claude Code makes lifecycle-aware skills first-class, much of hooks becomes vestigial. If it adds native per-hook enable/disable, the two knobs and the enable/disable sub-commands retire and this skill shrinks to authoring alone. Review annually.

Retired 2026-09-02 (v0.7.0): UserPromptSubmit-orient.sh and Stop-commit-backstop.sh. Archived in the private planning repo.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.