A terminal coding agent powered by the Anthropic API. KlaudeCode is an open-source effort to reproduce the developer experience of Claude Code from the ground up.
This is the first iteration: an agent loop that can hold a conversation, run shell commands on your behalf, and iterate until the task is done. Future versions will grow toward feature parity with Claude Code.
- Interactive REPL in the terminal
- Multi-turn conversation with full history kept in context
- Tool use loop: the agent calls
bash, reads the output, and decides what to do next - Works with any Anthropic-compatible endpoint via
ANTHROPIC_BASE_URL - Minimal dangerous-command guard (
rm -rf /,sudo,shutdown,reboot) - 2-minute per-command timeout, output truncated at 50k characters
- Node.js 20+
- An Anthropic API key
git clone https://github.com/Kepler2024/KlaudeCode.git
cd ./KlaudeCode
npm install
cp .env.example .env
# edit .env and fill in ANTHROPIC_API_KEY
npm startYou will land in a User>> prompt. Type a task and hit enter. Type quit to exit.
.env keys:
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY |
yes | Your Anthropic API key |
MODEL_ID |
yes | Model to use, e.g. claude-sonnet-4-5 |
ANTHROPIC_BASE_URL |
no | Override the API endpoint (proxies, gateways) |
The core is a loop:
- Send the conversation + tool definitions to the model.
- If the model responds with
tool_use, run the requestedbashcommand and feed the output back astool_result. - Repeat until the model stops calling tools.
- Print the final assistant message and wait for the next user turn.
Conversation history is preserved across turns, so the agent remembers what it has already done in this session.
KlaudeCode lets an LLM execute arbitrary shell commands on your machine. The built-in blocklist is a courtesy, not a sandbox.
- Run it inside a container, VM, or a throwaway directory.
- Do not point it at directories containing secrets, production credentials, or anything you cannot afford to lose.
- Review what the agent is about to do before letting it run for long stretches.
Toward Claude Code parity. Not in strict order:
- Streaming output
- Richer tool set:
read_file,edit_file,write_file,grep,glob - Slash commands (
/clear,/help,/model, ...) - Per-tool permission prompts and an allowlist
- Token and cost accounting
- Prompt caching
- Session save / resume
- MCP server support
- Subagents
- Configurable system prompt and project-level instructions (
CLAUDE.mdequivalent)
Issues and PRs welcome.
MIT. See LICENSE.