Patch
AI pair programming in your terminal
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
- Installation and quick start
- Security boundaries
- Running commands
- Development guide
- Run
patch --helpfor all command-line and configuration options - Report a problem or request a feature
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)
| File | Size | Uploaded | |
|---|---|---|---|
| patch_chat-0.2.0.tar.gz | 1.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|