CLI commands
ak init
Initialize an AgentKit project
ak init
Initialize an AgentKit project
Synopsis
What it does:
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.
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 envelope
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.
Output modes: pretty default on TTY (colors, ASCII markers) plain auto when stdout piped or --no-interactive json --json (single-object envelope, NDJSON-safe)
Exit codes: 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
ak init [dir] [flags]Options
--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 promptsSEE ALSO
- ak - AgentKit CLI