@kivacore/cli
v1.1.0
Published
KIVA API CLI
Readme
@kivacore/cli
KIVA API CLI.
CLI state files are stored under the active .kiva/ scope.
- Local default:
./.kiva/ - Global override:
~/.kiva/via-g/--global
Tenant OpenAPI files are stored under <settings-root>/tenans/<tenantId>/openapi.json.
Pi agent state for kiva work and kiva code is stored under <settings-root>/pi/.
Knowledge-graph caches and vector indexes are stored under <settings-root>/knowledge/<workspace-hash>/.
Tracked repo knowledge lives in kiva/knowledge/.
Installation
npm install -g @kivacore/clior
pnpm add -g @kivacore/cliUpdating
kiva update # install the latest published version
kiva update --check # only report whether a newer version existsIn a terminal, an outdated kiva asks to update before running a command and
does not continue until it is up to date. Agents, scripts and CI only get a
one-line notice on stderr. Set KIVA_SKIP_UPDATE_CHECK=1 to skip the check.
Start with a prompt
Type what you want straight after kiva and an agent opens with it as the
first message, already sent:
kiva "summarize what changed in this repo this week" # Work Agent
kiva "create a purchasing management app for my company" # Coding AgentKiva picks the agent from the prompt: the Coding Agent when it asks to build or
change software, the Work Agent for everything else, and whenever you are
logged out or the choice cannot be made within a few seconds. To choose
yourself, name the agent: kiva work "<prompt>" or kiva code "<prompt>".
The same options apply (kiva --thinking high "..."). The prompt must be
quoted: a single word is still read as a command.
AI provider for kiva work and kiva code
Once you are logged in (kiva auth login), both agents run on the Kiva AI
Gateway out of the box: no AI provider account or API key is needed. If you
have already set up your own provider it keeps working, and you can switch
between it and the gateway with the model picker. A Z.AI key of your own is
always used as-is instead of the gateway.
Agent skills
The Kiva skills for coding agents live in
kivacore/agent-skills and are
installed per folder. kiva work, kiva code, kiva server,
kiva apps clone and kiva apps create --local-development offer to install
them when the folder has none, and to update them when they are out of date.
kiva agent-skills status # installed? current?
kiva agent-skills install # install into this folder
kiva agent-skills update # bring them to the latest versionAuthentication
Login with explicit client ID:
kiva auth login --clientId "<your-client-id>"After a successful login, the client ID is saved in ~/.kiva/config.json and reused by default.
Logout active account:
kiva auth logoutWork with accounts and tenants:
kiva auth accounts list --json
kiva auth accounts use --userId "<user-id>" --json
kiva auth tenants list --userId "<user-id>" --json
kiva auth tenants use "<tenant-id-uuid-or-tenant-no>" --userId "<user-id>" --jsonEnvironments
The CLI ships with four built-in environments — live, beta, alpha, and dev
(aliases: prod → live, local-development → dev). Switch between them with
kiva env use <id|name>.
You can also register your own environments to target self-hosted / on-premise Kiva deployments:
kiva env list # built-ins + custom (builtIn flag)
kiva env add acme --url https://kiva.acme.internal --name "Acme"
kiva env use acme
kiva env update acme --url https://new.acme.internal # change url and/or --name
kiva env remove acme # if active, falls back to liveNotes:
The four built-ins are read-only — you can't add over, update, or remove them.
Custom environments are saved in the active settings scope. For a machine-wide environment, add it globally so every project sees it:
kiva -g env add acme --url https://kiva.acme.internalIf your on-premise server uses a self-signed or internal-CA certificate, trust the CA the standard Node way — no insecure flag is needed:
NODE_EXTRA_CA_CERTS=/path/to/internal-ca.pem kiva env use acme
Help
kiva # active environment + command overview
kiva --help
# Environment, auth, and account
kiva env --help
kiva auth --help
kiva account --help
# AI agents
kiva work --help # Work Agent (interactive pi assistant)
kiva code --help # Coding Agent
# Data, schema, and query
kiva ds --help
kiva dsql --help
kiva studio --help
kiva discover --help
# Apps, automations, and custom agents
kiva apps --help
kiva automation --help
kiva agent --help # custom-agent CRUD for an app
kiva acl --help
kiva messaging --help
# Integrations, knowledge, and releases
kiva connect --help
kiva knowledge --help
kiva project-plan --help
kiva release --help
# Tools and runtime
kiva browser --help
kiva server --help
kiva curl --helpBrowser Automation
Browser automation via a persistent daemon that holds a raw CDP (Chrome DevTools Protocol) WebSocket connection. Works in both local mode (Chrome on :9222) and remote sandbox mode (Cloudflare Browser Rendering).
The daemon starts automatically on the first command and stays alive for 5 minutes of idle time. All commands share the same browser connection.
# Session
kiva browser start # Start Chrome + daemon
kiva browser start --profile # Start with user's Chrome profile
kiva browser close # Stop daemon
# Navigation
kiva browser nav <url> # Navigate active tab
kiva browser nav <url> --new # Open in new tab
# Waiting
kiva browser wait --idle # Wait for network idle
kiva browser wait --selector "h1" # Wait for element to appear
kiva browser wait --url "**/dashboard" # Wait for URL pattern
kiva browser wait 2000 # Fixed delay
# Page snapshot and interaction
kiva browser snapshot # Interactive elements with refs (@e1, @e2, ...)
kiva browser snapshot --all # Include non-interactive elements
kiva browser click @e3 # Click by ref
kiva browser click 350 200 # Coordinate click (compositor-level)
kiva browser fill @e1 "value" # Clear + type into input
kiva browser select @e4 "Option" # Select dropdown option
# Inspection
kiva browser eval 'document.title' # Evaluate JavaScript
kiva browser screenshot # Viewport screenshot
kiva browser screenshot --full --base64 # Full page as base64
kiva browser info # URL, title, viewport, scroll
kiva browser console --level error # Console messages
kiva browser network --method POST # Network requests
kiva browser cookies --name "session" # Cookies
kiva browser content <url> # Extract readable markdown
kiva browser tabs # List/switch tabs
# CDP scripts
kiva browser run-script script.js # Run custom CDP scriptKnowledge Graph
Initialize and use the repo knowledge graph:
kiva knowledge init
kiva knowledge generate-initial
kiva knowledge refresh
kiva knowledge locate "Working Agreement" --json
kiva knowledge section "knowledge#Working Agreement" --json
kiva knowledge refs "knowledge#Working Agreement" --json
kiva knowledge search "how should agents use this repo?" --json
kiva knowledge expand "Read [[Working Agreement]] before editing" --json
kiva knowledge check --json
kiva knowledge config --jsonProject Plan
The project plan is a repo-tracked work graph stored at kiva/project-plan/project-plan.json. It organizes work into phases, features, and tasks. A derived PROJECT_PLAN.md is always kept in sync. Features are also synced into the knowledge base features document when it exists.
Manage phases, features, and tasks:
kiva project-plan show --json
kiva project-plan check --json
kiva project-plan ensure --json
kiva project-plan summary --json
kiva project-plan config --json
# Token-efficient slices (prefer over `show` for large plans)
kiva project-plan list-phases --json
kiva project-plan list-features --json
kiva project-plan list-tasks --status planned --limit 5 --json
kiva project-plan list-tasks --status in_progress --json
kiva project-plan list-tasks --phaseId "<phase-id>" --featureId "<feature-id>" --includeSummary true --json
# Phases
kiva project-plan upsert-phase --title "Core Features" --json
kiva project-plan upsert-phase --title "Testing" --slug "testing" --summary "Test coverage" --json
# Features
kiva project-plan upsert-feature --phaseId "<phase-id>" --title "Auth Flow" --json
kiva project-plan upsert-feature --phaseId "<phase-id>" --title "Data Export" --slug "data-export" --summary "CSV and JSON export" --json
# Tasks
kiva project-plan upsert-task --featureId "<feature-id>" --title "Implement OAuth2" --type new-implementation --assignee agent --json
kiva project-plan upsert-task --featureId "<feature-id>" --title "Fix token refresh" --type bug-fix --assignee agent --status in_progress --json
kiva project-plan get-task --taskId "<task-id>" --json
kiva project-plan set-task-status --taskId "<task-id>" --status done --json
kiva project-plan set-order --phaseId "<phase-id>" --order 1 --json
# Linked local subtasks
kiva project-plan create-linked-todo --taskId "<task-id>" --json
kiva project-plan create-linked-todo --taskId "<task-id>" --title "Step 1" --body "Details" --jsonTask types: new-implementation, bug-fix, api-test, browser-automation-test, work
Assignees: agent, user
Statuses: planned, in_progress, blocked, done
Release
Create versioned releases with changelog generation:
kiva release status --json
kiva release new-version --json
kiva release new-version --bump major --json
kiva release new-version --version 2.0.0 --json
kiva release new-version --dryRun --json
kiva release new-version --skipChangelog --skipTag --json
kiva release new-version --skipGithubRelease --jsonThe new-version command bumps the version in package.json, generates a categorized changelog from commit history, creates a git tag, and optionally publishes a GitHub release via gh.
Data Sources
Query data source items:
kiva ds list base task --columns "id,name,status" --limit 10 --orderBy "created_on desc" --jsonCreate, update, delete data source items:
kiva ds create base task --data '{"name":"My Task","status":"open"}' --json
kiva ds update base task "<record-id>" --data '{"status":"done"}' --json
kiva ds delete base task "<record-id>" --jsonAdd comments and file attachments to a record:
kiva ds comments create base task "<record-id>" --message "Looks good" --json
kiva ds files upload base task "<record-id>" --file ./contract.pdf --jsonBatch create/update (max 50 items) and file input (--from-file supports .json and .csv):
kiva ds create base task --data '[{"name":"Task 1"},{"name":"Task 2"}]' --json
kiva ds update base task --data '[{"id":"1","status":"done"},{"id":"2","status":"open"}]' --json
kiva ds create base task --from-file ./tasks.csv --json
kiva ds update base task --from-file ./tasks-update.json --jsonDSQL (Logical SQL)
Run read-only logical SQL against your data sources, generate queries from natural language, inspect schemas, and manage saved custom queries.
kiva dsql query "<sql>" --json
kiva dsql generate "open tasks assigned to me" --json
kiva dsql ask "how many tasks are open?" --json
kiva dsql schema app base --json
kiva dsql schema data-source base task --json # lists each enum field's option ids and labels; --no-expand-enums omits them
kiva dsql schema app base --expand-enums --json
kiva dsql list-custom-query --appSlug base --json
kiva dsql create-custom-query --appSlug base --name "Open Tasks" --dsqlQuery "<sql>" --fields '<json>' --json
kiva dsql run-custom-query --queryId "<id>" --jsonOpenAPI Discovery
Download current tenant OpenAPI spec:
kiva discover api --jsonDiscover from downloaded tenant OpenAPI spec:
kiva discover namespaces --json
kiva discover path /v1/users --json
kiva discover endpoint /v1/users/me --json
kiva discover endpoint [PUT]/v1/users/me/photo --json
kiva discover entity UserEntity --json
kiva discover search users,UserEntity --jsonConnectors
kiva connect list-connectors --json
kiva connect get-connector <slug> --json
kiva connect get-action <slug> <actionKey> --json
kiva connect list-connections <slug> --json
kiva connect curl <slug> <endpoint> --json
kiva connect run-action <appSlug> <actionKey> --jsonApps and Studio
List and manage apps:
kiva apps list --json
kiva apps list-api-clients --json
kiva apps list-api-clients --appSlug "<app-slug>" --json
kiva apps delete --appId "<app-id>" --json
kiva apps restore --appId "<app-id>" --jsonManage dev studio data sources, fields, and enums:
kiva studio list-data-sources --appSlug base --expand fields --json
kiva studio get-data-source --appSlug base --dataSourceSlug task --json
kiva studio create-data-source --appSlug base --title "Tasks" --name "task" --slug "task" --json
kiva studio update-data-source --appId "<app-id>" --dataSourceId "<data-source-id>" --data '{"title":"Tasks v2"}' --json
kiva studio delete-data-source --appId "<app-id>" --dataSourceSlug "task" --json
kiva studio bulk-create-data-sources --appId "<app-id>" --from-file ./data-sources.json --json
kiva studio list-fields --appSlug base --dataSourceSlug task --json
kiva studio get-field --appSlug base --dataSourceSlug task --fieldSlug status --json
kiva studio create-field --appId "<app-id>" --dataSourceId "<data-source-id>" --name "Status" --slug "status" --type "text" --json
kiva studio update-field --appId "<app-id>" --dataSourceId "<data-source-id>" --fieldId "<field-id>" --data '{"name":"Stage"}' --json
kiva studio delete-field --appId "<app-id>" --dataSourceId "<data-source-id>" --fieldSlug "status" --json
kiva studio create-fields-batch --appId "<app-id>" --dataSourceId "<data-source-id>" --data '[{"name":"Priority","slug":"priority","type":"text"}]' --json
kiva studio update-fields-batch --appId "<app-id>" --dataSourceId "<data-source-id>" --from-file ./fields-update.json --json
kiva studio delete-fields-batch --appId "<app-id>" --dataSourceId "<data-source-id>" --data '["field-1","field-2"]' --json
kiva studio list-enums --appId "<app-id>" --dataSourceId "<data-source-id>" --fieldId "<field-id>" --json
kiva studio create-enums --appId "<app-id>" --dataSourceId "<data-source-id>" --fieldId "<field-id>" --data '[{"name":"Open","sortOrder":1}]' --json
kiva studio update-enums --appId "<app-id>" --dataSourceId "<data-source-id>" --fieldId "<field-id>" --from-file ./enums-update.json --json
kiva studio delete-enums --appId "<app-id>" --dataSourceId "<data-source-id>" --fieldId "<field-id>" --data '["enum-1","enum-2"]' --jsonTenant-wide search across data sources (returns { data, meta: { total, limit, offset } }):
# Fields, with multi-value filters and keyword
kiva studio search-fields --keyword email --json
kiva studio search-fields --dataSourceId "<id1>,<id2>" --type field-text,field-textarea --limit 50 --json
kiva studio search-fields --keyword status --offset 100 --limit 50 --json
# Enums, joined with data source / field / enum set
kiva studio search-enums --dataSourceId "<data-source-id>" --json
kiva studio search-enums --enumSetId "<enum-set-id>" --json
kiva studio search-enums --fieldId "<field-id>" --limit 200 --json
# Enum sets
kiva studio search-enum-sets --limit 50 --offset 0 --jsonAutomations
Manage an app's automations and their triggers (trigger --type values are
kebab-case, e.g. record-created, recurrence, webhook).
kiva automation list --appSlug base --json
kiva automation get --appId "<app-id>" --automationId "<id>" --json
kiva automation create --appSlug base --from-file ./automation.json --json
kiva automation create-trigger --appSlug base --automationId "<id>" --type record-created --json
kiva automation delete-trigger --appSlug base --automationId "<id>" --triggerId "<id>" --jsonCustom Agents
CRUD for an app's custom agents and their sub-resources (models, tools, data sources,
deployments, and more). Run kiva agent --help for the full resource list.
kiva agent list --appSlug base --json
kiva agent create --appSlug base --name "Support Bot" --skillName "support" --json
kiva agent tools create --appSlug base --agentId "<id>" --toolType "<type>" --json
kiva agent deployments list --appSlug base --agentId "<id>" --jsonAccess Control
Manage tenant roles, role queries, and user hierarchy units.
kiva acl roles list --json
kiva acl roles create --slug "<slug>" --name "<name>" --json
kiva acl role-queries list --json
kiva acl hierarchy-units list --json
kiva acl hierarchy-units create --name "<name>" --jsonMessaging
Inspect tenant email accounts (non-credential info) and send email through them.
kiva messaging accounts --json
kiva messaging email send --accountId "<id>" --jsonAccount
Manage tenant brands, your own user profile, and tenant regional preferences.
kiva account brands list --json
kiva account brands create --name "<name>" --json
kiva account user-profile get --json
kiva account user-profile update --firstname "<name>" --json
kiva account tenant-preferences get --json
kiva account tenant-preferences update --timeZone "<id>" --jsonRaw API Access
kiva curl /users/me -i --json
kiva curl /dev/apps --jsonAgent Server
Start the agent HTTP server:
kiva server
kiva server --port 4000
kiva server --profile agent
kiva server --model anthropic/claude-sonnet-4-20250514 --thinking high
kiva server --auth "<bearer-token>"
kiva server --apiKey "<key>" --provider azureThe server exposes REST endpoints for chat, models, knowledge, project-plan, release, files, and dev environment management. It also attaches a WebSocket PTY terminal at WS /api/terminal for interactive shell access.
For full endpoint documentation see docs/API.md.
Pi Agent and Coding Agent
Launch the scoped pi assistant and coding agent:
# Interactive TUI
# First interactive launch opens the KIVA onboarding wizard if no provider is configured yet.
kiva work
kiva code
# Interactive TUI with an initial prompt
kiva work "Inspect the active tenant and list apps"
kiva code "Add a command to list my team dashboards"
# One-shot mode
kiva work --print "Which tenant am I using?"
kiva code --print --mode json "Summarize the CLI command surface in this repo"Built-in Agent Tools
When kiva/knowledge/ exists, kiva work, kiva code, and kiva server load built-in knowledge tools:
kiva_knowledge_searchkiva_knowledge_sectionkiva_knowledge_locatekiva_knowledge_refskiva_knowledge_expandkiva_knowledge_check
When kiva/project-plan/project-plan.json exists, the agents use project-plan CLI commands (kiva project-plan show, set-task-status, create-linked-todo, etc.) to read and update the canonical work graph.
The todo tool is always available with actions: list, list-all, get, create, update, append, delete, claim, release.
Slash Commands
Inside the interactive agent TUI:
/login # browser or API-key provider chooser
/logout # remove saved provider configuration
/plan [task] # start a planning-only branch and keep the current plan in .kiva/plans/
/end-plan # leave the planning branch, summarize it, and return to the original branch
/plan-policy # show the effective planning-model policy and the resolved planning model
/read-only # enter read-only mode — write and edit tools are disabled
/end-read-only # exit read-only mode and resume normal operation
/tasks # browse the canonical project-plan phases, features, and tasks
/todos # interactive todo manager
/souls # list available agent "souls" (communication styles)
/soul <id> # switch the agent's soul (e.g. caveman, master-yoda, pirate) — takes effect next sessionSouls
A "soul" is a style-only prompt overlay that changes how the agent talks without changing what it does. Tool usage, Kiva CLI rules, and structured (--json) output are always preserved; souls only affect narrative prose.
Select a soul inside the pi agent (kiva work / kiva code) with /soul <id> and list available souls with /souls. The selection is persisted in <settings-root>/config.json (same scope as environment/auth) and takes effect on the next agent session.
Over HTTP (kiva server):
curl http://localhost:3111/api/souls
curl -X POST http://localhost:3111/api/souls/select \
-H 'content-type: application/json' \
-d '{"soulId":"pirate"}'Full server API reference for Soul, MCP, and Skill endpoints: docs/server-api.md.
Full REST API reference for the Project Plan and Goal endpoints: docs/project-plan-goal-api.md (machine-readable OpenAPI 3.1 spec: docs/project-plan-goal-openapi.yaml).
When running through kiva server, /plan can be sent through /api/chat as normal chat input. If clarification is needed, the server emits a synthetic ask_user client tool. Frontends using AI SDK useChat should render that tool and submit structured answers back with addToolOutput.
Planning-Model Policy
Optional planning-model policy for controlling which model is used during /plan sessions:
- Project config:
<project>/.pi/plan-policy.json - Global config:
~/.pi/agent/plan-policy.json - Project config takes precedence over global config
Example:
{
"models": [
{ "model": "anthropic/claude-sonnet-4", "thinkingLevel": "high" },
"openai-codex/gpt-5.3-codex"
],
"profiles": {
"codex-implementation": {
"match": "openai-codex/gpt-5.3-codex",
"models": [
{ "model": "anthropic/claude-sonnet-4", "thinkingLevel": "medium" }
]
}
}
}match is the exact implementation-time provider/modelId active when /plan starts. The models array is an ordered fallback chain. If no configured planning model resolves, /plan stays on the current session model.
