Skip to content
kazma.
ع Star 7 Get Started

CLI Reference

The complete kazma, kazma-tui, and kazma-web command surface, every flag, and working examples — all verified against kazma-cli/ source.


Defined in pyproject.toml:73-76:

CommandModuleWhat it is
kazmakazma_cli.main:mainThe primary CLI (ask, acp, hub, gateway, swarm, project, docs, completion, update).
kazma-tuikazma_tui.app:mainThe Textual TUI dashboard.
kazma-webkazma_ui.app:mainThe FastAPI Web UI server (alias of kazma serve).

Framework note: The top-level kazma command is hand-rolled argv parsing (an if/elif chain over sys.argv[1:] in main.py:39-94) — not Click. Only the kazma hub subtree uses Click (kazma_core/hub/cli.py:104). Global early option --no-banner is stripped before dispatch (main.py:28-32).


kazma
├── (no args) # banner + status + help hint
├── status # probe running server, print versions
├── serve [port] # launch Web UI (uvicorn)
├── ask [options] <prompt> # in-process agent (no uvicorn)
├── acp # ACP JSON-RPC on stdio (Zed / JetBrains)
├── wizard # interactive skill-install wizard
├── hub ... # skill hub (Click group)
├── docs <build|serve> # build/serve the Docusaurus docs site
├── completion ... # shell tab-completion
├── project ... # .kazma/ project config
├── gateway ... # gateway control via REST
├── swarm ... # swarm orchestration via REST
├── update # check/install CLI updates
├── migrate ... # export/verify/import an installation
└── --help | -h | help # print command list

Prints the startup banner, runs config checks, prints status, and a help hint (main.py:35-37). Honors --no-banner.

Probes /api/gateway/status and /api/swarm/status on the running server, prints Python/Kazma versions, config path, and key package versions (main.py:352-439).

Terminal window
kazma status

Launches the Web UI via uvicorn kazma_ui.app:create_app --factory. Default port 8000. Binds 127.0.0.1 normally; switches to 0.0.0.0 only when KAZMA_SECRET is set (main.py:97-114, 110).

Terminal window
kazma serve # 127.0.0.1:8000
kazma serve 9090 # 127.0.0.1:9090
KAZMA_SECRET=xxx kazma serve # 0.0.0.0:8000 (approval endpoints protected)

Security: Never run kazma serve on 0.0.0.0 without KAZMA_SECRET. The HITL approval endpoint would otherwise be unauthenticated.

Runs the interactive skill-installation wizard (kazma_core.cli.wizard.SkillInstallationWizard, main.py:117-123).

Builds or serves the Docusaurus docs site under docs/ (main.py:133-202).

Terminal window
kazma docs build # npm install && npm run build
kazma docs serve # npm run start (default port 3000)
kazma docs serve 4000 # custom port

Runs the LangGraph supervisor in-process (kazma_core.cli.ask). Does not start uvicorn. Tokens stream to stdout; tool lines go to stderr.

FlagMeaning
--workspace, -w PATHWorkspace root (default: cwd)
--yoloAllow danger tools without HITL
--planEnter plan mode (read-only until the model plans)
--jsonNDJSON events on stdout (token / tool_* / hitl / done)
--no-streamWait for the full reply (with --json, a single object)
--thread IDReuse a thread id
--model NAMESwitch model for this process
--acpAgent Client Protocol stdio server (same as kazma acp)

On a TTY, danger tools prompt y/N (or a = allow for this session). Piped stdin / kazma ask - fail closed unless --yolo.

Terminal window
kazma ask "What files define the supervisor graph?"
kazma ask --plan "Add a rate limiter to the API"
kazma ask --json "fix the tests"
echo "summarize README.md" | kazma ask --json --no-stream -

Agent Client Protocol JSON-RPC on stdio (initialize, session/new, session/prompt, session/cancel). Streams session/update (agent_message_chunk, tool_call, tool_call_update) and asks the editor to approve danger tools via session/request_permission. Patch tools send ACP diff content (oldText / newText) so Zed can render a review stack. session/cancel aborts the in-flight turn.

Terminal window
kazma acp
kazma ask --acp --workspace /path/to/repo

Zed — ~/.config/zed/settings.json (Windows: %APPDATA%\Zed\settings.json):

{
"agent_servers": {
"Kazma": {
"type": "custom",
"command": "kazma",
"args": ["acp"]
}
}
}

Open the Agent Panel, pick Kazma, start a thread. Danger tools prompt in the editor (Allow once / Allow for this session / Reject).


Shell tab-completion generation and install (main.py:224-286, completions.py).

SubcommandDescription
kazma completion bashPrint bash completion script.
kazma completion zshPrint zsh completion script.
kazma completion powershell (aliases pwsh, ps)Print PowerShell Register-ArgumentCompleter script.
kazma completion install [shell]Auto-detect shell (PowerShell on win32; zsh/bash on POSIX) and install.
--list-modelsPrint available model names.
--list-providersPrint provider names.

Global flags (for completion data): --model, --provider, --yolo, --verbose, --no-banner, --help, -h.


.kazma/ per-project config (main.py:289-328, project.py).

SubcommandArgsDescription
kazma project init [path]default .Create .kazma/ with rules.yaml, context.md, personality.yaml, tools.yaml, history/. Idempotent.
kazma project show [path]default .Display parsed project config.
kazma project validate [path]default .Verify required files exist, YAML parses, rules.yaml has language and git_branch.

Omnichannel gateway control via REST. All subcommands accept --port N and talk to http://localhost:\{port\} (gateway.py).

Swarm and gateway commands target the server at http://localhost:8000 by default. The port resolves with this precedence:

SourcePriority
--port N (per command)highest
KAZMA_PORT env varmiddle
8000 (default)lowest

If the server is unreachable, the CLI prints Server not running. Start with: kazma serve and exits 1 (see exit codes).

SubcommandEndpointDescription
kazma gateway statusGET /api/gateway/statusAdapter table.
kazma gateway startPOST /api/gateway/startStart gateway.
kazma gateway stopPOST /api/gateway/stopStop gateway.
kazma gateway restartstop + 0.5 s + startRestart gateway.
kazma gateway refreshPOST /api/gateway/refresh-adaptersRe-scan adapters.
Terminal window
kazma gateway status
kazma gateway restart --port 9090

Swarm orchestration via REST (swarm.py). Value flags: --model, --provider, --type, --role, --context, --workers, --aggregation, --page, --page-size, --status, --port, --worker. Bool: --reset.

SubcommandDescription
kazma swarm statusGET /api/swarm/status.
kazma swarm workersList workers.
kazma swarm worker add &lt;name> [--model --provider --type --role]POST /api/swarm/workers.
kazma swarm worker spawn &lt;name> &lt;role> [--model --provider --type]POST /api/swarm/workers/spawn.
kazma swarm worker remove &lt;name>DELETE /api/swarm/workers/\{name\}.
SubcommandtypeDescription
kazma swarm dispatch &lt;worker> &lt;prompt> [--context C]dispatchSingle worker.
kazma swarm broadcast &lt;prompt> [--context C]broadcastAll workers.
kazma swarm consult &lt;prompt> --workers a,b [--context C]consultParallel opinions + synthesis.
kazma swarm pipeline --workers a,b,c &lt;prompt>pipelineOrdered stages + shared blackboard.
kazma swarm fanout --workers a,b &lt;prompt> [--aggregation strategy]fan_outParallel + aggregate.
Terminal window
# Dispatch one task to the "researcher" worker
kazma swarm dispatch researcher "Summarize today's oil prices"
# Fan out to three workers and vote on the result
kazma swarm fanout --workers a,b,c --aggregation vote "Best API design?"
# Run the standard pipeline
kazma swarm pipeline --workers researcher,refiner,builder,validator "Build a CLI tool"
SubcommandDescription
kazma swarm history [--type --status --page --page-size]GET /api/swarm/tasks (paginated).
kazma swarm task &lt;id>GET /api/swarm/tasks/\{id\}.
kazma swarm metrics [--worker W]GET /api/swarm/workers/\{W\}/metrics (or /metrics/all).
kazma swarm start / kazma swarm stopPOST /api/swarm/start / /stop.
kazma swarm approve &lt;task_id>POST /api/swarm/tasks/\{id\}/approve (HITL checkpoint).
kazma swarm reject &lt;task_id>POST /api/swarm/tasks/\{id\}/reject.
kazma swarm circuit-breaker [worker] [--reset]GET /api/swarm/circuit-breakers, per-worker, or POST .../reset.

Primary operator upgrade path (kazma_cli/update.py). Prefer this over a manual git pull on production/git installs. Full guide: Kazma Update.

FlagPurpose
--check / -cDry-run: show available update
--force / -fForce sync even if already latest
--yes / -ySkip confirmation
--reinstall / -rPackages/extras only (repair wiped venv)
--sync-mainCheckout main first (feature-branch safety)
--accept-discard-local-commitsAllow hard-reset when local commits are ahead of origin/main

Auto-detects install type:

  • pip install → PyPI upgrade path.
  • git / monorepo → preflight (main-only) → named stash → hard-reset origin/main → restore stash → reinstall extras → postflight (HEAD + kazma_cli import). Never hard-resets a feature branch in place.
Terminal window
kazma update --check # dry-run
kazma update --yes # apply without prompting
kazma update --reinstall -y # repair packages after a broken reinstall

8. kazma migrate — cross-machine migration

Section titled “8. kazma migrate — cross-machine migration”

Move a full Kazma installation (config, secrets, memory, chat history, snapshots, assets) across machines/OSes without silent breakage. See Migration for the full guide and the three load-bearing invariants (vault pairing, path translation, atomic import).

Terminal window
kazma migrate export [--out PATH] [--no-assets] # create a portable bundle
kazma migrate verify BUNDLE [--no-hash] # check integrity without importing
kazma migrate import BUNDLE [--workspace PATH] [--reset-vault-key] [--dry-run]
SubcommandPurpose
exportBundle the current install into a .zip (SQLite files + Postgres dump + vault + assets)
verifyValidate bundle structure, sha256 hashes, manifest, vault-key fingerprint
importRestore into this machine: staging → path-rewrite → backup → atomic swap

Postgres sources: set KAZMA_DB_CONTAINER so pg_dump is discovered via docker exec. See Migration → Postgres.

Vault-key mismatch: if the bundle’s vault key differs from the target’s, import aborts. Pass --reset-vault-key to overwrite (the existing target vault.db is backed up first).


The only Click-based subtree (kazma_core/hub/cli.py:104). Group options: --registry-path (env KAZMA_HUB_DB, default ~/.kazma/hub/registry.db), --hub-url (env KAZMA_HUB_URL, default https://hub.kazma.ai).

SubcommandDescription
kazma hub register &lt;path>Register a local skill.
kazma hub search [query] [--capabilities --tags --author]Search the registry.
kazma hub install &lt;skill_id>Install a skill.
kazma hub listList installed skills.
kazma hub info &lt;skill_id>Show skill details.
kazma hub validate &lt;path> [--json]Validate a skill manifest.
kazma hub uninstall &lt;skill_id>Remove a skill.
kazma hub submit &lt;path> [--json --source-url]POST to \{hub_url\}/api/v1/skills/submit.
kazma hub status &lt;submission_id> [--json]Submission status.
kazma hub badge &lt;skill_ref> [--json]Show certification badge.
kazma hub certified [--json]List certified skills.
kazma hub stats [--json]Registry stats.
kazma hub check-certification &lt;path> [--json]Check a skill against certification criteria.
kazma hub sign &lt;path> [--secret]HMAC-SHA256 sign the entry-point .py into the manifest. Requires KAZMA_SECRET. See Skills, MCP & Tools.
Terminal window
# Sign a skill (writes checksum + signature into skill_manifest.yaml)
KAZMA_SECRET=... kazma hub sign ./my-skill
# Search and install
kazma hub search "oil pricing" --capabilities mcp
kazma hub install oil-pricing-pro@1.2.0

Launches the Textual TUI (kazma_tui.app:mainKazmaTUI().run()). Tabs: Dashboard, Chat, Files, Traces, Swarm, Settings. Initializes ModelRegistry/SwarmEngine singletons if launched standalone. Includes a HITL approval modal (widgets/hitl_modal.py).

Terminal window
kazma-tui
# or: python -m kazma_tui

Alias for launching the FastAPI Web UI server directly (kazma_ui.app:main). Defaults 127.0.0.1:8000; warns if binding 0.0.0.0 without KAZMA_SECRET (app.py:900-906).

Terminal window
kazma-web

These are typed inside a connected chat (Telegram/Discord/Slack/Web). Defined in kazma-gateway/.../slash_commands.py.

CommandDescription
/helpList commands by category.
/resetClear conversation (handled in graph.py:196).
/statusGateway health overview.
/model or /modelsInteractive model selector (Telegram inline keyboard).
/memoryMemory subsystem stats.
/costToken spend for the session.
/replay list | &lt;iter> | compare &lt;a> &lt;b> | clearTime-travel: list snapshots, restore (rewind), compare diff, clear.
/fork &lt;iter>Branch from a snapshot into a new thread (original stays intact).
/config show | model &lt;n> | personality &lt;n> | memory on|off | tools list | tools toggle &lt;n> | exportConfig wizard.
/personalityDelegate to /config personality.
/contextContext-window token usage.
/undoStub — not implemented.
/editStub — not implemented.
`hitl approvedeny <thread_id>`
/swarmSwarm orchestration (Telegram-registered; interactive handler).

Parity note: /help text omits /hitl and /swarm even though both are functional. Telegram’s setMyCommands registers /swarm but not /hitl. Discord reserves /-prefixed commands for itself, so Kazma receives them as plain text. See Gateways & Platforms.


CodeMeaning
0Success.
1General failure / server unreachable (swarm & gateway commands print Server not running. Start with: kazma serve and exit 1 when the WebUI server is not running — start it first with kazma serve).
2Argument/usage error (Click, kazma hub subtree only).

Swarm and gateway commands are REST clients: they exit non-zero whenever the WebUI server is not running. Always start the server (kazma serve) before invoking them.


  • --help text prints “Kazma CLI v0.2.0” (main.py:75) while pyproject.toml is 0.3.0. Known drift.
  • kazma hub is the only Click subtree. All other commands are hand-rolled argv parsing — flag ordering and --help behavior may be less uniform than a pure-Click CLI.
  • /undo and /edit are stubs (slash_commands.py:257, 267) — present in the menu but explicitly “not yet implemented.”