BuilderOS

Hooks

Three hooks on Claude Code carry the rules that must hold every time, so they do not depend on a skill being loaded. Each one calls the script; without Node, the session goes on without it.

The three hooks

  1. SessionStart

    hooks/session-start

    Briefs the session: under 3,000 characters inside a project, two lines outside one. Runs on startup, resume, fork, clear and compact.

    Matches startup|resume|fork|clear|compact

  2. PreToolUse

    hooks/pre-tool-use

    Before any file write, refuses a hand-written state.json. Only the script writes state, history and gate results.

    Matches Write|Edit|MultiEdit|NotebookEdit

  3. UserPromptSubmit

    hooks/user-prompt-submit

    With each message, adds one line naming the active phase and what to check the request against. Silent outside a project.

  4. Stop

    hooks/stop

What every session is told

The SessionStart hook injects this text, followed by the briefing bos.mjs brief prints for the project.

How to use it. For product work (an idea, a feature, a fix to a product with BuilderOS memory, a spec, a stack or design choice, a release, an outcome) load the using-builder-os skill and follow its routes. A standalone question gets an answer, not a pipeline. Every other request uses the session's other capabilities.

Rules that hold in every phase.

  • Never write state.json by hand: the BuilderOS script writes state, history and gate results.
  • Never invent a number: every claim in a lifecycle artifact carries a source tag backed by a file in evidence/.
  • A gate verdict is not an acceptance: the frame, the spec, the build plan and the release wait for a person.
  • No code before the build plan is accepted, even when asked to skip: name what the gate needs and offer to finish it, run the work as a change, or record an override with the person's reason through the script. New scope after acceptance is a change of its own, never appended silently.
  • Before doing product work, check it against decisions/, the PRODUCT.md non-goals, the conditions earlier phases set and the active spec's out-of-scope; say what collides in at most two lines, then continue (code before an accepted plan is the exception above).
  • While a round of questions waits for the person, draft ahead on the recommended options in blocks marked **Provisional:**; the answer keeps or deletes each one, and no gate passes with one left.
  • Done means working in the app, with a capture; test where a break does damage; a rule the person sets goes into AGENTS.md or PRODUCT.md at once.

On other hosts

Hooks are a host feature, so BuilderOS never requires them. Without them, invoke the using-builder-os skill or rely on the Session Start block that initialization writes into the project’s AGENTS.md and CLAUDE.md.

Generated from hooks/hooks.jsonView on GitHub