Skip to content
agenticarusPublic
forked from Aider-AI/aider

About

Patch is AI pair programming in your terminal

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Patch

AI pair programming in your terminal

Website · GitHub

PyPI Python versions GitHub Stars License

Patch lets you pair program with LLMs to start a new project or build on an existing codebase.

Features

Cloud and local LLMs

Patch connects to cloud and local LLMs, giving you the flexibility to use the models that work best for you.

Maps your codebase

Patch maps your entire codebase, which helps it work well in larger projects.

100+ code languages

Patch works with Python, JavaScript, TypeScript, Rust, Ruby, Go, C++, PHP, HTML, CSS, and dozens more.

Git integration

Patch automatically commits changes with sensible commit messages. Use familiar Git tools to diff, manage, and undo AI changes.

Use in your IDE

Use Patch from within your favorite IDE or editor. Ask for changes by adding comments to your code and Patch will get to work.

Images & web pages

Add images and web pages to the chat to provide visual context, screenshots, reference docs, etc.

Voice-to-code

Speak with Patch about your code. Request new features, test cases, or bug fixes using your voice and let Patch implement the changes.

Linting & testing

Automatically lint and test your code every time Patch makes changes. Patch can fix problems detected by your linters and test suites.

Copy/paste to web chat

Work with any LLM via its web chat interface. Patch streamlines copying code context and edits between your terminal and browser.

Getting Started

Patch supports Python 3.10 through 3.14. Install it from PyPI and run the patch command:

python -m pip install patch-chat

# Start Patch in your codebase
cd /to/your/project
patch

To hack on Patch itself, install it from source in editable mode instead:

git clone https://github.com/PierrunoYT/patch.git
cd patch
python -m pip install -e .

See CONTRIBUTING.md for the full development setup.

Security Boundaries

Patch treats both model output and the repository under edit as untrusted input.

Writes stay inside the repository. Every model-supplied path is resolved canonically and must land inside the repository root before anything is created or modified. Absolute paths, .. traversal, and symlinks pointing outside the tree are refused, including under --no-git and --yes, and including the patch format's Move to: target. Files added with --read or /read-only are never written to at all: they are reference material, so an edit targeting one is refused whether it sits inside the repository or outside it.

The repository's own config is not trusted. A .patch.conf.yml or .env discovered inside the repository cannot set execution-capable options (test, test-cmd, lint-cmd, load, notifications-command, editor, verify-ssl, git-commit-verify) or environment variables that redirect API endpoints or proxies (*_API_BASE, *_BASE_URL, HTTP(S)_PROXY, REQUESTS_CA_BUNDLE, ...). Nor can it name another file for Patch to trust — env-file, model-settings-file and model-metadata-file are refused from repository config for that reason. The same applies to a .patch.model.settings.yml or .patch.model.metadata.json in the repository, whose extra_params would otherwise set api_base, api_key and extra_headers for every model. A repository .env may also only add environment variables, never replace ones you exported in your shell: a project that ships OPENAI_API_KEY would otherwise send your prompts to the real provider on someone else's account. Ignored settings and files are reported at startup. Your home-directory config and any file you pass explicitly on the command line with --config, --env-file, --model-settings-file or --model-metadata-file are trusted as usual — they still override your shell, because naming a file is an instruction — and only a flag actually present in the command line counts, never one a repository config supplied.

Pass --trust-repo-config to opt back in for a repository you trust. You can also set PATCH_TRUST_REPO_CONFIG in your shell. The setting is ignored when it comes from the repository's own config or .env, so a repository cannot grant itself trust.

Running in a container. The boundary above distinguishes your files from the repository's by comparing against your home directory, so do not set HOME to the directory you mount the project into — the two become indistinguishable and every filter above stops applying. The bundled docker/Dockerfile keeps HOME at /home/appuser and mounts your project at /app; mount a volume at /home/appuser/.patch if you want the caches to outlive the container.

Running Commands

/run, /test and --test-cmd stop a command after 120 seconds and report exit status 124, so a hung command cannot stall the session. Raise the limit with --command-timeout SECONDS, or pass --command-timeout 0 to remove it entirely:

patch --test-cmd "pytest" --command-timeout 600   # allow ten minutes
patch --test-cmd "pytest" --command-timeout 0     # no limit

Output is streamed to your terminal in full; only the copy kept for the chat is capped, at 1 MB, with the oldest lines dropped first.

Development

See CONTRIBUTING.md for local development instructions. Amp orbs use the repository's executable .agents/setup script to provision the complete development and optional-feature toolchain automatically on fresh remote machines.

More Information

Documentation

Community & Resources

About

Patch is AI pair programming in your terminal

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages