Skip to main content

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. 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 — 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

Release files for patch-chat 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for patch-chat 0.2.0
File Size Uploaded
patch_chat-0.2.0.tar.gz 1.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for patch-chat 0.2.0
File Interpreter ABI Platform
patch_chat-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / patch_chat-0.2.0.tar.gz

Download URL patch_chat-0.2.0.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
07a25e6490ad69abdb511ce07053a4b5d746cef77c18f41af04d0122caded2d0
BLAKE2b-256 checksum
How to use checksums
fd204185e215277026deb94f3bf44143a3f1601ff04e41f18c197ca14ecb8717
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / patch_chat-0.2.0-py3-none-any.whl

Download URL patch_chat-0.2.0-py3-none-any.whl
Size 268.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10172631a802ae35ae073cbfeaf82f673d2820a874565962237a7533420980b5
BLAKE2b-256 checksum
How to use checksums
2e3af106528c2213721a21d1be6f473ccc5c6568d804198217cf96c4c611ca60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page