Skip to main content

Your agentic CLI developer.

Project description

tunacode-cli

tunacode

PyPI version Downloads Python 3.11+ License: MIT Discord Shield

A terminal-based AI coding agent with a NeXTSTEP-inspired interface.

Early stage software — not production ready. Under active development, expect bugs and breaking changes.

Features

  • Any model - Works with any OpenAI-compatible API (Anthropic, OpenAI, Google, Ollama, vLLM, etc.)
  • Native tinyagent tools - Direct tinyagent tool contracts with no legacy wrapper compatibility layer
  • File operations - Read files with hash-tagged lines, create files, and edit existing files with hash-validated references
  • Shell access - Run bash commands with output capture
  • Repository discovery - Use discover for natural-language code search and repository exploration
  • Session persistence - Resume previous conversations with /resume
  • LSP diagnostics - Real-time code errors after file writes (Python, TypeScript, Go, Rust)
  • Themeable UI - CSS-based theming with NeXTSTEP-inspired design
  • Text selection + clipboard copy - Mouse selection works across Rich-rendered chat content; copy with ctrl+y or ctrl+shift+c
  • Agent loop - Powered by tinyAgent

Built With

  • tinyAgent - Core agent loop handling LLM interaction and tool execution
  • alchemy-rs - Rust-powered tokenizer and utilities via PyO3 bindings
  • Textual - Terminal UI framework with CSS-based styling
  • Rich - Terminal rendering with syntax highlighting
  • Typer - CLI framework

Installation

End Users

uv tool install tunacode-cli

Or with pip:

pip install tunacode-cli

Developers (Fresh Clone)

git clone https://github.com/alchemiststudiosDOTai/tunacode.git
cd tunacode
make dev-setup

Or without make:

git clone https://github.com/alchemiststudiosDOTai/tunacode.git
cd tunacode
./scripts/dev-setup.sh

Development

Common development tasks:

make dev-setup  # Full setup for fresh clone
make install    # Install/update dependencies
make run        # Run the development server
make test       # Run test suite
make lint       # Run linters
make clean      # Clean build artifacts

View technical debt:

uv run python scripts/todo_scanner.py --format text

Quick Start

# Configure API key
tunacode --setup

# Start coding
tunacode

Configuration

Set your API key as an environment variable:

export ANTHROPIC_API_KEY="your-key"
# or
export OPENAI_API_KEY="your-key"

Config file: ~/.config/tunacode.json

TunaCode deep-merges partial config files onto built-in defaults and validates the merged result at startup. If the file is malformed, the app reports a configuration error instead of silently guessing.

For local models and advanced settings, see the Configuration Guide.

Commands

Slash commands are command objects in tunacode.ui.commands; each one is a Command subclass and is registered in COMMANDS. handle_command() also routes shell commands (!<cmd>), legacy exit, and slash /exit.

Command Description
/cancel Cancel the current request or shell command.
/help Show available commands
/clear Clear transient agent state while preserving message history.
/compact Force context compaction
/debug Toggle debug logging to screen (includes parallel tool-call lifecycle lines)
/model Open model picker or switch model
/resume List, load, or delete persisted sessions.
/skills Browse, search, or load session skills.
/theme Open theme picker or switch theme
/thoughts Toggle the streaming thought panel.
/update Check for or install updates.
!<cmd> Run shell command
/exit Exit TunaCode
exit Legacy alias for exit

Confirm Parallel Tool Calls

Run /debug to enable lifecycle logs. During agent execution, parallel batches are reported with lines prefixed by:

  • [LIFECYCLE] Parallel tool calls active: ...
  • [LIFECYCLE] Parallel tool calls update: ...
  • [LIFECYCLE] Parallel tool calls complete

If no Parallel tool calls lifecycle lines appear, that request did not execute a parallel tool batch.

Tools

The agent has access to:

Tool Description
bash Execute shell commands
discover Search and explore the repository with a natural-language query
read_file Read file contents with content-hash tagged lines
hashline_edit Edit existing files using hash-validated line references from read_file
web_fetch Fetch web page content
write_file Create new files

TunaCode now uses the native tinyagent tool surface directly. Legacy wrapper-based tools such as update_file, glob, grep, and list_dir are removed rather than translated through a compatibility layer.

Important tool rules:

  • bash accepts optional cwd, env, timeout, and capture_output arguments in addition to the required command.
  • discover is the semantic repository mapper; use it to find code related to a concept or feature instead of manually chaining search tools.
  • read_file supports paging with offset and limit, wraps results in <file>...</file>, and each read replaces the editable cache window for that file.
  • hashline_edit only supports replace, replace_range, and insert_after using <line>:<hash> refs from the current read_file output.
  • write_file is create-only: it creates missing parent directories but refuses to overwrite an existing file.
  • web_fetch only fetches public http or https URLs and blocks localhost, private, and reserved addresses.
hashline-edit tool in tunacode

LSP Integration

Automatic code diagnostics when LSP servers are in PATH:

Language Server
Python ruff server
TypeScript/JS typescript-language-server
Go gopls
Rust rust-analyzer

Security

TunaCode has full shell access with no permission prompts. If you're concerned:

  • Use git so you can revert changes
  • Run in a container/sandbox

Discord

Discord

License

MIT

Project details


Release history Release notifications | RSS feed

This version

0.2.0

Download files

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

Source Distribution

tunacode_cli-0.2.0.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

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

tunacode_cli-0.2.0-py3-none-any.whl (439.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tunacode_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for tunacode_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b526c126f389473100a41ca3220285f9c71fac68ec4f1e2a963ef772ba388b8e
MD5 c845be520dace9e555099654f81bb92e
BLAKE2b-256 ceccb1b8f8975479795b0c75e076bf011446185a1ccc77319abc6d3e992ed72f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tunacode_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bff1c15dcdff68744fb59030bfe607a462eb47d09477f3a6ab62fed23280bfe
MD5 414502128c2e868fff5c76c6a2e4c2fb
BLAKE2b-256 d828f7b0fe950594d6f4fde05747ed3801e1485b4f0361d0d8443f83091a3f45

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