# --init Flag

> It runs your Setup hooks before a session starts.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** claude --init, claude --init-only, --maintenance

## Think of it like

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

## 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

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.

## Example code

```bash
claude --init-only
```

Run the setup hooks, then exit.

## Why it matters

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

## Common mistake

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

## Three principles

- **--init.** init Setup hooks.
- **--maintenance.** maintenance Setup hooks.
- **--init-only.** Run hooks, then exit.

## Related terms

- [Non-Interactive Mode](https://learn.benibix.com/term/ai/non-interactive-mode)
- [Claude Code Plugin](https://learn.benibix.com/term/ai/claude-code-plugin)

## Taught in

- [The claude plugin Commands](https://learn.benibix.com/learn/ai-claude-code-commands/claude-plugin-commands): Claude Code Commands, 13/17

---

Source: https://learn.benibix.com/term/ai/init-flag
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
