Reference

Reference


Environment Variables

All variables are optional unless noted. Sourced from codekepler-npm/src/ via grep 'process.env.' — this list is what the CLI actually reads.

Kepler runtime

VariableDescription
KEPLER_HOMEOverride the Kepler config directory (default: ~/.kepler)
KEPLER_TOKENAuth token — used in CI/CD and headless pipelines
KEPLER_PRODUCTProduct variant sent to the backend (X-Product header)
KEPLER_MISSIONOptional mission tag persisted with the session
KEPLER_NO_PREFLIGHTSkip the onboarding diagnostic on startup (1 / true)
KEPLER_STATUS_BARToggle the status bar (1 / 0)
KEPLER_SCRATCH_ROOTSComma-separated writable roots outside the CWD
KEPLER_PROMPT_BOTTOM_PADDINGBlank rows below the prompt (default 1)
KEPLER_LONG_RUNNING_TIMEOUT_MSOverride the long-running-tool cutoff
KEPLER_STAGNATION_DETECTION / KEPLER_STAGNATION_THRESHOLDTune stagnation heuristics

Model provider keys (BYOK)

VariableDescription
ANTHROPIC_API_KEYAnthropic direct access
ANTHROPIC_MODELDefault Anthropic model ID
OPENAI_API_KEYOpenAI direct access
OPENAI_BASE_URLOverride the OpenAI-compatible endpoint (e.g. self-hosted vLLM)
OPENROUTER_API_KEYOpenRouter (multi-provider routing)
GEMINI_API_KEY / GOOGLE_API_KEYGoogle Gemini access
BRAVE_API_KEYBrave Search (used by the web-search tool)

Logging & debugging

VariableDescription
DEBUGNamespace-scoped debug logging (e.g. DEBUG=kepler:*)
MCP_DEBUGVerbose MCP-transport logging
NO_COLORDisable ANSI colour output

Advanced / rare

VariableDescription
AGENT_IDIdentifies sub-agent processes (set automatically)
CLAUDE_CODE_PERMISSION_MODELegacy fallback for --permission-mode
CLAUDE_CODE_MAX_CONTEXT_TOKENS / CLAUDE_CODE_MAX_OUTPUT_TOKENSModel I/O caps
CLAUDE_CODE_STREAMING / CLAUDE_CODE_THINKINGFeature toggles
CLAUDE_CODE_ENABLE_TASKSEnable the built-in task manager
CLAUDE_CODE_DISABLE_CRON / CLAUDE_CODE_DISABLE_TELEMETRYOpt-outs
CLAUDE_CODE_SUBAGENT_MODELOverride the model used for sub-agents

Files on Disk

~/.kepler/ (Global Config)

PathPurpose
~/.kepler/authCached authentication token
~/.kepler/config.jsonGlobal preferences (default model, theme, etc.)
~/.kepler/keys/Encrypted API keys for BYOK providers
~/.kepler/skills/User-global installed skills
~/.kepler/projects/Per-project metadata
~/.kepler/history.jsonlCross-session prompt history
~/.kepler/state.jsonCurrent session metadata

.kepler/ (Project-Local)

Run kepler init in a project to scaffold this folder. Kepler may also create runtime files in .kepler/ as sessions run.

PathPurpose
.kepler/KEPLER.mdCanonical project memory loaded into Kepler context
.kepler/settings.jsonProject settings, environment entries, permissions, and hook configuration
.kepler/settings.local.jsonGitignored local override for personal settings
.kepler/config.jsonProject policy for context loading, planning, tasks, HITL, and command defaults
.kepler/project.mdAdditional durable project notes
.kepler/style.mdCode style and communication conventions
.kepler/hitl.mdHuman-in-the-loop approval guidance
.kepler/trust.jsonProject trust rules used by approval handling
.kepler/tasks/backlog.mdDeferred work
.kepler/tasks/active.mdCurrent work in progress
.kepler/tasks/blocked.mdWork waiting on input or external state
.kepler/tasks/done.mdCompleted work
.kepler/skills/Project-local skill bundles
.kepler/commands/Project-local command templates as they become available
.kepler/approvals.logRuntime approval decision log
.kepler/sessions/Runtime session transcripts
.kepler/reports/Runtime mission/report artifacts
.kepler/index/Runtime code-search index cache

Keyboard Shortcuts

Kepler’s REPL uses standard terminal keybindings plus a few extras.

ShortcutAction
EscCancel current execution
SpacePause / resume execution
/ Navigate command history
Ctrl+CCancel current operation / exit
Ctrl+DExit REPL (same as /quit)
Ctrl+LClear terminal screen
Ctrl+RSearch command history (reverse)
TabAuto-complete commands and file paths
Ctrl+UClear current input line
Ctrl+WDelete word before cursor
Ctrl+AMove cursor to beginning of line
Ctrl+EMove cursor to end of line

Exit Codes

CodeMeaning
0Success — no errors
1General error — check stderr
2Authentication error — session expired or invalid
3Configuration error — missing or invalid config
4Model error — model not found or unavailable
5Credit error — insufficient credits

Permission Modes

Set with --permission-mode <mode> to control approval behavior.

ModeDescription
bypassPermissionsNo approval prompts — all tool calls proceed
acceptEditsAuto-approve file edits, prompt for shell commands
planBlock all write operations — read-only planning mode
autoUse tier-based defaults (see risk tiers below)
dontAskNever prompt — reject anything not auto-approved

Risk Tiers

Every tool call is classified into one of eight tiers.

TierBehaviorExamples
readAuto — proceeds silentlyread_file, search_code, grep
sensitive-readPrompt requiredReading .env, *.pem, secrets/**
local-editAuto with checkpointedit_file, write_file
shell-safeAuto — proceeds silentlyls, cat, pwd, git status
shell-mediumPrompt safe (Enter=approve)npm install, git add, pip install
shell-dangerousPrompt explicit (must type y)rm -rf, chmod -R, sudo
destructivePrompt explicit (must type y)delete_file
networkPrompt safe (Enter=approve)curl, wget, git clone

Resume Modes

When resuming a session with --resume, Kepler selects a strategy based on context window size and conversation length.

StrategyBehavior
fullSend the entire conversation transcript
summarySend only a summary of the previous conversation
summary+tail-10Summary + last 10 messages
summary+tail-20Summary + last 20 messages

Event Types

The SSE stream between Kepler and the backend emits these event types:

EventDirectionDescription
contentBackend → CLIFull assistant message
content_partialBackend → CLIStreaming text delta
tool_callBackend → CLITool invocation request
tool_resultCLI → BackendTool execution result
errorEitherError event
completeBackend → CLISession complete
timeoutCLI → BackendSession timeout
startCLI → BackendSession start

Tool Catalog

Kepler has 25+ built-in tools. The agent selects and invokes them automatically based on the task.

File I/O

ToolDescription
read_fileRead a file with line ranges
read_filesRead multiple files at once
write_fileCreate or overwrite a file
write_projectWrite multiple files at once
edit_fileSearch-and-replace edit
multi_editMulti-file edits
delete_fileDelete a file
lsList directory contents
ToolDescription
search_codeSemantic search across project code
search_filesRegex search across files
grepFast regex search (ripgrep)
globPattern-based file search
analyze_codeGet structured analysis of a file
get_project_overviewGet project structure overview
get_file_infoGet file metadata

Shell

ToolDescription
bashRun shell commands
tool_searchSearch available tools

Git

ToolDescription
git_statusShow git status
git_diffShow git diff

Web

ToolDescription
web_fetchFetch URLs
web_searchSearch the web

Agent

ToolDescription
agent (explore)Spawn read-only code explorer
agent (review)Spawn code review agent
agent (architect)Spawn architecture planning agent

Skills

ToolDescription
skillExecute a skill
skills_listList available skills
skill_viewView a skill’s details

MCP (Model Context Protocol)

ToolDescription
read_mcp_resourceRead MCP resources
mcpMCP tool calls

Scheduling

ToolDescription
cron_createCreate a cron job
cron_deleteDelete a cron job
cron_listList cron jobs

Other

ToolDescription
ask_userAsk the user a question
send_messageSend a message
enter_worktreeEnter a worktree
exit_worktreeExit a worktree
notebook_editEdit Jupyter notebooks
todo_writeWrite task items
lspLanguage server protocol
remote_triggerRemote trigger

File Structure for the Kepler NPM Package

kepler/
├── bin/
│   └── cli.js            # Entry point for the `kepler` command
├── src/
│   ├── terminal/
│   │   ├── main.mjs      # CLI entry, subcommand dispatch
│   │   ├── repl.mjs      # REPL loop, command parsing
│   │   ├── agents.mjs    # Built-in agent definitions (explore, review, architect)
│   │   ├── analytics.mjs # Sessions, stats, history subcommands
│   │   ├── init.mjs      # `kepler init` — scaffold .kepler/
│   │   └── skills.mjs    # `kepler skills` — skill management
│   ├── agents/           # Agent team orchestration
│   ├── auth/             # Browser auth flow (bahulam.ai) + config
│   ├── config/           # CLI args, env, settings, memory, hooks
│   ├── context/          # AST parser, BM25 retriever, skeleton, symbol indexer
│   ├── core/             # Central logic (30+ modules)
│   ├── hooks/            # Hook engine
│   ├── mcp/              # MCP client + transports (SSE, WebSocket, SHTTP)
│   ├── onboarding/       # Preflight diagnostics
│   ├── permissions/      # Command classifier, injection check, path check, sandbox
│   ├── plugins/          # Plugin loader
│   ├── skills/           # Skill installer, loader, runner
│   ├── state/            # Orbit state, verbosity
│   ├── telemetry/        # Telemetry index
│   ├── tools/            # 25+ built-in tool implementations
│   └── ui/               # Approval, banner, commands, dock, formatter, icons
├── pulse/                # Kepler Pulse Next.js analytics dashboard
└── package.json

Data Flow

┌──────────────┐     ┌──────────────────┐     ┌──────────────────┐
│  Terminal     │────▶│  Kepler CLI      │────▶│  API Gateway     │
│  (REPL)       │     │  (Agent)         │     │  (Platform)      │
└──────────────┘     └────────┬─────────┘     └────────┬─────────┘
                              │                        │
                              ▼                        ▼
                       ┌──────────────┐       ┌──────────────────┐
                       │  Sub-Agents   │       │  LLM APIs        │
                       │  Explorer     │       │  (OpenRouter)    │
                       │  Planner      │       │  (Anthropic)     │
                       └──────────────┘       │  (OpenAI)        │
                                              │  (Google)        │
                                              └──────────────────┘
  1. You type a request in the REPL
  2. Kepler’s orchestrator analyzes the request
  3. If needed, sub-agents explore the codebase and plan the approach
  4. The orchestrator generates code changes via tool calls
  5. Each tool call is classified by risk tier and approved accordingly
  6. Changes are applied to your files
  7. Results are reported back in the terminal

Glossary

TermDefinition
BM25Best Matching 25 — text retrieval algorithm used for project indexing
BYOKBring Your Own Key — use your own API key instead of the platform default
BYOMBring Your Own Model — connect a custom model endpoint
CheckpointA save point recorded before auto-approved edits, enabling undo
CreditUnit of billing on the platform default plan
ExplorerSub-agent that reads files and searches code (read-only)
FreeswimMode that skips all approval prompts
GatewayProvider routing layer (platform, OpenRouter, Anthropic, etc.)
HeadlessNon-interactive mode for automation and benchmarks
HITLHuman-in-the-loop — review-and-confirm workflow
LocalMode that bypasses the backend and calls LLM APIs directly
MCPModel Context Protocol — connect external tools and data sources
OrchestratorThe main agent that coordinates sub-agents and tool calls
PlannerSub-agent that designs architecture and implementation approach
REPLRead-Eval-Print Loop — Kepler’s interactive terminal interface
ResumeContinue a previous session with context preservation
SkillA portable SKILL.md bundle with instructions and references
Sub-agentA specialized agent (explorer, planner, etc.) that handles a specific role
TrustAuto-approval granted for a specific tool from a specific agent in a session