AgentKit
ReferenceCLI commands
BetaYou are reading docs for the beta channel (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 envelope

Flags

FlagDescription
--dry-runPreview what would happen without writing any files
--forceProceed even when AK-owned files have been user-modified (drift)
-h, --helphelp for init
--jsonEmit machine-readable JSON (implies --no-interactive)
--no-backupSkip the pre-install snapshot (power users only — data loss risk)
--no-interactiveDisable interactive prompts (CI-safe)
--project-id stringOverride the project name stored in the manifest (default: directory basename)
-q, --quietSuppress non-error output on stderr
-V, --verboseExtra diagnostic output on stderr (loses to --quiet)
-y, --yesAssume yes for all prompts

Output modes

ModeBehavior
prettydefault on TTY (colors, ASCII markers)
plainauto when stdout piped or --no-interactive
json--json (single-object envelope, NDJSON-safe)

Exit codes

CodeMeaning
0success
1runtime error
2invalid flags
3user-cancel (SIGINT, prompt-cancel)
1directory does not exist or I/O error
2invalid flags
6drifted files detected without --force
  • ak — AgentKit CLI

On this page