# CLI & Install


This section is the reference for the `kli` program and how it gets onto your
machine.

## The `kli` command

`kli` dispatches on its first argument. Some tokens are subcommands; anything
else starts the terminal app.

| Invocation | Effect |
|---|---|
| `kli` | Start the interactive terminal app in the current directory. |
| `kli version` (`--version`, `-V`) | Print the version line and exit. |
| `kli update` | Update kli in place from a published release. |
| `kli docs` | Print kli documentation, fetched live from the docs site. |
| `kli mcp-serve <id>` | Serve a named extension's tools to an MCP client over stdio. |
| `kli install <url> <git-tree-sha1>` | Install an extension from a URL, pinned to its git object id. `--yes` confirms without prompting. |
| `kli help` (`--help`, `-h`) | Print usage and exit. |
| `kli <flags…>` | Any other arguments start the app with the flags passed through. |

Flags the app understands include `--profile <name>`, `-c` / `--continue`
(resume the most recent stored session), and `--extension <path>` (load an extra
extension on boot; repeatable). A fatal error exits with status `2`.

`kli --print-authority` is a one-shot introspection flag: it prints the
capabilities a session would hold under the resolved profile, then exits without
running an agent. `--profile <name>` inspects another profile, `--read-only` and
`--no-bash` preview the narrowed authority those flags produce, and `--json` emits
one object. Use it to size the confinement you run kli inside — see [Security
model and sandboxing](/kli/concepts/security-model-and-sandboxing).

`kli install <url> <git-tree-sha1>` installs a remote extension without a running
session: it verifies the pinned bytes and places them durably for the next
launch, exiting `0` on success, `2` on a malformed invocation, and `3` on a
refusal or verification failure. The declared extension id prints to stdout. This
is the headless form of the in-session `/install`; both are covered in [Sharing
extensions](/kli/extend/sharing-extensions), and the publishing side in
[Publishing extensions](/kli/extend/publishing-extensions).

## Pages

- [Installation](/kli/cli/installation) — the install one-liner, the variables
  that steer it, the on-disk layout, supported targets, and the Nix and
  from-source routes.
- [Reading the docs](/kli/cli/docs) — the `kli docs` subcommand: print the docs
  index, any page, or a search straight from your terminal.
- [Environment variables](/kli/cli/environment-variables) — every variable kli
  and its installer read.
