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
  • Streaming with waiting feedback — shows Thinking... immediately, then renders assistant text incrementally
  • Session diff and undo — inspect changes with /diff and roll them back step-by-step with /undo
  • Interactive approvals — confirm writes/commands with y/n/a/d; dangerous operations remain hard-denied
  • Tool timing — each tool execution displays its elapsed time
  • 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+

Windows note: if pip install fails with "Cargo, the Rust package manager, is not installed", run pip install repopilot-agent --only-binary :all: to force pre-built wheels, or use pipx.

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
/diff Show all file changes made during this session
/undo Revert the most recent file change

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     │
├─────────────────────────────────┤
│  Shared AgentLoopCore (ReAct)   │
├─────────────────────────────────┤
│  Context Manager  L0-L5 memory  │
├─────────────────────────────────┤
│  Tool Registry + Permission     │
├─────────────────────────────────┤
│  Sandbox (Local / Docker)       │
├─────────────────────────────────┤
│  LLM Service (LiteLLM)          │
└─────────────────────────────────┘

Both one-shot chat tasks and the interactive REPL use the same UI-independent AgentLoopCore for response normalization and tool execution. The REPL adds pre-first-event Thinking... feedback, streaming rendering, interactive approval, persistent context, /diff, and /undo. The indicator only communicates that a request is active; it does not expose or fabricate hidden model reasoning.

Development Status

  • Current package version: v0.2.1
  • Phase 2A is complete: streaming, first-event waiting feedback, TTFT/total-duration metrics, tool timing, interactive approval, /diff, and /undo
  • 492 project tests pass (excluding fixture and E2E data projects from collection)
  • Next: diagnose fresh-venv dependency resolution, then improve session recovery, tool control, security boundaries, Docker sandboxing, and Skills in small TDD-verified steps
  • See DEVELOPMENT_PLAN.md for the ordered roadmap and PROJECT_HANDOFF.md for the current implementation handoff

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.2.2.tar.gz (102.6 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.2.2-py3-none-any.whl (116.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: repopilot_agent-0.2.2.tar.gz
  • Upload date:
  • Size: 102.6 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.2.2.tar.gz
Algorithm Hash digest
SHA256 da36763407d787ed718a959d9d8f0154ad7779abb00e2aca2d6081e0891594de
MD5 d64251a5421e9906ec23a891663be233
BLAKE2b-256 2e4f51b2512f361cf0057653c52ef5fb0f4ebec5aa62a11476869cd19508582e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: repopilot_agent-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 116.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for repopilot_agent-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 48af6df729db14185c57772b5c4a78ccd04b2f376e712758af148e2878787a17
MD5 e0ebafab4a517a52f711fab43ccfa545
BLAKE2b-256 855aa8b1ce344449b9f47d97afdaf59a5fecb00e05a7a3b50c8f7a21695e83af

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