2.4.1-beta.1) — updated automatically on every beta release.Switch to stable →CLI commands
ak init
Initialize an AgentKit project
Idempotent initialize-or-update of an EXISTING directory. Creates the ownership manifest at <dir>/.agentkit/ownership.json and tracks all AK-managed files found under project .agentkit/, kits/, and .claude/ subtrees. The global AgentKit state directory is excluded when it overlaps project .agentkit/. If a manifest already exists, re-runs drift detection and updates tracked entries. Use ak new to scaffold a fresh project directory.
Who it's for: Both: power devs (--no-interactive --json) and non-tech users (defaults).
When to use it: Onboarding an existing directory into AK management, or re-running after manual file edits to refresh the ownership manifest.
What changes on disk: Creates or atomically updates <dir>/.agentkit/ownership.json. For existing manifests, snapshots configured global AK state via ak backups before mutation. With --dry-run no files are written.
Usage
ak init [dir] [flags]Examples
ak init # init current directory
ak init ./myproj # init a specific directory
ak init --dry-run # preview without writing
ak init --force # proceed even if files have drifted
ak init --project-id myproj --json # script-friendly envelopeFlags
| Flag | Description |
|---|---|
--dry-run | Preview what would happen without writing any files |
--force | Proceed even when AK-owned files have been user-modified (drift) |
-h, --help | help for init |
--json | Emit machine-readable JSON (implies --no-interactive) |
--no-backup | Skip the pre-install snapshot (power users only — data loss risk) |
--no-interactive | Disable interactive prompts (CI-safe) |
--project-id string | Override the project name stored in the manifest (default: directory basename) |
-q, --quiet | Suppress non-error output on stderr |
-V, --verbose | Extra diagnostic output on stderr (loses to --quiet) |
-y, --yes | Assume yes for all prompts |
Output modes
| Mode | Behavior |
|---|---|
pretty | default on TTY (colors, ASCII markers) |
plain | auto when stdout piped or --no-interactive |
json | --json (single-object envelope, NDJSON-safe) |
Exit codes
| Code | Meaning |
|---|---|
0 | success |
1 | runtime error |
2 | invalid flags |
3 | user-cancel (SIGINT, prompt-cancel) |
1 | directory does not exist or I/O error |
2 | invalid flags |
6 | drifted files detected without --force |
Related commands
ak— AgentKit CLI