DocsCLI Reference
Reference

CLI Reference

Comprehensive reference of CLI commands, slash commands, and configuration options for the Krnl code.

Authentication (Required)

Authentication is required before using any agent features. Both CLI and VS Code extension share credentials.

krnl-code auth-login
krnl-code auth-login

Authenticate via browser OAuth. Credentials saved to ~/.krnl/credentials.json

krnl-code auth-status

Check current authentication status and user info

krnl-code auth-logout

Clear stored credentials

CLI Commands

Main CLI commands for running the agent and managing configuration:

krnl-code                                    # Interactive agent session
krnl-code --resume                           # Resume latest session
krnl-code --session <id>                     # Resume specific session
krnl-code run "add a /health route"         # One-shot task
krnl-code providers                          # List configured providers
krnl-code models                             # List available models from provider
krnl-code init                               # Scaffold config.yaml + .env
krnl-code update                             # Update to latest version

Slash Commands (In-Session)

Type these commands at the agent prompt to configure and control the session:

Setup & Configuration

/provider <name>

Switch the active provider (openai, anthropic, gemini, groq, ollama, …)

Example: /provider openai

/key

Paste/set the API key for the active provider (stored in ~/.krnl-code)

Example: /key (prompts for hidden input)

/model <id>

Set the model id for the active provider

Example: /model gpt-4o

/baseurl <url>

Set a custom base URL for the API endpoint

Example: /baseurl https://api.openai.com/v1

/config

Show current provider, model, base URL, and key status

/providers

List all known provider profiles

/models [filter]

List available models from the active provider (optional text filter)

/multi-llm

Show the multi-model routing table (which model runs each phase + price)

/multi-llm auto

Auto-configure single-provider multi-model routing from known model tiers

/multi-llm setup

Interactive wizard to pick models for each role

/effort <low|medium|high>

Set reasoning effort for capable models

Example: /effort high

Modes

/plan

Plan mode for the next task — research read-only, propose a plan, then you approve before any change

/execute

Execute mode (default) — carry out the next task directly

Code Work & Review

/review

Review the current uncommitted git changes for bugs, security, and improvements (like a code review)

/security

Full security audit of the codebase, prioritized by severity with concrete fixes

/scan

Fast secret + dependency vulnerability scan

/secfix

Autonomous security remediation: audit → fix (with approval) → re-scan & re-test

/test [target]

Write tests for the code (or the named target) and run them

Example: /test auth.py

/testall

Build and run a comprehensive test suite for the whole project, then report coverage gaps

/ship [what]

End-to-end: plan → build → test → security-scan → deploy → monitor

Example: /ship deploy to production

/deploy [target]

Deploy the project to a live URL in one prompt

Example: /deploy vercel

/deploys

List deploy targets and which are ready (CLI installed + token set)

/monitor

Show monitoring status (errors / uptime / configured providers)

/heal [url]

Self-heal: health-check, auto-rollback if unhealthy, open PRs for errors

Example: /heal https://myapp.com

Project, Memory & Skills

/init

Create an AGENTS.md project-memory file

/onboard

Scaffold the .krnl/ wrapper (memory + skill + project doc) for this repo

/skills

List available skills (.krnl/skills/<name>/SKILL.md)

/search <text>

Search your past sessions

Example: /search authentication

Safety, Audit & Diagnostics

/audit

Show and verify the tamper-evident action audit log (.krnl/audit/)

/doctor

Run an environment self-check

/yes

Toggle auto-approve for edits & commands

/dangerous

Toggle DANGEROUS (YOLO) mode — run everything, never ask. Sandbox/egress rules still apply

Session Control

/usage

Show tokens, cost, and tool usage this session

/compact

Summarize the conversation to free up context

/undo

Revert the file changes from the last task

/reset

Clear the conversation context

/help

Show the in-chat help (Ctrl+C during a task = stop)

/exit

Quit the session

Environment Variables

Configure CLI behaviors programmatically using system environments:

KRNL_PROVIDER

Provider name (openai, anthropic, gemini, groq, ollama, …)

KRNL_API_KEY

API key for the provider

KRNL_MODEL

Model name to use

KRNL_BASE_URL

Custom base URL for provider

Exit Codes

The CLI returns distinct codes for automated process integration:

0Success
1General execution failure
130Interrupted by user (Ctrl+C)