# ox init (https://test.sageox.ai/docs/cli/init)

# ox init

Initialize a repository with SageOx, connecting it to the platform and setting up local configuration.

## Usage

<Terminal>
  <TerminalCommand>ox init [flags]</TerminalCommand>
</Terminal>

Run this command from the root of your Git repository after authenticating with `ox login`.

## What Happens During Init

When you run `ox init`, the CLI:

1. **Creates the `.sageox/` directory** - Config, a README, and a `.gitignore`
2. **Adds `ox agent prime` to `AGENTS.md` / `CLAUDE.md`** - So coding sessions load Team Context
3. **Installs hooks for your coding tools** - Claude Code by default, plus any named with `--agents`
4. **Stages the created files in git** - Review and commit them yourself
5. **Associates the repository with a team** - Prompts you to pick one unless you pass `--team`
6. **Registers the repository with SageOx**

## Flags

| Flag | Description |
|------|-------------|
| `--team <team>` | Team to associate the repository with, by name, slug, or ID. Required when there is no terminal to prompt in |
| `--agents <list>` | Comma-separated coding tools to configure, for example `claude-code,codex`. Unknown names are ignored |
| `--force` | Initialize even if `.sageox/` already exists on the remote |
| `--endpoint <url>` | SageOx endpoint to use when you are signed in to more than one |
| `-q, --quiet` | Suppress non-essential output |
| `--no-input` | Never prompt: a step that needs a choice fails and names the flag to pass instead. Global flag, for scripts and coding tools |

## The `.sageox/` Directory

```
.sageox/
├── config.toml       # Repository configuration (committed)
└── config.local.toml # Local overrides (gitignored)
```

## Prerequisites

- Git repository with at least one commit
- Authenticated with `ox login`
- Write access to the repository root

## Troubleshooting

**"Not a git repository"** - Run from within an initialized Git repository.

**"Not authenticated"** - Run `ox login` first.

**"Repository already initialized"** - Use `--force` to reinitialize.

## Related Commands

- [ox login](/docs/cli/auth) - Authenticate before initializing
- [ox doctor](/docs/cli/doctor) - Diagnose configuration issues
- [ox prime](/docs/cli/prime) - Activate context for AI agents
