UNPKG

akm-cli

Version:

akm (Agent Knowledge Manager) — a portable, local-first capability library for AI agents. Discover, load, share, and improve reusable skills, scripts, workflows, and knowledge across any shell-capable coding agent, including Claude Code, OpenCode, and Cur

99 lines (75 loc) • 3.97 kB
# Recipe: Headless Install A precise, no-prompts sequence for automated or agent-driven setup of `akm` — no interactive wizard, no assumed defaults. ```sh #!/usr/bin/env bash set -euo pipefail # 1. Install (standalone binary, runtime-free) curl -fsSL https://github.com/itlackey/akm/releases/latest/download/install.sh | bash export PATH="$HOME/.local/bin:$PATH" # a non-root install lands in ~/.local/bin (or pass --system) # 2. Initialize the bundle directory and accept all defaults (no prompts) akm setup --yes # 3. Semantic search is off by default. Set the mode explicitly so the script # behaves the same on every host. `auto` uses local embeddings (the model # is downloaded from Hugging Face on the first index run unless you # configure a remote embedding endpoint); `off` skips them entirely. akm config set semanticSearchMode auto # 4. Add sources (adjust paths as needed) akm bundle add /path/to/skills # 5. Build the search index (downloads the embedding model on first run if # semantic search is enabled) akm index # 6. Verify akm doctor info akm search "test" # 7. Install agent guidance akm hints >> AGENTS.md echo "akm setup complete" ``` ## Notes on each step **Install.** The standalone binary (step 1) is runtime-free. The npm package (`npm install -g akm-cli`, or one-shot via `npx akm-cli <command>`) requires Node.js >= 22.15; a working Bun >= 1.0 is optional and preferred for execution after Node starts the package launcher. **Setup.** `akm setup --yes` takes the detected default for every question: each agent program found on `PATH` is enabled and the first is the default. When akm can limit that program to reading and searching it takes akm's own model calls too; otherwise a local model server setup finds becomes the connection. To give akm an endpoint yourself, answer the question with a flag; the key is named by the environment variable that holds it and never appears on the command line: ```sh akm setup --yes --endpoint https://api.example.com/v1 --api-key-env EXAMPLE_API_KEY ``` `--no-probe` keeps the run offline: nothing is contacted or downloaded (the endpoint's model list is not fetched, so a new connection has no model until `akm models set` names one). For the full set of flags, see `akm setup --help`; for the config they write, see [configuration.md](../../reference/configuration.md). **Semantic search.** `--embedding local` chooses the built-in embedder, offered on Linux x64 (glibc) and Apple-silicon macOS; elsewhere it warns and keeps keyword search. Once the config is saved, a headless setup (`--yes` or `--from`) downloads the embedder's runtime and model into akm's cache and reports `semanticAssets` in its result (`ready`, `blocked: <reason>`, or `skipped` with `--no-probe`, which leaves the download to the first `akm index`). Without the flag, semantic search stays as the config has it (`off` by default): ```sh akm setup --yes --embedding local # local embeddings, downloaded now akm config set semanticSearchMode off # skip embeddings entirely ``` For resource requirements and remote-embedding alternatives, see [configuration.md](../../reference/configuration.md). **Add source.** `akm bundle add <path|github:owner/repo|@scope/package>` registers a directory or package as a source. Add every source before indexing. **Index and verify.** `akm index` builds the search index; `akm doctor info` reports `indexStats.entryCount` and `semanticSearch.status`; `akm search "<query>"` confirms retrieval actually returns results. **Install agent guidance.** `akm hints >> AGENTS.md` appends the canonical usage block agents need to discover and use the library. Run this after indexing so the guidance matches the installed version. ## See also - [configuration.md](../../reference/configuration.md) — full configuration key reference - [docs/agents/agent-install.md](../../agents/agent-install.md) — agent-facing entry point that links here