Skip to main content

A minimal, hackable AI coding agent with a composable tool loop and modular skills.

Project description

KittyCode - Hackable coding agent

KittyCode is a minimal terminal coding agent focused on a compact, readable implementation. It keeps the core runtime straightforward, with an agent loop, local tools, context compression, a small command-line interface, and support for both OpenAI-compatible and Anthropic APIs.

Background

KittyCode is inspired by NanoCoder and keeps the same general idea of a small terminal coding agent while simplifying the project around the core runtime.

KittyCode follows a simple terminal-agent runtime model:

  • A user message is sent through the configured model interface.
  • The model can either answer directly or call tools.
  • Tool calls are executed locally and the results are fed back into the conversation.
  • The loop continues until the model returns plain text.

The project is intentionally small. It includes the core agent runtime, a compact CLI, session persistence, context compression, and a default built-in tool set.

Features

  • Minimal agent loop with optional parallel execution for multiple tool calls.
  • LLM adapter that supports both OpenAI-compatible and Anthropic interfaces.
  • Core built-in tools for shell execution, file operations, web search, web fetch/crawling, TODO tracking, and sub-agents.
  • Interactive REPL and one-shot command mode, with Esc interrupt support.
  • Context compression to keep long sessions manageable.
  • Session save and resume support.

Requirements

  • Python 3.10 or newer
  • An API key for either an OpenAI-compatible endpoint or an Anthropic-compatible endpoint

Installation

Install from PyPI:

pip install kittycode

Configuration

KittyCode reads startup configuration from ~/.kittycode/config.json.

Supported fields:

  • interface: openai or anthropic
  • api_key
  • model
  • base_url
  • max_tokens
  • temperature
  • max_context

OpenAI-compatible example:

{
	"interface": "openai",
	"api_key": "sk-...",
	"model": "gpt-4o",
	"base_url": "https://api.openai.com/v1",
	"max_tokens": 4096,
	"temperature": 0,
	"max_context": 128000
}

Anthropic example:

{
	"interface": "anthropic",
	"api_key": "sk-ant-...",
	"model": "claude-3-7-sonnet-latest",
	"base_url": "https://api.anthropic.com",
	"max_tokens": 4096,
	"temperature": 0,
	"max_context": 128000
}

The CLI still allows explicit overrides such as --model, --interface, --base-url, and --api-key.

Skills

At startup, KittyCode scans ~/.kittycode/skills for skill folders. Each skill should live in its own directory and include a SKILL.md file at the top level.

Expected layout:

~/.kittycode/skills/
	example-skill/
		SKILL.md
		other-files...

KittyCode reads the leading name and description fields from each SKILL.md, keeps the resulting skill list in memory, and appends that list to each user turn inside a <system-reminder> block. The reminder includes:

  • name
  • description
  • path

This allows the model to see which local skills are available and decide when to read and use them.

KittyCode loads skills once at startup and keeps that snapshot fixed for the lifetime of the process. Restart KittyCode after adding or editing skills.

You can also invoke a loaded skill directly from the CLI with /<skill name>.

  • /<skill name> selects that skill for your next non-command message.
  • /<skill name> <task> runs the next request immediately with that skill.

Usage

Run the interactive terminal UI:

kittycode

When the CLI is busy, press Esc to interrupt the current run. The stop is cooperative: KittyCode cancels at the next safe checkpoint between LLM streaming, tool dispatch, and loop rounds. A blocking external call may still need to return before the run fully stops.

You can also use the module entry point:

python -m kittycode

Run a one-shot prompt and exit:

kittycode -p "Explain the project structure"

Resume a saved session:

kittycode -r session_1234567890

Override model, interface, or endpoint from the command line:

kittycode --interface anthropic --model claude-3-7-sonnet-latest

Interactive Commands

Inside the REPL, KittyCode supports:

  • /help
  • /reset
  • /skills
  • /<skill name>
  • /model <name>
  • /tokens
  • /compact
  • /save
  • /sessions
  • /quit

The /skills command prints the skills loaded at startup. Slash commands also support prefix matching while typing, so entering / shows matching commands and skills through completion suggestions.

Project Layout

  • kittycode/__init__.py: public exports and compatibility aliases for moved runtime modules
  • kittycode/main.py: CLI entrypoint wrapper
  • kittycode/cli.py: interactive and one-shot CLI
  • kittycode/config/__init__.py: config.json loading
  • kittycode/llm/__init__.py: provider adapter and streaming parsing
  • kittycode/prompt/__init__.py: system/user prompt builders
  • kittycode/skills/__init__.py: local skill discovery and caching
  • kittycode/runtime/: agent loop, context compression, interrupts, session helpers, and logging setup
  • kittycode/tools/: built-in tools
  • tests/: focused runtime and tool tests

Development

Run the test suite:

python -m pytest -q

The current test suite covers the exported API, config-file behavior, provider conversion helpers, context compression, session helpers, the default tool registry, and skill discovery/prompt injection.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kittycode-0.2.0.tar.gz (61.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kittycode-0.2.0-py3-none-any.whl (55.8 kB view details)

Uploaded Python 3

File details

Details for the file kittycode-0.2.0.tar.gz.

File metadata

  • Download URL: kittycode-0.2.0.tar.gz
  • Upload date:
  • Size: 61.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for kittycode-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f08e3a5c57ac060965a1c2b59a4c86bb9e5371b8a281a873ee19d0fce4ad1b09
MD5 062e45f1dd8e6ece157123f3a80e83ca
BLAKE2b-256 322b52f3492fc6995fd1c365bb1c4b06c64eecdfc645709fd17724a5eccd9fde

See more details on using hashes here.

File details

Details for the file kittycode-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: kittycode-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 55.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for kittycode-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 136aa76979333c3c72a4eea33e7f3c793ead4512196787dfb9899dd0be4375ca
MD5 b536642f8f84e66ad77b27722631e97c
BLAKE2b-256 2f83e89b2749d097e1fc0ceaf5b26ebe49572ddc984c1857c720b8c743d11e0d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page