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.3.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.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for llm_tools_patch-0.3.tar.gz
Algorithm Hash digest
SHA256 15e2236793bdaa4185889136711beb275fa2ebc2b28c538d3f6cc6644dce037a
MD5 72d7710bd202a7f06f6beee3c9ecdf42
BLAKE2b-256 c3521159bb2556157d4791769ce20e536747b74402db15b15731b274b782ead6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llm_tools_patch-0.3-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.11.10

File hashes

Hashes for llm_tools_patch-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c0253f9045dae28442e2f59f1741afe60f6f508df7d011b048dbfcd3b2baaeaf
MD5 370f3f81f93825f5269ea4b79813172e
BLAKE2b-256 a05c77956b6af7e3d46fd4e9b8339a248b57cd35ac9d27ce0192a6428cf5bbd0

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