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.3.tar.gz (101.8 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.3-py3-none-any.whl (87.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: repopilot_agent-0.1.3.tar.gz
  • Upload date:
  • Size: 101.8 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.3.tar.gz
Algorithm Hash digest
SHA256 717c6b78812426340da7bd49f2bede05b0addcb60f216e700d10cfd0436b154d
MD5 ec4c446a4c8ece82976b62b18e732898
BLAKE2b-256 44fe546ea1938146a272ec640135242884c135b58cd8135b2645cf4e393bff00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for repopilot_agent-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 37c3413f1d1ccfd224a849eb4b0b709215f51452ad48c8f2fdabd279789060ba
MD5 51ee97a0ceb488f33c63614357076748
BLAKE2b-256 e70e4754472370e4b1ede2f7053e043814079b45ccfbf3e1141a2e0ec3ba77d9

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