3.0.0-beta.15). Features may change before the next stable release.Switch to stable →ak kit
ak kit init
Install or build a kit with an explicit runtime, scope, delivery mode, and reviewed recovery path.
Use ak kit init when you want to resolve a kit and emit its capabilities into
a runtime or build directory. Choose the target, scope, and delivery mode before
you run it, because those choices determine both network activity and disk
effects.
Choose the correct lifecycle command
| Goal | Command | Result |
|---|---|---|
| Register an existing directory | ak init [path] | Records ownership for an existing project; it does not install a kit. |
| Create a new project | ak new <project-name> | Creates a greenfield directory and can install a template or kits. |
| Install a kit route | ak kit init <kit-name> | Resolves and emits a kit to the selected runtime, scope, and mode. |
| Install through the equivalent entry point | ak kit install <kit-name> | Uses the same installation behavior with an install-oriented command name. |
| Reconcile an installed route | ak kit refresh <kit-name> | Re-emits that route and removes stale owned output within its lifecycle rules. |
Use ak kit refresh, not a fresh forced install, when your goal is to update an
existing route.
Before you start
Released kits use the authenticated remote registry by default. The channel
resolves in this order: an explicit --channel, then the channel recorded in
the install receipt of an existing destination, then kit.channel, then
stable. An explicit --channel applies to that request only and is not
saved; it does not change later ak kit init, ak kit refresh, or ak update
runs. Conflicting receipts print a warning, fall through to kit.channel, and
are never rewritten. Paid kits require a valid CLI session and entitlement before
preview or writes.
ak whoami
ak licensesRemote resolution can renew local authentication state, contact the registry, download a runtime-specific artifact, and populate the verified cache. A warm, fully verified cache can satisfy some offline failures; a cold or unverifiable cache fails closed.
Use --local --kits-dir <dir> only for an explicit development or CI source.
It is not a fallback for failed authentication or entitlement.
Grok Build is a signed registry target for normal Kit installation. Use
--local --kits-dir <dir> only when intentionally selecting a development or
CI source. AgentKit emits Grok runtime files and lifecycle metadata; Grok
still owns authentication, model, trust, permission, and sandbox behavior.
Usage
ak kit init <kit-name>Supply one installable kit name in scripts. On an interactive TTY, omitting the name can open the setup wizard; a scripted invocation without the name fails.
For remote examples, replace <channel> with the release channel selected in
the docs header. Omitting --channel uses the existing receipt channel, then
kit.channel, then stable.
Command flags
| Flag | Default | Description |
|---|---|---|
--beta | false | Shorthand for --channel beta. |
--build-only | false | Build to a local directory instead of installing. |
--channel <channel> | Receipt channel, then kit.channel, then stable | Select the remote registry channel for this request only; the value is not saved. |
--exclude-skills <names> | Empty | Install all kit skills except a comma-separated set. |
--accept-risks <token> | Empty | With --fresh, accept exactly the safety risks a previous plan listed, by its printed token. |
--force | false | Authorize overwrite of an existing output within lifecycle and snapshot boundaries. |
--fresh | false | Reset one selected installed target to kit-only output after confirmation and a verified snapshot. Not with --force, --no-backup, --build-only, or --out. |
-g, --global | false | Use the adapter's user directory instead of the current project. |
--kits-dir <dir> | Empty | Select an explicit local kit directory for development, CI, or a local build. |
--local | false | Use the explicit local source instead of the remote registry. |
--no-backup | false | Skip pre-install recovery snapshots and related native-global Claude takeover protection. |
--out <dir> | Empty | Set the output root for build or export routes. On Windows, a drive-relative path such as D:out exits 2 before any write; quote the path or use forward slashes. |
--registry-url <url> | Environment or release default | Override the AgentKit registry base URL. |
--remote | true | Use the authenticated remote registry; explicit use is unnecessary because it is the default. |
--select-skills | false | Choose kit skills interactively. |
--skills <names> | Empty | Install only a comma-separated set of skills. |
--switch-to-plugin | false | Select Claude Code plugin delivery at the chosen scope. |
--target <ids> | claude-code | Select one or more comma-separated emitter target IDs, including dsh, grok, and pi; generated command facts may lag newly registered Kit projection targets. |
--version <version> | Channel latest | Select a remote kit version. |
--zip | false | With --target portable, also write one uploadable ZIP per Skill. |
--skills, --exclude-skills, and --select-skills are alternative selection
modes. --select-skills requires an interactive terminal. Shared flags are
listed in CLI conventions.
Choose a target, scope, and mode
| Route | Project scope | User scope | Selector |
|---|---|---|---|
| Claude Code native | Runtime files under .claude plus lifecycle metadata under .agentkit | Runtime files under ~/.claude plus AgentKit lifecycle data | --target claude-code; add --global for user scope. |
| Claude Code plugin | ak-<kit> in the project | ak-<kit> under the configured Claude plugin root | Add --switch-to-plugin; add --global for user scope. |
| Codex native | Skills under .agents/skills, the Codex runtime under <project>/.codex/, and the plugin package plus lifecycle metadata under .agentkit/adapters/codex/<kit>/ | Skills under ~/.agents/skills and other ~/.codex surfaces | --target codex; add --global for user scope. A project install reports the project's Codex trust state. |
| Cursor | Project .cursor surfaces | User .cursor surfaces | --target cursor; add --global for user scope. |
| DeepSeek Harness native | Skills under .dsh/skills/ plus lifecycle metadata under .agentkit/adapters/dsh/<kit>/ | Skills under ${DSH_HOME:-~/.dsh}/skills/ plus lifecycle metadata under ${AGENTKIT_HOME:-~/.agentkit}/adapters/dsh/<kit>/ | Use --target dsh; add --global for user scope. |
| Grok Build native | Runtime files under .grok plus lifecycle metadata under .agentkit/adapters/grok/<kit>/ | Runtime files under $GROK_HOME (default ~/.grok) plus lifecycle metadata under ${AGENTKIT_HOME:-~/.agentkit}/adapters/grok/<kit>/ | Use --target grok; add --global for user scope. |
| Pi native spike | Runtime files under .pi/skills, .pi/agents, .pi/rules, and .pi/extensions | Active Pi coding-agent profile (PI_CODING_AGENT_DIR or ~/.pi/agent) with no extra .pi/ segment | Use --target pi; add --global for user scope. An occupied profile is refused unless --force explicitly authorizes the overwrite. |
| Oh My Pi native | Portable ak-<slug> Skills under .omp/skills, plus project Agents, rules, and AGENTS.md | The corresponding surfaces below the resolved OMP profile root | Use --target omp; add --global for user scope. Project OMP also discovers project .agents/skills. |
| AGY | Unsupported | Skills under both ~/.gemini/config/skills and ~/.gemini/antigravity-cli/skills, with optional Agents under ~/.gemini/config/agents/<name>/agent.md | Use --target agy --global; remote source resolves the signed claude-code package, marks projected Agents as subagents, and strips incompatible tool frontmatter. |
| Local build | The selected --out directory | Not an install scope | Use --build-only --out <dir>. |
| Portable export | The selected --out directory | Not an install scope | Use --target portable --out <dir>; build mode is implied. |
A project install refuses a route that resolves to the user-level install, such as
a project directory that is your home directory, a project .agentkit that is
your AgentKit home, or a project .claude, .codex, or Pi extension that is the
matching user-level root. The check covers every selected target, runs before
any Skill picker, preview, lock, snapshot, or write, and exits 6. Re-run with
--global to manage the user-level install, or run from another project
directory. Build and export routes are not checked.
Project and user installs can coexist. Claude native and plugin delivery are separate modes within a scope; switching modes is an explicit, snapshot-backed transition. Codex does not provide full Claude command, Hook, or status-line parity, so review emitted warnings instead of assuming every component was projected.
For global Codex Hooks, an established wrapper may alias only the final hooks
leaf to the resolved user's canonical ~/.codex/hooks, using a POSIX symlink or
a Windows directory junction. AgentKit uses that canonical path for commands,
writes, rollback, and ownership. Linked parents and leaves that resolve to any
other target are rejected.
portable is export-only. --target portable without --out exits 1 before
preview, confirmation, source resolution, lifecycle preflight, or disk writes:
init: target "portable" is export-only and has no install mode; re-run with --out DIR to export a standalone build--out alone preserves the remote source default and reports mode: "build" in
JSON. Explicit --build-only --out remains valid and selects the
local-development source default. Add --zip when a portable export should also
produce one uploadable ZIP per Skill. Portable writes no install record. AGY is
global-only and is not a refresh lifecycle peer. Pi is an install projection
target, not an ak run adapter; use Pi's own discovery for emitted .pi/skills
and do not substitute --target omp unless you intend Oh My Pi dispatch.
OMP projection uses portable ak-<slug> directories and top-level
name: ak-<slug> in projected SKILL.md files. It does not rewrite body aliases
such as /ak:cook or $ak:cook, and ak run <kit>/<skill> --target omp keeps
its dispatch selector. In a trusted project, project .omp/skills shadows a
colliding project .agents/skills copy for project-scope OMP installs; project
.agents/skills shadows the OMP profile copy for global installs used from that
project. ak kit init --target omp warns and continues without skipping OMP
emission, deleting or rewriting either Skill, altering .agents or OMP settings,
requiring --force, or returning exit 6.
Review confirmation behavior
On an interactive TTY, install mode prints a destination preview and asks
Continue? [y/N]:. Bare Enter or any answer other than y or yes declines.
--json, --no-interactive, and non-TTY stdin skip the install prompt and
can proceed to writes without --yes. Use --yes in automation to make that
intent explicit; do not rely on a missing prompt as a safety gate.
--fresh is the exception: a scripted run without --yes stops with exit 3.
A TTY decline currently exits 1, not 3. Build and export routes do not show
the install preview because they write to the selected output directory rather
than an install destination.
For intentional automation, specify the route and confirmation explicitly:
ak kit init engineer --target codex --yes --no-interactive --json --channel <channel>
# Grok project install from an explicit local development source.
ak kit init engineer --local --kits-dir ./kits --target grok --yes
# Grok user install from the same explicit local source.
ak kit init engineer --local --kits-dir ./kits --target grok --global --yes
# Portable export with one uploadable ZIP per Skill.
ak kit init engineer --target portable --out ./ak-export --zipUnderstand disk effects
An install can write runtime-native files, AgentKit ownership and lifecycle metadata, project configuration, Hook scripts, native skill directories, and mode-transition records. A global Codex install can also register the AgentKit MCP runtime in the user Codex configuration.
Unknown and user-modified files are preserved unless a supported operation and
explicit --force authorize a bounded overwrite. Before destructive refresh or
mode-transition writes, AgentKit normally creates recovery snapshots. Do not
use --no-backup for routine installation.
Reset one target with --fresh
ak kit init <kit> --fresh resets one selected install target to kit-only
output. A target is one kit, one runtime, and one scope. Use it when the kit's
own lifecycle root has collected custom or stale files that a refresh or
--force keeps. ak kit install accepts the same flag.
# Review the plan; a scripted run stops here with exit 3.
ak kit init engineer --fresh --target codex
# Reset after reviewing the plan.
ak kit init engineer --fresh --target codex --yesThe reset runs in this order:
- Build a read-only plan. It lists the kit-exclusive reset root, the existing files there, the custom or unrecorded files it removes, the recorded files whose local edits it discards (inside and outside the reset root), the links and special files it keeps, the shared runtime roots it does not reset, and any safety risks.
- Ask for consent once (see below).
- Rebuild the plan under the lifecycle lock. If the safety risks changed, ask
again on a TTY or stop with exit
3in a scripted run. - Snapshot every path the reset can delete or overwrite, then verify each snapshot. A snapshot that fails verification is retaken once.
- Emit the kit.
- Sweep leftover files inside the reset root. A file changed since the plan was built is kept. This kit's stale recorded files are removed even when they were modified, because the verified snapshot holds their bytes.
What the reset leaves alone:
- Shared runtime roots, such as
.claudeor~/.codex, change only through this kit's recorded files, as they would under--force. - Sibling kits, other runtimes, and the other project or global install are not reset.
- Links, junctions, reparse points, and special files inside the reset root are kept and never followed.
- The previous skill selection is not inherited. The whole kit is installed
unless you pass
--skills,--exclude-skills, or--select-skills.
For Codex, an [agents.<slug>] table that points to a removed agent file is
pruned, so no dangling config_file entry remains.
Consent and safety risks
| Run | Plan without risks | Plan with risks |
|---|---|---|
| TTY | One Reset this target? [y/N] prompt; --yes skips it. | One prompt that names the risks, even with --yes; --yes --accept-risks <token> skips it. |
Scripted, --json, or --no-interactive | --yes proceeds. Without it, the command prints the plan and the exact rerun command, then exits 3. | Only --yes --accept-risks <token> proceeds. Otherwise the command prints the plan, the risk token, and the exact rerun command, then exits 3. |
--yes alone never accepts a risk. A plan lists a risk for each check it
cannot prove:
unproven-ownership: the occupied reset root has no install manifest, or the manifest is unreadable.other-kit-ownership: the reset root's install manifest names another kit.snapshot-unverified: the recovery snapshot failed verification twice. Nothing is reset until you accept it.
The risk token covers the exact risk kinds, paths, and files of that plan for
that kit and target. For an other-kit-ownership risk it also covers the kit
that owns the root, so accepting one kit's record never covers another kit's. A
new risk, file, or owning kit changes the token. If the locked plan has fewer
risks than you accepted, the reset proceeds. A token passed to a plan with no
risks is ignored with a notice. A token that accepts an unverified snapshot
keeps accepting one for that target, so do not save it for later runs.
--accept-risks without --fresh exits 2.
With --json, a stopped run writes an envelope with kind=kit.init_fresh_plan
and status: "confirmation-required". Its data includes reason
(not-confirmed, risks-not-accepted, risks-changed, or
snapshot-unverified), resetRoots, notReset, unrecordedPaths,
modifiedRecordedPaths, modifiedOutsidePaths, keptLinks, risks,
riskToken, confirmWith, and command. Each risks entry has kind,
path, detail, effect, and files, plus owner for an
other-kit-ownership risk. Human output caps each path list at 25 entries; the
JSON plan carries the complete lists.
Automatic adjustments
pi,grok,omp, anddshkeep kit output and runtime files in one folder, so no kit-only boundary exists. A fresh request there runs a snapshot-backed--forcerefresh instead, prints a notice, and keeps custom files.- A reset root reached through a link or reparse point also falls back to the
snapshot-backed
--forcerefresh with a notice. - A Claude Code plugin install is reset in place in plugin mode, even when
--switch-to-pluginis omitted. - A Codex install that still uses the legacy skills layout is migrated first
with a snapshot-backed
--forcerefresh, then reset in the same command.
Refusals
These exit 2 before the reset touches anything:
--freshwith--force,--no-backup,--build-only, or--out.- More than one target.
- An export-only target such as
portable.
These exit 1 before any mutation:
- A pending native-to-plugin switch. Finish it with
ak kit init <kit> --switch-to-plugin, then run--fresh. - A pending legacy migration transition. Run
ak migrate rollbackfirst. - Recorded ownership evidence that cannot be read.
- A global Claude home that is not AgentKit-owned. Run
ak kit init <kit> --globalto establish ownership first. - An ambiguous boundary, such as a runtime root inside the reset root, or a reset root that is not a directory.
- A snapshot that cannot be taken.
A project route that resolves to the user-level install, such as a project
directory that is your home directory, exits 6 before the plan is built. Re-run
with --global or from another project directory.
Recovery output
After a reset, human output reports each reset root with the number of removed custom or unrecorded files and modified stale files, each shared root that was not reset, and each pre-reset snapshot:
[i] Fresh reset: <reset-root> now holds only engineer output (removed 3 custom/unrecorded and 1 modified stale file(s))
[i] Pre-reset target saved (verified <id>). Roll back: <restore-command>A snapshot outside restore scope reports Manual recovery data: <path>
instead of a restore command. An accepted unverified snapshot is labeled
UNVERIFIED, may be incomplete. If nothing existed to reset, the output says
so and no snapshot is listed.
With --json, data.fresh carries resetRoots, notReset, snapshots
(each with id, roots, verify_command, and either restore_command or
manual_data_path, plus unverified when accepted), snapshotVerified,
removedUnrecorded, removedStaleModified, and reason. The legacy top-level
forceSnapshot field names only a verified snapshot, so it is empty when the
only snapshot is an accepted unverified one. If the run fails after the
snapshots, the error names each snapshot with its verify and restore
route.
When ak kit init hands off to an updated CLI first, the continuation carries
--fresh and any accepted --accept-risks token, never --force. Desktop,
ak update, and ak doctor have no fresh mode.
How --fresh differs from --force
--force | --fresh | |
|---|---|---|
| Custom or unrecorded files in the kit's lifecycle root | Kept | Removed |
| This kit's recorded files with local edits | Overwritten only on collision; modified stale files are kept | Discarded; modified stale files are removed |
| Recovery snapshot | Taken unless --no-backup | Always taken and verified; --no-backup is refused |
| Targets | One or more | Exactly one |
| Consent | Install preview; scripted runs can proceed without --yes | Plan plus one confirmation; scripted runs need --yes and any risk token |
The two flags are mutually exclusive.
Read human and JSON output
In human modes, progress, the destination preview, and confirmation appear on stderr. The final result summary appears on stdout and reports the kit, output path, file count, install mode, scope, Hook summary, warnings, and any recovery information that applies.
With --json, stdout contains one versioned success envelope with
kind=kit.init and command results under data. Unless --quiet is set,
stderr also receives raw status records with status=preview before the write
and status=complete after it. Consume stdout and stderr separately.
Success data can include the selected kit and targets, mode, install mode,
scope, output directory, file and skill counts, installed Hook summary,
warnings, project configuration state, mode transitions, and bounded recovery
snapshot fields. Hook projection data can also include optional hooksDropped,
droppedHookSummaries, hookMatchersNarrowed, and narrowedHookSummaries;
zero or nil values are omitted.
Human and JSON execution errors show the recovery reason by default, including
argument errors from the command's argument validation. Known secret shapes
and URL query strings are redacted while paths remain visible.
--verbose can expose the raw underlying error; review it before sharing.
Exit behavior
| Exit | Meaning | What to do |
|---|---|---|
0 | The selected build or install completed. | Verify the reported target, scope, mode, files, and warnings. |
1 | A runtime, validation, authentication, entitlement, source, emission, or write error occurred; a TTY decline also currently uses this exit. | Read the error and recovery fields before retrying. |
2 | Flags, arguments, or a flag combination were invalid. | Correct the route or selection flags. |
3 | The command was interrupted or cancelled through the shared cancellation path, or a --fresh reset was not run because it needs confirmation or acceptance of listed risks. | Inspect current state and any recovery output before retrying. For --fresh, review the plan and run the printed command. |
4 | Another AgentKit kit lifecycle operation holds the mutation lock. | Let it finish, then retry after a few seconds. |
5 | A kit was not found in the selected local kit directory. | Check the kit name and explicit local source. |
6 | The target already exists and cannot be replaced without --force, or the project route resolves to the user-level install. | Verify ownership and route; use --force only after reviewing the bounded overwrite. For a user-level route, re-run with --global or from another project directory. |
Exit meanings are command-local. In particular, do not interpret the TTY
decline as the shared exit 3 promise.
Recover from a failed or forced install
When output includes a recovery snapshot, inspect it before changing more files:
ak backups show <id>
ak backups verify <id>Some snapshots under AgentKit-owned restore roots can be applied with
ak backups restore <id>. A project-local forced install can instead report a
manual snapshot data directory because that output is outside normal restore
scope. Follow the recovery method in the result; do not assume every snapshot
is restorable by the same command.
After recovery or installation, reopen the target runtime and invoke one installed skill. If discovery fails, check target, project versus user scope, and Claude native versus plugin mode before reinstalling.
Read hook projection results
The success summary reports installed Hook events and scripts when present. Hook projection disclosures use separate lines:
Hook groups not projected: <count> group(s) - see warnings
Hook matchers narrowed (some tool matches unsupported on this target): <count> matcher(s) - see warningsIt then prints an actionable summary for each drop or narrow. A full drop removes the group; a narrow keeps handlers on supported matcher atoms.
For Codex, Engineer has one fully dropped task-state PostToolUse group and two
shared narrowed matchers. Marketing has no full drop and three narrows. The
install still succeeds: these are target limitations, not repaired Hooks or
fatal installation errors.
Related commands
- Complete
ak kit initcommand facts - Install kits safely
- Kit installation troubleshooting
- Register an existing project with
ak init - Create a project with
ak new - Refresh an installed route
Hook groups not projected can be unsupported or deferred by the harness bridge. Read hooksDeferred separately from unsupported groups; deferred does not mean permanently unsupported.