Skip to main content

Configuration Guide

Configure NikCLI to match your development workflow with comprehensive settings for API keys, agent behavior, security, and performance.

🔑 API Keys Setup

Supported AI Providers

NikCLI supports multiple AI providers for maximum flexibility:

Anthropic Claude

Recommended - Best for complex reasoning and code generation

OpenAI GPT

Popular - Excellent for general tasks and creativity

Google Gemini

Efficient - Great for analysis and optimization

Ollama Local

Private - Run models locally for complete privacy

Setting API Keys

# Set Anthropic API key (recommended)
/set-key anthropic sk-ant-api03-...

# Set OpenAI API key
/set-key openai sk-...

# Set Google API key
/set-key google AIza...

# Set Ollama endpoint
/set-key ollama http://localhost:11434

Environment Variables

You can also set API keys via environment variables:
# Set environment variables
export ANTHROPIC_API_KEY="sk-ant-api03-..."
export OPENAI_API_KEY="sk-..."
export GOOGLE_API_KEY="AIza..."

# Or in .env file
echo "ANTHROPIC_API_KEY=sk-ant-api03-..." >> .env
echo "OPENAI_API_KEY=sk-..." >> .env

Verify Configuration

# Check current configuration
/config

# Test API connectivity
/debug

# List available models
/models

⚙️ Agent Configuration

Universal Agent Settings

Configure the Universal Agent for optimal performance:
# Set agent behavior style
/agent-config universal-agent --style collaborative
/agent-config universal-agent --style autonomous
/agent-config universal-agent --style guided

# Set verbosity level
/agent-config universal-agent --verbosity detailed
/agent-config universal-agent --verbosity concise
/agent-config universal-agent --verbosity minimal

# Configure permissions
/agent-config universal-agent --permissions "read:src/,write:src/,execute:npm,git"

# Set context paths
/agent-config universal-agent --context "src/,tests/,docs/"

VM Agent Settings

Configure the VM Agent for secure development:
# Set isolation level
/agent-config vm-agent --isolation-level strict
/agent-config vm-agent --isolation-level moderate
/agent-config vm-agent --isolation-level permissive

# Configure container resources
/agent-config vm-agent --container-resources "memory:4GB,cpu:2,storage:10GB"

# Set token budget
/agent-config vm-agent --token-budget 50000

🎛️ System Preferences

Model Selection

# Switch to specific model
/model claude-3-5-sonnet
/model gpt-4o
/model gemini-1.5-pro
/model ollama:llama3.1:8b

# View current model
/model

# List all available models
/models

Creativity Settings

# Set temperature (creativity level)
/temp 0.7    # Balanced creativity
/temp 0.3    # More focused
/temp 1.2    # More creative

# View current temperature
/temp

Session Management

# Enable/disable chat history
/history on
/history off

# Set system prompt
/system "You are a senior React developer specializing in TypeScript and performance optimization"

# Clear current session
/clear

# Start new session
/new "React Authentication Project"

🔒 Security Configuration

Approval System

Configure the approval system for sensitive operations:
# Set approval level
/security --approval-level strict
/security --approval-level moderate
/security --approval-level permissive

# Configure approval timeout
/security --approval-timeout 300

# Enable/disable specific approvals
/security --enable-file-write-approval
/security --enable-command-execution-approval
/security --enable-network-access-approval

Sandbox Settings

# Enable sandbox mode
/sandbox --enable

# Configure file system access
/sandbox --allow-file-system
/sandbox --restrict-paths "/home/user/projects"

# Configure command execution
/sandbox --allow-commands "npm,git,node"
/sandbox --block-commands "rm,rmdir,sudo"

# Configure network access
/sandbox --allow-network
/sandbox --restrict-domains "github.com,npmjs.com"

Developer Mode

# Enable developer mode (reduces security restrictions)
/dev-mode

# Disable developer mode
/dev-mode --disable

# Check current mode
/dev-mode --status

📊 Performance Settings

Caching Configuration

# Enable response caching
/cache --enable

# Set cache size
/cache --size 100MB

# Clear cache
/cache --clear

# Configure cache TTL
/cache --ttl 3600

Memory Management

# Set memory limits
/memory --limit 2GB

# Configure garbage collection
/memory --gc-interval 300

# Monitor memory usage
/memory --stats

Parallel Execution

# Configure parallel execution
/parallel --max-concurrent 3
/parallel --timeout 300

# Enable parallel mode
/parallel --enable

# Disable parallel mode
/parallel --disable

🎨 UI Customization

Display Settings

# Set compact mode
/set compact true

# Enable clean chat mode
/set clean-chat true

# Configure live updates
/set live-updates ephemeral

# Set minimal stream mode
/set minimal-stream true

Color Themes

# Set color theme
/theme dark
/theme light
/theme auto

# Customize colors
/theme --primary "#4EC5F1"
/theme --secondary "#1f39ff"

🔧 Advanced Configuration

LSP Integration

# Enable LSP integration
/lsp --enable

# Configure LSP servers
/lsp --add typescript
/lsp --add python
/lsp --add rust

# Set LSP timeout
/lsp --timeout 5000

Context Management

# Configure context retention
/context --retention 7d
/context --max-files 1000

# Enable context indexing
/context --indexing true

# Set context paths
/context --paths "src/,tests/,docs/"

Logging Configuration

# Set log level
/log --level debug
/log --level info
/log --level warn
/log --level error

# Enable structured logging
/log --structured true

# Set log file
/log --file ~/.nikcli/logs/nikcli.log

📁 Configuration Files

Main Configuration

NikCLI stores configuration in ~/.nikcli/config.json:
{
  "defaultProvider": "anthropic",
  "defaultModel": "claude-3-5-sonnet",
  "temperature": 0.7,
  "historyEnabled": true,
  "approvalLevel": "moderate",
  "sandbox": {
    "enabled": true,
    "allowFileSystem": true,
    "allowCommands": true,
    "allowNetwork": true
  },
  "agents": {
    "universal": {
      "style": "collaborative",
      "verbosity": "detailed",
      "maxConcurrentTasks": 3
    },
    "vm": {
      "isolationLevel": "moderate",
      "tokenBudget": 50000,
      "containerResources": {
        "memory": "4GB",
        "cpu": "2"
      }
    }
  }
}

Environment Variables

Set these environment variables for advanced configuration:
# API Keys
export ANTHROPIC_API_KEY="sk-ant-api03-..."
export OPENAI_API_KEY="sk-..."
export GOOGLE_API_KEY="AIza..."

# Performance
export NIKCLI_COMPACT=1
export NIKCLI_CLEAN_CHAT=1
export NIKCLI_MINIMAL_STREAM=1

# Embedding Optimization
export EMBED_BATCH_SIZE=300
export EMBED_MAX_CONCURRENCY=6
export EMBED_INTER_BATCH_DELAY_MS=25
export INDEXING_BATCH_SIZE=300
export EMBED_ADAPTIVE_BATCHING=true

🔍 Configuration Validation

Check Configuration

# Validate current configuration
/config --validate

# Test all API connections
/debug --full

# Check agent status
/agents --status

# Verify permissions
/security --check

Troubleshooting

Problem: API keys not workingSolutions:
# Check API key format
/config

# Test API connectivity
/debug

# Re-set API key
/set-key anthropic sk-ant-api03-...
Problem: Permission denied errorsSolutions:
# Check current permissions
/security --check

# Adjust sandbox settings
/sandbox --allow-file-system

# Enable developer mode temporarily
/dev-mode
Problem: Slow performanceSolutions:
# Check memory usage
/memory --stats

# Clear cache
/cache --clear

# Adjust parallel execution
/parallel --max-concurrent 2

🎯 Best Practices

1. Start with Defaults

Begin with default configuration and adjust as needed:
# Use default configuration
/config --reset

# Gradually customize
/temp 0.7
/agent-config universal-agent --style collaborative

2. Use Environment Variables

For team projects, use environment variables:
# Create .env file
echo "ANTHROPIC_API_KEY=sk-ant-api03-..." > .env
echo "NIKCLI_COMPACT=1" >> .env

3. Regular Configuration Review

Periodically review and optimize configuration:
# Check current settings
/config

# Review performance metrics
/stats

# Optimize based on usage patterns
/agent-config universal-agent --optimize

🚀 Next Steps

Pro Tip: Use /config --export to save your configuration and /config --import to restore it on other machines.