CLI reference

The kya-os commands and flags for setting up Checkpoint, how --project resolves, and the environment variables and files the CLI reads and writes.

CommandWhat it does
kya-os setupSign in, choose the project, link the repository, and install Detect for the app in this directory
kya-os loginSign in as yourself, in this machine's browser or with --device for a code
kya-os logoutRevoke this machine's sign-in on Checkpoint, then delete it locally
kya-os whoamiWho is signed in, the organization, and the projects the sign-in covers (* marks this repository's)
kya-os projects listThe projects the sign-in covers
kya-os projects use <id or name>Link this repository to a project
kya-os detect installAdd Detect (pixel, beacon, or server SDK) to the app in this directory
kya-os mcp create <name>Scaffold a KYA-OS MCP server for Cloudflare Workers, tied to the linked project, with its own key
kya-os govern install|uninstallReport a coding agent's tool calls in this repository to the project's Activity feed
kya-os checkpoint key set|show|clearStore, check, or remove the project's runtime key (CHECKPOINT_API_KEY) in .env.local
kya-os checkpoint credentials …The management sign-in (status, login, logout, session) and, for owners and admins, runner workload keys, task grants, the organization's own model provider keys (model-keys), legacy delegations and reviewed identity changes
kya-os doctorCheck system health and compatibility
kya-os tuiOpen the interactive terminal UI

kya-os --help and kya-os <command> --help list everything the installed version supports.

setup

FlagEffect
--project <id or name>The project to link. See How --project resolves.
--surface <surface>pixel (default: no key, no dependency), beacon, or sdk (server middleware; mints the app's key if it has none)
--deviceApprove the sign-in from another device with a short code, instead of this machine's browser
--skip-installSign in and link the project; install nothing
--dry-runPrint what would change and change nothing
-y, --yesApply without asking. Without a terminal, nothing is applied unless this is given. --non-interactive is an alias.
--origin <url>The Checkpoint to sign in to. Defaults to CHECKPOINT_API_URL, then https://kya.vouched.id.
--jsonPrint one JSON document on stdout; progress goes to stderr

A live sign-in on the same Checkpoint is reused, so a second run doesn't open the browser. If the project you name isn't part of that sign-in, setup signs in again with it preselected so you can grant it. A name no project has yet is offered on the consent page instead, to create and grant in one step. With nothing named, the offer is this repository's name, and a granted project by that name is linked without asking.

detect install

FlagEffect
--surface <surface>pixel (default), beacon, or sdk
--project <id or name>The project, when this repository isn't linked yet
--dry-runPrint the plan and change nothing
-y, --yesApply without asking
--jsonPrint one JSON document on stdout

Without a sign-in, detect install uses the project you name as given, since the pixel and beacon need only the project ID; it says so. What it writes:

Stackpixelbeaconsdk
Next.js, App Router<Script> before </body> in the root layout, plus its importthe package, a 'use client' component, mounted in the layoutthe package, then proxy.ts (Next.js 16+) or middleware.ts at the root or in src/
Next.js, Pages Routera script tag before </Head> in _documentthe package, plus the line to add to your client entryas App Router
Vite SPA, static site, SvelteKitthe loader before </head> in index.html or src/app.htmlthe CDN script tag before </head>none; use the pixel or the Gateway
Express 4printed, for the HTML you renderthe package, plus the line to addthe package, plus the mount lines to add
Express 5printedthe package, plus the line to addrefused: the SDK's peer dependency is Express 4
ASP.NET Core (net8.0+)printed, for _Layout.cshtmlprinteddotnet add <project> package KyaOs.Checkpoint, plus the Program.cs lines to add
.NET Framework 4.6.2 to 4.8.1printed, for _Layout.cshtmlprintedthe Web.config settings and module to add
Java 21+ (Maven, Gradle)printed, for your page templateprintedthe dependency to add; below Java 21 it's refused

With --surface sdk and no CHECKPOINT_API_KEY in the app's .env.local or .env, a signed-in detect install offers to mint the app's key. It asks first; --yes skips the prompt, and a dry run only says it would. It adds the env file to .gitignore, then mints a key named kya-os CLI · sdk · <host> - <repository>, returned once, with read permission, and writes it to .env.local (Next.js) or .env (Express). The plan's API key limit applies, as it does to dashboard keys. ASP.NET and Java keep their key in their own secret store, so there the CLI prints where it goes.

Existing files only ever gain one block, marked Checkpoint Detect. A file that already has it is left alone, so a second run changes nothing. An existing middleware.ts or proxy.ts is never overwritten; the lines to compose into it are printed instead. A failed package install stops the run before anything that imports the package is written.

login, logout, whoami, projects

CommandFlags
kya-os login--device, --project <id or name> (an ID is preselected on the consent page; a new name is offered for creation), --origin <url>, --json
kya-os logout--json. Revokes the session on Checkpoint first; if Checkpoint can't confirm, the local copy is kept.
kya-os whoami--json. Exits non-zero when nobody is signed in.
kya-os projects list--json
kya-os projects use <id or name>--json. Writes .kya-os/project.json where the nearest link already is, otherwise at the repository root.

The sign-in is a management session for a person. It lists your projects and links repositories to them, and Checkpoint's runtime API refuses it, so it can never stand in for an app's API key. Access tokens last 15 minutes and renew silently; the session ends after 30 days without use, and after 90 days regardless. On Linux the session needs a Secret Service keyring (GNOME Keyring or KWallet); see Troubleshooting for machines without one.

mcp create

kya-os mcp create <name> runs @kya-os/create-mcpi-app for Cloudflare Workers, the runtime that pulls per-tool protection from Checkpoint. It's pre-filled with the linked project and your repository's package manager, and runs with no prompts. When you're signed in, it then mints the server's key (read and write, for proofs and tool discovery) into the new server's gitignored .dev.vars. The key never goes on the scaffolder's command line.

FlagEffect
--project <id or name>The project, when this repository isn't linked yet
--skip-installScaffold without installing the server's dependencies
--dry-runPrint the scaffolder command and run nothing
-y, --yesMint the server's key without asking
--no-keyScaffold without minting a key
--jsonPrint one JSON document on stdout

Without a terminal, pass --yes or --no-key: the key is decided before anything is scaffolded, so a server is never left half set up. The scaffolder needs Node.js 22.12 or newer.

Then run it locally with npm run dev (the CLI prints your package manager's form). Before the first npm run deploy, sign wrangler in once with npx wrangler login, then upload the server's secrets, the key among them, with npx wrangler secret bulk .dev.vars.

govern

kya-os govern install --agent claude adds a Claude Code PostToolUse hook to this repository. After every tool call, Claude Code runs kya-os hook post in the background, and the call appears in the project's Activity feed as an observed verdict. Nothing is blocked.

  • Sent: the tool's name, the session, and the call's ID. The tool's input and output are never sent, since they can hold file contents and secrets.
  • Never in the way: the hook runs asynchronously, gives up after three seconds, and exits 0 on any failure.
  • Key: the project's read-only runtime key, read from the repository's gitignored .env.local or .env. If the key is only in your shell's CHECKPOINT_API_KEY, install saves it to .env.local, because the hook runs inside Claude Code, which may not see your shell. When there's no key and you're signed in, install mints one.
  • Origin: the hook reports only to the Checkpoint it was installed for (hook post --origin …), so a later edit to the committed link can't redirect the key.
FlagEffect
--agent claudeThe agent to hook (Claude Code)
--scope localDefault. .claude/settings.local.json: you only, gitignored, pinned to this binary
--scope project.claude/settings.json: everyone who clones the repository, so each needs kya-os on their PATH
--scope user~/.claude/settings.json: every repository you open; reports only from linked ones
--dry-run, --yes, --jsonAs for setup

Your other hooks and settings are kept, and a second install changes nothing, unless the hook points at another Checkpoint or another kya-os binary: then it's replaced, and the state is updated. kya-os govern uninstall --scope <scope> removes only the kya-os hook.

How --project resolves

Every command that needs a project takes the first of:

  1. the --project flag;
  2. the KYA_OS_PROJECT environment variable;
  3. the nearest .kya-os/project.json, from the current directory up to the repository root;
  4. the only project the sign-in covers.

A value matches a project by ID, or by exact name, ignoring case. A name shared by several projects is refused with the list of matches, and with several projects and nothing selected, setup asks, offering a new project too (or, without a terminal, lists them and stops). Only a project ID preselects a project on the consent page; any other value is matched there by name, or offered as the name of a new project.

Environment variables

VariableEffect
KYA_OS_PROJECTSelects the project, after --project
CHECKPOINT_API_URLThe Checkpoint origin the CLI signs in to (default https://kya.vouched.id). The CLI reads it from its own environment; the SDK setting of the same name lives in your app's env file.
MCPI_CHECKPOINT_CONFIG_PATHWhere the CLI keeps its sign-in metadata (default ~/.mcpi/checkpoint.json)

The installer's own variables are on Installation.

Files

FileWhereHoldsCommit it?
.kya-os/project.jsonyour repositoryThe project link: origin, organization, project ID and name. No secret.Yes
.env.local or .envyour appCHECKPOINT_API_KEY and CHECKPOINT_PROJECT_ID, written by detect install --surface sdk (a minted key) or kya-os checkpoint key setNever
~/.mcpi/checkpoint.jsonyour home directorySign-in metadata. The tokens themselves are in the OS keychain: Keychain on macOS, the Secret Service on Linux.Not in a repository
~/.kya-os/bin/kya-osyour home directoryThe CLI, from the curl installerNot in a repository
.claude/settings.local.jsonyour repositoryThe govern hook, with --scope localNever (gitignored)
<server>/.dev.varsa server from mcp createThe server's CHECKPOINT_API_KEY for wrangler devNever (gitignored)
.kya-os/project.json
{
  "schema": "kya-os.project-link.v1",
  "origin": "https://kya.vouched.id",
  "organizationId": "5b1f3a9e-…",
  "projectId": "9c2d7e41-…",
  "name": "acme-web"
}

A link that names another Checkpoint origin (staging, a local server) is ignored, with a message, rather than resolved against the wrong one.

JSON output

With --json, a command prints one JSON document on stdout, and progress, prompts, and package-manager output go to stderr. setup reports the link and what Detect did:

{
  "origin": "https://kya.vouched.id",
  "signedInNow": true,
  "organizationId": "5b1f3a9e-…",
  "project": { "id": "9c2d7e41-…", "name": "acme-web" },
  "link": { "path": "/home/me/acme-web/.kya-os/project.json", "state": "written" },
  "detect": {
    "status": "applied",
    "report": {
      "surface": "pixel",
      "outcomes": [{ "outcome": "applied", "description": "edit app/layout.tsx (before </body>)" }],
      "notes": ["…"]
    }
  }
}
FieldValues
link.statewritten, unchanged, wouldWrite (dry run)
detect.statusapplied, planned (dry run), needsConfirmation (no terminal and no --yes), declined, skipped (--skip-install)
runtimeKeyPresent when a key was minted: its keyId, name, preview, and the file it was written to. Never the key.
detect.report.outcomes[].outcomeapplied, alreadyPresent, skipped, manual (with a title and snippet to add by hand), failed (with an error)

Exit codes

CodeMeaning
0Success, including a dry run
1An error: a failed step, a run that installed nothing, a plan left unapplied because there was no terminal and no --yes, a project that doesn't resolve, or nobody signed in (whoami, projects)
2A usage error: an unknown flag or a missing argument