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.
Authenticate via browser OAuth. Credentials saved to ~/.krnl/credentials.json
Check current authentication status and user info
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
Switch the active provider (openai, anthropic, gemini, groq, ollama, …)
Example: /provider openai
Paste/set the API key for the active provider (stored in ~/.krnl-code)
Example: /key (prompts for hidden input)
Set the model id for the active provider
Example: /model gpt-4o
Set a custom base URL for the API endpoint
Example: /baseurl https://api.openai.com/v1
Show current provider, model, base URL, and key status
List all known provider profiles
List available models from the active provider (optional text filter)
Show the multi-model routing table (which model runs each phase + price)
Auto-configure single-provider multi-model routing from known model tiers
Interactive wizard to pick models for each role
Set reasoning effort for capable models
Example: /effort high
Modes
Plan mode for the next task — research read-only, propose a plan, then you approve before any change
Execute mode (default) — carry out the next task directly
Code Work & Review
Review the current uncommitted git changes for bugs, security, and improvements (like a code review)
Full security audit of the codebase, prioritized by severity with concrete fixes
Fast secret + dependency vulnerability scan
Autonomous security remediation: audit → fix (with approval) → re-scan & re-test
Write tests for the code (or the named target) and run them
Example: /test auth.py
Build and run a comprehensive test suite for the whole project, then report coverage gaps
End-to-end: plan → build → test → security-scan → deploy → monitor
Example: /ship deploy to production
Deploy the project to a live URL in one prompt
Example: /deploy vercel
List deploy targets and which are ready (CLI installed + token set)
Show monitoring status (errors / uptime / configured providers)
Self-heal: health-check, auto-rollback if unhealthy, open PRs for errors
Example: /heal https://myapp.com
Project, Memory & Skills
Create an AGENTS.md project-memory file
Scaffold the .krnl/ wrapper (memory + skill + project doc) for this repo
List available skills (.krnl/skills/<name>/SKILL.md)
Search your past sessions
Example: /search authentication
Safety, Audit & Diagnostics
Show and verify the tamper-evident action audit log (.krnl/audit/)
Run an environment self-check
Toggle auto-approve for edits & commands
Toggle DANGEROUS (YOLO) mode — run everything, never ask. Sandbox/egress rules still apply
Session Control
Show tokens, cost, and tool usage this session
Summarize the conversation to free up context
Revert the file changes from the last task
Clear the conversation context
Show the in-chat help (Ctrl+C during a task = stop)
Quit the session
Environment Variables
Configure CLI behaviors programmatically using system environments:
Provider name (openai, anthropic, gemini, groq, ollama, …)
API key for the provider
Model name to use
Custom base URL for provider
Exit Codes
The CLI returns distinct codes for automated process integration:
