Kode uses a flexible configuration system powered by cosmiconfig.
Kode searches for configuration in this order (highest priority first):
- Project-level file:
kode.jsonorkode.config.ts/jsin project root - Environment variables:
SARVAM_API_KEY,SARVAM_BASE_URL,SARVAM_MODEL - Global config:
~/.kode/config.json - Dotfiles:
.koderc,.koderc.json,.koderc.yaml
The first found value takes precedence. This means project config overrides global config, which overrides defaults.
{
"provider": {
"apiKey": "your-sarvam-api-key",
"baseUrl": "https://api.sarvam.ai/v1",
"model": "sarvam-m"
},
"permission": {
"bash": "ask",
"write": "ask",
"edit": "ask"
},
"context": {
"maxTokens": 28000,
"compressAt": 0.80
}
}Controls LLM connection and model selection.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey |
string | Yes | — | Your Sarvam API key |
baseUrl |
string | No | https://api.sarvam.ai/v1 |
API endpoint URL |
model |
string | No | sarvam-m |
Model name to use |
Available Models:
sarvam-m— Default, balanced performancesarvam-30b— Faster, lighter modelsarvam-105b— Most capable, better reasoning
Controls how Kode handles operations that modify your system.
| Field | Type | Allowed Values | Default | Description |
|---|---|---|---|---|
bash |
string | ask, allow, deny |
ask |
Shell command execution |
write |
string | ask, allow, deny |
ask |
File creation and writes |
edit |
string | ask, allow, deny |
ask |
File edits and replacements |
Permission behavior:
ask: Shows a Y/A/N prompt before executing (Y = yes once, A = always allow, N = no)allow: Executes without any promptdeny: Blocks the operation entirely
Controls the agent's memory and compression behavior.
| Field | Type | Default | Description |
|---|---|---|---|
maxTokens |
number | 28000 |
Maximum tokens in conversation context |
compressAt |
number | 0.80 |
Compression trigger threshold (80% = 0.80) |
You can set these environment variables instead of using a config file:
# Required: API key
export SARVAM_API_KEY="your-api-key"
# Optional: Custom API endpoint
export SARVAM_BASE_URL="https://api.sarvam.ai/v1"
# Optional: Model selection
export SARVAM_MODEL="sarvam-105b"Environment variables take precedence over global config (~/.kode/config.json) but are overridden by project-level config (kode.json).
Store your default settings at ~/.kode/config.json:
mkdir -p ~/.kode
cat > ~/.kode/config.json << 'EOF'
{
"provider": {
"apiKey": "your-api-key",
"model": "sarvam-m"
},
"permission": {
"bash": "ask",
"write": "ask",
"edit": "ask"
}
}
EOFThis applies to all projects unless overridden by a local kode.json.
Create kode.json in your project root for project-specific settings:
{
"provider": {
"model": "sarvam-105b"
},
"permission": {
"bash": "allow",
"write": "ask",
"edit": "ask"
}
}This is useful for:
- Teams sharing the same API key
- Projects that need a specific model
- Repos where you trust bash commands (e.g., CI-like environments)
Kode automatically reads AGENTS.md or CLAUDE.md from your project root (or nearest parent directory) and appends it to the system prompt.
This file is not a configuration file — it's a way to teach Kode about your project:
# AGENTS.md
## Project Structure
- src/agent/ — Core agent logic
- src/tools/ — Tool implementations
- src/ui/ — Terminal UI components
## Coding Conventions
- Use TypeScript strict mode
- All functions must have JSDoc comments
- Run `npm run test` before committing
## Architecture Decisions
- Intent routing is deterministic, not LLM-based
- Tools are called via prompt-based patterns
- Session storage uses SQLite (sql.js)Kode appends this content to the system prompt, so the LLM knows your project's conventions.
1. kode.json (project root) ← Highest priority
2. Environment variables
3. ~/.kode/config.json (global)
4. Default values ← Lowest priority
- Check
SARVAM_API_KEYenv var orkode.jsonprovider.apiKey - Get a new key at https://sarvam.ai
- Verify the model name in
kode.jsonprovider.model - Available models:
sarvam-m,sarvam-30b,sarvam-105b
- Run
kodewithDEBUG=1to see config discovery logs - Check file locations:
kode.json,~/.kode/config.json - Ensure valid JSON syntax