Skip to main content

Local-first AI code agent in your terminal. Inspired by Claude Code and Codex CLI.

Project description

RepoPilot

Local-first AI code agent in your terminal.

English | 中文

Python License: MIT PyPI version

What is RepoPilot?

RepoPilot is a CLI coding agent inspired by Claude Code and Codex CLI. Navigate to any project, run repopilot, and describe what you want done in natural language — RepoPilot reads, searches, edits, runs tests, and fixes bugs autonomously in a sandboxed environment.

$ cd your-project
$ repopilot

────────────────────────────── RepoPilot ──────────────────────────────
  Directory: /your-project
  Model:     doubao-seed-evolving
  Sandbox:   local
  Approval:  auto

Type /help for commands, /exit to quit.

repopilot> fix the failing test in test_auth.py
> read_file(path=test_auth.py)
> bash(command=python -m pytest test_auth.py -v)
> edit_file(path=auth.py, ...)
> bash(command=python -m pytest test_auth.py -v)

  All tests pass. Fixed the token validation bug in auth.py line 42.

Features

  • Claude Code / Codex CLI style REPLcd project && repopilot, start chatting immediately
  • Pure ReAct agent loop — single model does all thinking, no multi-agent overhead
  • Persistent multi-turn conversation with automatic context compaction
  • Layered memory system — global + project REPOPILOT.md files (like CLAUDE.md)
  • Cross-session resume/resume to continue where you left off
  • Docker sandbox with CPU/memory limits and optional network isolation
  • 4 approval modes: auto / confirm / edit-only / deny (default: confirm — you approve writes/executions)
  • Dangerous command blacklist (path traversal, rm -rf /, curl|sh, force push, credential theft)
  • 10 built-in tools: read/write/edit/grep/glob/list_dir/bash/run_python/repo_tree/finish
  • tree-sitter repo map — code structure overview without reading every file
  • Circuit breaker + exponential backoff for reliable LLM calls
  • Cross-platform — Windows / Linux / macOS with automatic Unix→Windows command translation
  • Any OpenAI-compatible LLM — use your own API key (Doubao, DeepSeek, OpenAI, vLLM, local models, etc.)
  • No RAG / no vector database — deterministic grep/glob/tree-sitter retrieval is faster and more accurate for code

Installation

pip install repopilot-agent

Or install the latest version directly from GitHub:

pip install git+https://github.com/ZhangYang2297/repopilot.git

For an isolated install (recommended for CLI tools):

pipx install repopilot-agent

Requirements: Python 3.10+

First Run

On first run you will be prompted for your LLM configuration:

  1. Model name (e.g. openai/doubao-seed-evolving, openai/gpt-4o, openai/deepseek-chat)
  2. API key (sk-...)
  3. Base URL (for providers other than OpenAI, e.g. https://ark.cn-beijing.volces.com/api/v3)

You can also configure via environment variables:

export REPOPILOT_MODEL=openai/doubao-seed-evolving
export REPOPILOT_API_KEY=sk-your-key
export REPOPILOT_BASE_URL=https://ark.cn-beijing.volces.com/api/v3

Usage

Interactive Mode (Recommended)

cd your-project
repopilot                          # current directory, local sandbox, confirm approval
repopilot -r ../other-proj         # specify a different project directory
repopilot --sandbox docker         # run inside a Docker container
repopilot --approval-mode auto     # skip confirmations (trust the agent)
repopilot -m openai/gpt-4o         # override model

One-shot Task Mode

repopilot chat "fix the bug in auth.py"
repopilot chat "add --verbose flag to cli.py" -r ./myproj

Slash Commands

Command Description
/exit, /quit Exit (Ctrl+C / Ctrl+D also supported)
/help Show help
/model [name] Show or switch model
/approval [mode] Switch approval mode
/compact Trigger context compaction
/clear Start fresh conversation
/cd [path] Switch working directory
/memory [note] Show or add memory notes
/resume [id] Resume a previous session
/sessions List recent sessions
/cost Show token usage/cost
/status Show current configuration

Project Memory (REPOPILOT.md)

Create a REPOPILOT.md in your project root to give RepoPilot persistent instructions:

# Project Memory

## Build/Test
- Test: python -m pytest tests/ -v
- Lint: ruff check .

## Conventions
- Use type hints on all functions
- Never modify files in migrations/

Global memory lives at ~/.repopilot/REPOPILOT.md and applies across all projects.

Configuration

Config file: ~/.repopilot/config.toml

[core]
model = "openai/doubao-seed-evolving"
api_key = "sk-..."
base_url = "https://ark.cn-beijing.volces.com/api/v3"
sandbox_type = "local"
approval_mode = "auto"
max_steps = 200
budget_tokens = 500000
tool_timeout = 120

Manage config via CLI:

repopilot config show
repopilot config set model openai/gpt-4o
repopilot config init  # re-run setup wizard
repopilot models       # list recommended models

Architecture

┌─────────────────────────────────┐
│  CLI (Typer + Rich)    REPL     │
├─────────────────────────────────┤
│  Agent Loop (ReAct)             │
├─────────────────────────────────┤
│  Context Manager  L0-L5 memory  │
├─────────────────────────────────┤
│  Tool Registry + Permission     │
├─────────────────────────────────┤
│  Sandbox (Local / Docker)       │
├─────────────────────────────────┤
│  LLM Service (LiteLLM)          │
└─────────────────────────────────┘

Built-in Tools

Tool Description
read_file Read a file (with optional line range and offset limit)
write_file Write content to a file (creates or overwrites)
edit_file Find-and-replace edit (string replacement)
grep_search Search file contents with regex
glob Find files by glob pattern
list_dir List directory contents
repo_tree Show tree-sitter generated repository map
bash Execute a shell command (sandboxed)
run_python Execute Python code in an isolated temp file
finish Signal task completion and return to user

Supported LLM Providers

Any OpenAI-compatible endpoint works out of the box via LiteLLM:

  • Volcengine ARK (Doubao) — recommended, tested extensively
  • OpenAI (GPT-4o, GPT-4, o1, etc.)
  • DeepSeek (deepseek-chat, deepseek-reasoner)
  • Alibaba Qwen (qwen2.5-coder series)
  • Zhipu GLM (glm-4, glm-5 series)
  • Local models via vLLM / Ollama / llama.cpp (any OpenAI-compatible server)
  • Anthropic Claude (via LiteLLM)

License

MIT — see LICENSE for details.

Acknowledgements

Built after studying Claude Code (Anthropic), Codex CLI (OpenAI), and the SWE-bench / SWE-agent research.

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

repopilot_agent-0.1.4.tar.gz (101.9 kB view details)

Uploaded Source

Built Distribution

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

repopilot_agent-0.1.4-py3-none-any.whl (87.6 kB view details)

Uploaded Python 3

File details

Details for the file repopilot_agent-0.1.4.tar.gz.

File metadata

  • Download URL: repopilot_agent-0.1.4.tar.gz
  • Upload date:
  • Size: 101.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for repopilot_agent-0.1.4.tar.gz
Algorithm Hash digest
SHA256 13451ad5e064363f743e0b0ad4fae37ebdf155510bd5050f394bfd605888d600
MD5 4c57e185528b0645879046641c2a2131
BLAKE2b-256 673e2abe50cb04d907af4e407286dd709f07a0abb3ac2429dabaedd85ba89cef

See more details on using hashes here.

File details

Details for the file repopilot_agent-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for repopilot_agent-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 98197f8d9ee1bfaea31a02540a910b7c3e0c46745862592d45aa88ef171d11eb
MD5 389a0f509511665f9b54da8af0009d4e
BLAKE2b-256 151442fe833361394965b1a00d96b38967bb9a15e70aa83e533488b2489556fd

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