Skip to main content

LLM tools for reading, writing and changing text files

Project description

llm-tools-patch

PyPI Changelog Tests License

LLM plugin for Simon Willison's llm providing text file manipulation, including reading, writing, and edits.

Installation

Install this plugin in the same environment as LLM. You'll need at least LLM 0.26a1 or later.

From PyPI (recommended)

llm install llm-tools-patch

From source

git clone https://github.com/dannyob/llm-tools-patch
cd llm-tools-patch
llm install .

⚠️ Security Warning

This plugin provides AI agents with direct file system access. The tools can read, write, and modify files within your current working directory. Before enabling this plugin:

  • File access is restricted to the working directory where you run the llm command
  • Only use with trusted AI models and prompts
  • Use --ta (tool approval) mode - review all file operations carefully
  • Consider the potential impact if an AI agent modifies important files

Usage

The plugin provides a single Patch toolbox with five core operations:

Available Tools

  • read - Read complete contents of a text file
  • write - Write new content to a file (overwrites existing)
  • edit - Make a single string replacement
  • multi_edit - Apply multiple string replacements in sequence
  • info - Get file metadata and information

Basic Usage

# Make a single edit
llm prompt -m gpt-4o-mini "Change port 8080 to 3000 in config.txt" --tool Patch --ta
# Make multiple edits
llm prompt -m gpt-4o-mini "Add a smiley face to the first heading in README.md, then a thank you emoji to the last heading" --tool Patch --ta --chain-limit 0

Recommended Options

For interactive use, combine these flags:

  • --ta - Requires user confirmation before executing functions (safety)
  • --chain-limit 0 - Allows unlimited tool calls in one session (default is 5)

Development

Setup Development Environment

# Clone and set up development environment
git clone https://github.com/dannyob/llm-tools-patch
cd llm-tools-patch
make dev-setup
source .venv/bin/activate

Testing

make test           # Run all tests
make test-coverage  # Run tests with coverage report
make quick-test     # Fast test run (exits on first failure)

Plugin Testing

After installation, verify the plugin is working:

llm tools  # Should list Patch tools
llm prompt "Read this README.md file" --tool Patch

Credits and Thanks

Inspired by Claude Code's Read, Edit and MultiEdit tools.

Coded with Claude.

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

llm_tools_patch-0.2.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

llm_tools_patch-0.2-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file llm_tools_patch-0.2.tar.gz.

File metadata

  • Download URL: llm_tools_patch-0.2.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_tools_patch-0.2.tar.gz
Algorithm Hash digest
SHA256 9a25df7e8fe8ce6cce982d5c4f024c21810dc5052d856556222dc852b81f5709
MD5 d646e8bdca30fc1ee9fbc7fe17d16803
BLAKE2b-256 d5745e9e66f4d79d74dcd150668fe1d2f87074e1ca4f1a902628d362576b2e83

See more details on using hashes here.

File details

Details for the file llm_tools_patch-0.2-py3-none-any.whl.

File metadata

  • Download URL: llm_tools_patch-0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_tools_patch-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e408c2853d226fcd57d8f7a0af17b79f8bfdc2f405ef472fd06dd31193b5b4a0
MD5 e0eabec6fc43cd6a1ef9e0ad33008132
BLAKE2b-256 1f5f8f63358b26d7ce459b5142e2b3f156a4a31922493fa0ccef183bf637645a

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