Skip to content
BENIBIX Learn

--init Flag

Also known as claude --init, claude --init-only, --maintenance

It runs your Setup hooks before a session starts.

Think of it like

It is like you set the table before the meal starts.

Example

Lucy's repo has a Setup hook that puts tools in place for Claude. Her container runs claude --init-only once. Then each new session starts ready.

Why it matters

Setup work runs once, at the time you choose, not in the middle of someone's task.

Definition

--init runs your Setup hooks that match init before the session starts, in print mode. --maintenance does the same for Setup hooks that match maintenance. --init-only runs the Setup and SessionStart hooks, then exits with no chat at all. A script can use them to set up a machine with the hooks you wrote.

Example code

bash
claude --init-only
Run the setup hooks, then exit.

Common mistake

Using --init in a chat. It is for print mode. In a chat, use --init-only first, then start the session.

Key takeaways

  1. 1
    --init. init Setup hooks.
  2. 2
    --maintenance. maintenance Setup hooks.
  3. 3
    --init-only. Run hooks, then exit.

Learn it properly