kami CLI
kami (Knowledge Agent Markdown Interface) — a local-first personal knowledge base CLI. Manages articles as Markdown files with YAML frontmatter.
Rules for agents
- •Always use
--jsonflag to get structured output - •Use
--force --jsonfor delete (avoids interactive prompt) - •Pipe body content via
--body -with stdin - •Check
error.codein JSON on failure (see reference/error-codes.md) - •When creating articles, always provide an explicit URL-safe slug using
--slug. Use only ASCII lowercase letters, numbers, and hyphens (e.g.,--slug "my-article-title"). Never use non-ASCII characters, spaces, or special characters in slugs.
Scopes
| Scope | Path | Purpose |
|---|---|---|
| global | ~/.kami/ | User-wide shared knowledge |
| local | ./.kami/ | Project-specific knowledge |
- •Read: local-first, falls back to global
- •Write: local if exists, otherwise global
- •
--scope allspans both scopes
Commands
Article CRUD
# Create kami create <title> [-f <folder>] [-t <tag>]... [-T <template>] [--slug <slug>] [-b <path|->] [--draft] [-s local|global] [--json] # Read kami read <slug> [-m|--meta-only] [--no-frontmatter] [-s <scope>] [--json] # Edit (--body: replace body, --append: append to body. Cannot use both) kami edit <slug> [--title <t>] [--add-tag <tag>]... [--remove-tag <tag>]... [-b <path|->] [-a <path|->] [--draft <bool>] [--add-alias <a>] [--remove-alias <a>] [-s <scope>] [--json] # Delete kami delete <slug> [-F|--force] [-s <scope>] [--json]
List and search
# List kami list [-f <folder>] [-t <tag>]... [--sort created|updated|title] [--order asc|desc] [-n <limit>] [--offset <num>] [-s local|global|all] [--draft <bool>] [--json] # Full-text search (BM25, Japanese-aware, prefix and fuzzy matching) kami search <query> [-t <tag>]... [-f <folder>] [-s local|global|all] [-n <limit>] [--json]
Links
kami links <slug> [-s <scope>] [--json] # Forward links kami backlinks <slug> [-s <scope>] [--json] # Backlinks
Templates
kami template list [-s <scope>] [--json] kami template show <name> [-s <scope>] [--json] kami template create <name> [-b <path|->] [-s <scope>] [--json]
Other
kami export <slug> [-F md|html] [-o <path>] [-s <scope>] kami reindex [-s local|global|all] [--json] kami init [--force] # Create .kami/ in current directory
JSON output structure
Success: { "ok": true, "data": { ... }, "error": null }
Error: { "ok": false, "data": null, "error": { "code": "...", "message": "..." } }
Exit codes
0=success, 1=general error, 2=article not found, 3=ambiguous slug, 4=hook blocked
Wiki links
Use [[slug]] in article body to reference other articles. [[global:slug]] / [[local:slug]] for explicit scope. [[slug|display text]] for custom display text.
Reference
- •JSON output examples — Response examples for each command
- •Article format — Frontmatter spec, slug resolution, template variables
- •Error codes — Exit codes and JSON error codes