akm docs

CLI Reference

The CLI is called akm (Agent Knowledge Manager). Commands default to structured JSON at --detail brief. Use --format json|jsonl|yaml|text|md, --detail brief|normal|full|agent when you want a different presentation. Errors include error and hint fields.

This page is authoritative for the current CLI. For per-release behavior changes, see CHANGELOG.md and docs/migration/. For the bundle formats akm recognizes (detection, ref shapes, indexing, validation, read/write), see Bundle Types.

Global Flags

These flags are accepted by all commands:

Flag Values Default Description
--config file path AKM_CONFIG_FILE, then existing directory resolution Select the configuration file before startup; prefer akm --config <file> <command>
--format json, jsonl, yaml, text, md json Output format
--output path (none) Write rendered output to a file instead of stdout (all formats except jsonl)
--detail brief, normal, full, agent brief Output verbosity level, or the agent projection
--quiet / -q boolean false Suppress stderr warnings
--verbose boolean false Enable verbose diagnostics gated behind isVerbose(). Parsed globally before any subcommand runs. The AKM_VERBOSE env var honours the same setting and wins when both are present (see src/core/warn.ts).

Use akm --config ./custom.json config path to select a file for one invocation. The last explicit flag wins over AKM_CONFIG_FILE; relative paths resolve from the invoking directory. A missing or empty --config value fails; an empty AKM_CONFIG_FILE is warned about once and ignored. credentials.json and models.json stay in the default config directory (AKM_CONFIG_DIR, else the platform default), never beside the selected file. The retired setup --config '{...}' still exits 2 with a hint naming --endpoint. A file that does not yet exist can be created by setup or configuration writes. With neither selector, existing location variables and defaults keep their precedence.

For run, task run, task explain, and workflow run, put the selector before the top-level command. Their existing named input/parameter --config after the command keeps its original meaning. Other commands also accept the selector at nested levels or after their arguments. A literal -- ends AKM flag parsing. This file selector is distinct from the retired JSON-valued setup --config: use setup answer flags to supply answers.

--detail brief|normal|full controls how much is returned. --detail agent selects the token-lean action view on search, curate and show; every other command ignores it. (--shape, which carried agent and summary before 0.10, is gone: it is an unknown flag, exit 2. --shape summary had a projection only on show; use --detail brief there.)

Help (akm --help, akm help, <command> --help) is plain text, with no color codes, when stderr is not a terminal or NO_COLOR is set, like akm's other output; FORCE_COLOR turns the color on.

A command refuses a positional argument it does not declare (a usage error, exit 2) instead of ignoring it: any positional on a command that takes none, and any beyond the ones a command takes. akm search deploy script is refused; quote a value that contains spaces. A token after a literal -- is a positional too, except the child command of akm exec, akm env run and akm secret run. Two exceptions: akm help <command> ignores any further words, and akm info warns and continues.

Deprecation notices

When you use a command or flag that STABILITY.md marks Deprecated and its replacement exists in the same build, akm prints one line to stderr, once per process, naming the replacement: [deprecated] akm health is deprecated and is removed in 0.11: use akm doctor. Stdout, JSON and exit codes are unchanged, and --quiet silences the line. It is not printed for --help, for the scheduler's task run --scheduled, or for commands run by a task, improve or an audit (AKM_EVENT_SOURCE of task, improve or audit). The forms covered are health, metrics, info, log, judge, improve judge, every workflow command (run, plan, status, list, create, resume, abandon), akm run of a workflow ref or run id and a task that runs a workflow (workflows go in 0.11), agent <ref>, command, task run, task add, task sync, task prune, task doctor, task explain, task history, clone, improve report, improve --show-prompt, improve --require-feedback-signal, curate --pack, search --by-usage, search --include-proposed and --include-sessions, show --detail brief and --context lead, proposal extract --type, remember --auto, --enrich and --show-similar (no replacement flag), proposal reject --yes (no longer needed), upgrade --next and --timeout-ms. Since 0.10.261122 these also print the line: show --max-chars (use --max-tokens), lint --auto-fix (use --fix), migrate apply --dry-run (use akm migrate status), task add --rebind (use akm doctor scheduler sync --rebind), global --output (redirect stdout), --format yaml (use --format json or text), hints --detail full (use akm hints, akm help <command> and this reference), --detail agent on search, curate and show (use --detail normal), and, with no replacement because they do nothing, bundle update --yes, --allow-dangerous-env-keys (bundle add, bundle update, env run) and registry add --options. A deprecated form whose replacement is not built yet prints nothing, unless it is removed in 0.11 with no replacement (the remember flags and workflows): then the line says so.

Running OpenCode 1 prints the same kind of line ([deprecated] OpenCode 1 (<bin> <version>) is deprecated and is removed in 0.11: install OpenCode 2, or set the harness's bin to an OpenCode 2 binary. See STABILITY.md.), once per process, when an agent, command, task or workflow run or model work starts one. --quiet silences it, and it is not printed for a scheduled run or in an akm that a task, improve or audit started, so akm doctor's opencode-major advisory reports an OpenCode 1 harness for those.

The deprecated environment variables AKM_UPGRADE_SKIP_CHECKSUM (during upgrade), AKM_SQLITE_JOURNAL_MODE, AKM_VERBOSE and AKM_DEBUG=1 print the same one-line notice, once per process, and --quiet silences it. AKM_SQLITE_JOURNAL_MODE has no replacement; the others name akm upgrade --skip-checksum and --verbose. Since 0.10.261122 AKM_BUNDLE_DIR (when set and not empty; use akm bundle add and defaultBundle) and AKM_REGISTRY_URL (when set and akm search --from registry or --from all reads it; use config registries) do the same.

A config that sets improve.strategies or improve.qualityGate prints one line per process naming experimental.learning.strategies and experimental.learning.qualityGate, and a strategy-level limit prints one naming --limit and processes.reflect.limit; improve.stateGc.collect and a strategy's processes.consolidate.limit each print one saying the key goes in 0.11; a config that uses only experimental.learning.* prints nothing. The keys keep working exactly as before, and the lines follow the same rules as the command notices above.

--format jsonl

Outputs one JSON object per line. For search (including --from registry), each hit is a separate line, and curate --max-tokens writes each packed item on its own line. For other commands, the entire result is a single line. Useful for streaming consumption by scripts or agents.

--format md

json, jsonl, and yaml serialize the result envelope; text and md render it. Every result-envelope command supports all five.

A command may register a renderer for a document format when it has something better to say than the generic one: akm doctor --group-by run --format md emits its per-run table, and akm doctor --report --format md renders ## Checks (a table), ## Window comparison, ## Runs and ## Pending proposals, each from its field of the result, then every other field of the result. The renderers are data-driven — they fire when the result carries the report dataset, never on the format alone, so the same dataset is available as JSON too. Every other command falls back to a generic rendering derived from its own envelope — headings for the top-level keys, a table for an array of uniform objects, lists otherwise.

--format html was removed with akm ui: AKM Desktop shows what the HTML reports showed, and akm-web serves the same interface on a headless host or in a container (npm install -g akm-web, then akm-web). The flag is refused with a usage error (exit 2) that names Desktop and --format md, and output.format: html in config warns once and is ignored (the default format applies).

A small set of commands is format-exempt because their output is not a result envelope at all — completions, child-process passthrough (exec, env run and secret run), document payloads (help, help migrate), and env path and config path (a bare filesystem path is the payload, the documented shell-substitution primitive — wrapping it in an envelope would break $(akm env path <ref>) substitutions). Passing --format to one of those warns on stderr and is otherwise ignored; the exempt set is declared in src/output/format-exempt.ts. migrate status/apply invoke the packaged task migrator but are NOT exempt: the CLI parses its task plan and renders it through the normal --format pipeline, so text/md/yaml genuinely reformat it.

Scripted setup modes emit a normal format-aware result. Interactive setup is a terminal UI and emits no result document. agent leaves inherited child streams raw, then formats its final agent-result envelope normally.

--detail agent

Strips output to only action-relevant fields:

For local materialized assets, editHint is added only when editable is false. It is supplemental guidance and does not replace the normal show, run, or use action (or curate followUp). Registry-only results have no local path, editable, or editHint.

Exit Codes and Error Envelope

Every command exits with one of the following codes:

Exit code Meaning Error class
0 Success —
1 Not found or command-reported failure NotFoundError, command result
2 Usage / bad input UsageError
4 Health warning (akm doctor, or the Deprecated akm health) —
70 Internal / unclassified error unexpected throw
75 Transient — retry shortly (sysexits EX_TEMPFAIL); another akm process holds a lock or is writing state.db or index.db right now (the asset mutation lease, held by another writer, gives up after 10 minutes), not a bad command line. search, curate and show do not exit 75 because the index is cold or being built: they never build and never wait TransientError
78 Configuration error ConfigError

Failures classified by akm emit a JSON error envelope on stderr before exiting; stdout is normally left empty:

{"ok": false, "error": "<message>", "code": "<stable code>", "hint": "<optional hint>"}

The code field is the stable machine-readable code of a classified akm error (INVALID_CONFIG_FILE, MISSING_REQUIRED_ARGUMENT, ...); an unexpected internal error has none. The hint field is present only when actionable remediation is available (e.g. a suggested flag or alternate command). Agents should check ok === false on the parsed stderr envelope or a non-zero exit code to detect failure. Scripts can rely on the exit code alone.

Every success envelope produced by the passthrough stamp — config, clone, models, task-*, workflow-*, registry-*, and the rest of that shared handler — also carries ok: true (0.9.12+), so a caller branching on .ok sees the same field on both sides — success and failure — instead of undefined on success. A command that already computes its own ok from a graded outcome (e.g. task run's exit-code mapping, akm lint, akm proposal extract) keeps that value, false included.

exec, env run, secret run, and migrate preserve the spawned process's exact status and raw streams instead of replacing them with an akm failure envelope. task run maps completed, active, and disabled status to 0; blocked and failed status to 1; and configuration errors to 78. It retains a command child's exact status in result.detail.exitCode. agent maps a failed dispatch to 1 while retaining the child status in its formatted result envelope.

Commands

bundle create

Note: akm setup is the recommended entry point — it runs the same directory initialization plus guides you through AI connection configuration. akm bundle create remains available as a low-level building block.

Create the bundle directory structure and persist the working bundle path in config.

akm setup                        # Interactive setup wizard (creates bundle + configures connections)
akm setup --dir ~/custom-bundle   # Initialize at a custom location
akm setup --yes                  # Non-interactive, accepts all defaults

Every form of akm setup ends by building the search index for the bundle it configured (when its directory exists), so a search works straight away. In the non-interactive forms (--yes, --from) a failed build prints one warning naming akm index and setup still succeeds.

Creates one subdirectory per asset type under the bundle path — currently scripts/, skills/, commands/, agents/, knowledge/, workflows/, instructions/, rules/, memories/, env/, secrets/, lessons/, tasks/, sessions/, and facts/, plus a root .scratch/README.md and a /.scratch/ .gitignore rule (see Scratch space). See technical/filesystem.md for config file locations.

akm bundle create                              # Initialize the default bundle (~/akm) and set it as default
akm bundle create --dir ~/scratch-bundle        # Scaffold a secondary bundle WITHOUT changing your default
akm bundle create --dir ~/scratch-bundle --set-default  # Scaffold AND make it the default bundle

--dir <path> scaffolds (and backfills) the target directory. By design it does not change your configured default bundle unless you ask: bundle create updates the primary bundles entry and defaultBundle in config.json only when (a) no --dir is given, (b) no default is configured yet (first-time bootstrap), or (c) you pass --set-default. When a --dir is given and a default already exists without --set-default, your default bundle pointer is left untouched and bundle create prints a note telling you so. This prevents akm bundle create --dir /tmp/throwaway from silently hijacking your real default bundle. With --set-default the previous default keeps its entry and the new directory is added and becomes the default; a directory already configured under a key keeps that key.

The path is given only through --dir. A positional path (akm bundle create ~/scratch-bundle) is a usage error (exit 2) whose hint is the --dir spelling; nothing is created.

setup

Run the first-run wizard.

akm setup
akm setup --endpoint http://localhost:11434/v1 --yes   # no prompts

The wizard asks, in order:

  1. Agent programs. Which installed agent programs (Claude Code, Codex, OpenCode, ...) akm may use; each is shown with whether akm can limit it to reading and searching for its own model calls. With several, you pick the default. When a harness that cannot be restricted is enabled for akm's model calls, setup says "Model work on <name> cannot be restricted: it can edit files and run commands." where you choose, and in its summary line.
  2. Model calls. Whether the default agent program also takes akm's own model calls (improve, judging, extraction). It is asked only when a harness is enabled and there is no connection yet and no --endpoint, because a connection always takes model calls; answering no leads to a connection. A no that no connection follows is saved as modelWork: false on that harness, so model calls stay off (the summary says so and points at akm setup --endpoint) rather than falling back to it. A modelWork: false already saved is the question's default and stays through --yes; only a yes clears it. With --yes the answer is yes only for a harness akm can limit to reading and searching for its own model calls, and whose modelWork: false is not already saved.
  3. Connection. An OpenAI-compatible endpoint, its API key (typed at a masked prompt and stored in credentials.json, never in config.json), and one model per alias (fast, balanced, reasoning) picked from the models the endpoint lists. Change a pick later with akm models set.
  4. Embeddings. A model the default connection serves, akm's built-in local embedder, another endpoint, or off. The serving connection is the default of the config as this run will save it: a further --name connection does not serve embeddings, its models are not offered, and with several connections none called default, --embedding <model> refuses and asks you to name one default or pass --embedding-endpoint. The built-in embedder is offered on Linux x64 (glibc) and Apple-silicon macOS only; elsewhere the step says so in one sentence and offers an endpoint or off, and --embedding local warns and saves off.
  5. Save. The config is written, the bundle directory initialized, and a summary says what runs where. With the built-in embedder chosen, setup then downloads its runtime (ONNX Runtime, about 86 MB) and model (about 127 MB) into akm's cache and loads them; the wizard asks first. When agent work runs on akm's own runtime, the wizard also offers to download its OpenCode binary (about 114 MB) now rather than on the first agent run.

Flags answer one question each; --yes takes the detected default for every question left, so nothing is prompted. Without a terminal, akm setup refuses unless --yes or --from is given.

Flag Answers
--endpoint <url> The connection to add or update (the first is named default)
--api-key-env <NAME> The environment variable holding its key (apiKey: "$NAME")
--name <name> A further connection, with --endpoint
--harness <a,b> Agent programs to enable; the first is the default
--embedding <model|local|off> Embeddings
--embedding-endpoint <url>, --embedding-api-key-env <NAME> Another endpoint serving the embedding model
--from <file> A config file (JSON or YAML) to merge
--dir <path>, --no-init The bundle directory; skip scaffolding it
--learning <on|off> Background learning, on its own: see setup --learning
--no-probe Offline: nothing is contacted or downloaded. The endpoint's models are not listed, so a connection added this way has no model until akm models set names one, and the built-in embedder's runtime and model are downloaded by the first akm index

akm setup --dir <path> makes <path> the default bundle and drops the previous default bundle's entry from the config (its files stay on disk). The result's removedBundles ([{ id, path }], [] when none) names every bundle entry the save dropped, and the wizard prints a warning naming them; path is the bundle's path, or its git URL, website URL or npm package when it has no path.

setup --learning

akm setup --learning off
akm setup --learning on

--learning off writes improve.enabled: false and nothing else; --learning on removes that key and nothing else (no task, schedule, connection or harness is written). It is one step: no --yes, no bundle, no agent program. --yes, --no-probe and --no-init are ignored with a warning; any other setup flag is a usage error. The switch is per host and covers all bundles. While it is off, every akm improve run (scheduled or by hand, --dry-run too) and akm proposal extract do nothing: improve prints one line to stderr and returns skipped: { reason: "learning-off" } at exit 0. The improve task stays scheduled (akm task enable improve and disable change that). A plugin can hold the switch: with Claude's auto_learning option off, the plugin turns learning off again at each session start, so --learning on by hand reverts until the option is on. A process's own enabled: false is not touched either way. Experimental for its first release.

{ "ok": true, "learning": { "on": false, "harness": null, "scheduled": true } }

The detected defaults are: when no agent program is configured yet, every one found on PATH is enabled and the first found is the default. If no connection exists, model calls go to that program when akm can limit it to reading and searching; otherwise a local OpenAI-compatible server (Ollama on 11434, LM Studio on 1234, or a server on 8080), when one answers, becomes the connection default. Each alias takes the connection's current pick, else the first model the endpoint lists that is not an embedding model. Embeddings turn on only for a new default connection whose endpoint lists an embedding model.

The wizard also lets you review registries and add bundle sources. A scripted run prints its result with a runs object saying what runs where: modelCalls, agentWork and embeddings. When the saved config uses the built-in embedder, the result also has semanticAssets: ready once its runtime and model are downloaded and load, blocked: <reason> when they do not (the config is saved all the same), or skipped with --no-probe. A scripted run does not download akm's own agent runtime; its first agent run does.

index

Build or refresh the search index.

akm index            # Incremental (only changed directories)
akm index --full     # Re-drain every directory (keeps unchanged embeddings — see below)
akm index --verbose  # Print phase progress to stderr
akm index --clean    # Normal index + remove stale entries from the DB
akm index --clean --dry-run # Report stale entries without deleting
akm index --reembed  # Discard stored vectors and re-embed every entry
akm index --export-vectors vectors.db  # Experimental: write the current model's vectors to a file (reads the index only)
akm index --import-vectors vectors.db  # Experimental: index, storing vectors from the file instead of embedding matching entries

Returns stats: totalEntries, generatedMetadata, directoriesScanned, directoriesSkipped, verification, incompleteSources, optional warnings, optional moves, and timing breakdown in milliseconds. incompleteSources is always present: [{ bundle, component, path, reason }] for each configured source the index could not scan completely (a missing or unreadable path, a git or npm bundle that is not installed), [] when every source was scanned. A warning names each with its reason, and the entries a source had at its last complete scan are kept. The list is recorded in the index, and akm doctor's index-sources check reports it. Use --verbose to print the indexing mode, semantic-search settings, and phase-by-phase progress to stderr while the index is being built. Malformed workflow assets are skipped with file-path warnings instead of aborting the full run. verification.embeddingRuntime is onnxruntime-node when the local embedder embedded in this run; it is absent for a remote embedding provider and when nothing was embedded locally.

Progress in non-verbose JSON mode (default output format): even without --verbose, phase-start messages and the embedding heartbeat (Still generating embeddings: X/N stored, F failed; waiting on embedding provider.) are now written to stderr, and a failed embedding batch logs at the default level instead of --verbose-only — a long-running index build against a slow or unresponsive provider is no longer silent until the whole run finishes. Text-mode output keeps its spinner instead (no stderr line growth); JSON stdout output is unaffected either way. The high-frequency per-batch Embedded N/M entries. line stays out of non-verbose stderr (it fires after every committed batch) — pass --verbose for that level of detail.

A file renamed or moved on disk is the same asset. Move or rename a file or a folder with mv, git mv or a file manager; there is no move command. When the index next runs (full or incremental), an entry whose file is gone while a new file in the same bundle or another indexed bundle has the same content is paired with it: its row is re-keyed in place, so its vector, links and utility stay, and the state.db rows keyed by its old ref (usage, feedback, proposals, events, improve ledger, salience, outcome, task and workflow history) and its cached model results move to the new ref. Search utility is unchanged by the move and nothing is embedded again. When several vanished or new files share a content hash, the ones whose file names match one to one are paired; anything still ambiguous is not paired and is indexed as new (its history stays with the old ref), and a warning names the old refs. A file that was also edited is a new asset. The result's moves is { moved: [{ from, to }], unpaired } (the refs as bundle//conceptId), present only when a file was paired or could not be; each move is recorded as a moved event on the new ref with { from }, which akm lint reads to report links to the old ref (the events table keeps 90 days). A failure to carry the history over is a warning in the result, not silence. Links to the old ref in other assets are not rewritten here: see lint.

--clean flag: After indexing completes, verifies every indexed entry's source file still exists on disk. Removes any entries whose file is missing (for local bundle sources only; remote entries are skipped). Returns a clean block in the JSON result with checked, removed, removedRefs arrays, and dryRun flag. Use --clean to resolve the edge case where a deleted file in an unchanged directory lingers in the index across incremental runs. When a source was not scanned completely, --clean removes nothing, for a file in a folder akm could not list is not a deleted file: clean is then { skipped: { reason: "incomplete-scan", sources } }. With --dry-run, reports which entries would be removed without modifying the database.

--full does not re-embed unchanged content: a full run re-drains and re-persists every directory, but entry ids are kept, so a vector stays attached to its entry and only entries whose embedded text (the search text cut to embedding.maxInputTokens) changed go back to the embedding provider. An incremental run re-persists only the files that changed.

Embedding model changes: every stored vector records the embedding model it was generated under (embedding.model plus dimension for a remote endpoint, the local model name otherwise). When the configured model changes, the next akm index re-embeds entry by entry, committing each batch; nothing is purged first, an interrupted run resumes where it stopped, and search serves only vectors from the configured model in the meantime.

--reembed flag: Discards every stored vector and re-embeds all entries under the configured model. Run it after changing embedding.maxInputTokens: a cap change re-embeds nothing by itself. Run it before --export-vectors too: after a cap change, old vectors would otherwise be exported under the hash of the new, longer text.

--export-vectors <file> / --import-vectors <file> flags (Experimental): --export-vectors writes the vectors of the configured embedding model to a standalone SQLite file with one table, vectors(model, text_hash, embedding): model is the provider fingerprint, text_hash the SHA-256 hex of the exact text sent to the embedder (after embedding.maxInputTokens and the document template), embedding the float32 bytes. It reads the index only (no model calls, no source walk, no rebuild), writes a temporary file and renames it into place, and with no vectors writes an empty file with a warning. The file holds no document text and no paths. --import-vectors runs the normal index; in the embedding pass an entry whose current model and text hash are in the file is stored from it and never reaches the embedder, and any other entry is embedded as usual. A missing, unreadable or foreign file, or a file with nothing usable for the current model (a different model) warns and indexes normally; a single row of the wrong width is a silent miss. --reembed ignores the import (it regenerates every vector), and so does semantic search off; both warn. With both flags, the export runs and the import is ignored with a warning.

One build at a time: Every build takes a PID-liveness-only rebuild lock and releases it on exit (see Indexing). An akm index that finds a live build holding it does not wait and does not fail: it warns, builds nothing, prints { ok: true, skipped: { reason: "lock-held", pid, launcherPid, startedAt } } (launcherPid is the holder's launcher pid when known, null otherwise) and exits 0. The next build indexes whatever changed. The other commands that build the index after their own change (bundle add, bundle update, bundle remove, improve) skip the same way and carry on, and report the skipped build in their index field; their own change is kept. A task step that runs akm index therefore needs no wrapper. --skip-if-locked on akm index is accepted, warned about once as deprecated, and ignored. If index.db is genuinely busy (SQLite database is locked) long enough to exhaust the driver's retry window, the run fails with exit 75 and code INDEX_DB_CONTENDED, the same retry-shortly contract as STATE_DB_CONTENDED. akm search, akm curate and akm show never build or wait for a build, so they are safe to call frequently.

akm index always rebuilds the search index and keeps metadata in the index, generated deterministically. In text mode, the default CLI UI shows a spinner with processed-versus-total source counts; structured output modes (json, yaml, jsonl) stay clean and machine-readable.

Timeout durations

Every --timeout flag takes one grammar: a bare positive integer is milliseconds, or a number with ms, s, m, h or d (250ms, 30s, 2m, 1h, 7d). Units are case-sensitive and there is no month unit. This covers command run, agent, proposal new, proposal extract, improve, task add, workflow run and run. timeout: fields in task, agent and workflow files and --since, --expires and --window-compare keep their own grammar. Where --timeout-ms also exists, equal explicit --timeout 30s --timeout-ms 30000 values are accepted; conflicting budgets are rejected. The existing millisecond flag and each command's timeout scope and defaults remain unchanged: improve's budget bounds the whole run, extract's is per session, and task add stores the target's timeout. This does not change model or learning defaults.

doctor

Inspect runtime health and developer diagnostics. These additive 0.10 entry points reuse the existing handlers, flags, output shapes and exit codes:

Command Existing 0.10 command Purpose
akm doctor akm health Runtime health, durable state and improve telemetry
akm doctor metrics akm metrics Read-only usage and outcome reports
akm doctor info akm info Capabilities, configuration and index state; still reports when config is broken
akm doctor log akm log Filter the local event stream
akm doctor prompt <ref> akm improve <ref> --show-prompt Inspect the composed reflect prompt without execution or writes
akm doctor judge akm judge List, inspect and evaluate the existing model judges
akm doctor scheduler sync akm task sync / akm task prune Reconcile or prune the OS scheduler entries
akm doctor explain <ref> akm task explain / akm workflow plan Print what a task or workflow would run, without running it
akm doctor log --task <id> akm task history One task's run history
akm doctor metrics improve akm improve report Improve-run LLM usage and routing report
akm doctor metrics assets akm search --by-usage (Deprecated) Assets shown in the project, most shown first
akm doctor --read-only --no-probe
akm doctor metrics --since 7d
akm doctor info
akm doctor log --limit 20
akm doctor prompt lessons/my-lesson --task "Focus on examples" --format text
akm doctor judge --list
akm doctor judge reflect.quality --schema
akm doctor scheduler sync --dry-run
akm doctor scheduler sync --prune --yes
akm doctor explain team//tasks/nightly
akm doctor log --task nightly --limit 20
akm doctor metrics improve --since 7d
akm doctor metrics assets --limit 10

akm doctor scheduler sync reconciles enabled task and workflow schedules with the OS scheduler, as akm task sync does, and takes the same --bundle, --rebind and --dry-run flags. With --prune it instead removes the owned scheduler entries a plain sync can never reclaim. Prune is a preview that exits non-zero when it finds candidates; --yes removes every candidate and --id <id1,id2,...> limits it to the named binding ids (a name that is not a current orphan is a usage error and removes nothing).

akm doctor explain <ref> takes a task ref or id (--bundle selects the bundle), or a workflow ref (workflows/<name>), and prints the same secret-free, read-only plan as akm task explain or akm workflow plan. It never runs anything. For a version 5 task it takes the input flags and --env, --secret and --timeout of a start, runs the check a start makes, and lists the steps and each schedule entry's env, secret and timeout. Each schedule entry is checked as akm doctor scheduler sync checks it: one the sync would refuse (an env: asset that does not exist, say) has its reason as error under the entry, and the result is ok: false (exit 1).

Bare akm doctor prints health's result with one more field, scheduler: the scheduler backend, paths and task state akm task doctor reports. Its engine is { defaultEngine, defaultEngineKind, connections, harnesses }: the default target and whether it is a connection or a harness, then each configured connection and harness. When improve.strategy names a strategy that does not exist (a removed one), akm doctor still runs: improveStrategy is { name, error, code }, there is no improveAutonomy or improveTriage, and the status is at least warn (exit 4). Diagnosis alone never repairs or removes an entry.

akm doctor log --task <id> lists that task's run history instead of events; an empty or blank id is a usage error (exit 2), not every task's runs (add --bundle <name> for a task in another bundle and --limit <n> for the most recent runs). Each row carries trigger: schedule when the OS scheduler started the run, manual otherwise; it is absent when the run did not record one. The Deprecated akm task history prints the same trigger.

akm doctor metrics improve [--run <id> | --since <window>] is the improve report over the same handler. akm doctor metrics assets is search --by-usage: the same filters as search and the same result fields, and it records no usage.

Bare doctor keeps health's defaults: probes run and state may be initialized or migrated. Use --read-only --no-probe for an offline inspection without writes to the inspected state. With --read-only the invocation records no CLI usage either; otherwise it records diagnostic usage in the cli_usage_* tables of metrics.db. Health statuses retain exit codes 0 (pass), 4 (warning) and 1 (failure).

All existing top-level commands remain available in 0.10. Health's reporting flags (doctor --report, --group-by, --window-compare, --windows and --since) are transitional aliases in 0.10; all reporting is moving under doctor commands in 0.11. The full flag and result contracts remain documented in the linked sections. doctor prompt accepts the same --task, --bundle, --strategy, --connection, --harness, and --model settings as the legacy prompt preview. It preserves the JSON envelope and --format text rendering, requires a fully-qualified asset ref, and does not acquire a lock, write an index, or call a model. This regrouping does not change judge or learning behavior. Put a subcommand's options after its name, for example akm doctor metrics --since 7d; health-only options such as --read-only and --report belong to bare akm doctor. Global output flags work before or after the subcommand. Like info, doctor info warns and continues when a flag is unknown. The deprecated forms in the right column above print a stderr notice naming the replacement (see Deprecation notices); their output is unchanged.

info

Deprecated; use akm doctor info; removed in 0.11.

Show system capabilities, configuration, and index state.

akm info

Returns a JSON object with:

Field Description
version Current akm version
bundleDir Primary bundle directory — same resolution akm bundle list uses. Falls back to the platform-default location when no bundle resolves.
defaultBundle Name of the primary bundle from config, or null when none is configured
configError Present only when config.json exists but could not be loaded (parse or schema failure); every config-derived field falls back to the same defaults a fresh install reports
bundleDirError Present when a bundle IS configured (an env override or bundles.* in config) but its path doesn't resolve, OR when the platform-default fallback itself can't resolve (e.g. HOME unset) — absent for the ordinary "no bundle created yet" state, where bundleDir needs no explanation
dataDir Resolved data directory (getDataDir())
configDir Resolved config directory (getConfigDir())
cacheDir Resolved cache directory (getCacheDir())
stateDir Resolved state directory (getStateDir())
assetTypes List of recognized asset types
searchModes Active search modes (fts, optionally semantic and hybrid)
semanticSearch Semantic search status: mode, status, and optional reason/message
registries Configured registries
connectionsAndHarnesses The connections, harnesses and work that runs on them, as the rows akm health reports under its connections-and-harnesses check, without contacting anything: each connection's endpoint and whether its key is held, each harness's platform and whether its binary is on PATH, and for each kind of work the connection or harness and model it resolves to
learning Background learning, read from the config alone: on (the improve.enabled switch, not whether anything is set up to run), harness (the platform improve runs on; null for a connection or nowhere) and scheduled (whether the improve task is enabled; the config's word, not the OS scheduler's). Experimental for its first release
sourceProviders Configured sources (filesystem, git, website, npm)
indexStats Index stats: entryCount, byType (per-asset-type breakdown), links (declared links per kind with total and unresolved; absent when the index holds none), lastBuiltAt, hasEmbeddings, unreadable (index.db exists but the filesystem refuses to read it — a permissions problem), unavailable (index.db is readable but the SQLite-level read didn't complete: locked by another akm process, a newer layout this akm can't understand, or a corrupt file)

akm info never refuses: an unreadable config, an unresolvable bundle directory, or an index.db that's locked, newer, older, corrupt, missing, or empty each degrade the relevant field(s) above instead of failing the command. It also never waits more than about 1.5s on a locked index.db, regardless of the shared 30s lock-wait every write command otherwise uses, and warns rather than refusing on an unrecognized flag or a positional argument.

semanticSearch.status values:

The status is what the index recorded at its last embedding pass, read when the command runs; akm doctor's semantic-search check and akm bundle update report the same record.

Use akm info to verify that semantic search is working after setup.

Scripts that need akm's resolved paths (for example a health check that differs between a host install and a container) can read them with akm info --format json | jq -r .dataDir instead of hardcoding a path.

health

Deprecated; use akm doctor for checks and akm doctor metrics for reports; removed in 0.11.

Check akm runtime health, durable state, and recent improve-loop telemetry.

akm health
akm health --since 24h
akm health --since 7d --format text
akm health --since 2026-05-01T00:00:00Z
akm health --read-only --no-probe          # inspect existing state without creating or migrating it
akm health --report --format md           # full report: per-run rows, trends, proposal queue
akm health --report --format json         # the same dataset as data
akm health --report --window-compare 7d --format md
Flag Description
--since Rolling window start for task-history, improve, and advisory metrics. Accepts ISO 8601, YYYY-MM-DD, epoch milliseconds, or shorthand like 24h / 7d. Default: last 24 hours.
--report Fetch the full report dataset: per-run rows, trend deltas vs the prior window (default: the --since window, so deltas are like-for-like), and the pending proposal queue. A data flag — the same dataset comes back in every --format; md renders it as the rich report.
--window-compare Compare the current window against the prior window of the same duration (e.g. 24h, 7d). With --report, overrides the default trend window.
--group-by Group rows by run (one row per improve_runs entry). Omit for the default summary.
--windows Explicit comparison window(s) as name=...,since=ISO,until=ISO (repeatable, up to 4). Mutually exclusive with --window-compare.
--read-only Open existing state without creating, migrating or repairing it, and skip the database write/read probe (unknown). Missing, corrupt or unavailable state is a failing health result. Independent of network probing: add --no-probe for offline inspection.
--no-probe Skip the connections-and-harnesses reachability probes and harness --version runs, the cli-version update check, the plugin-version and codex-plugin-version newest-tag lookups, and the scheduler-binary version check (for an offline or air-gapped host).

By default the command opens and migrates state.db, verifies that the required tables exist, performs a write-read probe against the events stream, inspects task_history, checks the configured connections and harnesses (the connections-and-harnesses table), and summarizes recent improve_* events. Unless --no-probe is given, it also sends a bounded (3s timeout) reachability probe to each connection's endpoint, one probe per distinct endpoint, checks the installed akm-cli version against the latest release on its channel (cli-version: GitHub's latest release, and for a prerelease install also npm's next tag, as akm upgrade reads it), and runs the scheduler's recorded akm binary with --version to check it against the running CLI (scheduler-binary). The plugin-version advisory compares the installed Claude Code plugin with the newest build on the channel the registered marketplace follows, read the way akm upgrade --check reads it (the version the branch's catalog offers, from the source and ref Claude registered; a marketplace pinned to a tag offers nothing newer). It also compares the akm-cli the plugin's package.json pins (the copy its hooks run, which shares the host's databases) with the running CLI, and says which side is older. codex-plugin-version does the same for a Codex install from the akm-plugins marketplace (the version from codex plugin list, the newest release on the ref and source its marketplace entry registers, and the akm-cli in that version's plugin cache under $CODEX_HOME/plugins/cache/akm-plugins/akm/, compared with the running CLI), and opencode-plugin-version / opencode-v2-plugin-version compare the akm-cli bundled in the OpenCode plugin the config loads with the running CLI. A plugin ahead of the CLI is fixed by akm upgrade, one behind it by updating the plugin once its channel has a newer build; a lookup that could not reach the marketplace is unknown and says so.

Every check result with status unknown also carries a reason saying why there is no result: off (the feature is turned off), not-probed (the probe was not asked for), blocked (the check could not run or could not decide) or idle (nothing has happened yet).

Primary result fields:

Field Description
status Overall health verdict: fail when a hard check fails, warn when any check (hard or advisory, heuristic included) warns, else pass; unknown checks do not count. Exit code 1, 4 and 0 respectively
hardChecks Deterministic checks such as state-db-schema, state-db-round-trip (unknown in a read-only run, which skips it), state-db-integrity, state-db-migrations, task-history-read, active-runs, connections-and-harnesses, index-sources (sources the last akm index could not scan completely), and semantic-search
advisories Non-fatal warnings including session-extraction (akmExtract pipeline health), cli-version (installed vs latest release on its channel), plugin-version, codex-plugin-version, opencode-plugin-version and opencode-v2-plugin-version (harness plugins), scheduler-binary, opencode-major (present only when an opencode harness is installed: warn for each one whose binary is OpenCode 1, which is Deprecated and removed in 0.11; unknown under --no-probe or when its version cannot be read), and cli-usage-store
metrics Aggregate task/runtime metrics: taskFailRate (task runs that failed), agentFailureRate and agentFailureReasonCounts (every agent dispatch: v4 command rows and each v5 step that ran an agent), stuckActiveRuns (active runs whose akm process is gone), llmUsage. A rate is null (unknown) when the window holds no run or dispatch to count, and 0 means there were some and none failed; when state.db cannot be read every field is null. In a window comparison a metric that is unknown in either window has the delta pctChange: "unknown", and text and Markdown print unknown
improve Recent improve-loop counts derived from improve_invoked, improve_skipped, and improve_completed events; null when state.db cannot be read

The improve section includes counts for planned refs, reflect/distill actions, memory-prune actions, memory-inference writes, session-extraction outcomes (sessionsScanned, sessionsExtracted, proposalsCreated), dead-URL detections, and skip reasons observed in the selected time window.

state-db-migrations reports what akm health's own open of state.db applied. A normal open applies pending migrations (copying the file to state.db.pre-<id>.bak first when one drops schema), so the check passes and names the applied IDs (evidence.applied) and the copy (evidence.backupPath). It fails only when a pending migration could not be applied — naming it and pointing at akm migrate apply — rather than the command crashing. Read this check's status instead of grepping akm's error text. A state.db that cannot be read at all, or that is not a SQLite database (garbage, a truncated copy), is likewise one failing state-db-readable check with the repair steps, and the command exits 1, never 78.

With --read-only, missing state or pending migrations are reported as a failing check instead of creating or migrating the database. The write/read round-trip is skipped and reported as unknown; the other checks and exit codes are unchanged. This also applies with --report: proposal data is read through a read-only connection. If state is unavailable, the native failing diagnostic is returned without attempting the report's additional queries. --read-only writes nothing, so no CLI usage is recorded for it either.

connections-and-harnesses is one table: a row for each configured connection (endpoint, whether its key is held, whether the endpoint answers) and harness (platform, whether its binary is found, and with a probe its --version), then a row for each kind of work (improve, judges, agents, extract, enrich, index, embedding) naming the connection or harness and the model it resolves to. The rows are in evidence.rows, each typed connection, harness or process; the text format always prints them. It is a warn when a key variable is unset, an endpoint does not answer (the probes, and the harness --version runs, are skipped by --no-probe), a harness is not installed, or the config leaves a kind of work unresolvable, and unknown when nothing is configured.

semantic-search reports what the last akm index recorded about semantic search, with the index's entry and vector counts read now. It loads no model and sends no request. It passes when every entry has a vector (and a local model embedded on onnxruntime-node) or semanticSearchMode is off; warns when vectors lag the entries (akm index embeds the rest), local embeddings ran on another runtime, or akm offers no local embeddings on this platform (keyword search or an endpoint is the default there, so the message names akm setup --embedding off and akm setup --embedding <model> --embedding-endpoint <url>); fails, with the recorded reason, when the last index found semantic search blocked (an embedding endpoint or model download failed) or unavailable for a cause that can be fixed (the runtime could not be downloaded or did not load, for example from a noexec cache directory); and is unknown before the first index. Search never reads this record: a query still tries semantic search and falls back to keyword search on its own. A fix shows here after the next akm index. evidence carries the recorded status, unavailable (platform or load), provider, runtime, reason, the index's builtAt, entryCount and embeddingCount.

cli-usage-store warns when metrics.db, which holds the CLI usage tables (cli_usage_*), cannot be read. Usage capture is fail-open, so an unreadable store stops collection without failing any command, and this is the only place it shows. The check is silent when the file is absent or readable, and it never recreates tables; move or delete metrics.db to restart collection.

cli-version compares the installed akm-cli version against the latest release on the channel this install follows — GitHub's latest release, and for a prerelease install also npm's next tag, the same sources akm upgrade trusts — and warns with the upgrade command when a newer release exists. --no-probe, offline, or a rate-limited request all degrade it to unknown, never a false warn.

The session-extraction advisory is derived from the extract_sessions_seen ledger for the last 7 days — not improve_runs, which the hook-driven akm proposal extract --session-id ... invocation never writes. It reports unknown when nothing was recorded in the window (cannot tell "off on purpose" from "broken"), warn when every session in the window was skipped for an infrastructure reason (llm_unavailable, read_failed, exception, locked_concurrent) — naming the reason and, when recorded, the connection or harness it ran on, as engine "<name>". It also warns when some sessions harvested but others had candidate writes fail and were not yet extracted again (a validator refusal does not count; extracting the session again clears it). Otherwise it is pass, with per-outcome counts.

metrics

Deprecated; use akm doctor metrics; removed in 0.11.

Experimental (see STABILITY.md): the report, its JSON shape and the dashboard may change in any release.

Report what akm has recorded locally: asset usage (search, show, curate, rule loads), feedback, derived utility, LLM tokens, task runs, proposal flow, workflow token spend, and index runs. Read-only, and every number comes from state.db or index.db; nothing is collected that was not already recorded.

akm metrics
akm metrics --since 7d
akm metrics --since 2026-05-01 --format yaml
akm metrics --since 30d --format md --output metrics.md
Flag Description
--since Window start. Accepts ISO 8601, YYYY-MM-DD, epoch milliseconds, or shorthand like 24h / 7d. Default: 30d.

The window always ends now. Only user-source usage rows are counted (matching utility and retrieval counts), and every ranked list holds its top 20. For a narrower view, use --since or AKM Desktop's metrics view.

Result sections (schemaVersion: 1):

Field Description
window, filters The resolved window and the usage source counted
usage Search, show, curate and select totals, searchesWithHits and selectsPerSearch (selects divided by searches that returned a hit: a plain ratio that can exceed 1, not a conversion percentage; selects are deduped per search id and ref, and kept only when they followed a search from the counted source, except legacy selects with no source, which count for every source), searchMedianMs (over searches with totalMs >= 0), a daily series (with rules, the akm rules loads per day), rules (loads, the mean meanRules and meanChars per load, and byRule, loads per rule), top assets, top and zero-result queries, and rows by source
feedback Positive and negative totals, per-asset valence, per-tag counts, and the most recent negatives with their reasons
utility A ten-bucket histogram of utility_scores, the lowest and highest assets, and how many indexed entries were never used
outcomes The assets with the lowest outcome_score
llm akm health's LLM usage aggregate (byStage, byProcess, and byEngine, keyed by the name of the connection or harness). usageCalls and reasoningCalls count the calls whose provider response reported token usage; a call without it adds no tokens and the report shows unknown, not zero, when none reported
index, tasks, proposals, workflows Index runs and median time, task runs and fail rate, proposals by status and accept rate by source, workflow runs and tokens by model
rows The raw usage and LLM rows of the window; see below
notes Anything that limits what the numbers mean

A rate whose denominator is 0 is null, never NaN. A missing state.db gives an empty report and a missing index.db an empty utility section, each with a notes entry, and the exit code stays 0.

rows is present with --detail full; it is absent otherwise.

Notes you may see:

Search bundle assets, registries, or both.

akm search "deploy"
akm search "deploy" --type script --limit 10
akm search "lint" --from registry
akm search "docker" --from all --detail full

# Selection inside an authorised set (not tenant isolation; see below):
akm search "deploy" --filter user=alice
akm search "deploy" --filter user=alice --filter agent=claude

# Rank one user's assets slightly higher, dropping nothing:
akm search "deploy" --prefer user=alice

# Include proposal-queue entries:
akm search "deploy" --include quality=proposed

# Only assets dated within a range (observed date, else updated):
akm search "deploy host" --since 2026-06-01 --until 2026-09-30

# ConceptId-prefix enumeration — list a subtree instead of keyword-matching:
akm search "memories/projectA/"
akm search "knowledge/"
akm search "team-catalog//"
akm search "team-catalog//skills/"

A query ending in / is a conceptId prefix, not a keyword search. It enumerates the entries whose conceptId starts with that prefix: akm search "memories/projectA/" lists exactly the projectA/ subtree of memories (recursive, /-boundary exact — a sibling projectAlpha/ scope does not leak), and akm search "sessions/" lists every session (a prefix is explicit intent, so the default session exclusion — an untyped-path policy — does not apply). A <bundle>// prefix scopes enumeration to one bundle, optionally narrowed further (team-catalog//skills/); <bundle>// alone lists the whole bundle, which is what replaced akm bundle items.

Because the prefix matches the conceptId — the same spelling every emitted ref carries — a ref copied out of search output can be truncated to a prefix and pasted straight back in. Hits carry the fixed browse score 1 in deterministic listing order, matching the empty-query enumeration contract, and compose with --limit, --belief, --filter, and named --from narrowing. A full ref without the trailing slash (memories/projectA/auth-tip) stays an ordinary keyword search — use akm show to resolve a single ref. An explicit --type flag wins over the prefix.

The pre-0.9.0 <type>: / <type>:<prefix>/ spelling was removed. A query in that shape is now an ordinary keyword search, and when it returns nothing the tip names the conceptId spelling that replaces it.

Local search responses include searchMode: semantic when vector ranking ran, keyword when keyword-only search was intentional or semantic search was not ready, and fts-fallback when a ready semantic backend failed during this query. The last case also adds one sanitized, endpoint-naming entry to warnings; it never repeats the provider/runtime error text. Both fields are preserved by --detail agent so machine consumers can lower their confidence instead of treating keyword fallback as healthy semantic ranking.

Ranking fuses two candidate lists by reciprocal rank (k = 60, equal weights): BM25 over whole documents matching any non-stopword query word, and the document vectors nearest to the query embedding, 100 candidates each. Filters (--type, --from, --filter, --belief, the default session exclusion, proposed quality) drop ineligible entries from each list before its 100 candidates are taken. The fused score is then multiplied by 1 + 0.03 × (ln(1 + positives) − ln(1 + negatives)) over the user's recorded feedback for the asset (see akm feedback), and, among dated candidates only, by a recency factor 1 + 0.04 × r, where r is 1 for the newest dated candidate and halves for every year older (measured from that candidate, not from today). The date is the observed date, else updated. Dated candidates are reordered among the places dated candidates already hold, and each place keeps its score, so undated candidates keep their places and scores. Recency needs two distinct dates among the candidates. When both channels contribute it passes only near-ties; in keyword-only search, where every fused score is 1 / (60 + rank), it can lift a dated hit one place past a dated hit most of a year older, or two places past one 1.5 to 2.5 years older, whatever the keyword margin. Hits are ordered by that score, equal scores by fully qualified ref (<bundle>//<conceptId>, even where the output shows the short form). A hit's score is the adjusted score of its place. If state.db exists but cannot be read, the search ranks without feedback and adds a warning. The query is embedded with the model's query template (see embedding.queryTemplate in configuration.md); when the embedding takes longer than embedding.queryTimeoutMs (default 3000) or fails, the search is served by keyword ranking alone with fts-fallback and a warning. One-hit-per-file deduplication, and keeping only the highest-ranked of entries with identical indexed content (the same body saved under another name or in another bundle), drop entries from the ordered list without reordering it.

Flag Values Default Description
--type skill, command, agent, knowledge, instruction, rule, workflow, script, memory, env, secret, lesson, task, session, fact, any any Filter by asset type. Free-form and unvalidated — an unknown type returns no hits. Also accepts any adapter-defined type (e.g. website) — see Bundle Types for the open types each adapter emits.
--limit number 20 Maximum results
--from local, registry, all, bundle name local Where to search. A bundle name narrows to that bundle; repeat --from (--from team --from personal) to search several bundles as one ranked set (OR). A keyword cannot be mixed with bundle names, and an unknown name is a usage error. With several bundles the response carries bundles
--filter <key>=<value> (none) Frontmatter filter — repeatable; a repeated key matches any of its values, different keys must all match. A key is any frontmatter key (team, project, category, ...), tag (matched the way the index normalises tags), or a scope key (user, agent, run, channel). Example: --filter team=platform --filter user=alice. An empty value (--filter channel=) matches assets that do not carry the key (tag always carries path-derived tags, so tag= matches almost no assets), and combines with other values of the key by OR: --filter channel=acme --filter channel= keeps acme's assets plus every unscoped one. Narrows the candidates before ranking.
--prefer <key>=<value> (none) Frontmatter preference — same keys, repetition and matching as --filter, but a boost, not a limit: a matching asset's score is multiplied by 1.02 (browse and ref-prefix listings put matches first). It never drops or admits an asset; --from and --filter still decide which are eligible. Example: --prefer channel=ops.
--project project name, none (by directory) Use this project's defaults instead of the one the working directory selects; none uses no project. An unknown name is a usage error. A flag you pass replaces the project's value of the same kind. When a project applies, the response carries project and text output opens with one line, e.g. Project akm (~/code/akm): prefer project=akm.
--include quality=proposed, type=<asset-type> (none, or project) Repeatable: relax only the named default exclusions. Ordinary hits remain eligible; query matching, explicit type, source/project boundaries and filters still apply. Repeating type restores each named type in search.defaultExcludeTypes; other excluded types stay hidden. Explicit selectors replace the project's entire include value. An unsupported key, or a type that is neither a known asset type nor a custom type listed in search.defaultExcludeTypes (read from the config file only, not from extends layers), is a usage error (exit 2) whose hint lists the valid selectors.
--include-proposed flag false Deprecated; use --include quality=proposed; removed in 0.11. Include entries with quality: "proposed" in the result set. Default search excludes them; generated and curated quality entries are always included. Unknown quality values warn once and remain searchable.
--belief all, current, historical current Belief filter on any asset. current keeps unflagged/active/asserted assets; historical keeps deprecated/contradicted/superseded/archived assets. Labels do not establish truth.
--since YYYY-MM-DD (none) Keep local assets dated on or after this day: the observed date, else updated. Assets with neither are dropped. Applies before the candidate budgets, like --filter. Search only; registry hits are unaffected.
--until YYYY-MM-DD (none) Keep local assets dated on or before this day, by the same date.
--include-sessions flag false Deprecated; use --include type=session; removed in 0.11. Include session assets, which are excluded from default results via config.search.defaultExcludeTypes
--by-usage flag false Deprecated in 0.10.261120; use akm doctor metrics assets; removed in 0.11. List instead of search: the eligible assets that were shown (akm show) in the project in force, most shown first, ties by ref. See Usage list
--format json, jsonl, yaml, text, md json Output format
--detail brief, normal, full, agent brief Output verbosity level, or the agent projection

--filter flags AND-join: every supplied key must match the entry for it to appear in the result set. Entries without a supplied key are excluded as soon as a filter is supplied, unless one of that key's values is empty (key=), which matches exactly the entries without the key. A key whose value is not indexed (an object, or a value over 200 characters) counts as absent. Keys other than the scope keys are read from the indexed frontmatter; the first akm index after upgrading indexes them for existing files. Their values are used only for selection: never searched, embedded or shown. With no --filter (the default), unfiltered queries continue to surface all entries — including legacy memories that pre-date the scope contract.

akm search and akm curate never build the index. With no usable index for the library (none yet, one built for another library, or an unreadable file) they exit 0 with no hits and one warning: there is no search index for this library yet, run akm index (or, while another process holds the rebuild lock, that a build is running). An index whose build has not completed (still embedding, interrupted, or a source failed) serves its keyword results with one warning that results may be incomplete: that the index is still being built while a process holds the rebuild lock, otherwise that the last build did not complete and akm index fixes it. See Indexing.

Local refs come from the index's canonical fully qualified item_ref; output keeps the short form for the default bundle and qualifies non-default bundles. Local paths are absolute materialized file_path values. Key fields by availability:

The default brief shape is intentionally small. The exact field set per detail level (and for --detail agent) is authoritative in src/output/shapes/helpers.ts (shapeSearchHit / shapeSearchHitForAgent), assembled into the shape registry by the src/output/shapes.ts barrel:

Level Local bundle hits Registry hits
brief (default) type, name, ref, action, estimatedTokens name, installRef, score
normal type, name, ref, description, action, score, estimatedTokens, optional warnings/quality/observed/updated/keys name, description, action, installRef, score, optional warnings
full full hit object (includes ref, the durable itemRef (bundle//conceptId), origin, tags, whyMatched, optional warnings, optional quality, optional observed/created/updated/expires, timings, bundle metadata) full hit object
agent name, ref, type, path, editable, conditional editHint, description, action, score, optional estimatedTokens/keys/observed/updated no local access fields

There is no registry curated boolean. Renderers surface an optional warnings: string[] field on hits when a provider has non-fatal issues to report; the field is omitted otherwise. Populating warnings does not affect ranking.

Score ranges differ between local and registry hits. Local SearchHit.score is a fixed contract value in [0, 1], higher = better. Registry RegistrySearchHit.score is registry-native: provider-defined and may exceed 1 (the bundled static-index provider can emit values up to ~1.85 from scoreStash()). Use registry scores only for ranking within a single registry — do not compare them numerically against local SearchHit.score values or across registries with different scoring formulas. See docs/architecture/architecture.md for the current type-level distinction.

Ordinary search defaults to current evidence. Use --belief all to enumerate or compare every belief state, and --belief historical to investigate old records. These modes also apply to empty and prefix queries.

curate

Pick the assets worth loading for a task. Unlike akm search, curate attaches a preview and run details per hit, adds related support refs, and summarizes the set — the usual starting point for an agent.

akm curate "plan a release"
akm curate "deploy a Bun app" --limit 3
akm curate "review an architecture proposal" --type skill
akm curate "learn the release workflow" --from all --format text
akm curate "deploy the service" --from team --filter user=alice --filter channel=ops
akm curate "investigate the previous deployment port" --belief historical
akm curate "compare deployment decisions" --belief all
akm curate "deploy the service" --filter user=alice --max-tokens 4000
Flag Values Default Description
--type skill, command, agent, knowledge, instruction, rule, workflow, script, memory, env, secret, lesson, task, session, fact, any any Filter curated results by asset type
--limit number 4 Maximum curated results
--from local, registry, all, bundle name local Where to search before curating; repeat it to search several bundles (OR), as in akm search
--filter <key>=<value> (none) Repeatable exact frontmatter filter (any key, tag, or user, agent, run, channel); a repeated key matches any of its values, different keys are AND-joined; an empty value (key=) matches assets without the key
--prefer <key>=<value> (none) Repeatable frontmatter preference with the keys and matching of --filter; matching hits rank slightly higher (×1.02 on the score). It never drops or admits a hit and does not change which evidence curate accepts
--project project name, none (by directory) Use this project's defaults instead of the one the working directory selects; none uses no project. An unknown name is a usage error. A flag you pass replaces the project's value of the same kind. When a project applies, the response carries project and text output opens with one line, e.g. Project akm (~/code/akm): prefer project=akm.
--include quality=proposed, type=<asset-type> (none, or project) Repeatable: relax only the named default exclusions. Ordinary hits remain eligible; query matching, explicit type, source/project boundaries and filters still apply. Repeating type restores each named type in search.defaultExcludeTypes; other excluded types stay hidden. Explicit selectors replace the project's entire include value. An unsupported key, or a type that is neither a known asset type nor a custom type listed in search.defaultExcludeTypes (read from the config file only, not from extends layers), is a usage error (exit 2) whose hint lists the valid selectors.
--belief all, current, historical current Current keeps unflagged and active/asserted assets; historical keeps deprecated/contradicted/superseded/archived assets
--max-tokens positive token budget (none) The replacement for --pack. It uses the same shared packing budget and output. Conflicting explicit budgets are rejected; equal values are accepted. The unbudgeted default is unchanged.
--pack positive token budget (none) Deprecated; use --max-tokens; removed in 0.11. Pack eligible local content in rank order; drop tail items before truncating the first oversized item. The budget is estimated at about 4 characters per token; a ref#fragment hit packs only that section; registry hits are never packed. It is a context-size target for this call, not a workflow asset's budget (a run-cost cap)

akm curate takes the top --limit hits of one search, in search order, and enriches each with a preview, run details and up to two support refs: the assets the hit's declared links name (xrefs:, supersededBy: and the other kinds akm show lists under links), what it links to before what links to it, skipping assets curate already selected. Curate includes direct follow-up commands such as akm show <ref> or akm bundle add <ref> so you can immediately inspect or install what it found. --detail (including agent) works on curate output. Curate preserves the underlying search's searchMode and warnings. Scope, named source, type and belief controls also constrain derived surfaces, support refs and packed content; an empty eligible pool stays empty. Missing or newly ineligible content is omitted instead of falling back to unchecked text. Explicit all/historical results and support refs expose beliefState and label historical context; packed historical items also carry a label (including text output). Direct show <ref> remains available for deliberate inspection. Ordinary knowledge without a belief label stays usable. Belief labels are metadata, not evidence of factual truth. Existing prose within an eligible asset is preserved; filters select assets rather than fact-checking their body. Agent-shaped local items include ref, path, and editable, plus editHint only for read-only items. Their followUp remains akm show <ref> rather than being replaced by clone guidance. Use --type workflow when you want curated step-by-step procedures instead of individual scripts, skills, or docs. Curate returns no items, on purpose, for a harness or tool envelope (input that starts with an XML-style tag and contains a closing tag, such as <task-notification>…</task-notification>), the stash README boilerplate, or an exact phrase in its short conversational list, such as hello, thanks, that worked!, ok sounds good, go ahead, yes, lgtm, ok do it, continue, or thanks so much. Phrase matching ignores case, repeated whitespace, and common punctuation (commas, periods, exclamation marks and question marks). This is an explicit phrase list, not general detection of conversational intent. Unlisted phrases and phrases followed by task text retrieve normally. The summary starts with Curate abstained and names the reason; tip explains how to curate a task. For a deliberate lookup of a word or asset name that collides with the list, such as hello, use akm search "hello". Long input is curated like any other. akm curate is safe to call frequently, including from a hook that fires on every prompt: it only ever reads the index as it currently stands (the same read-only path search uses) and never builds, waits on or contends with an akm index rebuild in progress.

show

Display an asset by ref. On a markdown document #fragment selects one section by heading slug (falling back to case-insensitive heading text); an unmatched fragment lists the available slugs. For a large document, read the outline first and then only the sections you need: akm show <ref> --outline returns the document's toc without the body, and akm show <ref>#<slug> returns one section.

akm show scripts/deploy.sh
akm show skills/code-review
akm show agents/architect
akm show commands/release
akm show workflows/ship-release
akm show knowledge/guide                 # the whole document, plus its toc
akm show knowledge/guide --outline       # the outline (toc), no body
akm show knowledge/guide#authentication  # just that section
akm show knowledge/guide --max-tokens 800 # bounded body, without needing a fragment
akm show knowledge/guide#authentication --lead --max-tokens 800
akm show knowledge/guide#nope            # lists the available fragment slugs

# Bundle .meta/ orientation docs — direct-read, not indexed:
akm show meta                       # working bundle's .meta/index.md
akm show meta:about                 # working bundle's .meta/about.md
akm show akm//meta                  # the primary bundle explicitly
akm show github:owner/repo//meta    # an installed bundle's .meta/index.md

akm show resolves the asset from the bundle's files, so it needs no index: an asset added outside akm since the last build, or shown before any build, is found and rendered. The index adds only what it alone has: declared links, indexed fragment context (--lead, and an opaque #akm-fragment-… selector's stored revision) and usage ids. With no index row, --lead shows the exact section and warns instead of failing. A ref is not found only when no file in the bundle resolves it. show never builds the index or waits for a build.

Flag Values Default Description
--outline boolean false Outline and brief metadata without the body; the replacement for --detail brief.
--lead boolean false Add the indexed-safe document lead to a Markdown fragment; the replacement for --context lead.
--context exact, lead exact --context lead is Deprecated; use --lead; removed in 0.11. Fragment presentation. exact preserves the selected-section behavior. lead returns the indexed-safe first fragment followed by [Selected matching fragment] and the selected fragment.
--max-chars positive integer 3200 for lead Deprecated; use --max-tokens; removed in 0.11. Hard contextual content budget in characters; requires --context lead and is mutually exclusive with --max-tokens.
--max-tokens positive integer (none) Approximate body budget using four characters per token, for whole assets, exact fragments or lead context; mutually exclusive with --max-chars.
--project project name, none (by directory) The project recorded on this read's usage event, for akm doctor metrics assets; changes nothing else. none records no project; an unknown name is a usage error.

--max-tokens bounds the returned content, template and prompt text, not metadata, outlines or structured fields such as workflow steps. A leading frontmatter block is metadata: it is kept whole and not counted, the budget applies to the body after it, the cut prefers a whitespace boundary within the last quarter (at most 32 characters) of the budget, and a UTF-16 surrogate pair is never split. The contentBudget object reports maxTokens, returned estimatedTokens and truncated; estimates use four characters per token, not a model tokenizer. Text output states the same limit and truncation. A read without a budget still returns the complete body. Sensitive env and secret assets retain their metadata-only output; a budget never exposes their values.

--outline cannot be combined with a content budget, lead context or an explicit --detail other than brief. --detail brief with --lead, or with --max-tokens without lead context, is a usage error (exit 2), as it asks for a body it does not show. --detail brief --context lead [--max-chars N | --max-tokens N] keeps working exactly as in 0.10.261118. --lead requires an indexed Markdown fragment and conflicts with --context exact; its errors name --lead when you typed --lead. Direct .meta reads support --max-tokens but not --outline. --detail brief is Deprecated; use --outline. --context lead is Deprecated; use --lead. --max-chars is Deprecated; use --max-tokens. All are removed in 0.11 and keep their existing behavior until then.

meta is not an asset type — [<origin>//]meta[:<name>] direct-reads a human-authored orientation doc from a bundle's optional .meta/ directory (<name> defaults to index; .meta/<name>.md is tried before an extensionless .meta/<name>). These files are never indexed, so they do not appear in akm search. See Concepts for the full convention.

The default show JSON includes the asset body when applicable. Canonical ref is always present, at every --detail level, agent included. Absolute path and editable are always present too. None of ref/path/ editable are gated behind --detail full. Use --detail brief for a reduced metadata-first view without content/template/prompt; --detail full adds verbose extras such as schemaVersion and, when editable is false, editHint; --detail agent strips non-action metadata (e.g. origin, tags) down to the action-relevant field set while still including ref/path/editable, plus the optional fragment metadata described below.

toc is the outline of a whole Markdown document (knowledge, and every other Markdown asset whose #fragment selects a section): one { "level", "text", "slug", "startLine" } entry per heading, in order, at every --detail level, brief and agent included. slug is exactly what <ref>#<slug> selects, duplicate headings included (notes, notes-1, ...), and startLine is the heading's 1-based line in the file. It is read from the same file the section is cut from, so it never lists a slug the show cannot resolve. It is omitted for non-Markdown assets, for documents with no headings, and for a fragment show (<ref>#<slug>). --format text prints it as a toc: block.

links lists the asset's declared links, grouped by kind: outgoing (the assets its own xrefs:, supersededBy:, contradictedBy:, currentBeliefRefs:, wiki sources:, .derived parent, page links, or workflow and task targets name), incoming (the assets that name it), and unresolved (tokens it names that match no indexed asset, as written). Each kind is { "total": n, "refs": [...] } with at most 10 refs; total counts them all. The field is omitted when nothing links either way. Links are read from frontmatter and parsed structure at index time, with no model; they do not affect search ranking.

Indexed body-link syntax depends on the bundle adapter:

Adapter Body links that produce links_to relationships
okf Inline [label](./target.md) and explicit reference [label][id] with [id]: ./target.md definitions
llm-wiki Inline Markdown links; frontmatter xrefs: and sources: retain their separate contracts
akm and other native adapters Their declared frontmatter/structural relationships; ordinary Markdown body links do not automatically become links_to

For OKF and LLM Wiki, relative paths resolve from the linking file's directory and /-rooted paths from the component root. Optional titles, fragments and queries do not change the target identity. Repeated targets collapse in first appearance order. External schemes, protocol-relative URLs, in-page anchors, non-.md targets and paths escaping the component root are excluded. Missing supported targets stay unresolved; their diagnostics are non-blocking.

Inline backtick code and backtick/tilde fenced code (including fences inside lists and blockquotes) produce no body-link relationships or broken-link warnings. Reference definitions inside code cannot supply OKF links. Rendering [[wiki links]] in the UI does not establish indexed support: neither adapter indexes that syntax, and LLM Wiki does not index reference-style body links. This is the existing indexed subset, not a full Markdown syntax parser.

After upgrading a build that indexed links inside examples, run akm index --full once. It reparses unchanged files and replaces their stored relationships, removing false outgoing links, backlinks and curated support references. Ordinary incremental indexing updates changed/deleted entries but can retain unchanged older parsing results. No data migration is required; rebuilding the index under the selected build is also the recovery action after reverting the fix.

Opaque fragment shows and --context lead keep ref as the canonical parent identity and add selectedRef, parentRef, one-based fragmentOrdinal, fragmentCount, startLine, endLine, optional previousRef/nextRef, and separate fragment/parent character and token estimates. Contextual shows also report contextMode, contextMaxChars, and contextTruncated. Heading aliases are canonicalized in contextual selectedRef to the resolved opaque indexed selector. Default exact shows through a friendly #heading retain their source-live body and do not attach indexed-safe provenance that could describe a different revision or projection.

--context lead is opt-in and accepts only fragment-qualified indexed Markdown assets. Both the lead and selected content come from the same line-preserving, safe indexed revision used by fragment search, even when the source file changes between search and show. The selected block is labelled and kept last. When the budget is tight, AKM clips or omits lead content before clipping selected evidence; contextTruncated reports either case.

Returns type-specific payloads:

Type Key fields
script run, setup, cwd
skill content (full SKILL.md)
command template, description
agent prompt, description, modelHint
knowledge content — the whole document, or one section via #fragment; toc on a whole document
workflow workflowTitle, workflowParameters, steps (each step's orchestration summary names its engine (the connection or harness it runs on) and model, or — for an exec step — its exec.command and no engine at all)
memory content
env keys (key names only — values and comment text never returned)
lesson content plus when_to_use surfaced from frontmatter

editable means current AKM source policy authorizes direct in-place modification of that exact path. It is computed from current source ownership and effective writable policy, not persisted in the index; unknown paths fail closed. editHint is present only when editable is false. akm show uses the local index and materialized disk path, with no remote-provider fallback. If the ref points to a package origin that is not installed, it returns guidance to run akm bundle add <origin> first.

workflow

Deprecated (see STABILITY.md): workflows, the workflow asset format, the engine and every akm workflow command are removed in 0.11, where tasks with ordered steps replace them. Nothing changes in 0.10.x. Start runs with akm run <ref>; akm migrate apply converts workflow files in 0.11.

Author, inspect, and execute structured workflow assets.

akm workflow create ship-release --print
akm workflow create ship-release
akm workflow create ship-release --from ./ship-release.md
akm run workflows/ship-release --version 1.2.3   # always starts a new run
akm run <run-id>                           # continue an active partial run
akm workflow status <run-id>
akm workflow status workflows/ship-release
akm workflow status 7c115132               # 8+ char run-id prefix also works
akm workflow resume <run-id>               # re-activate a blocked or failed run, then `akm run <run-id>`
akm workflow abandon <run-id>
akm workflow list --active
akm workflow list --children               # also list child workflow runs (Experimental)
akm doctor explain workflows/ship-release  # compile+freeze preview, zero writes

Bare akm workflow (no subcommand) runs akm workflow list.

Subcommands:

Subcommand Description
create <name> Validate and write a Markdown workflow under workflows/. --path <dir> places it in a subdirectory; --from <file> imports content; --force overwrites; --print prints the template that would be written instead of writing it
run <run-id|ref> Canonical start/execute command. A ref always starts a new run (other active runs of the ref produce one warning, see below); a run id continues that exact active run. Executes until completion, failure, verification rejection, interruption, or an explicit limit
status <run-id|ref> Show the full run state, including all step statuses. --units also lists per-unit rows from the run journal (diagnostics only). Renders a children: tree when the run composes child workflows. A ref shows its most recently updated run. --all-scopes is a deprecated no-op
list List workflow runs (optionally filtered by --ref; --active shows only status=active runs, excluding blocked/failed/completed). Child workflow runs (the Experimental unit: { workflow: … } step) are excluded unless --children is passed. Lists every run on the host, most recently updated first, from any working directory. --all-scopes is a deprecated no-op
resume <run-id> Flip a blocked or failed run back to active so run <run-id> can continue it; it executes nothing. Completed runs cannot be resumed
abandon <run-id> Mark a run failed so it stops counting as active (resume can reopen it)
plan <ref> Deprecated; use akm doctor explain <ref>. Compile and freeze a workflow WITHOUT publishing a run: the canonical step graph, per-step frozen target kinds, task/child expansion, input bindings, source read set, and lowering notices — zero durable writes. Returns the full JSON envelope by default, like every other command; pass --format text for a human-readable summary

Everywhere a run id is accepted (run, status, resume, abandon), a unique run-id prefix of 8 or more characters works too — the same convention akm proposal accept/reject use for proposal UUIDs. A prefix matching more than one run is a usage error listing every candidate; a prefix matching none is a not-found error. Only strings shaped like a run id (hex digits and hyphens, 8+ characters) are ever treated as a prefix, so a workflow ref is never mistaken for one.

The public workflow start, next, and complete lifecycle was removed in 0.9, along with the experimental brief/report external-driver protocol. Use workflow run for execution and workflow status for inspection. The removed commands fail with an UNKNOWN_COMMAND envelope; there are no compatibility aliases.

There is also no akm workflow template, validate, or watch. workflow create --print prints a starter, akm lint --type workflows validates it, and akm doctor log --run <id> --since '@offset:<id>' provides durable event polling.

workflow run

Deprecated; use akm run <workflow-ref> to start a run and akm run <run-id> to continue one; removed in 0.11. The other workflow subcommands are Deprecated too and are removed in 0.11 with workflows.

akm workflow run workflows/ship-release --version 1.2.3
akm workflow run workflows/review --files a.ts --files b.ts
akm workflow run <run-id> --max-steps 3
akm workflow run <run-id> --max-retries 2 --timeout 10m
akm workflow run <run-id> --skip-if-locked   # for scheduled runs: skip (exit 0) instead of failing on contention

Parameter flags must follow the target and exactly match keys declared in the workflow's params frontmatter. AKM coerces each value from the declared JSON Schema before persisting the run:

A bare boolean flag means true. Hyphen/underscore aliases are not inferred: declared include_processes requires --include_processes, not --include-processes. Parameters are accepted on every ref start (a ref always starts a new run); passing them with a run id is rejected, because that run already has its parameters. The old --params <json> bag is removed.

Flag Description
--max-steps <n> Stop once this many steps have finished, leaving a partial run active. Must be at least 1.
--max-retries <n> When a step fails, reopen the same run and retry the failed step up to this many additional times. Range: 0 through 100; default 0. Gate rejection and interruption are not retried.
--timeout <duration> Abort the whole invocation after N, Nms, Ns, Nm, Nh or Nd; bare N is milliseconds. The active step remains resumable.
--new Deprecated, no effect (accepted through 0.10): a workflow ref always starts a new run.
--skip-if-locked If another akm process is already driving this run (it holds the run's lock file: RUN_LEASE_HELD), when starting a ref an active run of that ref is held by a live process, or state.db is busy with another writer (STATE_DB_CONTENDED), skip gracefully (exit 0) instead of failing (exit 75, TransientError). The envelope reports { skipped: { reason: "lock-held" | "state-db-contended", message } }. Every other failure (a bad flag, an unresolvable target) still fails loudly regardless of this flag. Use for high-frequency scheduled runs so they don't pile up failures while a longer-running invocation is in progress — same family as improve --skip-if-locked.

A ref always starts a new run. workflow run <ref> never resumes: use workflow run <run-id> to continue a run and workflow resume <run-id> to reopen a blocked or failed one so run <run-id> can continue it. When other runs of the same ref are still active, the start prints one warning naming their ids and the akm run <id> / akm workflow abandon <id> commands, and starts anyway. --skip-if-locked is the guard for scheduled callers: it skips (exit 0) instead of starting when an active run of the ref is held by a live process.

The result includes the current run, an executed step report list, a stepsProcessed count of the steps that finished, and optional done, gateRejection, aborted, or timedOut markers. A failed run, rejected verification gate, timeout, or interrupt exits nonzero. SIGINT and SIGTERM map to 130 and 143; a timeout maps to exit 1. Reaching --max-steps with an active resumable run is successful. A --timeout that lands during the run's final bookkeeping is not reported as a timeout: a run that reached completed has nothing left to abort and nothing left to resume.

What --max-steps counts. The budget is spent by the steps that finish — completed, failed, or gate-rejected with the loop budget spent — not by entries in the executed report, which gains one per gate-loop iteration. So a step's whole bounded gate.max_loops loop costs one, and a step the invocation left unfinished — an abort, a verification-judge outage — costs nothing either, because the next invocation still owes that work. --max-retries subtracts the same way: a reopened run's remaining budget is not shrunk by loops or skips.

The budget is checked between steps, so it does not bound what any single step dispatches — a step's gate loop runs to its own limit no matter how little budget is left. gate.max_loops (1–100) is the per-step ceiling; budget.max_units and budget.max_tokens are the whole-run ceilings, seeded from the unit journal so they hold across resumes.

Every non-empty ### gate needs a connection or a harness to judge it before a new run can be frozen (the judge runs where model work runs; see Configuration). Gate evaluation is fail-closed.

Workflow runs are identified by run id, and workflows by ref; neither depends on the working directory. workflow list and workflow status workflows/<name> see every run on the host, from any directory, so the runs of a scheduled task (which runs from the scheduler's cwd) appear exactly as runs started from your shell do. akm show reports no run state; it belongs under akm workflow.

workflow create

akm workflow create ship-release
akm workflow create ship-release --from ./ship-release.md
akm workflow create ship-release --from ./ship-release.md --force
akm workflow create ship-release --force
akm workflow create ship --path release          # writes workflows/release/ship.md
Flag Description
--path <dir> Relative subdirectory under workflows/ to place the workflow in. The filename comes from <name>.
--from <file> Import and validate a Markdown workflow from an existing file
--force Overwrite an existing workflow: with --from, replace its content from that file; alone, replace it with a fresh template
--print Print the Markdown template without creating anything

<name> itself must be flat — ^[a-z0-9][a-z0-9._/-]*$ after combining with --path, but the bare --name positional is rejected if it contains a /. Hierarchical placement (release/ship) goes through --path release --name ship, the same convention every other create command (knowledge, env, secret, …) uses — akm workflow create release/ship directly is a usage error (exit 2).

Snapshot isolation: workflow run compiles and freezes the workflow plan when it creates a run. Edits to the source workflow after that point do not affect the in-flight run.

workflow status

akm workflow status <run-id>
akm workflow status workflows/ship-release
akm workflow status <run-id> --units    # also list per-unit rows from the run journal

Accepts a run id, a unique 8+ character run-id prefix, or a workflow ref. When given a workflow ref, resolves to the most-recently-updated run for that ref on this host. --all-scopes is a deprecated no-op. --units adds per-unit rows (unit id, status, failure reason, and any result/error diagnostic text) from the run journal — diagnostics only; step evidence stays deterministic and is unaffected. A failed unit's row also carries an orchestration object (in text, argv:, cwd:, env: and ref: lines): the step's argv, cwd and env refs from the frozen plan, and the bundle-qualified ref each ${ref} token, env ref and child workflow resolves to right now (not found when no bundle owns it).

workflow plan

Deprecated in 0.10.261120; use akm doctor explain workflows/<name>; removed in 0.11.

akm workflow plan workflows/release
akm workflow plan workflows/release --format json

Evolving (see STABILITY.md). Compiles, resolves, and freezes the named workflow exactly as akm workflow run would when starting a new run — the same two calls, loadWorkflowAsset + compileResolveFreezeWorkflowV4 — and stops. It publishes no run row, takes no lease, appends no event, and writes to no other table: zero durable writes, verified by row count before and after, not merely assumed. Use it to preview what a run would freeze — the canonical step graph, which steps expand through a task or a composed child workflow, and any freeze-time lowering notices or compile warnings — before committing to a run, or to inspect a workflow's shape without side effects.

Two output modes:

Text-mode example:

workflow: team//workflows/release (markdown)
source:   workflows/release.md
plan:     irVersion 8, hash 4f2ba91c3d0e… (not published)
limits:   maxConcurrency 4; budget max_units 50, max_tokens 100000
params:   channel, version
steps:
  1. notify   [command]        direct
  2. build    [script]         via tasks/plan-v4-task
  3. dispatch [child-workflow] -> workflows/release-checklist (plan 91acbe20f5d1…)
       with: channel="stable" (literal), files <- steps.build.output.files (reference)
       3.1 verify [command] direct
  4. summarize [command]       direct
read set:
  workflows/release.md
  commands/notify.md
  workflows/release-checklist.md

Each step also lists what it will run and what that names, from the same projection akm show prints: argv: (JSON, so word boundaries survive), cwd:, env: and one ref: line per ${ref} token in the argv or cwd, per env: entry and per child workflow:, in the form ref: ${team//scripts/x.ts} -> team//scripts/x.ts (argv). In JSON this is each step's orchestration object, with refs[] (ref, resolved, in). A ref no bundle owns fails the plan with an error that names it. The resolved ref is a name, never a value or a path.

Secret-free by construction. Neither mode ever prints a resolved reference value (references resolve at pre-attempt, not here), request content (request.command.content, request.persona, request.conversation, request.runtime.environment), a script's bytesBase64, or any credential — only binding shapes (inputBindings[].name/.kind, a literal's .value, a reference's .from), environment binding names (environment[].kind/ .name, an env-ref's .ref), and connection and harness names (orchestration.engine, gate.judgeEngine).

workflow resume

akm workflow resume <run-id>

Flips a blocked or failed run back to active; it does not execute anything. Run akm run <run-id> afterwards to continue it. Completed runs cannot be resumed. Use workflow list to find runs by status.

Workflow markdown contract:

See Workflows for the complete authoring contract.

How bundle add works

akm bundle add infers what to do from the input:

Input What happens
akm bundle add ~/.claude/skills Registers a local directory as a filesystem source
akm bundle add github:owner/repo Clones the repo into akm's cache as a git source
akm bundle add @scope/pkg Installs the npm package as an npm source
akm bundle add https://docs.example.com Crawls and caches a website as a website source
akm registry add <url> Adds a discovery registry (separate concept)

HTTP(S) URLs on known Git hosts, and URLs ending in .git, are treated as git sources, and so are git:// and ssh:// URLs (akm bundle add git://host/repo.git). A ref that contains :// is never read as a registry id. Other HTTP(S) URLs are crawled as website sources.

bundle add

Add a source — a local directory, npm package, GitHub repo, git URL, or website. akm detects the bundle's format automatically (its own native workspace, a Claude Code or OpenCode tool directory, an OKF or LLM-wiki knowledge base, …) — see Bundle Types for how detection works and what each format gives you.

akm bundle add ~/.claude/skills              # Local directory
akm bundle add @scope/pkg                    # npm package
akm bundle add npm:@scope/pkg@latest         # npm with version
akm bundle add github:owner/repo#v1.2.3     # GitHub with tag
akm bundle add https://github.com/owner/repo
akm bundle add git+https://gitlab.com/org/bundle
akm bundle add ./path/to/local/bundle
akm bundle add github:andrewyng/context-hub --name context-hub  # context-hub as a git bundle
akm bundle add https://docs.example.com --name docs
akm bundle add https://docs.example.com --max-pages 100 --max-depth 5
Flag Description
--name The bundle key. A contract, not a hint: it must be a legal bundle slug (no : . # / or whitespace) and not already taken by a different bundle, or the add fails before any write. Re-adding an already-installed source under a different --name than it already carries also fails — use akm bundle rename <old> <new> instead. Omit it and akm derives a name (falling back to a -<hash> suffix on a collision).
--provider Explicit provider for declarative source configuration; normally inferred from the input
--adapter Component adapter for a local directory: website-snapshot, agent-skills, claude, opencode, dotenv, akm-workflow, akm-task, llm-wiki, akm, okf, generic-files or code-project; normally detected
--before / --after Insert the new bundle before or after this configured bundle, setting its search order
--writable Mark a git source as writable so akm sync also pushes (default: false)
--options Provider options as JSON (e.g. '{"maxPages":100}')
--allow-insecure-transport Allow a plain-HTTP source URL after explicitly accepting transport substitution risk
--allow-dangerous-env-keys Deprecated, no effect. bundle add no longer scans env files for process-hijacking keys. Accepted through 0.10 so existing scripts keep working.
--max-pages Maximum pages to crawl for website sources (default: 50)
--max-depth Maximum crawl depth for website sources (default: 3)
--credential Git HTTPS bearer credential, stored as a reference and never a literal token: $VAR, ${VAR}, or an akm ref such as ${secrets/gitea_token} (${team//secrets/gitea_token} for a secret in another bundle). Resolved only when git runs

To index only a subdirectory of a git bundle, set the component root after adding it:

akm bundle add <url> --name <name>
akm config set bundles.<name>.components.main.root <subdir>
akm bundle update <name>

root is relative to the detected stash root of the checkout, not always the repo root, and takes effect on the next bundle update or akm index.

Env files and process-hijacking keys

Installing a bundle is the trust decision. akm bundle add and akm bundle update do not scan a bundle's env/ files, never prompt, and never roll an install back over the keys an env file sets, so a bundle whose env/*.env sets PATH installs and refreshes unattended with no flag. akm exec, akm run and workflow env: bindings inject what the bundle defines.

akm lint still reports env keys that can hijack a process (dangerous-env-key, non-blocking), for bundle authors who want to review their own files. The flagged key set is 41 literal names plus 2 regex pattern families (src/commands/lint/env-key-rules.ts): LD_PRELOAD, LD_LIBRARY_PATH, LD_AUDIT, LD_DEBUG, LD_BIND_NOW, LD_PROFILE, LD_ASSUME_KERNEL, LD_TRACE_LOADED_OBJECTS, DYLD_INSERT_LIBRARIES, DYLD_LIBRARY_PATH, DYLD_FRAMEWORK_PATH, PATH, BASH_ENV, ENV, PROMPT_COMMAND, PS1, PS2, IFS, ZDOTDIR, NODE_OPTIONS, NODE_PATH, NODE_TLS_REJECT_UNAUTHORIZED, PYTHONSTARTUP, PYTHONPATH, PYTHONINSPECT, PYTHONHOME, PYTHONNOUSERSITE, RUBYLIB, RUBYOPT, PERL5LIB, PERL5OPT, JAVA_TOOL_OPTIONS, JDK_JAVA_OPTIONS, _JAVA_OPTIONS, GIT_SSH_COMMAND, GIT_EXTERNAL_DIFF, GIT_PAGER, GIT_EDITOR, EDITOR, VISUAL, and PAGER (41 literals), plus any key matching ^BASH_FUNC_ or ^GIT_CONFIG_.

Bundle publishers: see the Author Bundles guide for guidance on env files that legitimately need these keys.

Website sources

An HTTP(S) URL outside known Git hosts is treated as a website source. akm crawls the site breadth-first from the given URL, converts each page to markdown, and stores the results as knowledge assets with the URL path hierarchy preserved.

akm bundle add https://www.agentic-patterns.com/ --name agent-patterns
akm bundle add https://docs.example.com/guide --name guide --max-pages 200

Pages are cached locally when the bundle is added and re-crawled only by akm bundle update. The crawl stays within the same origin (hostname) and skips static assets (images, CSS, JS, etc.).

Use --max-pages and --max-depth to control how many pages are fetched and how many link levels deep the crawler goes. These values are persisted in your config so subsequent re-indexes use the same limits.

See registry.md for the full install flow for managed sources.

Note: there is no akm bundle add context-hub convenience alias or akm enable/disable context-hub command — add it explicitly as a git bundle: akm bundle add github:andrewyng/context-hub --name context-hub. A bundle type string of "context-hub" in an existing config still normalizes to "git" at load time, so you don't need to edit your config files.

bundle list

Show all sources — local directories, managed packages, and remote providers.

akm bundle list                            # All sources
akm bundle list --kind filesystem          # Only plain filesystem/local directory sources
akm bundle list --kind git                 # Only git sources
akm bundle list --kind npm                 # Only npm-managed sources
akm bundle list --kind website             # Only crawled website sources
akm bundle list --kind filesystem,git      # Multiple kinds (comma-separated)
Flag Description
--kind Filter by source provider: filesystem, git, npm, website (comma-separated). Any other value is a usage error (exit 2) — there is no local/managed/remote grouping.

bundle remove

Remove a source by id, ref, path, URL, or name and reindex.

akm bundle remove npm:@scope/pkg           # Managed source by id
akm bundle remove owner/repo               # Managed source by ref
akm bundle remove ~/.claude/skills         # Local source by path
akm bundle remove my-provider              # Any source by name
akm bundle remove my-provider --yes        # Skip the confirmation prompt
Flag Description
-y, --yes Skip the confirmation prompt

Removing a git bundle deletes or abandons its checkout, so it is refused (exit 78, SOURCE_HAS_LOCAL_WORK) while the checkout holds local work: uncommitted files (up to five are named) or commits that are not on its upstream. The error names the checkout, the paths and the commits. Push, move or discard them, then remove again; there is no flag that bypasses the refusal.

bundle update

Update one bundle, or refresh every configured bundle with --all. Git, npm, and website candidates are staged before they replace the active generation. Filesystem bundles require no hydration; update reconciles their current files into the index immediately.

akm bundle update npm:@scope/pkg
akm bundle update --all
akm bundle update --all --force   # Force fresh download even if version is unchanged
Flag Description
--all Update all managed sources
--force Fetch again even when the upstream revision is unchanged
--allow-dangerous-env-keys Deprecated, no effect. An update no longer scans env files for process-hijacking keys. Accepted through 0.10 so existing scripts keep working.
-y, --yes Deprecated, no effect. An update never asks before pruning old install directories of a read-only bundle; they are a re-fetchable cache. Accepted through 0.10 so existing scripts keep working.

A read-only git or npm bundle whose upstream revision still matches its lock is left exactly as it is: nothing is fetched or replaced, and the update reports it as unchanged, with the installedAt of the install that is there. An update never deletes unpushed commits or uncommitted files in a git checkout: a read-only refresh that would replace a checkout holding local work, a writable checkout that has diverged or whose fast-forward would overwrite local work, and a re-add of such a bundle are refused with exit 78 (SOURCE_HAS_LOCAL_WORK), naming the commits and paths and the live checkout (not the staging folder). A real revision change installs the new revision beside the old one, keeps the immediately previous revision directory (a task or workflow may still be running from it) and removes older ones. A revision directory another bundle still references is kept.

An update takes the index rebuild lock before it publishes and holds it across the publish and the reindex. When another process already holds it, the update still publishes and skips the reindex, reporting index.skipped. If the reindex fails after the bundle was published, the update warns that the bundle was updated but its index was not refreshed, then fails with the original error; akm index or the next scheduled build indexes it.

An update reindexes incrementally: only directories whose files changed are re-read, and akm index --full is the explicit full pass. A writable Git install whose live checkout is already at the fetched commit, and whose lock already records that revision and the fetched upstream tip is unchanged, publishes nothing and builds no index (the result reports changed.any: false); --force skips that shortcut, but never a refusal over local work. Local edits in a writable checkout are not part of an update: they reach the index with the next akm index or scheduled build.

The index block of an update reports semanticStatus, the state the index recorded at its last embedding pass (the one akm doctor info reports), read from the index when this update ran none; semanticReason says why when it is unknown because the index could not be read.

A publication or index failure preserves the prior active bytes, lock/config generation, and searchable index for that bundle.

A writable Git update is fetched into a staged copy of the checkout beside the live one, so a failed fetch leaves the live checkout, the lock and the index untouched. Publication refreshes the configured origin tracking ref to the tip Git fetched in staging, independently of any local-ahead HEAD. A concurrent change to that live tracking ref is reported rather than overwritten, and a refused fast-forward puts the tracking ref back. The live checkout is then fast-forwarded to exactly the staged commit (git merge --ff-only), which refuses, preserving local work, when local commits have diverged or the merge would overwrite local work. AKM holds its source/index writer lease through that fast-forward and the index pass; all AKM writers cooperate with this lease, but a non-cooperating local process is not excluded. Do not edit a writable checkout from another process while its update is running.

The index and its update-owned state maintenance share one deferred SQLite transaction. WAL readers continue to see the last committed generation while a update index pass runs, and competing writers wait for that pass to commit or roll back.

This boundary guarantees rollback for handled process faults (throws and SQLite commit failures); it is not an abrupt-termination or cross-database power-loss guarantee. Both index.db and state.db remain in WAL mode, where SQLite does not guarantee an atomic commit across attached database files after SIGKILL, abrupt power loss, or storage failure. The durable outcome may therefore combine approved old/new source bytes and lock state with adjacent index/state generations. akm doctor reports index-state-generation when a durable usage link disagrees with the searchable index, but that advisory cannot identify every theoretical split. Stop concurrent writers, rerun the targeted bundle update if the checkout/lock is not the intended approved revision, then run akm index --full to rebuild the search index and relink durable usage state.

Reports per-entry change flags: changed.version, changed.revision, and changed.any. With --all, each bundle is isolated: successful entries appear in processed/plainSynced; provider or transaction errors report status: "failed" and a code. The command continues with later bundles without half-publishing a failed one.

bundle rename

Rename a configured bundle's key everywhere akm itself persists it — the one command allowed to change it (renaming by hand-editing config.json's bundles key strands every durable ref the tool minted under the old id; see akm doctor / the startup warning that names this).

akm bundle rename old-name new-name
akm bundle rename old-name new-name --dry-run   # Show the plan; write nothing
Flag Description
--dry-run Report what would change (index/state row counts, scheduler refs, content files that still mention the old name) without writing anything

<new> must be a legal, unused bundle slug (the same --name contract akm bundle add enforces) or the rename fails before any write. Rewritten: the config bundles key; defaultBundle/defaultWriteTarget when they name the old id; every scheduler.enabled[].ref with the old <old>// prefix; the lockfile entry id; every indexed entry's bundle_id/ref; and this tool's own state rows that name the old bundle (proposals.ref, a pending proposal's write target, workflow task_history.target_ref, workflow_runs.workflow_ref, the recorded feedback and usage in usage_events.entry_ref and events.ref, and the improve loop's improve_ledger, asset_salience and asset_outcome rows, so search and improve keep counting the bundle's feedback; the old name is matched case-sensitively). The result's activeWorkflowRuns lists the active and blocked runs of the renamed bundle, each with its status: their frozen plans keep the old qualified refs, so continue them with akm run <id> (after akm workflow resume <id> for a blocked one) or give up with akm workflow abandon <id>. Reported, never rewritten: refs inside the bundle's own CONTENT (cross-references, uses: in a task, supersededBy) — the result's contentRefs lists the indexed files that still spell the old <old>// prefix so you can fix them by hand. A real run also re-syncs native scheduler bindings under the new name (taskSync in the result reports the outcome, never thrown, since config/index/state are already renamed by then). taskSync.ok is false both when the sync call itself fails and when it comes back reporting one or more taskSync.result.failures — a binding that failed to prepare has already lost its old native row and stays unscheduled until you re-run akm doctor scheduler sync; --dry-run lists the installed native rows that still name the old bundle (nativeSchedulerRows) so you can see what that sync will replace.

upgrade

Upgrade akm itself to the latest release. Standalone binaries are downloaded, checksummed, and staged before replacement; npm, Bun, and pnpm global installs use their package manager.

Upgrade replaces the installed program when a newer release exists, then runs akm-migrate apply — the migrator that shipped with whatever is now installed — and rebuilds the derived index. The migration step runs on every akm upgrade, install or no install, and its plan is reported under migration; an upgrade whose migration is blocked or could not run exits 1. That makes akm upgrade safe as a container entrypoint: on a current installation it is a no-op. An akm installed as a dependency of another package (installMethod: "package-local") is never reinstalled — the parent package owns that copy — but its migrations still run. An npm global upgrade requires evidence that this copy is inside the npm global root, read from the npm beside the launching Node or else the npm on PATH; a package-local Bun invocation without that evidence also leaves installation to its owner. Standalone downloads use a temporary rollback copy only during atomic executable replacement.

Standalone downloads are streamed directly to the staged file while SHA-256 is computed, with a 256 MiB binary limit. Release/checksum metadata is capped at 1 MiB; an oversized response is cancelled and the staged file is removed.

akm upgrade              # Install a newer release if there is one, run every pending migration, then update the harness plugins
akm upgrade --check      # Report pending updates, CLI and plugins, without changing anything (no migration step)
akm upgrade --force      # Force the install even if already on latest
akm upgrade --next       # Deprecated; use --channel. Include prereleases when selecting the newest CLI release
akm upgrade --skip-checksum # Recovery only: install although the release checksum cannot be verified
akm upgrade --channel next   # Switch CLI and installed harness plugins to next
akm upgrade --channel latest # Return CLI and installed harness plugins to stable
Flag Description
--check Report pending updates (CLI and per-harness plugins) without changing anything
--force Force upgrade even if on latest version
--skip-post-upgrade Skip the post-upgrade index rebuild
--skip-checksum Recovery only: install even when the release checksum cannot be fetched or its file is not listed. A checksum that does not match always fails. Replaces AKM_UPGRADE_SKIP_CHECKSUM=1, which keeps working through 0.10 with a stderr notice and is removed in 0.11
--channel latest|next Switch the CLI and installed Claude, Codex and OpenCode plugins together; works with --check
--allow-downgrade Permit an older target version during an explicit --channel switch
--next Deprecated; use --channel next; removed in 0.11. Include prereleases when selecting the newest CLI release; retain configured harness channels (see below). Works with --check, --force and -q

Offline, or to migrate without a release check, run akm migrate apply directly: it is the same step.

Harness plugins

After the CLI step, akm upgrade updates the akm plugin of each agent harness it finds. It only updates: a plugin that is not installed is never installed, and a harness without the akm plugin is skipped. Each external command runs with a timeout, and a failure is recorded on that harness's entry without stopping the CLI upgrade.

Harness Updated when What runs
Claude Code claude is on PATH, the akm-plugins marketplace is configured and akm@akm-plugins is installed claude plugin marketplace update akm-plugins, then claude plugin update akm@akm-plugins
Codex codex is on PATH and akm@akm-plugins is installed from the akm-plugins marketplace codex plugin marketplace upgrade akm-plugins (this also refreshes the installed plugin cache)
OpenCode 1 akm-opencode is cached at $XDG_CACHE_HOME/opencode/packages/akm-opencode@latest (default ~/.cache/opencode/...) and opencode is on PATH If npm's akm-opencode@latest differs from the cached version and no OpenCode process is running: the cache directory is moved to the trash (never deleted), then opencode debug config is run from a temporary directory to fetch the new version. While OpenCode runs the update is deferred to a later akm upgrade.
OpenCode 2 akm-opencode-v2 is named under "plugins" in the global OpenCode config (opencode.json or .jsonc) and cached at $XDG_CACHE_HOME/opencode/npm/akm-opencode-v2@latest/<build>/, and the opencode2 on PATH (else the opencode) is OpenCode 2 If npm's akm-opencode-v2@latest differs from the cached version (the newest <build> folder): opencode plugin update <spec> is run from a temporary directory, with the spec as the config names it. OpenCode 2 installs the new build into a fresh <build> folder and the running service keeps the old one until it restarts, so nothing is moved to the trash and the update is not deferred while OpenCode runs. Listed only on a host that has the plugin, so an OpenCode 1 host reports exactly what it did before.

The two OpenCode plugins never touch each other: akm-opencode is only looked for in OpenCode 1's cache and plugin key, akm-opencode-v2 only in OpenCode 2's cache and plugins key. Before moving a cache, akm reads --version of the binary that owns it (opencode for OpenCode 1; for OpenCode 2 opencode2 when it is on PATH, else opencode) and skips the plugin when that binary is the other major, since only the matching major can re-create that cache; akm never installs or replaces opencode. A spec that appears only under the legacy plugin key for OpenCode 2 is skipped with a note (move it to plugins). akm's own runtime does not depend on this step: it runs its own pinned OpenCode binary, fetched by akm (see Configuration).

OpenCode 2 has its own updater, opencode plugin check and opencode plugin update, which akm uses for akm-opencode-v2. Two things to know when you run them by hand: plugin list and plugin check print "No plugins found" until the OpenCode service has loaded its plugins after a restart, and plugin update leaves the old <build> folders under the cache folder (the newest one is the one in use).

Claude Code does not update third-party marketplaces on its own (the Claude desktop app turns plugin updates off), and OpenCode never re-checks a cached plugin, so neither moves without this step. Codex refreshes its git marketplaces at every start.

The result gains a plugins array, one entry per harness: { "harness": "claude-code" | "codex" | "opencode" | "opencode-v2", "outcome": ..., "from"?, "to"?, "message"? }. outcome is updated, current, skipped, deferred or failed; under --check it can also be pending or unknown. A plugin state akm could not read is failed with the reason, with or without --channel and under --check too: the claude or codex command is present but fails, opencode.json(c) exists but cannot be read or parsed, or Codex's config.toml cannot be parsed (never skipped, and a failed entry with channel: "unknown" carries no channelMismatch). --check writes nothing, and reports the plan a real run would carry out, --channel included: an OpenCode @next plugin newer than npm's @latest stays ("stays at ...; latest has nothing newer") with no config edit, and the CLI's own "stays" decision shows in latestVersion and updateAvailable. For Claude Code and Codex it reads the akm build the channel in force offers, the same read the real switch makes and akm health makes: the catalog and plugin manifest of the channel's branch of the marketplace the harness has registered, read from a blobless clone with nothing checked out in a temporary folder. The channel is the --channel asked for, else the one the marketplace follows. It reports pending, with that build as to, when it is newer than the installed one, else current; with --channel, a plugin whose channel has nothing newer (or whose build cannot be read) is current and stays, as the switch itself leaves it. A plain check whose marketplace cannot be read reports unknown, with the reason in message. For OpenCode it compares the cached version with npm, so it reports pending when an update is due. A failed plugin makes akm upgrade exit 1 (not --check). On an up-to-date machine the text output prints nothing for plugins.

The CLI does not wait for plugins. The CLI target is the newest akm on the selected channel (--channel, next for --next, otherwise the channel the installed akm is on: next for a prerelease, latest for a stable release), whatever the plugins pin. It never moves the CLI to an older version without --channel and --allow-downgrade: when the channel offers nothing newer, akm stays and says so. Plugins update to their own channel's newest build; a plugin running an older bundled akm reports itself stale through akm doctor and updates with its own release.

Prereleases (--next)

--next is Deprecated; use --channel; removed in 0.11.

akm upgrade --next means "newest available, prereleases included". The result carries channel: "next" ("latest" otherwise), plus the CLI's inferred currentChannel and each installed plugin's configured channel and channelMismatch. A plugin is updated, current within its configured channel, or skipped with the reason in its message; a channel is never switched without --channel. When a plugin's bundled akm differs from the CLI, its message also names the engine skew akm health reports. The text output, AKM Desktop and the scheduled version check show the same result.

Switching channels together (--channel)

akm upgrade --channel next selects the actual npm next CLI tag and changes installed harness plugins to their next branch or package tag. --channel latest selects stable and removes those prerelease refs. An explicit switch may replace a pinned plugin spec. The same rule applies to each component (the akm CLI, each OpenCode plugin, the Claude Code marketplace and the Codex marketplace): if the channel's newest build is newer than the installed one, the component switches and updates; if it is equal or older, the component is left completely untouched (no spec or ref change, no refresh) and reported as current with a message such as "akm stays at 0.10.261121; next has nothing newer". Nothing errors for this. --allow-downgrade switches every component and moves it to the channel's version. A failed CLI install or migration stops the plugin switch.

Claude and Codex retain their marketplace registrations, plugin enablement, pluginConfigs, and unrelated settings. akm edits only the marketplace ref, then uses the native updater. Claude's installed user, project and local scopes are updated explicitly. OpenCode changes only the installed plugin's spec, retaining tuple options and JSONC comments, then refreshes the desired cache. Every changed config file has a sibling .akm-channel-*.bak backup, whose path appears in that harness's backups result. Restart the harness to load updates.

--check --channel next shows channel, targetChannel and mismatches without writing settings or fetching Git marketplaces. The CLI's currentChannel is inferred from its version: prerelease means next, otherwise latest. A configured channel is distinct from a successful refresh: native update failures retain the configured target and backup paths but report failed. An installed plugin left on the other channel, including OpenCode awaiting shutdown, makes an explicit switch exit 1; retry after resolving its reported cause. A plugin already on the channel whose update is deferred or skipped is reported in its entry and does not, as in an upgrade with no --channel. The switch is coordinated, not a transaction across independent harnesses.

Containers

With the plugin step, a container entrypoint needs only:

akm upgrade -q || true
( while sleep 86400; do akm upgrade -q; done ) &   # long-running containers only
exec "$@"

Codex hooks need one-time trust, and nobody can open /hooks in a container. Bake the trust entries into the image's ~/.codex/config.toml, one per hook the plugin declares (today session_start and user_prompt_submit):

[hooks.state."akm@akm-plugins:plugin.json#hooks[0]:session_start:0:0"]
trusted_hash = "sha256:<hash>"

[hooks.state."akm@akm-plugins:plugin.json#hooks[0]:user_prompt_submit:0:0"]
trusted_hash = "sha256:<hash>"

Copy the two trusted_hash values from a machine where you have trusted the hooks in /hooks (they are in that machine's ~/.codex/config.toml). The hashes stay the same across plugin version bumps and change only when a hook's command changes, so an upgraded plugin keeps running without a prompt.

Checksum verification is the default. If a release's checksums.txt is genuinely unreachable, the recovery hatch is akm upgrade --skip-checksum (the AKM_UPGRADE_SKIP_CHECKSUM=1 environment variable it replaces keeps working through 0.10). See STABILITY.md.

Shipping akm inside your own product (a Docker image, a plugin's own node_modules)? See Bundling akm for the full boot contract, JSON shapes, and exit codes.

akm upgrade replaces the binary in place for its own install method, but a scheduler binding recorded by an earlier akm doctor scheduler sync under a different install method is not repointed automatically — the scheduler runs the binary path recorded at sync time, not whichever akm upgrade just installed. Run akm doctor scheduler sync after switching installers so scheduled runs pick up the new binary; see doctor scheduler sync and akm doctor's scheduler-binary advisory.

clone

Deprecated; use akm import <ref> --asset-ref; removed in 0.11.

Copy an asset from any source into a managed writable bundle or an unmanaged custom destination for editing.

akm clone scripts/deploy.sh
akm clone "npm:@scope/pkg//scripts/deploy.sh"
akm clone scripts/deploy.sh --name my-deploy.sh
akm clone scripts/deploy.sh --force
akm clone scripts/deploy.sh --bundle team-bundle
akm clone scripts/deploy.sh --dest ./project/.claude
akm clone "npm:@scope/pkg//scripts/deploy.sh" --dest /tmp/preview
Flag Description
--name New name for the cloned asset
--force Overwrite if the asset already exists at the destination
--bundle <name> Managed destination bundle. When omitted, clone falls back to defaultWriteTarget, then the working bundle
--dest <path> Unmanaged destination directory. Bypasses managed target resolution and cannot be combined with --bundle; the type subdirectory is appended automatically

Skills (directories) are copied recursively. Other types copy a single file.

Refs outside the type directories. A ref whose concept id is not under a type directory (a skill in a flat skills repo, my-repo//domain-name-brainstormer; a page from a website or wiki bundle) is placed by what the source file is: a SKILL.md directory clones to skills/<name>/, any other recognized type to its own directory, and markdown of any other type to knowledge/<name>.md. <name> is the last segment of the concept id, slugified; --name overrides it. An asset that is not markdown and has no place in a bundle fails with a usage error that points to akm import <path>.

Provenance. A cloned markdown asset (a skill's SKILL.md included) records where it came from: the origin ref, <bundle>//<concept-id>, is added to its sources: frontmatter, keeping any entries already listed. sources: is free-form provenance that akm lint does not resolve, so a clone shared where the origin bundle is not installed does not report a missing ref. Other bytes of the file stay as written, non-markdown files and workflows are copied unchanged, and the origin is never modified.

Remote clone: When the origin in the ref points to a package that is not installed locally (e.g. an npm package or local path not in your bundle sources), akm fetches it to the cache automatically and extracts the requested asset. The package is not registered as a managed source -- use akm bundle add for that.

# Clone a single script from a remote package without installing the full bundle
akm clone "npm:@scope/pkg//scripts/deploy.sh"

# Clone from a local directory that isn't configured as a search path
akm clone "/path/to/bundle//skills/code-review" --dest ./project/.claude

Without --dest, clone uses normal write-target resolution: explicit --bundle -> defaultWriteTarget -> working bundle. Managed clones use the destination bundle's canonical ref and are indexed immediately. When --dest is provided, no managed write target is required, which keeps clone usable in CI or fresh environments without running akm setup first.

sync

Stage and commit local changes in a git-backed bundle. If the bundle has a remote configured and is marked writable: true, akm sync first fetches the remote, brings in what another host pushed (a fast-forward when it can, otherwise git's default merge), and then pushes. A merge that conflicts is aborted: your commit stays, the push is skipped, and reason names the conflicting files.

An explicit akm sync commits every unignored change inside the bundle: additions, edits and deletions, in any directory (root README.md, notes/, attachments), not only the asset directories. A bundle whose content sits in a subdirectory of the repository stays inside that subdirectory. Files a .gitignore rule matches are left out, and so is a nested Git repository. Work already staged in the index is never swept into the commit; a path of the bundle with staged changes is refused until it is committed, stashed or discarded. Git's core.filemode is honoured: when it is off (an SMB/CIFS mount), a tracked file keeps its Git mode and a new file is 100644, whatever the filesystem presents.

When the bundle has a configured credential (a git bundle added with --credential), akm sync passes it to both the fetch and the push, including a push of earlier unpushed commits. It goes to Git through the child process environment only, never in the remote URL, Git config or arguments. Without one, Git's own helpers and SSH setup apply as before.

Note: there is no akm save command — use akm sync.

akm sync                            # Sync primary bundle (auto timestamp message)
akm sync -m "Add deploy skill"     # Sync with custom message
akm sync --no-push                  # Commit only; never push even when writable
akm sync --format json             # Explicit format (both --format json and --format=json work)
akm sync my-skills                  # Sync a named writable git bundle
akm sync team/core -m "Update"    # Slash-containing source names are valid selectors
akm sync my-skills -m "Update"     # Sync named bundle with message
Argument / Flag Description
[name] Optional git-backed bundle selector. Matches the configured source name exactly and also accepts canonical GitHub aliases such as owner/repo, github:owner/repo, and branch-ref forms like github:owner/repo#branch. Forward slashes are allowed. Defaults to the primary bundle
-m, --message Commit message. Defaults to akm save <timestamp>
--no-push Commit only; never push even when the bundle is writable with a remote configured
--format Output format (any of the six global values). Both --format json and --format=json are accepted

If no positional selector is provided, akm sync --format json still targets the primary bundle. If a positional selector is provided, it wins even when the value also looks like a format token.

Behaviour by repo state:

State Result
Not a git repo Exit 0, skipped: true in JSON output — no error
Git repo, no remote Stage and commit only
Git repo, has remote, not writable Stage and commit only
Git repo, has remote, writable: true Stage, commit, fetch, fast-forward or merge the upstream, and push
Writable with a remote, nothing to commit, upstream has moved Fast-forward or merge the upstream; nothing is pushed unless there is a new commit
Writable with a remote, but no upstream branch, the fetch fails, or the merge conflicts Stage and commit; the merge is aborted, the push is skipped, and reason says not pushed: ...
Writable with a remote and ahead of its upstream Stage, commit, and push, unpushed commits included
Any writable repo with --no-push Stage and commit only (push suppressed)

Primary bundle writable config:

To make the primary bundle push on sync, set writable: true on its bundles entry in your config file (~/.config/akm/config.json or the path shown by akm config path):

{
  "bundles": { "primary": { "path": "~/akm", "writable": true } },
  "defaultBundle": "primary"
}

When writable: true is set and the primary bundle has a git remote configured, akm sync will stage, commit, and push.

When akm setup successfully initializes the default bundle as a local git repo (requires git to be installed), akm sync will commit there safely without pushing. If git is unavailable, the bundle will not be a git repo and sync will return a skipped result.

To make a named remote git bundle writable, pass --writable when adding it:

akm bundle add git@github.com:org/skills.git --provider git --name my-skills --writable

Projects

A project is a named entry under projects in the config file: the directories you work on it in, and what akm reads and writes there (see configuration). One project applies to a call at most: --project <name> if given (none: no project; an unknown name is a usage error), else the configured path that most specifically contains the working directory, else none, and then nothing changes. It supplies defaults only for akm search, akm curate (and curate()), akm remember, akm proposal extract and akm proposal new; never for improve, model work or the scheduler (show only records the project on its usage event). A flag you pass replaces the project's value of that kind (--from, --filter, --prefer, --include, --bundle, --user, --agent, --channel); nothing is merged. --pack with any format but text and md (json, jsonl, yaml) prints only the packed items, so it does not report the project (text and md output open with the project line). proposal extract takes a project's write.user, agent, channel and metadata but never its write.bundle, and chooses the project per session from the session's own directory (--project names one for every session). A project with no prefer prefers project=<name>, and its writes carry project: <name>.

Project rules

Assets in the bundle's top-level rules/ folder are rule assets: short bullet lists of agent rules (see Project Rules); a rules folder deeper down (docs/rules/) is not. A rule applies when its frontmatter project equals the value the project in force writes as project (its write.metadata.project, default its name) or it has none (shared); with no project, only shared rules apply. If the selection's own project filter is in force, that filter decides and the comparison is skipped. In search and curate, rules are ordinary hits: nothing is added to a page for them, and they follow --from, --filter, --since/--until, disabled bundles and --belief like any asset. A rule of another project is never returned while a project is selected, by any search or curate, including --type rule.

A session loads its rules with akm rules, not with search. The AKM agent plugins run it at session start and after compaction; an agent without a plugin runs the same command.

rules

Experimental (see STABILITY.md): the flags, the JSON shape and the rules metrics section may change in any release.

Print the rules that apply here, in full: the project's rules first, then shared ones, each group by ref.

akm rules
akm rules --project acme
akm rules --project none --from team
akm rules --filter team=platform --format text
Flag Default Description
--project <name|none> the project whose path contains the working directory The project to use instead (none: no project); an unknown name is a usage error
--from <bundle> the project's from Bundle name (repeatable), replacing the project's from. local, registry and all do not apply to rules: they are ignored with one warning and the default below is read. A disabled or unknown bundle is a usage error
--filter <key>=<value> the project's filters Repeatable frontmatter filter with the matching of akm search --filter, replacing the project's filters

Which bundles supply rules. A rule is an instruction the agent obeys, so only bundles you named supply them. With --from, those bundles; else the project's from; else, with a project, the default bundle and the project's write.bundle; with no project, the default bundle. A bundle installed from a registry or a git URL supplies rules only when it is the default bundle or you name it in from. A disabled bundle is never read.

Which rules. Files the index walker types as rule in those bundles (a Markdown file in the top-level rules/ folder, README.md excepted), read from the files: no index is needed, a rule written a second ago applies, and a locked or rebuilding index changes nothing. A rule with quality: proposed is never returned. The project match is the one above and the filters match as in search. There is no query, limit, --include or --prefer, and nothing is cut.

Output. JSON: { project?, bundles, rules: [{ ref, description, project?, content }] }. project is the project as applied (as in search), present only when one applies; bundles are the bundle ids read, in order; ref is the ref search prints, so akm show <ref> reads it; project on a rule is the project it names (absent when shared); content is the body without frontmatter. text and md print the project line, then each rule under its ref (No rules apply here. when none).

Usage. One rules usage event per call, never a search or show event, with the project in force, the bundles read, the refs returned and the total characters of their content. akm metrics reports rule loads, rules and characters per load, and loads per rule under usage. A call moves no search count, ranking or utility score.

Usage list (--by-usage)

search --by-usage is Deprecated in 0.10.261120; use akm doctor metrics assets, which takes the same flags and returns the same fields; removed in 0.11.

akm doctor metrics assets (formerly akm search --by-usage) lists the eligible assets that were shown in the project in force, most shown first. It applies the project's from, filters and your flags like any search, takes no query (one given is ignored with a warning) and no --from registry|all (warned; local is used), orders by use instead of --prefer, records no usage event, and leaves rules out (akm rules lists them). Assets that were never shown are not listed, so with no history the list is empty. What counts: akm show events of source: user in the last 90 days (the usage retention); only akm show counts, not nested command or persona reads. Search and curate results are impressions and do not count. Each akm show records the project in force on its event: the value the project writes as project, from --project on show (for this attribution only; none records none) else the working directory. With a project, only shows that recorded it count and an asset naming another project is left out (unless the project's own project filter decides); shows from before the project was recorded count for no project only. --project none counts every show. Reads that must not raise their own count (a session-start hook, an automatic rule read) run with AKM_EVENT_SOURCE set to unknown (or audit), which is not user demand.

Plugin recipe. With the project resolved: akm doctor metrics assets --detail normal [--project <p>], run in the session directory. With no project resolved, read the default bundle with no selection: --project none --from <defaultBundle>, where <defaultBundle> is akm config get defaultBundle. If none is configured there is no bundle to name (neither --from <name> nor --from <path> accepts the primary stash), so pass --project none without --from; every enabled bundle is then read. Rules come from akm rules, not from this list.

remember

Record a memory. This writes a markdown file into memories/ in the configured write target and returns the resulting ref.

Write target resolution: the destination is the working bundle (defaultBundle) unless defaultWriteTarget is set in config, which overrides it to a named source. An explicit --bundle <name> flag overrides both. The full order is --bundle → defaultWriteTarget → working bundle → ConfigError. See Configuration for details.

A bundle-qualified mutation ref implies that bundle. In particular, a qualified --supersedes team//memories/old routes the correction and demotion to team; a different explicit --bundle is a usage error. Qualified --xref values only identify the cited copy and do not select the write target.

akm remember "Deployment needs VPN access"
akm remember --name release-retro < notes.md
akm remember "Pair with ops before rotating prod secrets" --name ops/prod-secrets

# With structured frontmatter:
akm remember "VPN required for staging deploys" \
  --tag ops --tag networking \
  --expires 90d \
  --source "skills/deploy"

# Scope a memory to a user, agent, run or channel:
akm remember "Use staging cluster for blue-green" \
  --user alice --agent claude --run run-42 --channel "#ops"

# Cite provenance / related assets in frontmatter `xrefs:` (validated at write time):
akm remember "The token rotation quirk applies to staging too" \
  --xref knowledge/auth/vendor-x-token-api \
  --xref memories/projectA/token-quirk

# Correct an existing memory: write the fix AND demote the stale incumbent
# (beliefState: superseded + supersededBy on the old asset, in one step):
akm remember "Staging now uses the new gateway endpoint" \
  --name new-endpoint --supersedes memories/projectA/old-endpoint

# Route the write to a specific writable bundle:
akm remember "Deployment needs VPN access" --bundle team-bundle
Flag Description
--name Optional memory name. Defaults to a slug derived from the content
--path <dir> Subdirectory under memories/ to place the memory in (for example personal/projects). The filename still comes from --name or the content slug
--force Overwrite an existing memory with the same name
--description <text> Short description written to frontmatter (persisted as the memory's description field). No tags required.
--tag <v> Tag to attach to the memory. Repeatable: --tag foo --tag bar
--expires <dur> Expiry shorthand (30d, 12h, 6m for minutes, 3M for 90 days). Resolved to an ISO date. No tags required.
--source <s> Free-form source reference — URL, asset ref, file path, or any string. No tags required.
--xref <ref> Cross-reference ref recorded in the memory's xrefs: frontmatter list. Repeatable: --xref knowledge/auth-flow --xref memories/vpn-note. Each ref must resolve in the write target or a configured source (read-only sources count); an unresolvable ref fails with exit 2 before anything is written. More than 5 refs warns (soft cap) but still writes.
--supersedes <ref> Ref of an existing asset this memory corrects. Repeatable. Writes the correction with the old ref folded into its xrefs: (correction provenance) AND demotes the old asset — beliefState: superseded + supersededBy: [<new ref>], a metadata-only frontmatter edit that preserves every other key and the body — then reindexes it so --belief current hides the stale version immediately. An unresolvable ref fails with exit 2 before anything is written or demoted; so does a ref naming the asset being written itself (a correction cannot supersede itself, e.g. --force overwriting the same name). A ref that resolves only outside the write target and the working bundle still writes the correction but skips the demotion: stderr warns and the JSON output reports superseded: [{ref, applied: false, reason}] — the reason names the --bundle remedy when the old asset lives in a configured writable source. An old asset whose existing frontmatter is not parseable YAML is skipped the same way (applied: false) instead of being rewritten lossily. Re-running the same correction is idempotent. On a git write target the correction and the demoted old asset land in the same single boundary commit.
--auto Deprecated in 0.10.261120; removed in 0.11 with no replacement flag. Apply heuristic tagging from the body (opt-in, zero-latency, pure TS)
--enrich Deprecated in 0.10.261120; removed in 0.11 with no replacement flag (enrichment moves to improve). Call the configured LLM for tag/description proposals (opt-in, 10s timeout, fails soft)
--user <id> Scope this memory to a user id. Persisted as the canonical scope_user frontmatter key.
--agent <id> Scope this memory to an agent id. Persisted as scope_agent.
--run <id> Scope this memory to a run id. Persisted as scope_run.
--channel <name> Scope this memory to a channel name. Persisted as scope_channel.
--bundle <name> Override the write destination. Accepts a source name from your config; falls back to the project's write.bundle, then defaultWriteTarget, then the working bundle.
--project <name> Use this project's write defaults instead of the one the working directory selects; none uses none.

Pass the content as a quoted positional argument for short notes, or pipe markdown into stdin for longer memories.

Metadata is optional and independent. --description, --expires, --source, and scope or cross-reference flags work without --tag. The zero-flag form (akm remember "body") writes capture metadata and a description derived from the body. Invalid expiry durations and unresolved cross-references fail before writing. --auto and --enrich remain opt-in, fail-soft metadata helpers: if they derive nothing, the memory still writes.

Scope flags (--user, --agent, --run, --channel) write the four canonical top-level frontmatter keys (scope_user, scope_agent, scope_run, scope_channel) and a memory with only scope flags is valid (no tags required). Scope is selection inside a set the caller is already authorised to read; the same shape is read back by akm search --filter and akm curate --filter. Tenants are separated by deployment or by bundles, never by scope.

Cross-references (--xref) implement the bundle back-linking conventions' provenance channel: the refs land in the memory's xrefs: frontmatter list, which the indexer folds into the asset's search hints, so the new memory is findable from searches for its source. Refs are validated before anything is written — against the write target plus every configured source, including read-only cross-bundle sources — so a typo'd ref fails fast (exit 2) instead of becoming permanent silent noise. When a write lands at the type root (no --path, flat name) in a bundle that carries convention facts, the JSON output includes an additive hint key pointing at the bundle's placement conventions.

Corrections (--supersedes) implement the conventions' two-write corrections pattern in one command: the new asset is written with an xref to what it corrects, and the old asset gets a metadata-only demotion (beliefState: superseded + supersededBy: [<new ref>]) that the write path reindexes immediately. A qualified superseded ref selects that bundle as the write target. Same-bundle frontmatter edges remain short; cross-bundle edges stay qualified. The old asset is demoted only when it lives in the write target or the working bundle — a match in any other configured source (read-only, or writable but not this write's target) is reported as applied: false (with a stderr warning) while the correction still writes; so is an old asset whose existing frontmatter is not parseable YAML, which a demotion rewrite would corrupt. Validation happens before any write, so a typo'd ref, or a ref naming the asset being written itself (exit 2), leaves both assets untouched — no partial correction.

import

The additive asset and task modes below first shipped in 0.10.261119 and replace akm clone and akm task add; existing document imports keep their semantics.

These modes are mutually exclusive and reject document-only --path, --xref, and --supersedes before reading or writing. --dest requires --asset-ref. Without either new mode, YAML and ref-shaped paths remain knowledge imports.

Import a knowledge document. This writes a markdown file into knowledge/ in the configured write target and returns the resulting ref. The source may be a file path, a single HTTP/HTTPS URL, or - for stdin.

Write target resolution: the destination is the working bundle (defaultBundle) unless defaultWriteTarget is set in config, which overrides it to a named source. An explicit --bundle <name> flag overrides both. The full order is --bundle → defaultWriteTarget → working bundle → ConfigError. See Configuration for details.

akm import ./docs/auth-flow.md
akm import ./notes/release.txt --name release-checklist
akm import - --name scratch-notes < notes.md
akm import https://example.com/docs/auth

# Cite provenance in the document's frontmatter `xrefs:` (validated at write time):
akm import ./notes/oauth-quirks.md --xref knowledge/auth/vendor-x-token-api

# Import a corrected doc AND demote the one it replaces (in one step):
akm import ./notes/modern-guide.md --supersedes knowledge/legacy-guide

# Route the write to a specific writable bundle:
akm import ./docs/auth-flow.md --bundle team-bundle
Flag Description
--asset-ref Copy an asset ref using clone semantics; explicitly distinguishes it from a document path.
--type task Import a validated local task definition file, preserving authored source.
--dest <dir> Unmanaged copy destination; requires --asset-ref and cannot combine with --bundle.
--name Asset rename or task id in explicit modes; optional knowledge name. Defaults to the source filename, URL path, or a slug from stdin content
--force Overwrite an existing knowledge document with the same name
--bundle <name> Override the write destination. Accepts a source name from your config; falls back to defaultWriteTarget then the working bundle.
--xref <ref> Cross-reference ref merged into the document's xrefs: frontmatter list. Repeatable. A document without frontmatter gains a block; a document with valid frontmatter keeps every existing key and value and gets the refs dedupe-appended (never a nested second block). Each ref must resolve in the write target or a configured source; an unresolvable ref fails with exit 2 before anything is written. If the document's existing frontmatter is not a parseable YAML mapping, the import fails (exit 2) rather than rewriting the block lossily — fix the frontmatter or import without --xref, which preserves the file verbatim.
--supersedes <ref> Ref of an existing asset this document corrects. Repeatable. Imports the correction with the old ref merged into its xrefs: AND demotes the old asset (beliefState: superseded + supersededBy: [<new ref>], a metadata-only frontmatter edit), then reindexes it. Same validation (including the self-supersede rejection), skipped-demotion (applied: false), idempotence, and git-boundary-commit behaviour as on remember (see above).

URL imports fetch only the exact page you pass, convert it to markdown, and do not register a persistent website source. The default knowledge name comes from the URL path (for example, /docs/auth -> knowledge/docs/auth.md).

The source must be a readable file path, a reachable HTTP/HTTPS URL, or - to read the document from stdin.

--xref behaves as on remember (validated refs, soft ~5 cap, additive hint output key on type-root writes), with one import-specific rule: because imported documents may already carry frontmatter, the refs are merged — existing keys are preserved and the xrefs: list is dedupe-appended, so the result always has exactly one frontmatter block. The merge requires the existing block to parse as a YAML mapping; a malformed block aborts the import (exit 2, nothing written) instead of silently flattening the values the parser could not read. Importing the same document without --xref always preserves it byte-for-byte.

feedback

Record positive or negative feedback for any indexed bundle asset. Record --negative only when the asset's content is wrong or stale, and say what is wrong and what it should say; a note that simply did not fit your task is not negative feedback, so record nothing for it. akm feedback <ref> --negative --reason "<what is wrong and what should change>" flags the asset: it ranks lower right away, and the next improve run may repair its description, title or when_to_use from your reason. Improve does not rewrite an asset's text. Once you have verified the correct fact, attach the exact fix with --replace, --with and --source: akm checks that each --replace text appears exactly once and that the frontmatter still parses, records nothing if either check fails, and applies the edit at once, with no review or gate: it files a feedback proposal and accepts it in the same command (gate decision manual-fix, src/commands/feedback-cli.ts; the accept is a normal one, committed to a git-backed bundle, and akm proposal revert undoes it). If the accept refuses, the proposal is rejected, the file is left alone and the command fails. The asset stays eligible for improve like any other. To mark the asset's history, with or without a text fix, add --superseded-by <ref> (another asset replaces it) or --outdated (it describes a past state and no single asset replaces it), with --reason and --source. The same single edit sets the asset's beliefState (superseded, or deprecated) and, for --superseded-by, adds the successor's ref to its supersededBy list, by editing only those lines of the frontmatter. --positive records that an asset helped (it raises its ranking) and does not trigger a rewrite. Feedback changes akm search and akm curate ranking at once, with no reindex: each recorded positive raises the asset's score and each negative lowers it, the same way for every asset, so an asset with 5 positives ranks higher than one with 2, and each further vote counts for a little less. A hit's fused score is multiplied by 1 + 0.03 × (ln(1 + positives) − ln(1 + negatives)) (FEEDBACK_WEIGHT in src/indexer/search/ranking.ts). A negative that carried an exact fix stops counting once the fix is accepted, and counts again if akm proposal revert undoes it. The effect is small, and how far a vote moves a hit depends on the search. In keyword-only search every fused score is exactly 1/(60 + rank), so neighbouring hits in the first 20 sit 1.3 to 1.6 percent apart and one vote (about 2 percent) moves a hit one place whatever the keyword margin between them. When embeddings contribute too, the two channels' ranks spread the scores and a vote breaks only near-ties. Only feedback recorded as the user in the last 90 days counts, not feedback from improve, task or audit runs; the output's rankingUpdate.applied says which it was (true, or false with a reason). Feedback needs a usable index for the ref. Without one it exits 2 and says to run akm index; while a build holds the rebuild lock it exits 75 (INDEX_DB_CONTENDED): retry when the build finishes. Feedback also updates the utility score that improve and akm doctor metrics read.

akm feedback scripts/deploy.sh --positive
akm feedback agents/reviewer --negative
akm feedback memories/deployment-notes --positive
akm feedback env/prod --positive
akm feedback skills/code-review --positive --reason "Worked perfectly for PR reviews"
akm feedback skills/code-review --negative --reason "references a removed flag"
akm feedback skills/code-review --negative --reason "flaky" --tag slice:train --tag team:platform
akm feedback knowledge/opencode-server --negative --reason "the default port is 4096, not 8000" --replace "port 8000" --with "port 4096" --source "https://opencode.ai/docs/server/"
akm feedback knowledge/setup-v1 --negative --reason "the v2 guide replaces it" --superseded-by knowledge/setup-v2 --source "knowledge/setup-v2"
akm feedback knowledge/api-v1 --negative --reason "describes the retired v1 API" --outdated --source "https://example.com/changelog"
Flag Description
--positive Record that an asset helped: it raises its ranking and does not trigger a rewrite
--negative Flag the asset: it ranks lower right away, and the next improve run may repair its frontmatter from --reason
--reason What is wrong with the asset's content and what should change; not for akm command errors. Attached to the feedback event (required for negative feedback by default, and always with a fix: --replace, --superseded-by or --outdated)
--replace <text> Exact text to correct, copied verbatim from the asset file; it must appear exactly once. Repeatable, each paired in order with a --with. Negative feedback only
--with <text> The corrected text for the matching --replace. Use --with=<text> for a value that starts with -
--source <where> The URL, command or file that shows the correct fact. Required with --replace, --superseded-by and --outdated; kept on the proposal as the audit trail
--superseded-by <ref> The ref of the asset that replaces this one. The edit sets beliefState: superseded and adds the ref, as its bundle//conceptId, to supersededBy; contradicted and archived stay, a ref already listed is not added again, and a scalar supersededBy becomes a list. The ref must be indexed and must not be the asset itself, or nothing is recorded; nor is anything when the asset already says all this (the fix changes nothing). Negative feedback only; may be combined with --replace/--with, not with --outdated; markdown assets only
--outdated The asset describes a past state and no single asset replaces it. The edit sets beliefState: deprecated, unless the asset already says superseded, contradicted or archived. Negative feedback only; may be combined with --replace/--with, not with --superseded-by; markdown assets only
--tag Tag to attach to the feedback (repeatable, e.g. --tag slice:train --tag team:platform)
--applied-to <ref> Credit a lessons/<name> lesson that helped resolve this task. When combined with --positive, appends this feedback ref to the target lesson's lessonStrength[] frontmatter array (dedup, idempotent). A non-lesson target, or a missing --positive, produces a warning rather than silently doing nothing.

Specify exactly one of --positive or --negative. The ref must already be present in the current local index.

Only negative feedback with a specific reason gets an asset reviewed and fixed: akm improve plans a rewrite (reflect) only for an asset with fresh negative feedback, or for an explicit ref. A positive or note-only signal never plans one, and improve no longer rewrites assets on a proactive cadence.

The --applied-to flag records the lesson-strength signal: each credit is kept in the lesson's lessonStrength[] frontmatter. Search ranking does not use it.

log

Deprecated; use akm doctor log; removed in 0.11.

Append-only realtime events stream (#204). Every mutating CLI verb appends an event row to <dataDir>/state.db; akm log reads it.

Note: there is no akm events command, and no akm history command — use akm log. There is no akm log tail either (0.9.0: dropped — a foreground polling daemon in a one-shot CLI); poll --since '@offset:<id>' from a cooperating process instead.

akm log                                      # All events, oldest first
akm log --type feedback                      # Filter by event type
akm log --ref skills/deploy                   # Filter by asset ref
akm log --since 2026-04-01T00:00:00Z         # ISO timestamp
akm log --since '@offset:12345'              # Resume from a row-id cursor
akm log --limit 20                           # Only the 20 most recent events (unlimited by default)
akm log --run <run-id>                       # Only events for one workflow run
Flag Description
--since Lower bound. Accepts ISO 8601, epoch ms, or @offset:<id> for a durable row-id cursor that survives across processes.
--type Filter by event type. Common values include add, remove, update, remember, import, sync, feedback, promoted, rejected, propose_invoked, reflect_invoked, distill_invoked, select, and improve_skipped.
--ref Filter by asset ref ([bundle//]conceptId).
--run Filter to one workflow run's events (metadata.runId) — the replacement for the dropped akm workflow watch <run-id>. Poll with --since '@offset:<id>' for a live tail; there is no daemon.
--limit Return only the most recent N events matching every other filter. Default: unlimited.
--include-tags Only include events with ALL these tags (repeatable).
--exclude-tags Exclude events matching these tags (repeatable).

The envelope echoes a nextOffset row-id cursor — persist it and pass it back as --since '@offset:<nextOffset>' to resume from exactly where you stopped, with no duplicates and no losses, even across process boundaries (poll on an interval from a cooperating process if you need to follow the stream live).

Environment isolation

The events stream lives in <dataDir>/state.db, where <dataDir> is derived from XDG_DATA_HOME (or AKM_DATA_DIR) at the time of each call. Two processes with different inherited data-dir env values write to different databases; if the events stream is being used as a shared bus between cooperating processes, set those env vars consistently across them.

registry

Manage bundle registries. The registry command has three subcommands: list, add, and remove. Searching registries is akm search --from registry (0.9.0: registry search was dropped in favor of it — see search).

Building a registry index is maintainer tooling, not a CLI command — see bun scripts/build-registry-index.ts in the akm repository.

registry list

List all configured registries and their status.

akm registry list

registry add

Add a third-party registry by URL.

akm registry add https://example.com/registry/index.json
akm registry add https://example.com/registry/index.json --name my-team
akm registry add https://skills.sh --name skills.sh --provider skills-sh
Flag Description
--name Human-friendly label for the registry
--provider Provider type (e.g. static-index, skills-sh). Default: static-index
--options Provider-specific options as JSON
--allow-insecure-transport Allow a plain HTTP registry URL (rejected by default)

Duplicate URLs are rejected.

registry remove

Remove a registry by URL or name.

akm registry remove https://example.com/registry/index.json
akm registry remove my-team
akm registry remove my-team --yes    # Skip the confirmation prompt
Flag Description
-y, --yes Skip confirmation prompt

migrate

Inspect or apply every pending migration in one plan. akm migrate is a thin wrapper over the standalone akm-migrate executable (installed alongside akm, and embedded in the release binary), which owns every historical shape akm 0.9.15 and later wrote so the CLI proper reads only current schemas. The steps, in order:

  1. config.json rewritten in its current shape (configFile): retired keys dropped (a key akm has never known is left as it is), configVersion bumped, and the engines / defaults form converted to connections / harnesses — the same conversion every load already runs in memory, so this only persists it, under a backup. The keys akm no longer reads from config (an engine's apiKeyFile, a literal or ${secrets/...} apiKey, and the same on a connection or embedding) move to credentials.json, one note per key and never its value; a key that cannot be moved stays where it was, with a note. A leftover models.json is folded into the models of the connections and harnesses it names, then moved to config-backups/ in the cache directory. A connection or harness akm cannot use stays in the file as written, with a note on what to fix. What each retired key becomes is the table in Configuration. An improve.strategy that names a built-in strategy 0.10 removed (quick, thorough, catchup, reflect-distill, proactive-maintenance, graph-refresh; 0.9's defaults.improveStrategy: "quick" becomes one) is dropped with a note, and the default strategy applies; a strategy of that name defined under improve.strategies is kept. A config older than 0.9.15 (the legacy stashDir/sources[]/installed layout) is not converted by 0.10 and blocks this step: run akm migrate apply under akm 0.9.x first;
  2. pending state.db migrations (stateMigrations), the ones that drop schema (018-drop-dead-lane-schema, 028-improve-ledger) included. Any akm command that opens state.db applies them the same way: before the first pending migration that drops schema, it copies the database beside itself to state.db.pre-<id>.bak (VACUUM INTO). This step applies them now and reports what it applied and the copy (safetyCopyPath);
  3. task files at version 2 or 3, and version 4 files still carrying the retired schedule[].enabled key, rewritten as task source v4 (taskFiles) under one backup directory per run, each emitted document re-parsed by the runtime v4 parser first (after apply, taskFiles lists the files it rewrote, each status: "changed" with its afterHash, with changed counting them, and the text output lists them and the backup path); a file the planner cannot convert unambiguously is reported blocked and left alone. A task file named on the command line (akm migrate apply <task-file>...) is converted to task source v5 (version: 5-beta.1) instead, after the same check a start makes of the result, under the same backup directory. A named file must be a .yml file under the tasks folder of an enabled bundle; no file that is not named is converted. What a v4 task did that v5 does not is listed per file, in notes, to change by hand, and a file with no v5 form is reported blocked and left as it is. A named workflow file (workflows/<name>.md) is not changed: a new tasks/<name>.yml is made from it, or it is reported blocked with detail and guidance saying what to change (see Converting a workflow). Each named file's outcome is in taskFilesV5. The workflow files that remain in writable bundles are counted by bundle in workflowFiles, as akm doctor counts them; workflows are removed in 0.11;
  4. the retired engine: key on commands, agents, workflows and task sources rewritten to connection: or harness: by what the name is now (assetEngineKeys), under one backup directory per run. The run that has rewritten every such key it can reach forgets the old engine names and adds one note to assetEngineKeys.notes listing each renamed engine and the flag that replaces it (see The engines form);
  5. refs in the markdown and YAML files akm indexes in writable bundles (not those read with the generic-files, code-project or website-snapshot adapters) that still use the spelling from before refs became bundle paths (knowledge/WORK/x, now WORK/x; #1432), in frontmatter and body: [bundle//]<folder>/<path>[.md], <type>:<path> and wiki:<path>, rewritten (assetContentRefs) under one backup directory per run. An old spelling that is now another file's ref is not rewritten and is listed in assetContentRefs.shadowed. JSON, plain text, scripts and other files are never read or rewritten, so frozen corpora and captured results stay byte-for-byte, and a second run changes nothing;
  6. stale bundle policy removed from files (bundlePolicy), in writable bundles: an asset's lint_skip: frontmatter is stripped (lint skips live in the bundle's lint.skip config), and a .gitignore with the old # akm: intentionally track env and secrets line adds "tracked-secrets": ["**"] to that bundle's lint.skip. .gitignore is never modified. The config is written first (its own backup), then the files under one backup directory per run. A bundle with that line and no config entry is listed in bundlePolicy.notes;
  7. superseded residue removed (deadResidue): pre-0.9.0 .akm leftovers in the stash, and the transaction-journal, maintenance-barrier, lock-mutex and version-stamp files older releases kept under $DATA, $STATE and $CONFIG.
akm migrate status
akm migrate status --read-only   # the same, and records no CLI usage, so nothing is written
akm migrate apply
akm migrate status tasks/nightly.yml            # what apply would make of one task file (version 5)
akm migrate status workflows/weekly.md          # the same for a workflow file
akm migrate apply workflows/weekly.md           # make tasks/weekly.yml from it
akm-migrate apply          # the same, without the akm wrapper

status is read-only with respect to the migrated files (apply --dry-run, deprecated, is the same run). Without --read-only, status records diagnostic usage in the cli_usage_* tables of metrics.db like other commands; with --read-only the invocation records no CLI usage and writes nothing at all. Apply skips blocked task sources rather than failing (and exits 1 while any remain), backs up each changed file immediately before replacement, and atomically publishes strict task source v4 YAML; it is idempotent, so a current installation is a no-op. akm upgrade runs apply after its install step. See Tasks: Migrating to task source v4 for the full blocked-reason table and worked examples, and Bundling akm for the plan JSON shape and how to drive this from a container/image boot step.

Each step above runs under its own catch: a step's own anomaly is always recorded in the plan's failedSteps: [{step, error}] instead of ending the whole run — the remaining steps still run in order. Under apply, a failed step's section falls back to its read-only preview; if that fails too, the fallback adds its own failedSteps entry, and the section is absent from the plan. Any failedSteps entry forces status: "blocked" and adds a matching line to blockers, so akm migrate status|apply reports the plan and exits 1 (not the internal-error 70) the same way it does for any other blocked plan.

backups prune

Remove old backups from the data directory. akm migrate apply copies each file into backups/<folder>/<timestamp>-<id>/ (tasks, asset-engine-keys, asset-content-refs) before it rewrites it, and nothing deletes those copies later; akm health reports a backups/ that has grown large (data-dir-usage). Nothing reads an old backup back at run time, so removing one only gives up restoring that run by hand.

akm backups prune --dry-run              # what would go, nothing removed
akm backups prune                        # prompts; --yes skips the prompt
akm backups prune --older-than 7d --yes
Flag Meaning
--older-than <duration> Remove entries last modified longer ago than this (30d, 12h, 3M; default 30d).
--dry-run Report the same result and remove nothing.
--yes, -y Skip the confirmation prompt, which a non-interactive run requires.

The newest entry of each folder is always kept, however old, so the latest rollback point survives. The result is {dryRun, olderThan, cutoff, count, bytes, folders: [{folder, count, bytes, kept}]}: what was removed (or would be) in total and per folder. A missing backups/ directory is nothing to prune.

config

Read and write configuration. Bare akm config runs akm config list.

akm config list                     # List current config
akm config get output.format        # Read one key
akm config get output.format --show-source  # Read one key, with where it came from
akm config set output.detail full   # Set one key
akm config set output.detail full --silent  # Set without the post-write config dump on stdout
akm config set projects.x.filters.project '["x"]'  # Array and object values take JSON; `akm config unset <key>` removes a key
akm config unset embedding          # Remove an optional key
akm config path                     # Print path to config file
akm config diff other-host/config.json  # Effective-config differences, secrets redacted

Subcommands:

Subcommand Description
get <key> Read one config key (the effective, post-extends value). --show-source wraps it as { value, source }, where source is local, extends:<ref>, or default. With --format text a string, number or boolean prints as the bare value and an unset key prints an empty line.
list List current configuration
set <key> <value> Set one config key; prints the resulting config with ok: true. A key the schema does not know is refused (exit 2, "Unknown config key"), as get refuses it, and the file is left as it was
unset <key> Unset an optional key, or a whole embedding, connection or harness section; prints the resulting config with ok: true. It also removes a key the file holds that the schema does not know
path Print the config file path (akm info reports the bundle, config, data, cache and state directories). Load-bearing: config path is the one subcommand the CLI still allows to run when the on-disk config itself fails to load, so you always have a way to locate a broken config.
diff <path|bundle//path> Compare this instance's effective config (its own extends already applied) against another config file or bundle-relative file (loaded through the same loader — its extends honoured too); prints sorted { path, local, other } rows for every differing leaf, secrets redacted on both sides.

list, get and diff do not print a secret: the string value of a key whose name marks it as a credential (token, secret, password, key, and the like, a hyphen read as _) and the value of an Authorization or Proxy-Authorization header are left out, as apiKey is; a $VAR reference stays visible. A key in the file that akm does not know is warned about once, ending "Check the spelling, or remove it from " (the file that holds it, a base file included).

A key that holds an API key (connections.<name>.apiKey, embedding.apiKey) accepts a $VAR reference and rejects a literal key: keys live in the environment or in credentials.json, never in config.json (see Credentials). A connection or harness name that is not lowercase kebab-case, or a harness entry that names no platform, is refused before anything is written.

set and unset accept --silent to suppress the post-write config dump entirely — nothing is printed on stdout, and the exit code is the status (the write still happens and errors still print) — use it from hooks and CI scripts.

See configuration.md's "Sharing configuration across installs" for the extends config key that diff and get --show-source work with. extends is Deprecated (0.10.261120) and removed in 0.11: copy the inherited settings into the local config file.

Removed in 0.9.0: akm config enable/akm config disable. Use akm registry add|remove to toggle a registry, the general mechanism. akm config show (an alias of list) and akm config validate (load-time schema checks already reject an invalid config) were also removed.

See configuration.md for details.

models

Show which model answers each alias (fast, balanced, reasoning, and any you add) on a connection, then the models its endpoint lists, and change one. Connections only: a harness's alias map is harnesses.<name>.models, edited with akm config set. Run akm models --help for the options.

akm models                            # The default connection's picks and the endpoint's models
akm models --connection cloud         # Another connection
akm models --no-probe                 # The picks only; the endpoint is not contacted
akm models set reasoning glm-5        # Make glm-5 answer "reasoning"

akm models prints { connection, aliases, available }. set writes connections.<name>.models.<alias>; an alias whose entry carries request fields keeps them and changes the model. A model the endpoint does not list is written with a warning. With no connection configured both commands say so and point at akm setup. A --connection that is not configured fails as any named target does: exit 78, the configured connections listed and the closest name suggested.

help

Print the sectioned command overview, detailed help for any command, or a release's migration guidance.

akm help                       # Sectioned command overview (same as `akm --help`)
akm help bundle                # Detailed options and subcommands for `bundle`
akm help env                   # Detailed options and subcommands for `env`
akm help migrate 0.6.0         # Notes for a specific release
akm help migrate v0.6.0        # v-prefix accepted
akm help migrate v0.6.0-rc1    # Prereleases normalize to the stable note
akm help migrate latest        # Resolve against the most recent CHANGELOG entry

akm help <command> is equivalent to akm <command> --help. Bare akm help prints the same sectioned overview as akm --help and exits 0.

Migration notes live as one markdown file per release in docs/migration/release-notes/. Adding notes for a future version is a one-file drop — no code edit required. Requesting an unknown version prints the list of bundled notes so you can pick one that exists. See CONTRIBUTING.md for the per-release workflow.

hints

Print the agent-facing CLI guide. Add this output to your AGENTS.md, CLAUDE.md, or system prompt so your agent knows how to use the CLI. The short guide is the default; use --detail full for the complete version. (akm help agents, the short-first form, was removed in 0.10.)

akm hints
akm hints --detail full

env vs secret — which do I use?

Both protect their values identically (values never reach akm's stdout, the index, or akm show). They differ in purpose, not in how well they hide data:

env secret
Purpose configuration — a group of related settings for an app/service authentication — one sensitive value used on its own
Holds a .env file of many KEY=value pairs (URLs, flags, and any credentials it needs) one value per file (an API token, PEM key, cert, service-account JSON)
Sensitivity values may or may not be sensitive — all are protected anyway the value is always a credential
Injects many env vars at once (--env <ref>) one env var (--secret <ref>:<VAR>)
Discoverable key names (not values) name only (the whole file is the value)

env is primarily for configuration — a group of related values you load together, protected whether or not any are sensitive. secret is primarily for a single sensitive value used for authentication. Reach for env to load a service's config; reach for secret when one value is an auth credential.

Note: there is no akm vault command — use env or secret.

env

Manage .env-backed environment files — a group of related configuration for an app or service (URLs, feature flags, and any credentials it needs), loaded together. Each env asset is an entire .env file stored under env/ in your bundle (mode 0600; on a filesystem without POSIX permissions, such as a CIFS/Azure Files share, the mount options decide the mode instead). Values may or may not be sensitive; akm protects them all the same — key names are discoverable; values and comment text never appear in structured output (comments routinely contain commented-out credentials, so they are treated like values). akm does not manage individual entries — you edit the .env with your own editor (or ingest one with --from-file) and akm loads it wholesale. list and show surface key names only; akm run --env and export are the supported value-use paths (akm exec --env is the Experimental form for any command).

akm env list
akm env create env/prod                      # creates env/prod.env (mode 0600)
akm env create env/prod --from-file ./.env    # ingest an existing .env
akm env create env/prod --path staging        # creates env/staging/prod.env
$EDITOR "$(akm env path env/prod --quiet)"    # edit the file directly
akm run --env env/prod scripts/test.sh       # run a script with the whole file injected
akm env remove env/prod --yes                 # remove the whole env file

akm does not manage individual keys — edit the .env file directly ($EDITOR "$(akm env path <ref>)"). env remove <ref> removes the whole file.

In an unquoted value, # starts a comment only after a space or tab, so URL=http://x/y#frag keeps its fragment, PASSWORD=#abc is #abc and A=v # note is v. Quote a value to keep a # that follows a space.

Every <ref> is a full akm ref, [bundle//]env/<name>; there is no bare-name form (--env prod is a usage error naming env/<name>). A value in the file can embed a ${ref} token: ${secrets/name} (or ${bundle//secrets/name}) is replaced with the secret's value when the env is injected, and any other asset ref with its absolute path. A ${...} body that is not an akm ref, such as ${HOME}, is left as text. A ref no bundle owns fails the run and nothing is injected. See Environment & Secrets.

Env mutations (create, remove) pick their write destination the same way every other write command does: an explicit --bundle <source> wins, else defaultWriteTarget, else the working bundle. The chosen source must be writable — a non-writable --bundle/defaultWriteTarget fails with a ConfigError before anything is written — and on a git-backed writable target the mutation lands in a single boundary commit (filesystem targets are committed by akm sync; env/ stays out of git when your bundle .gitignore excludes it). Reads (list, path, run, export) still span all configured sources and are unchanged.

Subcommands:

Subcommand Description
list List all env files across all bundles with key names only
run <ref> -- <command> Deprecated; put the command in a script asset under scripts/ and run it with akm run --env <ref> scripts/<file>. Run a command with the env injected. --only / --except filter which keys are injected; --clean starts from a minimal inherited environment
create <ref> Create an env file (a full ref such as env/prod). Empty by default; seed with --from-file <path> or --from-stdin
path <ref> Print the absolute env file path (Docker _FILE / --env-file / direct editing). --quiet suppresses the warning
export <ref> --out <file> Write a safe sourceable export script to a file (never to stdout)
remove <ref> Delete an env file (and its .sensitive marker)

Removed in 0.9.0: akm env set/akm env unset. akm does not manage individual keys — edit the .env file directly.

env run

Deprecated; put the command in a script asset under scripts/ and run it with akm run --env <ref> scripts/<file>; removed in 0.11. --only and --except have no run form: keep the variables a command needs in an env asset of their own.

akm env run env/prod -- <command>
akm env run env/prod -- $SHELL          # interactive: a shell with the env loaded
akm env run env/prod --only A,B -- cmd  # inject only A and B
akm env run env/prod --except DEBUG -- cmd
akm env run env/prod --clean -- cmd
akm env run env/prod --clean --inherit SSH_AUTH_SOCK -- cmd
akm env run team//env/prod -- cmd       # an env in an installed bundle

Runs the command with the env file's values injected directly into the child process — never through a shell, and never into akm's own structured output. However, the child process controls its own stdout/stderr: if it prints its environment, those values will appear in your terminal or agent transcript. --only / --except (comma-separated key names, mutually exclusive) restrict which env-file keys are injected. --clean starts from a minimal inherited environment (PATH/HOME/locale/terminal basics, and the names Windows needs to start a process) instead of inheriting the full parent environment; use --inherit KEY1,KEY2 to pass specific parent vars through in clean mode. Installing a bundle is the trust decision, so env run injects what the env file defines whichever bundle it comes from, including keys such as PATH or LD_PRELOAD; it does not warn or block. --allow-dangerous-env-keys is a deprecated no-op, accepted through 0.10 so existing scripts keep working.

The single-key run <ref>/KEY form was removed. To inject one value, store it as a secret and run a script with akm run --secret secrets/<name>:<VAR> scripts/<file>.

Values injected via env run live in the child process environment for its entire lifetime and are visible to all subprocesses it spawns. Avoid env run for long-lived daemon or server processes, and do not use commands like env, printenv, shell tracing, or verbose diagnostics in agent contexts unless you explicitly intend to expose the child environment.

env create

akm env create env/prod                   # empty
akm env create env/prod --from-file ./.env  # seed from an existing .env (byte-for-byte)
printf 'A=1\nB=2\n' | akm env create env/prod --from-stdin
akm env create env/prod --path staging    # creates env/staging/prod.env
akm env create env/prod --sensitive       # hidden from `env list` and the search index
akm env create env/prod --bundle team     # write to the `team` source
Flag Description
--path <dir> Relative subdirectory under env/ to place the file in. The filename comes from <name>.
--from-file <path> Seed the env file from an existing .env at this path
--from-stdin Seed the env file from stdin
--sensitive Exclude this env file from env list output and the search index
--bundle <source> Override the write destination (falls back to defaultWriteTarget then the working bundle)

Creates env/prod.env with mode 0600. Empty create is a no-op if the file exists; --from-file/--from-stdin refuse to clobber an existing env (remove it first). --sensitive hides the file from env list and the search index.

env list

akm env list

One entry per env file across all configured bundles. The structured shape is envs: [{ ref, keys }] — values are never included and the absolute path is omitted from JSON output. Text output uses Markdown sections:

## env/prod

- DATABASE_URL
- API_KEY

env path

akm env path env/prod            # warns: don't source the raw file
akm env path env/prod --quiet    # for `_FILE` / `--env-file` use

Prints the absolute path to the env file — for the Docker _FILE convention (MY_VAR_FILE=$(akm env path env/prod --quiet)), docker run --env-file, or editing the file directly. By default a stderr warning steers you away from source-ing the raw file (its shell substitutions would execute); --quiet suppresses it for the legitimate file-path uses. Format-exempt (src/output/format-exempt.ts) — this command's stdout is always the bare path, never a result envelope; passing --format warns rather than doing anything.

env export

akm env export env/prod --out /tmp/prod.sh && source /tmp/prod.sh && rm -f /tmp/prod.sh

Writes a safe, sourceable export KEY='value' script to --out <file> (mode 0600). Values are re-serialised single-quoted, so a raw .env containing shell substitutions (e.g. X=$(rm -rf ~)) becomes a literal string — sourcing the generated file can never execute it. export never prints values to stdout (that would leak them into a captured/agent context) and so requires --out.

For most uses prefer akm run --env <ref> scripts/<file> (no file, no cleanup). export exists for the case where a tool must source a file or you need a generated env script.

secret

Manage secrets — a single sensitive value used on its own for authentication: an API token, a PEM private key, a TLS cert, a service-account JSON. Where an env file holds a group of related configuration and exposes key names, a secret is one value and its entire file is the value, so only the secret's name is ever surfaced. Each secret is a mode-0600 file under secrets/ in your bundle (on a filesystem without POSIX permissions, such as a CIFS/Azure Files share, the mount options decide the mode instead).

This mirrors Docker's secret model (one value per file, mounted at /run/secrets/<name>, read at runtime, never baked into the image or env at build time). The key security property: secret values never appear in structured output — not in the index, akm search, akm curate, or akm show. The supported value-use path is akm run --secret (inject into a child env var).

akm secret list
printf '%s' "$TOKEN" | akm secret set secrets/deploy-token
akm secret set secrets/deploy-key --from-file ~/.ssh/id_ed25519   # byte-exact
AKM_VALUE="$TOKEN" akm secret set secrets/api --from-env AKM_VALUE
akm run --secret secrets/deploy-token:GITHUB_TOKEN scripts/release.sh

Every <ref> is a full akm ref, [bundle//]secrets/<name>; a bare name (--secret deploy-token:VAR) is a usage error naming secrets/<name>. The value is read with surrounding whitespace trimmed.

Subcommands:

Subcommand Description
list List all secrets across all bundles by name (contents never shown)
set <ref> Create/overwrite a secret — value from stdin (default), --from-file, or --from-env
run <ref> <VAR> -- <command> Run a command with the secret value injected into $VAR in the child only
remove <ref> Remove a secret file (and its .sensitive marker). --yes skips the prompt; --bundle picks the write target

Removed in 0.9.0: secret path. It exits 2 with Unknown command. A ref's file lives at <bundle>/secrets/<name> (run akm bundle list for bundle roots); use akm run --secret to consume the value without touching disk. secret remove, removed with it, is back as of 0.10. Like akm env remove, it names its file through the write-target resolver only (--bundle, then defaultWriteTarget, then the working bundle), so for a ref present in more than one bundle name the bundle with --bundle.

secret set

# Default: read the value from stdin (never crosses argv)
printf '%s' "$TOKEN" | akm secret set secrets/deploy-token

# Import an existing file byte-exact (multi-line PEM keys, certs, binary)
akm secret set secrets/deploy-key --from-file ~/.ssh/id_ed25519

# From an environment variable
AKM_VALUE="$TOKEN" akm secret set secrets/api --from-env AKM_VALUE

The value is never accepted via positional arguments. With stdin, a single trailing newline is stripped (so echo "$TOKEN" | akm secret set … stores the token without the shell-added newline); use --from-file for byte-exact storage of multi-line material. Writes are atomic (mode 0600) under an exclusive <secret>.lock. Maximum size is 5 MB.

secret set selects its write destination like every other write command: an explicit --bundle <source> wins, else defaultWriteTarget, else the working bundle. The chosen source must be writable (a non-writable target fails with a ConfigError), and on a git-backed writable target the mutation lands in a single boundary commit. Reads (list, run) still span all configured sources.

secret run

Deprecated; put the command in a script asset under scripts/ and run it with akm run --secret <ref>:<VAR> scripts/<file>; removed in 0.11.

akm secret run secrets/deploy-token GITHUB_TOKEN -- gh release create v1.0.0
akm secret run secrets/deploy-token GITHUB_TOKEN --clean -- gh auth status

Runs one subprocess with the secret's value set as $VAR in the child's environment. The value never appears in akm's structured output — it is passed directly to the child process. The target variable name is validated as an environment variable name; process-hijacking names such as LD_PRELOAD or PATH are injected like any other. --clean starts from a minimal inherited environment instead of inheriting the full parent environment; use --inherit KEY1,KEY2 to pass specific parent vars through in clean mode.

Secrets injected via secret run live in the child process environment for its entire lifetime and are visible to all subprocesses it spawns. For long-lived daemons, point the process at the secret file directly (<bundle>/secrets/<name>) so the value never sits in an environment variable. Avoid commands that print the environment in agent contexts unless you explicitly intend to expose the child environment.

Sensitive marker

A sibling <name>.sensitive marker file excludes a secret from secret list and from indexing entirely (parallel to env files). The secret remains usable via secret run.

Wikis (no dedicated command)

An LLM wiki (the Karpathy pattern — schema.md rulebook, agent-authored pages/, immutable raw/ sources) is a bundle format, not a command family. There is no akm wiki verb; a bundle whose root holds schema.md plus pages/ is recognized automatically at install time, and its pages are indexed and addressed like any other asset:

akm bundle add github:team/research-wiki        # install a wiki bundle (or a local dir)
akm search "attention"                   # pages rank alongside all other assets
akm show research-wiki//pages/attention  # read a page by bundle//conceptId ref

Writing pages, ingesting raw sources, and maintaining index.md/log.md are the agent's job, using its native Read/Write/Edit tools guided by schema.md — akm's job is recognition, indexing, and search. See wikis.md for the full format.

completions

Generate or install a bash completion script for akm. The script is built dynamically from the command tree, so it always reflects the current set of subcommands and flags.

akm completions                # Print bash completion script to stdout
akm completions --install      # Install to the appropriate directory
Flag Description
--install Write the script to the XDG-compliant completions directory
--shell Shell type (currently only bash is supported)

Manual activation: pipe the output into your shell or source it from your profile:

source <(akm completions)

Install locations (checked in order):

  1. $XDG_DATA_HOME/bash-completion/completions/akm
  2. ~/.local/share/bash-completion/completions/akm
  3. ~/.bash_completion.d/akm

Improvement Flow

These commands define the self-improvement and agent-dispatch surface.

run

akm run <ref> selects the existing executor from the resolved asset's type. It is additive in 0.10.x: the original execution commands retain their inputs, defaults, result shapes, exit codes, and side effects.

akm run agents/reviewer --prompt "Review the patch" --harness reviewer
printf '%s' 'Review the patch' | akm run agents/reviewer --prompt-stdin
akm run commands/review --arguments "src/cli.ts" --dry-run
akm run team//tasks/nightly --region=us-east-1
akm run workflows/release --version=1.2.3 --max-steps 1
akm run <workflow-run-id>                 # Continue the frozen run
akm run tasks/deploy --env env/prod --secret secrets/deploy-token:GITHUB_TOKEN
Resolved type Inputs and controls Result
Agent --prompt or --prompt-stdin, execution selection, --timeout, --max-retries, --cwd, --clean, --inherit; a persona requires a prompt Existing agent-result and exit status
Command Exact --arguments substitution, --agent, execution selection, --timeout, --max-retries, --cwd, --clean, --inherit, --dry-run Existing agent-result or command-dry-run
Task Exact-name declared input flags, including repeated array values; --bundle and --scheduled. A version 5 task also takes --timeout, --max-retries, --cwd, --inherit, --resume and --skip-if-locked Existing task-run, history/log writes, and task exit status; a version 5 task also returns result
Script --timeout, --max-retries, --cwd, --clean, --inherit before the ref; everything after the ref goes to the script The script's exit status
Workflow Exact-name declared parameter flags, --max-steps, --max-retries, --timeout, --skip-if-locked Existing workflow-run, journal, gates and exit status

A version 5 task start reads its flags before the ref too (akm run --env env/a tasks/x). --clean, --dry-run, --model, --harness, --prompt, --timeout-ms and --max-steps are UNKNOWN_FLAG ("... is not taken by a version 5 task start.") unless the task declares an input of that name. --resume is listed in akm run --help and takes no inputs or other start flags (see Tasks). A declared input whose value starts with - takes the next token as its value (--name -x). A flag given no value binds only to an input whose type includes boolean; any other input answers INPUT_BINDING_INVALID ("requires a value"), and a calling step's literal true into a string input is bound as the text true. A --timeout above 2147483647 milliseconds (24 days) is refused naming the limit, and a --cwd that cannot be made is refused (exit 2) naming the folder and the error. --max-retries 0 is accepted on every kind of run, and with --max-retries above 0 an agent or command run that was tried more than once prints one result carrying attempts.

--env <env-ref> and --secret <secret-ref>:<VAR> apply to every type and repeat. They set the env asset's variables, and the secret's value as VAR, in akm's own environment for the run, which every process the run starts inherits; a task's or workflow unit's own env: bindings are set over them. Env assets apply in the order given, then secrets over them, and a later flag wins over an earlier one for the same variable. The secrets injected this way (a --secret, and a ${secrets/...} token inside an --env asset) are scrubbed from the output akm captures: task logs and results, agent and command replies, and the workflow journal. A missing ref, or a --secret that is not <ref>:<VAR>, stops the run before it starts. The two names are reserved: a task input or workflow parameter called env or secret cannot be passed through akm run. For a version 5 task, --env and --secret reach every step of the run and of the tasks it runs, over the environment each step starts with (see Tasks). To run a program that is not an akm asset, use akm exec.

Execution selection uses the same --connection, --harness, and --model settings as the original agent/command entry points. Global output controls work unchanged. Refs resolve through the existing source-order and adapter ownership policy; task dispatch retains the resolved bundle identity. Tasks and workflows can resolve from authored sources without an index, as their original commands do.

A workflow ref starts a fresh run. A run id (or its accepted unique prefix) continues that run's frozen plan; new parameters cannot be supplied to an existing run. workflow resume, status, list, and abandon retain their lifecycle roles. The deprecated no-op --new is not accepted by the new entry point.

A script runs by its ref only (akm run scripts/<file> [arguments], or team//scripts/<file>); a filesystem path is refused. It runs in place, and its exit status is akm's. A #! first line decides what runs it: the program the line names and its one argument (#!/bin/bash -e, #!/usr/bin/env -S bash -eu, #!/usr/bin/env python3), then the file. With no first line the extension selects the program (.py runs python3). Windows has no #! lines, so there the extension always decides. akm's flags (--timeout, --max-retries, --cwd, --env, --secret, --clean, --inherit) go before the ref; every token after the ref, -- included, is passed to the script unchanged, and akm reads none of them (--help, -h, -q, --verbose, --bundle and --format among them). --inherit <VAR,...> starts the run clean with those variables; --clean, --inherit, --max-retries and --cwd also apply to agent and command runs, and a missing --cwd folder is made. A version 4 task keeps its own flag parsing. A version 5 task reads its start flags itself: a held lock (lock: true) exits 75, or 0 with --scheduled or --skip-if-locked.

--timeout and a signal to akm stop what a script started, in one of two ways. With no controlling terminal (cron, systemd, CI, an agent's shell tool) the script runs in its own session and process group: a timeout, or SIGINT, SIGQUIT, SIGTERM or SIGHUP to akm, sends the group SIGINT, then SIGTERM when the script has exited or 5 seconds have passed, then SIGKILL 5 seconds later if anything is left, so nothing is orphaned and the output pipe is released. A script's INT trap runs; a TERM-only trap runs only if the script survives SIGINT. On a terminal the script stays in akm's process group, so Ctrl-C, Ctrl-Z and reads from /dev/tty work as when it is run directly. SIGTERM and SIGHUP to akm are forwarded to the script, which runs its TERM trap, and akm ends by that signal once the script has exited. SIGINT and SIGQUIT are the terminal's to deliver: akm ignores them while the script runs and exits with the script's status, so a script that handles Ctrl-C and carries on keeps running. A timeout runs the same ladder on the script alone, so a process the script started that outlives it is left running, as it is when the script runs directly. akm exec, akm env run and akm secret run behave the same.

Arguments and the environment reach the program as UTF-8 text: the runtime decodes them, so a byte that is not valid UTF-8 arrives as U+FFFD. The program inherits the open-file limit the runtime raised at start-up, not the one the shell had. This holds for akm run, akm exec, akm env run and akm secret run.

When the script or command dies of a signal, akm dies of the same signal (so a shell reports 128 plus its number; where akm cannot re-raise it, akm exits with that code). When akm runs inside a host that handles SIGTERM, SIGINT or SIGHUP itself (an application embedding akm, a test runner), the child is still stopped on that signal; the host keeps its handler and decides the exit code. Where akm captures a program's output (a task step, a workflow exec unit, a harness run), a background process the program leaves in its own process group is stopped when the program exits; a process that must outlive the run starts its own session and redirects its output (setsid server >server.log 2>&1 &); either alone fails.

Flags must apply to the selected executor or its declared inputs. Unsupported asset types, fragments, extra positional values and -- tails (for an agent, command, task or workflow) fail before execution. Supply command text through --arguments and agent text through --prompt or --prompt-stdin.

exec

Experimental, and off by default. Turn it on with experimental.exec:

akm config set experimental.exec true

While it is off, akm exec refuses with a config error (exit 78) that names the key, and runs nothing. akm run --env and --secret are not gated.

Run any command with env assets and secrets injected into its environment:

akm exec [--env <env-ref>]... [--secret <secret-ref>:<VAR>]... [--clean] [--inherit <names>] [--cwd <dir>] [--timeout <duration>] [--max-retries <n>] -- <command>
akm exec [--env <env-ref>]... [--secret <secret-ref>:<VAR>]... [--harness <name>] [--connection <name>] [--model <name>] --prompt <text>

akm exec --env env/prod -- npm test
akm exec --env env/prod -- $SHELL                     # interactive: a shell with the env loaded
akm exec --env env/base --env team//env/prod -- ./deploy.sh
akm exec --secret secrets/deploy-token:GITHUB_TOKEN -- gh release create v1.0.0
akm exec --env env/prod --clean --inherit SSH_AUTH_SOCK -- ./migrate
akm exec --timeout 2m --max-retries 1 -- "make build | tee build.log"   # one argument is a shell line
akm exec --prompt "Summarize the failing tests" --harness claude
Flag Description
--env <env-ref> Inject every variable of the env asset ([bundle//]env/<name>). Repeatable. ${ref} tokens in its values are replaced as described under env.
--secret <secret-ref>:<VAR> Inject the secret's value, trimmed, as VAR. Repeatable.
--clean Start the command with a minimal inherited environment (PATH/HOME/locale/terminal basics, the names Windows needs to start a process, and akm's own location variables) instead of the full parent environment.
--inherit <names> Also pass these parent variables through (comma-separated). Without --clean it starts the command clean with these variables.
--cwd <dir> Run in this folder, made if missing; a relative path is taken from the folder akm was started in.
--timeout <duration> Stop the command after this long: 30s, 2m, 1h; a bare number is milliseconds. Exits 1 with a message.
--max-retries <n> Run the command again, up to n more times, when it fails or times out; each try has the whole --timeout.
--prompt <text>, --prompt-stdin Run a prompt on the default agent instead of a command, and print its reply. --harness, --connection and --model select the agent. Not with a command after --.

One argument after -- is a shell line, run by sh -c (cmd /d /s /c on Windows); several arguments are a program and its arguments, run directly. The command runs on this terminal and its output is not captured; akm exec exits with its status and is exempt from --format. --timeout and a signal to akm reach the command as they reach a script run by akm run: without a controlling terminal the command runs in its own process group and the whole group is stopped; on a terminal it stays in akm's group and only the command itself is signalled. Env assets apply in the order given, then secrets over them, and a later flag wins over an earlier one for the same variable. A missing ref, or a --secret that is not <ref>:<VAR>, is an error and nothing runs. Each use records an env_access or secret_access event with names only.

Installing a bundle is the trust decision: akm exec injects what the bundle's files define, including keys such as PATH or LD_PRELOAD, and does not warn or block.

The command's output is its own and is not scrubbed: if it prints its environment, those values appear in your terminal or agent transcript. The values stay in its environment for its whole lifetime and are visible to the subprocesses it starts. Prefer akm run with the same flags for an akm asset; akm scrubs the secrets it injected from what it captures there.

akm env run and akm secret run are Deprecated and removed in 0.11: put the command in a script asset under scripts/ and run it with akm run --env <ref> scripts/<file> or akm run --secret <ref>:<VAR> scripts/<file>. akm exec stays documented here, as Experimental.

A version 5 task's exec: and prompt: steps run the same way and do not need experimental.exec.

command run

Deprecated; use akm run <command-ref>; removed in 0.11.

Resolve a stored command through its owning bundle adapter and execute one fresh session. It runs on the default harness, else on akm's own runtime over the default connection, unless a flag or the command's own frontmatter names a connection or harness (see Configuration):

akm command run <command-ref> [--arguments <exact-text>] [--agent <selector>] [--connection <name> | --harness <name>] [--model <id-or-alias>] [--timeout <duration>] [--cwd <path>] [--dry-run]

--dry-run does not dispatch and does not materialize credentials.

Argument / Flag Description
<command-ref> Local indexed command ref, optionally bundle-qualified (for example commands/review or team//commands/review)
--arguments <exact-text> Exact string substituted for every literal $ARGUMENTS; it is not trimmed, tokenized, quoted, or recursively expanded
--agent <selector> Portable agents/... ref or a native harness selector
--connection <name> / --harness <name> Current-invocation connection or harness override (mutually exclusive)
--model <id-or-alias> Current-invocation model: an alias (fast, balanced, reasoning) or an exact name
--timeout <duration> The replacement for --timeout-ms, as a duration; see Timeout durations.
--timeout-ms <ms> Deprecated; use --timeout; removed in 0.11. Current-invocation timeout override
--cwd <path> Current-invocation workspace override
--dry-run Resolve and lower the command without dispatching or materializing credentials

Commands and portable personas are rendered by their bundle adapter. Native frontmatter is never sent as prompt text and native files are never rewritten. The only portable template token is literal $ARGUMENTS. Positional, named, expression, legacy {{...}}, and other native-only constructs fail before dispatch; invoke those templates through their native tool. Omitting --arguments and passing an explicit empty string both substitute empty text, but remain distinct in the resolved request.

akm command run ... --dry-run performs the real adapter read, target and model resolution, and request lowering. It returns a successful JSON result with schemaVersion: 1, shape: "command-dry-run", ok: true, dryRun: true, engine (the name of the connection or harness it would run on), safe provenance, and safe lowering notices. It has no fake exit code, stdout, stderr, or duration.

Each provenance entry contains only field, layer, kind, and via. Each lowering notice contains code, severity, adapter, optional field, and fixed message. Dry-run does not dispatch and does not materialize credentials. It uses a read-only source lookup and records no asset usage, execution events, or model accounting. The CLI invocation still records diagnostic usage in the cli_usage_* tables of metrics.db.

Diagnostics exclude resolved values. They never include prompt content. They never include command content. They never include environment values. They never include credential values. User-authored inference keys are collapsed to the safe wildcard field instead of being echoed.

For live execution, global --verbose emits the same safe provenance and notices to stderr before dispatch. The normal command result on stdout is preserved unchanged, so enabling verbose diagnostics does not corrupt scripts that consume stdout.

agent

Deprecated for an agent ref; use akm run <agent-ref>; removed in 0.11. The no-ref interactive launch has no replacement: run the agent's own CLI.

Run an agent on a harness, or on akm's own runtime over a connection, optionally embodying a bundle agent persona. Run akm agent --help for the options. Stored command assets execute only through akm command run (or akm run <command-ref>); akm agent has no command compatibility alias.

akm agent [<agent-ref>] [--connection <name> | --harness <name>] [--prompt <text>] [--model <model>] [--timeout <duration>] [--cwd <path>]
Argument / Flag Description
<agent-ref> Optional agent asset ref (e.g. agents/code-reviewer). Resolves persona and model defaults.
--connection <name> / --harness <name|platform> Connection or harness to run on, by name, a harness also by platform (mutually exclusive); default: the default harness, else akm's own runtime over the default connection
--prompt <text> / --prompt-stdin The task. Without one the harness starts interactively.
--model <model> An alias (fast, balanced, reasoning) or an exact model name; overrides the model in the agent asset
--timeout <duration> The replacement for --timeout-ms, as a duration; see Timeout durations.
--timeout-ms <ms> Deprecated; use --timeout; removed in 0.11. Override the run's timeout in milliseconds
--cwd <path> Working directory for the run (defaults to the current directory)

With a prompt the agent runs the task, and its reply is the result's stdout. On a harness the program runs as you would run it by hand (How akm runs a harness). When <agent-ref> is provided, akm resolves the bundle agent's persona and model default; --model wins over the asset. An alias is looked up on the selected connection or harness (see Aliases): --harness claude --model reasoning runs Claude Code's reasoning model, and --connection local --model reasoning the model connections.local.models.reasoning names.

Without a prompt, akm agent --harness <name> starts the harness interactively, with the terminal inherited and nothing sent to it; only a model may ride along. A connection has nothing to start, so --connection without --prompt is an error that says to pass --prompt or name a harness. A persona, an inference setting or an output schema applies to a task, so selecting one without --prompt or --prompt-stdin is rejected.

# Interactive launch:
akm agent --harness opencode

# Dispatch with a prompt only:
akm agent --harness claude --prompt "summarize recent changes"

# Embody a bundle agent asset:
akm run agents/code-reviewer --harness opencode --prompt "review src/"

# Model override with alias:
akm run agents/planner --harness claude --model reasoning --prompt "plan the sprint"

# Exact model name override:
akm agent --harness opencode --model anthropic/claude-opus-4-7 --prompt "audit the API"

# On akm's own runtime, over a connection:
akm agent --connection local --prompt "summarize recent changes"

Returns { ok, engine, exitCode, stdout, stderr, durationMs, reason?, error?, sessionId? }. engine is the name of the connection or harness the run used. sessionId is the run's session id when it has one: akm's own runtime reports the session it keeps in <akm data dir>/opencode-runtime/data/opencode/opencode.db, so the run can be found there; a harness run reports none. On failure, reason is a short code such as timeout, spawn_failed, non_zero_exit or parse_error. Captured dispatches render this final envelope using the selected akm format. Interactive child stdout/stderr remain inherited and raw. A failed dispatch exits 1; exitCode in the envelope retains the child's exact status when one exists.

lint

Scan the Markdown assets of a bundle for structural issues: unquoted colons, missing updated field, orphaned stubs, placeholder stubs, missing name/type, stale paths, and broken refs — in body text and in refs/xrefs/supersededBy/contradictedBy frontmatter. A belief edge pointing at a memory that akm improve pruned resolves through the archive tombstone under .akm/memory-cleanup/archive/ and is not reported. Also reports dangerous-env-key findings for env files (the key set described under Env files and process-hijacking keys; lint only warns). --type workflows structurally parses and compiles Markdown workflows; errors surface as invalid-workflow-structure findings (0.9.0: this is the only structural-validation surface now that akm workflow validate is gone).

In an akm bundle the files are the ones the indexer would index and each file's type is the type the indexer gives it, so a file under a wiki folder, a loose folder or the bundle root is linted with its type's checks, not only the files under the type folders. The walk is the indexer's: dot-directories, node_modules, git-ignored files and a root .scratch/ are not linted. Nothing under env/ or secrets/ is read. A file inside an LLM Wiki (a folder with schema.md and pages/, the llm-wiki adapter's own probe) is written by the wiki's own process, not authored as an akm asset, so missing-updated and missing-name-or-type do not apply to it; every other check does. Types that search leaves out by default stay out unless --type names them, and the bundle's lint.skip globs apply.

A bundle of another adapter is checked through that adapter's validate, and the checks every file gets (unquoted-colon, missing-updated, stale-path, missing-ref, redacted-content) are the same ones, with the same exemptions (skills, LLM Wikis, lint.skip), as in an akm bundle. An adapter can leave a rule out for its own files: okf and website-snapshot do not apply missing-updated. The checks of a type that has its own (a command's and an agent's name and type, a fact's category, a task's source, a memory stub, a workflow stub) are one table both routes read.

A ref an asset declares in frontmatter (xrefs, supersededBy, contradictedBy, currentBeliefRefs, sources, and refs) is checked whatever folder it points into, read as the index reads it: a wiki page's raw/x.md and wiki:<name>/pages/x are relative to its wiki. A word in prose is a ref only when it looks like one (bundle//concept), as before.

A link to a ref that akm index recorded as moved (see index) is a missing-ref finding that carries movedFrom (the link as written) and movedTo (the ref the asset has now, as bundle//conceptId). --fix rewrites that link in frontmatter and prose, outside code fences, keeping its spelling (a bare link stays bare unless the asset moved to another bundle); a second run changes nothing. A missing-ref with no recorded move is reported as before and never rewritten. A qualified ref (bundle//concept) is looked up in the bundle it names, so one whose concept exists only in another bundle is a missing-ref; an unqualified ref is looked up in every bundle.

akm lint                        # Report findings; exits 0 regardless
akm lint memories/note.md       # Lint one file (a file in a bundle takes its type from its location)
akm lint ./nightly.yml --type tasks  # One file outside every bundle: --type is required
akm lint --fix                  # Auto-fix Tier-1 issues in place
akm lint --type workflows       # Only lint one asset type
akm lint --dir ~/other-bundle    # Override the bundle root (default: from config)
akm lint --fail-on-flagged      # CI-friendly: exit non-zero when summary.flagged > 0
akm lint --prune-dangling-edges # Opt-in: drop belief edges whose target is gone
akm lint --rule stale-path      # List one rule's findings, grouped by asset
Argument or flag Description
<file> Optional. Lint just this file with the rules the bundle lint applies to it, and return the same result with the counts for that file only (first in 0.10.261122). A file inside a bundle (a configured one, or the root given with --dir) gets its type from where it sits, as the bundle lint decides it. A file outside every bundle needs --type (agents, commands, memories, skills, workflows, lessons, tasks, knowledge, facts, instructions, rules, sessions), as a type name (rule) or its folder name (rules). Checks that need other files, such as broken refs and orphaned stubs, run only for a file inside a bundle; outside one only the file's own rules run. A --type that disagrees with the file's location, a missing path, a directory (use --dir) and --prune-dangling-edges are usage errors (exit 2). --fix changes only this file.
--fix (alias --auto-fix, Deprecated: use --fix) Apply auto-fixes in place, including the rewrite of links to moved refs. Refused with a usage error when the target bundle is configured writable: false.
--dir Override the bundle root directory (default: from config)
--type Only lint assets of this type, by type name or folder name (e.g. workflow or workflows, task, memory or memories); a bundle lint leaves out the types search leaves out by default (search.defaultExcludeTypes, default session) unless --type names one. akm bundles only — every other adapter validates the whole bundle and warns on stderr that the flag had no effect.
--rule List this rule's findings grouped by asset: the asset ref and file, then each finding with its line, path, reason, nearest existing directory and line text. Combines with --type. A listing: it cannot combine with --fix or --prune-dangling-edges. An unknown rule name warns and shows every rule.
--fail-on-flagged Exit non-zero when summary.flagged > 0. Default: exit 0 regardless of findings.
--prune-dangling-edges Opt-in repair (#884): drop supersededBy/contradictedBy entries whose target has neither a file nor a prune tombstone. Not implied by --fix — it edits well-formed files to delete a belief-graph claim, so review a plain akm lint report first. Clears the same writable: false gate --fix does.

A version 5 task file is linted for what the file alone decides: its keys, steps, ${name} use and schedule. That a run: ref, env asset or secret exists, and that tasks do not run each other in a loop, are checked by akm doctor explain and by a start.

Returns fixed[] and flagged[] arrays plus a summary: { fixed, flagged } count and byRule: { <rule>: { findings, assets } } for the flagged findings. Each entry carries file, issue, detail, whether it was fixed, and, for a finding about one asset of the bundle, its ref.

The default text output is one line per rule: its findings and assets, the three folders holding most of them, whether --fix fixes it, and how to fix it. akm lint --rule <rule> lists that rule's findings.

stale-path: 41 findings in 12 assets; memories (30), knowledge/guides (11); --fix does not fix it; correct the path; ...

stale-path reports an absolute path in an asset that does not exist, so an agent can find it and correct it. It judges only paths this machine can check: under the current user's home, under a configured bundle or project root (projects), and under /tmp. Paths under /opt, /var, /etc, /root or another user's home are not checked unless they sit under a bundle or project root. A line that says it records the past or an example ("historically", "formerly", "for example", "e.g.") and a section under a History, Changelog, Archive or Examples heading are skipped, as are fenced code blocks and run-time filename templates (<stamp>, {stamp}, YYYYMMDD, globs). Each finding carries ref, file, line (1-based, in the file), path, lineText, nearestExisting (the deepest existing directory above the path) and reason: missing for a path under the home, a bundle or a project, ephemeral for a /tmp path that no longer exists. To clear a finding, correct the path, or say on the line that it records the past or an example, or move it under a History or Examples heading. Fenced code can name generated outputs and sample inputs, so it makes no assertion that those literal files currently exist. State required current input paths in prose or frontmatter to have them checked.

tracked-secrets flags each env/ or secrets/ file that git tracks in a bundle that has a remote (a push can leak it); git rm --cached the file.

missing-updated does not apply to skills. redacted-content ignores [REDACTED] in code (fenced, indented and inline), quotes and table cells.

A bundle skips a rule for some of its assets in its config entry: lint.skip maps any rule lint reports to globs matched against the path relative to the bundle root, where ** is the whole bundle. A rule name lint does not know is warned about once and ignored.

"bundles": {
  "docs": {
    "path": "~/docs",
    "lint": { "skip": { "stale-path": ["skills/sec/**", "knowledge/articles/**"], "tracked-secrets": ["**"] } }
  }
}

Task files are checked for more than their fields: a tasks/*.yml whose YAML does not parse is reported as invalid-task-yaml (it used to fall through as an empty mapping and lint clean), and a tasks/*.yaml file — a spelling akm never indexes or schedules — is flagged for the extension rather than skipped.

--fix is transactional per file: a fix that cannot be written (read-only file, full disk) is reported as fixed: "failed" on that file and the sweep continues, so a mid-run write failure can no longer abort the command and hide the fixes that already landed.

improve

Improve existing assets and write the results to the proposal queue.

akm improve
akm improve memory
akm improve skills/code-review
akm improve workflows/release-checklist --task "reduce duplication"
akm improve --skip-if-locked           # for high-frequency scheduled runs: skip (exit 0) if a run is already in progress
akm improve --harness claude            # run every call of this run, judges included, on the claude harness
akm improve --no-sync                  # skip the pre-run and end-of-run git sync entirely (default: on for git-backed bundles)
akm improve --sync --no-push           # commit only, skip the push after it
akm improve --dry-run --strategy consolidate # preview which connection or harness and model each consolidate process would use; nothing is dispatched
akm doctor prompt lessons/my-lesson --format text # print the composed reflect prompt for one asset, unwrapped; no lock/index/model call
akm doctor metrics improve             # LLM usage/routing report for the most recent real run
akm doctor metrics improve --run <id>  # ...for one specific improve_runs id
akm doctor metrics improve --since 7d  # ...aggregated over every real run started in the last 7 days
akm doctor judge reflect.quality < revision.json # reflect's quality judge on one revision; writes nothing
Flag Description
--task Optional extra guidance for this improvement pass
--dry-run Show the schema-v2 result on stdout without creating config, learning data, state, cache, bundle, log, or result artifacts. Dry-run results are never persisted, including on errors or signals. Diagnostic CLI usage is still recorded separately in metrics.db.
--bundle Select the bundle the run improves and writes to (default: defaultWriteTarget, else the working bundle); only that bundle's assets are planned. When the ref scope is bundle-qualified, it must name the same bundle
--limit <n> Cap the refs the run processes, highest salience first (refs routed to distill only come last). Overrides the strategy's processes.reflect.limit and limit
--timeout <duration> The replacement for --timeout-ms, as a duration; see Timeout durations.
--timeout-ms <ms> Deprecated; use --timeout; removed in 0.11. Wall-clock budget for the run (default: 7200000 = 2 hours)
--require-feedback-signal Deprecated; use a strategy with processes.proactiveMaintenance.enabled: false, selected with --strategy; removed in 0.11. Turn the proactive-maintenance lane off for the run, so only assets with recent feedback are planned
--strategy <name> Override the active improve strategy (a built-in or entry under improve.strategies); it chooses which processes run, never where
--connection <name> / --harness <name> Run every call of this run, judges included, on this connection or harness instead of the default; they are mutually exclusive
--model <alias|name> The model for every call of this run: an alias (fast, balanced, reasoning) or an exact name
--json-to-stdout Also emit the full persisted JSON result on stdout for a live run. Without this flag, stdout stays empty. Dry-runs always emit their result and are never persisted.
--skip-if-locked If another improve run already holds the lock, skip gracefully (exit 0) instead of failing with "already running" (exit 75, TransientError, code IMPROVE_LOCK_HELD: two improve invocations colliding on this lock is ordinary, retryable contention, not a broken config file). Use for high-frequency scheduled runs so they don't pile up failures while a longer run is in progress.
--show-prompt Deprecated; use akm doctor prompt <ref>; removed in 0.11. Print the composed reflect prompt for one asset and exit — before any lock, index write, or model call. Requires a fully-qualified asset ref as the scope (akm improve lessons/my-lesson --show-prompt); rejected with a type or whole-bundle scope. The default output format is JSON, which carries the prompt as a prompt field (escaped into one line) alongside engine (the connection or harness reflect would run on) and engineKind (connection or harness); pass --format text to print the prompt itself, unwrapped and readable by eye.
--sync / --no-sync Sync the git-backed primary bundle like akm sync (fetch and merge the upstream, commit, push) before the run, and commit (and optionally push) when it finishes. A conflict or fetch failure before the run only warns; the run continues on the local state. Default: on for git-backed bundles (per profile config).
--push / --no-push Push after the pre-run and end-of-run sync commits when writable with a remote configured. --no-push commits only, skipping the push. Default: per profile config (true). sync.push stays outside the autonomy gate — this is a per-run opt-out, not a default change.

akm improve is the public entrypoint for whole-bundle, type-scoped, and ref-scoped improvement. It owns the memory-cleanup and lesson-distillation flow. A qualified scope such as team//skills/code-review selects that bundle; a different explicit --bundle is a usage error.

A type scope that matches no asset in the stash (a misspelt type, say) prints a warning on stderr, with the nearest real type when one is close, and plans nothing; the exit code stays 0.

A run improves one bundle, the one it writes to, and plans only that bundle's assets: an asset that lives in another bundle is left alone even when that bundle is writable, and a bare ref scope (akm improve skills/x) resolves inside the write target only. To improve another bundle, name it (akm improve --bundle team, or akm improve team//skills/code-review). A scheduled akm improve therefore covers only its write target: schedule one akm improve --bundle <name> run per other bundle. --dry-run resolves the bundle the way a live run does (the working bundle starts from AKM_BUNDLE_DIR, then defaultBundle), so it previews the bundle a live run improves.

Every stage records what it did with each asset in the improve ledger (improve_ledger in state.db) and reads it before any model call: an asset whose proposal was rejected waits 14 days (reflect), 30 days (distill) or 7 days (other stages) before it is tried again; an expired proposal waits one day; an asset a stage looked at and left unchanged is revisited after 7 days, or as soon as new feedback (or, for consolidation, an edit) arrives.

Consolidation's promotion of a memory into knowledge/ is the exception to the 7-day rule: once a promotion is accepted or rejected, or the model judged the memory and proposed nothing, the memory is not offered to the model again until its body changes, however long that takes. The ledger records the body hash the promotion was decided against and compares it with the memory's current body (frontmatter edits do not count), the same content-driven rule the consolidate pair pass uses. A promotion decided by an older release, which recorded no hash, keeps the old windows. A memory whose body equals that of a consolidate promotion rejected on or after 2026-09-29 is held the same way, under whatever name it has. Consolidation also does not promote a memory that knowledge/ already covers: before it queues a promotion it compares the memory with the 20 knowledge/ docs in its bundle nearest to it by stored vector, and skips the memory when one of them holds at least 30% of its distinct 5-word shingles (skip reason dedup_covered_by_knowledge in the result's consolidation.skipReasons). A covering doc that ranks lower than the 20th nearest goes unseen. With no stored vector (semantic search off, or the memory not indexed yet) that check does nothing and the exact slug and whole-body checks still apply.

No built-in strategy turns the improve-stage extract process on. Set the selected strategy's process enabled: true to opt in. Proactive maintenance is on in default; set processes.proactiveMaintenance.enabled: false to turn it off. The stage toggle does not disable a direct akm proposal extract --type <harness> or akm proposal extract --auto invocation.

The maintenance pass run by improve also expires stale proposals: any pending proposal older than the top-level archiveRetentionDays config key (default 90, not improve.archiveRetentionDays) is moved to the archive with the reason expired: no action within retention window and a proposal_expired event is emitted (a proposal put back by akm proposal reopen is counted from the reopen, not its original creation). Set archiveRetentionDays to 0 to disable expiration entirely. The total expired count surfaces in the improve result as proposalsExpired.

improve never promotes proposals on its own — there is no confidence gate. Every generated proposal lands in the queue with a pending status and is adjudicated later with akm proposal accept / akm proposal reject or the drain engine. Reflect still emits a confidence score (0..1) in its JSON response schema; it is recorded on the proposal for triage and ranking, but no threshold auto-accepts anything.

Selection plans a reflect (a proposed rewrite) only for refs with negative feedback in the last 30 days newer than the stage's last ledger attempt, or for an explicit ref scope. A positive or note-only signal never plans one, so improve does not rewrite an asset from a positive signal. Distill keeps its own trigger: a memory with feedback of any kind (a signal or a note) in that window, newer than distill's last attempt. It skips a memory flagged wrong and not edited since (a negative feedback in that window judged the body it still has, or, recorded without that body's hash, is newer than the file's last write), and a memory whose only feedback in that window is positive with no reason or note, unless the ref is explicit. In a strategy that enables proactiveMaintenance (default does), a further lane plans refs with no such feedback that are due for a revisit: at most maxPerRun (default 15) per run, only refs not reflected or distilled for dueDays (default 30), so each comes up at most once a month. It picks only refs in the retrieval scope: returned by search, curate or show, or named by feedback, in the last 90 days, or new material no improve stage has processed. The planned refs are ranked by salience and cut to the limit; an explicit ref scope bypasses every gate. Use a strategy with processes.proactiveMaintenance.enabled: false (select it with --strategy) to turn that lane off for a run. The planned refs are the same as with the Deprecated --require-feedback-signal; only the skip label differs. With the flag, a candidate left out is always reported as no_new_signal ("no new signal since last proposal"). With the strategy it is not_retrieved ("not retrieved inside the usage window") when it has no feedback and search, curate and show did not return it in the last 90 days (and it is not new material).

When the active strategy enables a process (or the triage judgment) that has no connection or harness to run on, the run does not silently do nothing for it: the process is skipped, and the result carries skippedProcesses — an array of {process, configKey, reason} entries (omitted entirely when nothing was skipped). configKey is the setting that would place the process (improve.processes.<process>.connection) and reason says that no connection or harness is configured and points at akm setup. ok and the exit code are unchanged either way, matching extract's skipReasons contract: consumers that need to know branch on skippedProcesses. When no model-calling process can run at all (no connection or harness is configured, or several are and none is called default), there is nothing to degrade to: the run stops at planning with exit 78, naming what is missing, before it takes a lock, writes the index or opens a log, and --dry-run stops the same way. No flag asks for that. (The 0.9 --require-engines is still accepted and does nothing, with one warning, so a task installed for 0.9 keeps running. It used to refuse the run unless every enabled process had a usable target; that check is gone, and akm doctor (akm doctor && akm improve, which stops on exit 4) is what checks whether each connection answers and each harness is installed.)

--timeout (or the Deprecated --timeout-ms) is a run-wide wall-clock budget: when it expires, the run cooperatively aborts any in-flight model request (the same AbortSignal every LLM call already honors) instead of waiting out the call's own, much longer, timeout — the run then finishes and reports normally rather than hanging past its budget. SIGTERM/SIGINT/SIGHUP end a live run the same way, within a short bounded grace period, and the process exits with a stable per-signal code (143/130/129) rather than needing a kill -9. If a live run has waited more than a few seconds without any model response at all, one default-level line ("Still waiting for the first model response...") is printed so a scheduled run's log is never silently empty while a model is slow or dead.

For dry runs, plannedRefs is the effective post-limit work set, not every ref in the requested scope. The plan object preserves both views: raw scope size and per-gate removals, configured and effective caps, final ranked refs and their selection lanes, proactive and consolidation statistics, stage decisions, triage mode/caps, and snapshot.status/snapshot.reason for the read-side index boundary. limits.effective is the cap on the refs the run dispatches; the replay lane is retired, so limits.additiveReplayAllowance is always 0 and limits.totalCeiling equals the cap (omitted when the run is unbounded). A missing or incompatible index is an explicit empty snapshot and is not created or migrated. plan.mode is estimate and plan.dispatch is false; live JSON results use the same projection with mode: "execution". The dry result is a best-effort observation assembled during that invocation, not an atomic cross-store snapshot or a reservation. Live execution re-inspects mutable inputs, so a later run can differ after index, state, filesystem, clock, or session-log changes.

plan.processes (#947) is the resolved process -> connection or harness -> model routing table: one row per improve process (reflect, distill, consolidate, memoryInference, extract, validation, triage, proactiveMaintenance), plus a triage.judgment row when the strategy enables a judgment. Each row carries enabled, engine (the name of the connection or harness it resolved to), its model and engineKind (connection or harness), this process's own lowering notices, and — for reflect/distill/consolidate only — eligibleRefs, the count of this run's effectiveRefs the process would act on (shouldSkipRef's allowedTypes/process-disabled check; a count, not a per-ref matrix, to keep the envelope bounded). A row whose process has no connection or harness carries unavailable: {configKey, reason} — the same data behind skippedProcesses above, reshaped per process. Wherever a result says where work ran (agent, command run, extract, llm_usage rows, a workflow step's summary) the field is named engine and always holds a connection or harness name; scripts can rely on it. This table is resolved before any dispatch on every invocation (dry or live), so akm improve --dry-run --strategy <name> previews an ad-hoc strategy override without changing config first; akm doctor and akm doctor info print the same resolution for every kind of work, whichever strategy runs. --dry-run does not probe reachability over the network — run akm doctor to check whether a connection actually answers.

akm doctor prompt <ref> (formerly --show-prompt) is the cheapest way to exercise reflect alone: it builds the exact prompt reflect would send for one asset — the same source resolution, runner selection, feedback/schema-hint/rejected-proposal gathering akm improve's live reflect step uses — and prints it without reading a credential, so it never calls a model. A connection receives the reply's JSON Schema as response_format, and a harness as an instruction that dispatch appends to this prompt. Add --format text (the default JSON/yaml envelope escapes the prompt into one line, which defeats a by-eye read) to confirm by eye that recent feedback is framed as a signal (never a fact to insert) and that the response contract asks only for confidence and a frontmatterPatch of description, when_to_use and title: akm keeps the body.

When reinforced facts need promotion, knowledge is the higher-authority destination than memory.

improve report

Deprecated in 0.10.261120; use akm doctor metrics improve (same --run and --since); removed in 0.11.

akm improve report (#944) answers "which connection or harness did each model-calling process use this run, how much did it cost, and which enabled processes made zero calls (and why)" without hand-written SQLite against state.db. It is a real subcommand (report is not an asset type, so it is not a scope of the improve run). It takes two flags of its own, --run <id> (the usage report for one specific improve_runs row instead of the most recent real run) and --since <window> (aggregate over every real, non-dry-run run started since a duration like 24h/7d or an ISO timestamp); they are mutually exclusive, and on akm improve itself they are unknown flags (exit 2).

Every real (non-dry-run) akm improve invocation persists a usageReport field on the result (result_json in improve_runs, and in the --json-to-stdout / dry-run JSON): { byProcessEngineModel, noCalls }. byProcessEngineModel is a cross-tab of the LLM call records this run's own usage sink collects (#576) — one row per distinct (process, engine, model) triple, where engine is the connection or harness name, each with calls, failures, promptTokens, completionTokens, totalTokens, reasoningTokens, and totalDurationMs. noCalls lists every model-calling process (reflect, distill, consolidate, memoryInference, extract, validation — not triage/proactiveMaintenance, which never make an attributable LLM call themselves) the active strategy enabled but that ended the run with zero calls, each with a reason drawn from the existing skip-reason vocabulary: "engine_unavailable" (also in skippedProcesses), "autonomy_gated", "strategy_filtered_all_passes", a reflect/distill dominant skip reason (e.g. "no_change" for reflect, "no new signal since last proposal" for distill), or "no_signal" as the fallback — never a fabricated category. The field is omitted entirely when both would be empty. The same table is printed to stderr ([improve] usage report ...) after every real run, independent of --json-to-stdout.

akm improve report reads that field back: with no flags, the most recent real run; --run <id>, one specific run; --since <window>, summed across every real run in the window (byProcessEngineModel rows merged by (process, engine, model); noCalls lists a process only if it made zero calls across every included run). A run recorded before 0.9.15 has no persisted usageReport — the command recomputes byProcessEngineModel from that run's stored llm_usage events (summarizeLlmUsageCrossTab) instead of erroring, sets noCalls to [] (eligibility reasons are not reconstructable after the fact), and adds a notes entry saying so rather than fabricating precision the old row can't support.

improve judge

Deprecated; use akm doctor judge; removed in 0.11.

akm improve judge (a real subcommand; no flags) is akm judge reflect.quality for one revision, kept for callers that read its older shape. It reads {"source": "...", "candidate": "...", "feedback": "...", "ref": "..."} JSON from stdin (feedback and ref are optional; ref names the revised asset, which a judge on a harness may read), judges with the connection or harness improve.qualityGate names (the default when it names none), and prints { engine, pass, score, reason, criteria }, where engine is the name of the connection or harness that judged. A score of -1 means the judge gave no verdict. It writes nothing. Its --strategy flag is gone: a strategy never chose where a judge runs.

judge

Deprecated; use akm doctor judge; removed in 0.11.

akm judge --list                                  # the registered judges
akm judge reflect.quality --schema                # its input schema, output schema and version
akm judge reflect.quality < revision.json         # on the judge's default runner
akm judge distill.lesson --connection lab < lesson.json
akm judge consolidate.pair --harness claude --model sonnet < pair.json

Runs one of akm's model judges on one input and prints the verdict, so a judge can be measured on its own and compared across runners. It reads the input as JSON on stdin, checks it against the judge's input schema (an unknown field is refused, exit 2), and writes nothing.

Judge Judges Input
reflect.quality a revision of an asset's frontmatter (reflect's quality gate) source, candidate, feedback? (lines), ref?
distill.lesson a new lesson, or with extending an update of one (distill's quality gate and its lesson updates) lesson, source (the memory; its frontmatter is stripped before judging), feedback?, related? ({ref, content}), extending?
consolidate.pair what each of two notes states that the other does not a (the older note), b; each {ref, type, created, updated, content}; a call whose a has a later created than b is refused (exit 2), equal dates are allowed and the prompt says neither is newer
proposal.judgment accept, reject or defer one pending proposal (the drain's judgment tier) proposal ({ref, source, content}), reason, liveAsset?, siblings, neighbours?

Everything a judge reads is in its input: the lookups the pipeline makes (related assets, the live asset, same-ref proposals, nearest notes, git dates) are input fields, so on a connection a call is fully determined by its input. On a harness, reflect.quality may also read the asset at ref with akm show.

Flag Description
--connection <name> / --harness <name> Run on this connection or harness (mutually exclusive). Without either, the judge runs on the runner akm gives it in the pipeline: the quality gate's judge for reflect.quality and distill.lesson, consolidate's for consolidate.pair, triage's judgment for proposal.judgment.
--model <alias-or-name> Model to run, by alias or exact name
--list List the judges with their descriptions and schema versions
--schema Print the judge's input schema, output schema, schema version and what it may read on a harness

Output is one envelope: { judge, schemaVersion, runner, outcome, verdict?, reason?, notices? }, where notices carries what akm says about the run (for a harness that cannot be restricted, model-work-unrestricted), also for akm doctor judge, and runner records kind, name, platform? and model of what judged. outcome is verdict (with verdict), error (the call failed: a timeout, a transport error, a harness that exited non-zero) or unparseable (the reply held no verdict); the last two carry a reason, print ok: false and exit 1, and are never a rejection. schemaVersion is the judge's, and changes when its input or verdict changes shape. The verdicts of reflect.quality and distill.lesson are { pass, score, reason, criteria, reviewNeeded? }, where a non-pass is reviewNeeded from a mean of 2.5 for distill.lesson and of 3.5 for reflect.quality, the routes the pipeline takes; consolidate.pair's is { onlyInA, onlyInB, relation, redundant, confidence, reason }; proposal.judgment's is { decision, reason }. The workflow gate's judge is not registered.

proposal

Manage the proposal queue. The canonical grammar is akm proposal <verb>: extract, new, list, show, diff, accept, reject, reopen, revert, drain. Bare akm proposal runs akm proposal list. There are no flat-verb spellings (akm proposals, akm extract, akm propose, akm accept, akm reject, akm diff, akm revert) — use the akm proposal <verb> form.

list, show, diff, accept, reject, reopen, and revert (and bulk accept/reject) support --queue <source>. It selects the proposal queue stored for that configured writable source root; without it, commands use the primary queue. Queue selection is not a destination override. drain does not take --queue — it operates on the standing backlog via a policy, not a single queue.

New qualified proposals record their destination source name and materialized root. proposal diff, accept, and revert use that recorded target by default; an explicit --bundle must resolve to the same source and root or the command fails with exit 2. An unbound proposal in a selected non-primary queue uses that authenticated queue root. A short historical unbound proposal mutation requires either an explicit --bundle or a selected --queue that authenticates its root; it never falls back to an ambient write target.

proposal extract

Evolving (see STABILITY.md): measured by the extract eval; 0.10 is still settling the improve defaults, so it is not yet Stable.

Extract durable insights from native coding-agent session files (claude-code, codex, opencode) and queue them as proposals. This is the standalone entrypoint for session extraction — it replaces the legacy session-checkpoint hook and runs independently of the built-in strategies' improve-stage extract toggle (see improve above). Only your own improve.strategies.<active>.processes.extract.enabled: false stops it: the run then makes no model call, resolves no connection or harness, and returns ok: true with no sessions and a warning that says so.

akm proposal extract --sessions claude --session-id <id>
akm proposal extract --sessions claude --since 24h
akm proposal extract --sessions opencode --since 7d --dry-run
akm proposal extract --sessions codex --since 24h
akm proposal extract --auto                 # iterate every available harness
akm proposal extract --sessions claude --location /custom/path --session-id <id>
Flag Description
--sessions <harness> Session source: claude, codex or opencode. Required unless --auto.
--type <harness> Deprecated in 0.10.261120; use --sessions; removed in 0.11. Same values and behavior.
--session-id <id> Process only this session ID. When absent, discover sessions via --since.
--location <path> Override the harness's default session-discovery location.
--since <cutoff> Discovery cutoff. ISO timestamp or duration (24h, 7d, 30m). Default 24h.
--auto Iterate every available harness with the default --since. Mutually exclusive with --sessions.
--dry-run Show candidates without queuing proposals.
--force Re-process sessions even if they were already extracted and have no new events. Default: skip already-seen sessions.
--timeout <duration> The replacement for --timeout-ms, as a duration; see Timeout durations.
--timeout-ms <ms> Deprecated; use --timeout; removed in 0.11. Per-session LLM timeout in ms. Default: the selected connection's or harness's own timeout.
--connection <name> / --harness <name|platform> Connection or harness for this invocation, by name, a harness also by platform (mutually exclusive).
--model <alias|name> Model for this invocation: an alias or an exact name.
--strategy <name> Improve strategy supplying extract behavior; it never chooses where the model runs.
--user <id> / --agent <id> / --run <id> / --channel <name> Scope stamped on every proposal, as for akm remember (scope_* frontmatter). A scope the model writes is never used.
--project <name> Use this project's write.user, agent, channel and metadata for every session, instead of the project each session's own directory selects; none uses none. write.bundle is never used by extract.

--sessions (or the Deprecated --type) and --auto are mutually exclusive; one of them is required. --auto iterates getAvailableHarnesses() — every harness with a detectable session-log location on the current machine — and returns an aggregated extract-auto-result envelope (harnessesProcessed, totalProposals, per-harness results); the run exits non-zero only when every harness failed.

The codex harness reads Codex's rollout files under $CODEX_HOME/sessions (~/.codex/sessions by default; --location points at another rollout directory). It lists a person's sessions, codex exec runs included, and leaves out the rollouts Codex writes for subagents and its other internal agents: those are not sessions of their own. akm's own Codex model-work runs are among the sessions it lists; Codex gives them no marker.

The opencode harness reads two SQLite files, read-only and without starting OpenCode: OpenCode's own opencode.db (under $XDG_DATA_HOME/opencode, which is ~/.local/share/opencode unless XDG_DATA_HOME says otherwise, on every platform) and akm's own runtime's opencode.db (under <akm data dir>/opencode-runtime/data/opencode/), where it keeps its agent runs (--location points at a directory holding another opencode.db). Runs of the opencode harness are in OpenCode's own file. It reads both OpenCode 2 and OpenCode 1 files. Of an OpenCode 2 file it lists only top-level sessions, leaving out subagent sessions and akm's own model work, which ran as the akm-model-work agent. Of an OpenCode 1 file it leaves out akm's own model work the same way, from the OpenCode 1 release that records the agent on a session (May 2026). A file it cannot read is named in a warning, never taken for an empty history.

There is no akm proposal extract --watch/--debounce-ms either (0.9.0: dropped — a foreground polling daemon in a one-shot CLI); the shipped core/extract.yml cron template (akm proposal extract --auto on a schedule) is the answer.

Extraction is model work: it needs a connection or a harness (see Configuration). With neither it fails and points at akm setup. It runs on the default connection, else the default harness; --connection, --harness and --model choose another, and improve.processes.extract sets it for the improve stage too.

A run that writes proposals first checks that the proposal queue (the stash it extracts into) has a configured, writable bundle, and fails before any model call when it does not, with the reason (No configured bundle owns proposal queue <dir>. or Proposal bundle "<name>" is not writable.). It never registers a replacement or changes a bundle's permissions. --dry-run previews need no writable owner.

Output. ok means the command ran to completion — it is true even when every session was skipped (an unreachable connection included); it does not mean anything was harvested. Consumers that need "did this run actually harvest" branch on skipReasons, warnings, or sessionsProcessed / sessionsSkipped instead. The envelope also reports:

Field Description
engine Name of the connection or harness the run resolved to. Absent only when extract is disabled by the selected improve strategy (the run returns before a target is resolved).
engineKind "connection" or "harness" — what engine names. Same absence condition as engine.
skipReasons Per-skipReason count across sessions[] (e.g. { "llm_unavailable": 25 }). Present only when sessionsSkipped > 0.
writeFailures { candidates, sessions, causes } when candidate writes failed for a reason other than the validator's refusal (state.db busy, I/O, config), summed over sessions[]; causes is at most three distinct messages. ok stays true, as for a skipped session, so a scheduler or hook does not start failing. The run is incomplete: proposals holds only what was queued, and the failed sessions stay retryable. Absent when no write failed that way, so a no-op, a validator refusal (counted per session in failedRejectedCount) and a full success read alike. akm improve carries the same field in its extract[] results.
warnings Includes one aggregate line per infrastructure skip reason that fired (llm_unavailable, read_failed, exception, locked_concurrent) — e.g. 25 of 25 sessions skipped: llm_unavailable (engine "default") — so an outage is visible without inspecting sessions[]. Session-content skips (already_extracted, too_short, triaged_out) are counted in skipReasons but never produce a warning line.
sessions[].warnings One line per candidate the model wrote that the output contract refuses, as <type>:<name> dropped: <reason> — a lesson without a when_to_use of 15 characters, a description under 20, a name that is not a kebab-case slug — and one per candidate held back by the improve ledger. A session whose every candidate was dropped has candidateCount: 0 and no rationaleIfEmpty, so this is where the loss shows.

proposal new

Generate a brand-new asset proposal from a description. Output is always a proposal — never a direct write.

akm proposal new <type> <name> --task "..."
akm proposal new <type> <name> --file ./prompt.md
akm proposal new skill code-review --task "PR-style review skill"
akm proposal new lesson docker-cleanup --file ./prompts/docker-cleanup.md
akm proposal new skill code-review --path team --task "PR-style review skill"  # writes under skills/team/
akm proposal new skill code-review --bundle team --task "PR-style review skill"  # queued for the `team` bundle
Flag Description
--path Relative subdirectory under the type dir to place the proposed asset in (e.g. release). The filename comes from <name>.
--bundle Configured writable bundle to queue the proposal for. The prompt takes its convention facts from that bundle, the proposal records it as its target (so akm proposal accept writes there), and it is queued in that bundle's queue (akm proposal list --queue <bundle>). An unknown, disabled or read-only bundle is refused, as for akm remember --bundle. Default: the working bundle
--task Inline task text
--file Read task text from a UTF-8 file
--connection / --harness Override the default connection or harness, by name, a harness also by platform (mutually exclusive)
--model Override the model: an alias or an exact name
--timeout <duration> The replacement for --timeout-ms, as a duration; see Timeout durations.
--timeout-ms Deprecated; use --timeout; removed in 0.11. Override the selected connection's or harness's timeout for this call
--user / --agent / --run / --channel Scope stamped on the proposal, as for akm remember (scope_* frontmatter). A scope the model writes is replaced by these flags (none given: removed), with one warning.
--project <name> Use this project's write defaults (write.user, agent, channel, metadata, and write.bundle as the destination) instead of the one the working directory selects; none uses none.

Exactly one of --task or --file is required. Emits propose_invoked.

proposal new is agent work: it runs on the default harness, else akm's own runtime over the default connection, and --connection or --harness choose another. The agent returns the proposal as one JSON object on stdout with the asset's ref, its full content and a self-rated confidence. akm sends the object's JSON Schema as an instruction at the end of the prompt, and captures the reply, which is the agent's plain-text output; a harness runs headless, with no live terminal session. A reply that is not a valid proposal gets one corrective retry that says what was wrong. If that reply is not valid either, the command exits 1 with reason: "parse_error" and an error that names the connection or harness, for example Engine "local" reply was not valid proposal JSON after 2 attempts: ….

proposal list

List proposal queue entries.

akm proposal list
akm proposal list --queue team-bundle
akm proposal list --status pending|accepted|rejected|reverted
akm proposal list --ref skills/deploy
akm proposal list --generator consolidate-pair
Flag Description
--queue <source> Select the proposal queue by configured writable source name
--status Filter by pending, accepted, rejected, or reverted
--ref Filter by asset ref. A qualified ref preserves bundle identity; a short ref matches that concept in the selected queue
--type Reserved type filter
--generator <name> Filter by generator/source (e.g. reflect, distill, consolidate-pair) — the same value accept/reject --generator take

Each retire proposal's retirement.continuityRisk, when present, also shows in the default listing (⚠ continuity-risk inline) and in the text output of proposal show and proposal diff (the specific failing/unverified queries) — see Retirement continuity.

Each proposal record carries an optional confidence field (0..1) emitted by reflect/propose runs. It is recorded for triage and ranking only — there is no confidence gate or auto-promotion; proposals are adjudicated with akm proposal accept / reject. Once accepted, a proposal that overwrote an existing asset also carries a backup field pointing to the captured prior content, which akm proposal revert uses.

proposal show

Inspect a queued proposal and its validation findings.

akm proposal show <id>
akm proposal show <id> --queue team-bundle

A proposal recorded before concept IDs, whose ref is the retired <type>:<name> grammar (lesson:<name>) and whose metadata has no changes or proposedTarget, is shown as written with one legacy-ref finding naming what it lacks. It cannot be accepted: accept and diff refuse it with the same reason and drain leaves it alone; akm proposal reject <id> --reason <why> archives it with its content and ref kept. The legacy-ref finding is Experimental for its first release (#1513).

proposal accept

Accept a proposal and promote it into its recorded destination. Accepts a full UUID, an 8-character UUID prefix, or an asset ref.

akm proposal accept <id>
akm proposal accept <id> <id> <id>             # several at once: one commit
akm proposal accept 7c115132                  # 8-char UUID prefix
akm proposal accept skills/akm-dream           # Asset ref
akm proposal accept <id> --queue team-bundle
akm proposal accept <id> --bundle team-bundle  # Must match a recorded target
akm proposal accept --generator reflect -y    # Bulk-accept by generator (requires -y)
akm proposal accept --generator reflect --max-diff-lines 50 -y    # ...only if <= 50 lines
akm proposal accept --generator reflect --older-than 7 --dry-run  # Preview a bulk accept
Flag Description
--queue <source> Select the proposal queue by configured writable source name
--bundle <name> Write destination; must match the proposal's recorded target
--generator <name> Bulk-accept all pending proposals from this generator (e.g. reflect, distill). Requires no positional id.
--max-diff-lines When bulk-accepting, only accept proposals whose content is <= this many lines. Larger proposals are skipped.
--older-than When bulk-accepting, only accept proposals created (or last reopened) more than this many days ago
--dry-run List proposals that would be bulk-accepted without accepting them
-y, --yes Skip confirmation (required in non-interactive mode for bulk accept)

Bulk-accept all pending proposals from one generator with --generator <name> (e.g. reflect, distill) and no positional id. Bulk accept requires -y/--yes in non-interactive shells.

Several ids accept in one process and return one proposal-accept-batch envelope (accepted, failed, and a results list in argument order). An id that fails appears as { ok: false, id, error }, the command exits 1, and the others are still accepted and committed.

When the destination bundle is a git repository (a .git directory, whatever its source kind), one accept is committed with exactly the paths it wrote or removed and the subject akm accept: <generator> <proposal-id-8> <ref>. A process that accepts several proposals (several ids, --generator, or akm proposal drain) commits them once at its end: the subject is akm proposal accept: N accepted (<generator> n, ...) (akm proposal drain: ... for a drain) and the body has one <proposal-id-8> <generator> <ref> line per proposal. A retirement's archived copy and tombstone, and the source memory a consolidate promotion retires, are part of the same commit. The commit is local: akm sync, or the end-of-run sync of akm improve, pushes it. A commit that fails warns and the accept stands. The accept's result (each entry of a batch) carries commit: { "committed": true, "sha" }, or { "committed": false, "reason", "error"? } with reason not-git, ignored (every written path is ignored by .gitignore), nothing-to-commit or failed (with git's error).

proposal reject

Reject a proposal and archive the reason. Accepts a full UUID, an 8-character UUID prefix, or an asset ref. akm proposal reopen undoes a rejection.

akm proposal reject <id> --reason "duplicates existing workflow"
akm proposal reject <id> --queue team-bundle --reason "duplicates existing workflow"
akm proposal reject 7c115132 --reason "not ready"      # 8-char UUID prefix
akm proposal reject skills/my-skill --reason "not ready" # Asset ref
akm proposal reject --generator reflect --reason "noisy"  # Bulk-reject by generator
akm proposal reject --generator reflect --reason "noisy" --max-diff-lines 50
Flag Description
--reason Reason for rejection (required)
--queue <source> Select the proposal queue by configured writable source name
--generator <name> Bulk-reject all pending proposals from this generator (e.g. reflect, distill). Requires no positional id.
--max-diff-lines When bulk-rejecting, only reject proposals whose content is <= this many lines. Larger proposals are skipped.
--older-than When bulk-rejecting, only reject proposals created (or last reopened) more than this many days ago
--dry-run List proposals that would be bulk-rejected without rejecting them
-y, --yes Deprecated, removed in 0.11: reject no longer asks for confirmation, so the flag does nothing

Bulk-reject all pending proposals from one generator with --generator <name> and no positional id. Reject does not ask for confirmation; akm proposal reopen undoes a rejection.

proposal reopen

Undo a rejection: move rejected proposals back to pending so they can be reviewed again (a proposal that retention expiry archived is a rejected one too). A rejection is otherwise final. accept refuses anything that is not pending, and a rejected consolidate pair-pass retire proposal also keeps the pair pass from proposing that retirement again while both documents are unchanged.

akm proposal reopen <id>
akm proposal reopen <id> --reason "the diff was misrendered (#997)"
akm proposal reopen <id> <id> <id>                 # several at once: all or none
akm proposal reopen <id> --queue team-bundle
# One id per call, and only the rejections whose reason says the diff was misread:
akm proposal list --status rejected --generator consolidate-pair \
  --detail normal --format json \
  | jq -r '.proposals[] | select(.review.reason // "" | test("blank line"))
      | .id' \
  | xargs -r -n 1 akm proposal reopen --reason "diff was misrendered"
Flag Description
--reason <text> Why the rejection is being undone. Kept in the proposal's review history and the proposal_reopened event, and in its ledger row's detail when it has a row
--queue <source> Select the proposal queue by configured writable source name

Takes full proposal ids: a UUID prefix only matches pending proposals, so it cannot name a rejected one (akm proposal list --status rejected prints the ids; add --generator consolidate-pair for the retire backlog). An asset ref also resolves, to the newest proposal for that ref, but only while none is pending, and it never reaches a retire proposal, which is named by its id.

Check a rejection's reason before reopening it. The default brief output of akm proposal list leaves it out; --detail normal --format json shows it as review.reason. Reopen only the rejections you want back, since a deliberate rejection would otherwise be undone with the rest. The pattern in the example, test("blank line"), matches the reason given in the 0.9.19 upgrade note (the diff read as a blank-line replacement); change it to yours. Pass one id per call (xargs -n 1) so a refusal skips only that proposal, and use xargs -r so GNU xargs does not run reopen with no id when nothing matches. A retire proposal refused because another pending retire proposal involves the same document can be reopened once that one is decided.

Reopening is refused, with the reason, when:

With several ids nothing is reopened unless every one can be: the error lists each refusal (exit 2).

A reopened proposal is pending again with its review cleared. The rejection (its review, and any gate verdict that came with it) is appended to the proposal's reviewHistory, which akm proposal show prints as one line per reopen: reopened: <when> (<reopen reason>), undoing rejected: <why> (<when>). The gate verdict is cleared so the drain treats the proposal as undecided, except a deferred one, the quality gate's hand-off to a person, which stays so the drain keeps leaving the proposal for that person.

A reopened retire proposal no longer counts as a settled pair for the pair pass, and while it is pending that pair is not proposed a second time. The proposal's improve_ledger row goes back to what the mint wrote (a retire proposal's mint writes none, so the row its rejection created is dropped). The age that retention expiry and --older-than see restarts at the reopen, and a proposal_reopened event is appended. Accepting a reopened retire proposal archives the retired file exactly as for any retire proposal, and akm proposal revert restores it byte-exactly.

Output: for one id, the envelope reject returns (ok, id, ref, the proposal, and reason, here the reopen reason); for several ids, { reopened, results } with one such envelope per proposal.

proposal revert

Revert an accepted proposal by restoring the prior asset content from the backup captured at promotion time. Only works on proposals that overwrote an existing asset; new-asset proposals leave no backup. Sets the proposal's status to reverted and appends a proposal_reverted event to the audit log.

akm proposal revert <id>
akm proposal revert skills/akm-dream           # Asset ref
akm proposal revert <id> --queue team-bundle
akm proposal revert <id> --bundle team-bundle  # Must match a recorded target
Flag Description
--queue <source> Select the proposal queue by configured writable source name
--bundle <name> Select the destination for an unbound proposal, or confirm a recorded destination; a conflict with a recorded target is rejected

Accepts the full proposal UUID or the asset ref. UUID prefixes are not supported for reverting (archived proposals require the full identifier). Errors with exit code 2 if the proposal is not in accepted status, has no captured backup, or cannot be found.

proposal diff

Preview the proposed change against the live asset. Accepts a full UUID, an 8-character UUID prefix, or an asset ref directly.

akm proposal diff <id>
akm proposal diff skills/akm-dream             # Asset ref form
akm proposal diff 7c115132                    # 8-char UUID prefix
akm proposal diff <id> --queue team-bundle
akm proposal diff <id> --bundle team-bundle    # Must match a recorded target
Flag Description
--queue <source> Select the proposal queue by configured writable source name
--bundle <name> Select an unbound destination or confirm a recorded one for proposal accept, diff, or revert; a conflict with a recorded target is rejected

proposal accept runs full validation before promoting. proposal reject requires --reason.

A retire proposal (the consolidate pair pass's consolidate-pair retirements) writes no content: accepting it archives the retired file under .akm/memory-cleanup/archive/ (nothing is deleted), and akm proposal revert restores it byte-for-byte. Its diff shows just that, the retired file's lines as removals and nothing added, under a retire header. It does not present the file as replaced by a blank one, which is how earlier releases rendered it:

$ akm proposal diff <id>
# proposal <id> (retire: memories/old-note -> memories/new-note)
retire.label: duplicate (cosine=0.986)
retire.reason: Same durable facts, B adds nothing new.
note: Accepting archives the retired file under .akm/memory-cleanup/archive/ (nothing is deleted); `akm proposal revert` restores it byte-exactly.
--- stash//memories/old-note (existing)
+++ /dev/null (retired: archived; successor memories/new-note)
@@ 1,5 0,0 @@
----
-description: an old note
----
-The durable fact.
-A second line.

The JSON result carries three more fields for a retire proposal, and none of them on any other proposal: op ("delete"), retirement, and note (what accept and revert do to the file). retirement uses the keys proposal show reports the pair under: retiredRef, successorRef, judgeLabel, judgeReason (the judge's own text; the stored block's reason is the tombstone vocabulary and is not repeated), cosine, and continuityRisk when the retirement continuity check flagged the pair. The text output prints the same verdict lines show does, continuityRisk and its failing queries included, above the diff. isNew is always false for a retire proposal; when the retired file is already gone (retired, or removed by something else), the diff is only its two header lines, --- <ref> (missing) and the +++ line.

proposal drain

Experimental (see STABILITY.md).

Drain the standing pending-proposal backlog instead of adjudicating proposals one at a time. One rule decides each proposal: a proposal whose quality judge passed on its current content is accepted (unless its target changed since it was minted — that one is auto-rejected as stale-target); an empty diff is rejected; a proposal that reflect or distill deferred for review is left for a person; a proposal from the proactive-maintenance lane (no feedback behind it) is left for a person too (reason proactive-needs-review), even when its judge passed it; everything else goes to the judgment tier when one is enabled, and is otherwise left for review. The judgment tier may accept only a consolidate promotion (a memory proposed as a new knowledge note); any other kind it would accept, such as a retirement or a reflect revision, is left for a person (reason judgment-not-promotion). Judged over every kind, the tier accepted unsafe retirements, applied exact fixes unreviewed and changed notes nobody had touched: 6 to 14 harmed items a night on two models (#1132). A reflect revision that changes the body, and every distill lesson or knowledge promotion, is deferred for review even when its judge passes it. A bare akm proposal drain queues: it stages its decisions and writes nothing to assets, whatever the default strategy's apply mode is. --promote always accepts (and asks for confirmation first). An explicit --strategy <name> supplies that strategy's apply mode, ceilings and judgment; a strategy whose apply mode is queue stages instead. akm improve's triage pre-pass follows its strategy's apply mode.

akm proposal drain --dry-run                        # Preview without writing
akm proposal drain --promote -y
akm proposal drain --max-accepts 10 --older-than 7 --promote -y
akm proposal drain --strategy default --promote -y  # Read the triage block from an improve strategy
Flag Description
--strategy Read the triage block (apply mode, ceilings, judgment) from this improve strategy instead
--promote Promote (accept) judge-passed proposals. Without it, a bare drain queues: it stages decisions and writes nothing to assets; an explicit --strategy supplies its own apply mode
--dry-run List what would be accepted/rejected/deferred, without writing
--max-accepts Hard per-run accept ceiling; accepts beyond this are reported as skippedByCap
--older-than Only consider proposals created (or last reopened) more than this many days ago
--judgment Explicitly enable the judgment tier for this standalone drain, including when the selected strategy says judgment.enabled: false; it accepts only consolidate promotions; execution overrides still come from that strategy. Without this flag, strategy judgment config does not enable standalone drain judgment. A missing runner remains a no-op with a logged triage_deferred summary.
-y, --yes Skip the confirmation prompt (required in non-interactive mode for promotion)

feedback (--reason)

akm feedback accepts an optional --reason <text> flag whose value is forwarded into feedback metadata and consumed by improve/distill proposal prompts. Negative feedback requires a reason by default: say what is wrong and what should change.

Write the reason about the asset's content. Reflect treats it as an unverified report to investigate, not a fact to insert, and is told to leave the section unchanged when the reason asks for information the asset lacks. Distill's quality gate rejects a lesson that is off-subject for the asset it was distilled from and sends a borderline one to review. A command that failed (akm show erroring on the ref, say) says nothing about the asset, so it is not a reason to record against it.

task

akm task is the scheduling surface for workflows, agent prompts, and shell commands. It manages on-disk task definitions under <bundle>/tasks/<id>.yml and reconciles them with the OS-native scheduler (cron / launchd / schtasks). Task source v4 YAML (version: 4) is the only stable source contract this release accepts (the Experimental version: 5-beta.1 is described in Tasks); akm import <file> --type task imports a v4 file — see the canonical Tasks reference. The group is add | enable | disable | run | explain | sync | doctor | history | prune — there is no show or remove; use akm show tasks/<id> to inspect one task. Only enable and disable are current (validate one task file with akm lint <file> --type tasks, a bundle's tasks with akm lint --type tasks). The rest are Deprecated, removed in 0.11:

Deprecated Use
task add akm import <file> --type task, then akm task enable <ref>
task run akm run <bundle>//tasks/<id>
task sync akm doctor scheduler sync
task prune akm doctor scheduler sync --prune (preview; --yes to remove)
task doctor akm doctor (its scheduler field)
task explain akm doctor explain <ref>
task history akm doctor log --task <id> (the no-id cross-task form has no replacement; akm doctor metrics gives per-task totals)

task sync, prune, doctor, explain and history are Deprecated in 0.10.261120; task add and task run since 0.10.261119. The sections below describe the Deprecated commands and name the replacement. Use task enable / task disable for host-local activation; edit the file only to change the authored schedule or remove the task. List tasks with akm search --type task.

akm search --type task                       # List tasks (cross-bundle)
akm show tasks/<id>                          # Inspect one task
akm import ./nightly.yml --type task         # Import a task file (disabled; --name sets the id)
akm import ./nightly.yml --type task --force # Overwrite an existing task id
akm task enable team//tasks/nightly       # Add local activation and sync its bundle
akm task disable team//tasks/nightly      # Remove local activation and unschedule it
akm run team//tasks/nightly                 # Execute now (what the scheduler calls)
akm doctor explain team//tasks/nightly      # Read-only: declared inputs, target, schedule — spawns nothing
akm doctor log --task <id> [--bundle <name>] [--limit <n>]  # Recent runs from state.db
akm doctor scheduler sync                   # Reconcile activated refs from all enabled configured bundles
akm doctor scheduler sync --dry-run         # Preview the reconcile — zero scheduler writes
akm doctor scheduler sync --rebind          # Also capture the current installed runtime
akm doctor                                  # Health, plus a `scheduler` field: backend + paths
akm doctor scheduler sync --prune           # Preview orphaned scheduler entries — zero writes
akm doctor scheduler sync --prune --yes     # Remove every currently-computed orphan
akm doctor scheduler sync --prune --id ghost,stale --yes  # Remove only the named orphan ids

The Deprecated task add also accepts --name, --description, --when-to-use and --tags (the file's name, description, when_to_use and tags), --disabled (write the task but leave its ref out of this host's scheduler activation), --force (overwrite an existing task with the same id), and --rebind (also point the bundle's installed scheduler rows at this akm invocation, as akm doctor scheduler sync --rebind does).

akm doctor explain <ref> [input flags] (formerly akm task explain) prints a task's declared inputs:, the values that would actually be supplied (with provenance), the resolved target, effective execution settings, and schedule bindings — read-only: it never spawns anything, writes history, or touches the scheduler. A secret-shaped value prints as <redacted>. See akm doctor explain.

Through 0.10 the OS scheduler invokes akm task run <id> --scheduled at the scheduled time (that invocation prints no deprecation notice); run a task by hand with akm run <ref>. Each run is recorded as a row in the durable task_history table (state.db), surfaced by akm doctor log --task <id> — not by the event stream (akm doctor log without --task); there is no task_invoked/task_completed event type on that stream.

Task source cannot enable itself. akm task enable <fully-qualified-ref> adds the ref to this host's scheduler.enabled list and syncs that bundle; akm task disable removes it and unschedules the task. Manual akm run <ref> remains available. To remove a task, delete its file (<bundle>/tasks/<id>.yml) and run akm doctor scheduler sync — sync uninstalls the orphaned scheduler entry.

A config with no scheduler.enabled list at all (written before 0.9.17) means "keep what is installed": akm doctor scheduler sync takes the akm-written rows already in the scheduler as this host's choice and writes the list; an explicit list is never second-guessed. akm doctor scheduler sync --dry-run prints the planned adds/updates/removes (removals carry their owning bundle) without touching the scheduler — zero writes. Exits non-zero when removals are pending, so it can gate a CI/health check on "sync would change something."

sync's (and sync --dry-run's) result always carries failures: [{path, ref?, reason}] — one entry per item sync could not reconcile: a task/workflow source that failed to parse or prepare (its installed row is left as it is), two sources claiming the same scheduler id, a desired binding whose id is already scheduled from a different bundle or installation, a row whose install or removal failed, or — for an unscoped, multi-bundle sync — a whole bundle whose sources could not be read. Every one of these is a per-item failure: the item is left exactly as it was and reported here, while every OTHER item and bundle in the same sync still reconciles; with --bundle, that one bundle IS the whole sync, so a bundle that cannot be read raises instead of being reported here. failures is empty on a fully clean sync; a non-empty failures still exits non-zero, same as a pending removal. A crontab whose akm markers are malformed is refused unmodified, and another akm process holding the scheduler lock makes sync exit 75 (retry shortly).

akm doctor scheduler sync --prune reclaims installed scheduler entries that sync can never clean up on its own: entries that no longer resolve to a live bundle (a row whose AKM_BUNDLE_DIR names a directory that is gone, or a row written before 0.9.17-alpha.7 whose --scheduler-context descriptor cannot be read). It never touches an entry that still resolves to a live bundle — that's sync's job. Like sync --dry-run, the default is a dry-run preview (zero scheduler writes) that exits non-zero when there are candidates to remove; --yes executes the printed plan, and --id <id1,id2,...> narrows a --yes run (or a preview) to specific binding ids — naming an id that isn't a current orphan candidate (not installed, or it still resolves to a live bundle) is refused with a usage error and removes nothing.

Scheduler activation is host-local config and captures the installed akm runtime. Ordinary akm doctor scheduler sync reconciles activated refs from all enabled configured bundles while preserving that runtime binding. Use akm doctor scheduler sync --rebind only after intentionally moving or replacing the installation, or to repair a stale runtime path, then verify the result with akm doctor. Interactive akm setup reviews every embedded task template (both the core set and the improve-schedule set) and asks once before changing task files or scheduler state; non-interactive setup changes neither.

Because the scheduler runs the exact binary path recorded at the last akm doctor scheduler sync, upgrading akm through a different installer than the one active at that sync (npm-global to a standalone download, or vice versa) leaves scheduled runs invoking the old, now-stale binary — akm doctor scheduler sync re-resolves the current path and repoints them. akm doctor's scheduler-binary advisory warns when the two diverge, naming both versions.

Setup reconfiguration preserves existing scheduler runtime bindings. Changing the AKM storage path or installed runtime path therefore requires an explicit akm doctor scheduler sync --rebind; setup does not silently migrate those entries.

Bundle targeting (--bundle <bundle>). By default read/write commands operate on the primary/default bundle, while an unscoped sync reconciles all enabled configured bundles. add, enable, disable, history, sync, run, and explain accept --bundle <bundle> to schedule, reconcile, or inspect tasks that live in another configured bundle (akm doctor reports scheduler-wide state and takes no --bundle; validate takes a bare filesystem path instead of a ref, so it has no bundle to target either):

akm import ./nightly.yml --type task --bundle team-bundle
akm doctor scheduler sync --bundle team-bundle             # reconcile only that bundle

A non-default bundle is recorded in the installed scheduler entry as a --bundle <bundle> token, so the scheduled akm task run resolves the task (and its relative asset refs) from that bundle. sync --bundle limits a run to one bundle; unscoped sync reconciles every configured bundle as one transaction. Scheduler ids are the bare task id and are never namespaced: registering a task whose id is already scheduled from a different bundle is a hard error.

The Deprecated task add accepts exactly one CLI target selector (--workflow <ref>, --prompt <text-or-ref>, or --command <shell>) and writes a task source v4 document (version: 4). In the file, exactly one of uses or run is allowed. uses accepts command, workflow, and script refs plus akm/command; agents and task refs are not executable. run accepts a shell string with the closed shell and working-directory contract. Task source v4 has no akm: options bag or on: trigger block — scheduling, resolver overrides, timeout, maxSteps, maxRetries, and redaction names are all top-level keys on the document itself. Normal execution rejects v2 and v3 and points to akm migrate apply --dry-run followed by akm migrate apply. See Tasks for the complete grammar and fail-closed migration behavior.

Task-log redaction and redact:. A task's persisted output — the run .log file and its logs.db rows — is scrubbed before it is written. Two passes run: credential shapes (Bearer …, sk-…, webhook URLs) are matched by pattern, and exact secret values are matched by value. akm knows a value is secret when the config declares it (the key every connection and embedding resolves to: a $VAR's value, or the credentials.json entry), and it infers others from the variable name (*_TOKEN, *_SECRET, *_API_KEY, *_PASSWORD, …) provided the value is at least 8 characters — a short one is far more likely to be a flag than a credential, and redaction replaces substrings, so guessing wrong mangles the log.

Any task kind may add redact: for a secret exported under a name none of those rules recognise:

version: 4
run: ./deploy.sh
schedule: "0 3 * * *"
redact: [ACME_DEPLOY_TOKEN]   # NAMES, never values

akm looks each name up in the environment the run is given; a name that is unset contributes nothing. Names only. A literal secret in a task file would leak far more widely than the redaction closes: task files are indexed into the search database, can be sent to an embedding provider, are printed verbatim by akm show, and ship inside bundles over git and npm.

A workflow-target task executes the same native orchestration as akm workflow run; it does not stop after creating a run. Completion maps to task completed, while workflow failure or verifier rejection maps to task failed. A workflow-target task's declared inputs: (with their default: values) remain the non-CLI way a scheduled definition supplies its new-run parameter snapshot.

Workflow-task run bounds. Top-level timeout, maxSteps, and maxRetries correspond to akm run --timeout, --max-steps, and --max-retries. Unlike the interactive command, a scheduled workflow task gets a default whole-run timeout of 6 hours (DEFAULT_WORKFLOW_TASK_TIMEOUT_MS): nobody is at the terminal to Ctrl-C an unattended run, so without one a single wedged unit hangs the task forever. An explicit timeout always wins, and timeout: null opts out entirely. On expiry the runner aborts the run's signal, which the engine treats as a graceful break at the next step boundary — the journal is kept and the run stays active, and akm run <run-id> continues it (the run id is in the task run's detail.error and log). The attempt itself is recorded as failed, so the OS scheduler sees a non-zero exit.

version: 4
uses: workflows/nightly-report
inputs:
  region:
    type: string
    default: us-east-1
schedule: "@daily"
timeout: 3600000   # 1h whole-run bound (omit for the 6h default, null for none)
maxSteps: 20       # optional
maxRetries: 1      # optional

CLI invocation usage

akm doctor metrics usage reports local command attempts, explicit argument counts, argument combinations, failures and duration summaries, and under report what the daily usage report last did for each surface. Existing akm metrics (Deprecated) and bare akm doctor metrics keep their existing report.

akm doctor metrics usage --since 30d --format json
akm doctor metrics usage --cli-version 0.10.261118 --source audit --export --format json

--until selects an inclusive UTC end day. Aggregates select whole UTC days; --since accepts the existing diagnostic date/duration syntax. --export includes retained details. JSON schema version 1 includes stable aggregate keys and invocation IDs. For overlapping exports, keep the newest generatedAt snapshot per aggregate key; never sum snapshots or add detail counts to aggregate counts. Detailed rows are a subset of the aggregates. A report includes its own unfinished attempt. No output carries the store's instance UUID, in a row or in an aggregate key, so exports of different installs cannot be told apart or combined by key.

Collection is enabled at CLI entry, before the full configuration is read (only usage.capture is read, from the selected config file, and a missing or broken file leaves capture on), with no network transmission of its own and no sampling (the separate daily usage report sends counts). AKM_EVENT_SOURCE=user|agent|task|improve|audit supplies known provenance and wins. Without it the source is agent when an agent harness is detected from the environment (the way usage events detect it), user when there is none and a terminal is attached to stdin or stdout, else unknown. When a harness is detected, rows and aggregates also carry its name as an optional harness field (absent otherwise; no schema change). This store never feeds learning or ranking.

Only declared argument identities and recognized command spellings are retained. Free text, paths, URLs, refs, prompts, credentials and unknown flag/command names are redacted. Booleans and declared enum choices are safe; string flags retain only finite allowlisted format, detail and asset type choices. Default values are marked separately from explicit input. Arguments after -- retain only their count. No raw argv is stored. The resolved run asset type is recorded through a narrow hook when resolution reaches dispatch, and show records the type of the asset it showed the same way.

The usage tables (cli_usage_meta, cli_usage_invocations, cli_usage_aggregates) live in metrics.db in the existing AKM data directory, independent of state.db, index.db and learning events; they share no table, PRAGMA user_version or migration ledger with other metrics.db content. Detailed records expire after 30 days on the next invocation. UTC daily aggregates survive detail expiry and must be preserved during upgrades. Collection errors preserve command output and exits; a failed final write leaves an unfinished attempt. Missing/unavailable storage, unrecorded attempts, periods before collection began, direct SDK calls, failures before the CLI module loads, and hard termination remain explicit coverage gaps. SIGKILL cannot run a completion handler. --read-only records nothing; help, version and info are still counted. usage.capture: false in the config file turns capture off (see Configuration). Read-only workspace SDK operations never start CLI collection.

First released in 0.10.261119; the inferred source and the harness field are new in 0.10.261120.