Skip to main content

open source terminal-based coding agent

Project description

Logo

Open source coding agent in your terminal
· Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing

About The Project

Product Name Screen Shot

opencodr is a simple recursive function combined with the Function Calling API + Model Context Protocol to create agentic behavior.

  • ❌ No Auth Screens
  • ❌ No Provider Lock-in

API Key(s) + A Terminal Is All You Need™️

Built With

LiteLLM

Pydantic v2

Typer

Rich

Docker

Getting Started

Prerequisites

Installation

> MacBookPro:example user$ pip install opencodr
> MacBookPro:example user$ opencodr init opencodr --help

✋ opencodr project not initialized. Run `opencodr init`

Initialization

Run the following command from the root of your project:

> MacBookPro:example user$ opencodr init

📄 .rc file generated at /workspace/example/.opencodr/.rc
✔️ .opencodr added to .gitignore
> MacBookPro:example user$ opencodr --help

 Usage: opencodr [OPTIONS] COMMAND [ARGS]...

╭─ Options ────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the     │
│                               current shell.                 │
│ --show-completion             Show completion for the        │
│                               current shell, to copy it or   │
│                               customize the installation.    │
│ --help                        Show this message and exit.    │
╰──────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────╮
│ gen                                                          │
│ workspace                                                    │
╰──────────────────────────────────────────────────────────────╯

Configuration

/workspace/example/.opencodr/.rc

# List of allowed directories, Separated with colons (:) e.g "/path/to/a/dir:/path/to/b/dir"
export OC_PATH="$(pwd)"

# <provider>/<model_name>
export OC_MODEL="openrouter/openai/gpt-4o"

# export OC_BASE_URL=""
# export OC_MAX_TOKENS=""
# export OC_MAX_DEPTH=""

# Provider API Keys
export OPENROUTER_API_KEY=""
# export OPENAI_API_KEY=""
# export ANTHROPIC_API_KEY=""

NOTE: See https://docs.litellm.ai/docs/providers for the list of supported models

/workspace/example/.opencodr/mcp.json (Optional)

{
  "sqlite": {
    "command": "uvx",
    "args": ["mcp-server-sqlite", "--db-path", "./test.db"]
  },
  "puppeteer": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-puppeteer"]
  }
}

Prompt Overrides (Optional)

/workspace/example/.opencodr/SYSTEM.txt

/workspace/example/.opencodr/REPROMPT.txt

(back to top)

Usage

generate

> MacBookPro:example user$ opencodr gen --help

 Usage: opencodr gen [OPTIONS]

╭─ Options ────────────────────────────────────────────────────╮
│ --f           TEXT  Load prompt from file [default: None]    │
│ --help              Show this message and exit.              │
╰──────────────────────────────────────────────────────────────╯

workspace

NOTE: Requires Docker

> MacBookPro:example user$ opencodr workspace --help

 Usage: opencodr workspace [OPTIONS] COMMAND [ARGS]...

╭─ Options ────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                  │
╰──────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────╮
│ create   Creates a docker image to sandbox the agent         │
│ start    Shortcut to start the container                     │
│ stop     Shortcut to stop the container                      │
╰──────────────────────────────────────────────────────────────╯

Contributing

Prerequisites

Repo Setup

git clone https://github.com/notpolomarco/opencodr.git
cd opencodr

Create Virtual Environment

uv venv
source .venv/bin/activate

Install

uv pip install -e ".[dev]"
pre-commit install
pre-commit install --hook-type pre-push

NOTE: to test any new features in workspace mode, build the base image from /opencodr/dockerfile.dev

uv build
docker build -t opencodr/base -f dockerfile.dev .

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

opencodr-0.1.8.tar.gz (235.7 kB view details)

Uploaded Source

Built Distribution

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

opencodr-0.1.8-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file opencodr-0.1.8.tar.gz.

File metadata

  • Download URL: opencodr-0.1.8.tar.gz
  • Upload date:
  • Size: 235.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.9

File hashes

Hashes for opencodr-0.1.8.tar.gz
Algorithm Hash digest
SHA256 d7be1292b8a2f093c82c2c60a635ce920bf9b06d099c8f7248abfc4259f1f551
MD5 0c7f3fdf561b9ba77fd7f8ffb08604d2
BLAKE2b-256 57cb01e2d1f1b471212c6142e5ba2b614bb618c8fc20ba9f56cc4e33d3ce5381

See more details on using hashes here.

File details

Details for the file opencodr-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: opencodr-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.9

File hashes

Hashes for opencodr-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fc5152a1d35210c85575ee7ac855e69a605b8c520bf400a40ae460a653b8924a
MD5 e12ec814318cd070ca4529f253cef376
BLAKE2b-256 cd0a3e71d05bd27dfa50de8c8a5caa4c3c3b4b872e7d4adcc4aab4a89cb75207

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