kraken-code-cli
v1.0.0
Published
Kraken Code — an AI coding agent CLI for JavaScript, TypeScript, and Python.
Maintainers
Readme
🐙 Kraken Code
An AI coding agent for your terminal — chat, generate, edit, explain, and refactor code in JavaScript, TypeScript, and Python.
Kraken Code is a modern command-line agent that connects to the Kraken AI proxy and gives you a beautiful, minimal interface to over 30 frontier models — without ever asking for an API key.
✨ Features
- 💬 Interactive chat in your terminal with streaming responses
- 🛠️ Rich tool set — read, write, patch, search, grep, move, delete, fetch URLs, run commands
- 🧠 30+ models across OpenAI, Anthropic, Google, DeepSeek, xAI, Qwen, Kimi, Llama
- 🎨 Beautiful UI — gradients, spinners, syntax highlighting, markdown rendering
- 🔌 No API key required — points to the Kraken AI proxy out of the box
- 📁 Project-aware — gitignore-aware file listing, attach files to context
- ⚡ Tool calling with automatic fallback for proxies that don't support it
- 🧩 Clean architecture — separated commands, services, client, UI
📦 Installation
From source
git clone <your-repo-url> kraken-code
cd kraken-code
npm install
npm run build
npm linkNow kraken is available globally:
kraken --helpLocal development
npm install
npm run dev -- chat🚀 Quick start
# Start interactive chat
kraken
# Ask one question and exit
kraken ask "How do I write a TypeScript generic that constrains to objects?"
# Generate a new file
kraken generate src/utils/slugify.ts -p "create a slugify function with diacritics removal"
# Edit an existing file
kraken edit src/server.ts -p "add request logging middleware"
# Explain code
kraken explain src/core/agent.ts
# Get a code review
kraken review src/api/users.py
# Refactor a file
kraken refactor src/parser.js -p "convert to TypeScript with strict types"
# Browse and select models
kraken models
kraken models set🧭 Commands
| Command | Description |
|---|---|
| kraken / kraken chat | Start the interactive chat REPL |
| kraken ask <question> | One-shot question, prints answer and exits |
| kraken generate <file> -p "..." | Generate a new file from a prompt |
| kraken edit <file> -p "..." | Edit a file according to an instruction |
| kraken explain <file> | Explain what a file does |
| kraken review <file> | Get review suggestions for a file |
| kraken refactor <file> -p "..." | Refactor a file with an instruction |
| kraken models | List all available models |
| kraken models set | Interactively pick the default model |
| kraken config show | Show current configuration |
| kraken config get <key> | Get a single config value |
| kraken config set <key> <value> | Set a config value |
| kraken config reset | Reset config to defaults |
| kraken config path | Print the config file path |
Global flags
| Flag | Description |
|---|---|
| -m, --model <name> | Override model for this invocation |
| -c, --cwd <path> | Working directory (defaults to current) |
| --no-stream | Disable streaming |
| --debug | Enable debug output |
| -v, --version | Show version |
| --help | Show help |
Slash commands inside chat
| Slash | Description |
|---|---|
| /help | Show available slash commands |
| /model | Switch model mid-conversation |
| /clear | Reset conversation history |
| /files | List project files |
| /add <file> | Attach a file to your next message |
| /save <path> | Save the last response to a file |
| /exit or /quit | Leave Kraken |
🤖 Available models
Kraken Code ships with the full Kraken AI gateway model catalogue:
OpenAI — gateway-gpt-5, gateway-gpt-5-1, gateway-gpt-5-3, gateway-gpt-5-4, gateway-gpt-5-5, gateway-gpt-5-mini, gateway-gpt-5-nano, gateway-gpt-5-online, gateway-gpt-4o, gateway-gpt-4-1-mini, gateway-gpt-4-1-nano, gateway-o3, gateway-o3-mini, gateway-o4-mini
Anthropic — gateway-claude-opus-4-7 (default), gateway-claude-opus-4-6, gateway-claude-opus-4-5, gateway-claude-opus-4-1, gateway-claude-sonnet-4, gateway-claude-sonnet-4-6
Google — gateway-gemini-3-1-pro, gateway-gemini-3-pro, gateway-gemini-2-5-pro, gateway-gemini-2-5-flash
DeepSeek — gateway-deepseek-v4-pro, gateway-deepseek-v4-flash, gateway-deepseek-r1, gateway-deepseek-v3
xAI — gateway-grok-4, gateway-grok-3
Alibaba — gateway-qwen-3-max, gateway-qwen-qwq-32b
Moonshot — gateway-kimi-k2
Meta — gateway-llama-3-3-70b
⚙️ Configuration
Configuration lives at the platform-appropriate user config directory (run kraken config path to see it).
Default settings
| Key | Default | Description |
|---|---|---|
| endpoint | https://krakenai.onrender.com/v1 | Proxy base URL |
| defaultModel | gateway-claude-opus-4-7 | Default model |
| stream | true | Stream responses |
| autoApproveWrites | false | Skip write confirmations |
| autoApproveShell | false | Allow run_command tool to auto-execute |
| maxContextFiles | 20 | Max files in project context |
| maxContextBytes | 200000 | Max total context bytes |
| timeoutMs | 120000 | HTTP timeout |
| retries | 3 | Retry attempts on network/5xx errors |
| theme | ocean | Color theme |
Examples
# Change the default model
kraken config set defaultModel gateway-gpt-5
# Point at a different proxy (e.g., self-hosted)
kraken config set endpoint https://my-proxy.example.com/v1
# Enable auto-approve for file writes (use with care)
kraken config set autoApproveWrites true
# Reset everything
kraken config reset💡 Example workflows
Chat with a file attached
$ kraken
you › /add src/server.ts
✓ Attached src/server.ts (1842 chars)
you › Add error handling to the /users endpointKraken will read the attached file, propose changes, and either render them as Markdown or call the write_file tool to update the file (with a diff + confirmation).
Generate a Python module
kraken generate scripts/csv_to_parquet.py \
-p "convert a CSV file to a Parquet file using pyarrow, with CLI args via argparse"Refactor JavaScript to TypeScript
kraken refactor src/legacy.js \
-p "rewrite in strict TypeScript with proper types and ESM imports"Code review
kraken review src/api/users.py🧰 Built-in tools
The agent has access to the following tools. Each tool call is rendered in a colored box in the terminal so you can see exactly what the model is doing.
| Tool | Description |
|---|---|
| read_file(path) | Read a single file |
| read_many_files(paths) | Read multiple files in one call |
| list_files(directory?) | List project files (gitignore-aware) |
| write_file(path, content) | Create/overwrite a file with diff + confirm |
| apply_patch(path, search, replace) | Surgical search/replace edit |
| search_files(pattern, glob?) | Regex search across files |
| grep(query, glob?) | Find files containing a literal string |
| create_directory(path) | Create a directory |
| delete_file(path) | Delete a file (asks confirmation) |
| move_file(from, to) | Move or rename a file |
| fetch_url(url) | HTTP GET a URL |
| run_command(cmd) | Run a shell command (off by default) |
🏗️ Architecture
src/
├── index.ts # entry point
├── cli.ts # Commander setup
├── commands/ # one file per command
├── core/
│ ├── agent.ts # message + tool loop
│ ├── client.ts # HTTP client (stream + non-stream)
│ ├── tools.ts # tool definitions and handlers
│ ├── prompts.ts # system + task prompts
│ └── context.ts # project context building
├── config/ # defaults, model catalogue, persistent store
├── ui/ # theme, banner, logger, spinner, markdown, diff, box
├── fs/ # safe file reader, writer (diff + confirm), project walker
├── types/ # API + config types
└── utils/ # errors, language detection, token estimationThe Agent maintains the message history and runs a loop:
- Send messages (+ tool definitions) to the proxy
- If the model returns native
tool_calls, execute them and feed results back - If the proxy doesn't support tool calling, fall back to parsing JSON action blocks from the assistant text
- Stop when the model produces a final text reply
🛡️ Safety
- No API key required — auth is handled by the proxy
- Write confirmations — every file write shows a unified diff and prompts before applying
- Path safety — all reads/writes are constrained to the working directory
- Shell off by default —
run_commandrequires explicit per-invocation confirmation unlessautoApproveShellis enabled
🛣️ Roadmap
- Multi-file refactors with patch planning
- Project memory (persistent context across sessions)
- Plugins / custom tools
- Cost & token telemetry
- Workspace-level
.kraken.jsonconfig
📄 License
MIT © Kraken AI
