A project that splits files and copies them to paste buffer with context for an LLM.
Reason this release was yanked:
Released 1.1.1
Project description
chunkwrap
A Python utility for splitting large files into manageable chunks, masking secrets, and wrapping each chunk with custom prompts for Large Language Model (LLM) processing.
Overview
chunkwrap helps you prepare large files for LLM workflows by:
-
Splitting them into smaller, prompt-ready chunks
-
Redacting secrets via TruffleHog-style regexes
-
Tracking progress across invocations
-
Supporting clipboard-based interaction or (soon) alternate output modes
Features
-
Configurable chunking: Choose chunk size (default: 10,000 characters)
-
Multi-file support: Concatenate multiple inputs into a single stream
-
Secret masking: Redact sensitive patterns using configurable regexes
-
Prompt wrapping: Use distinct prompts for intermediate and final chunks
-
Clipboard integration: Copy output chunk directly to your paste buffer
-
State tracking: Progress is remembered across runs using a local
.chunkwrap_statefile -
Optional prompt suffix: Append boilerplate only to intermediate chunks
Installation
-
Clone the repository:
bash
git clone https://github.com/your/repo.git cd chunkwrap -
Install dependencies:
bash
pip install pyperclip -
On first run, a default config file will be created at:
-
Linux/macOS:
~/.config/chunkwrap/config.json -
Windows:
%APPDATA%\chunkwrap\config.json
-
Usage
Minimal example
bash
python chunkwrap.py --prompt "Analyze this:" --file myscript.py
Multiple files
bash
python chunkwrap.py --prompt "Review each file:" --file a.py b.md
Secret masking
Place a truffleHogRegexes.json file in the same directory:
json
{
"AWS": "AKIA[0-9A-Z]{16}",
"Slack": "xox[baprs]-[0-9a-zA-Z]{10,48}"
}
Each match will be replaced with ***MASKED-<KEY>***.
Custom chunk size
bash
python chunkwrap.py --prompt "Summarize section:" --file notes.txt --size 5000
Final chunk prompt
bash
python chunkwrap.py --prompt "Analyze chunk:" --lastprompt "Now summarize everything:" --file long.txt
Disable prompt suffix
bash
python chunkwrap.py --prompt "Chunk:" --file script.py --no-suffix
Show config path
bash
python chunkwrap.py --config-path
Reset state
bash
python chunkwrap.py --reset
Output Format
Each chunk is wrapped like:
Your prompt (chunk 2 of 4)
"""
[redacted content]
"""
Final chunk omits the index and uses --lastprompt if provided.
Roadmap
Near-term improvements
1. Auto-prompt modification for non-final chunks: Automatically append instructions to non-final chunks asking the LLM to reserve comprehensive responses for the final chunk. This prevents information loss when users only review the last response in a sequence.
2. Reset investigation: The reset command does not work as expected, and needs some love & attention.
- Configurable prompt suffixes: Add support for automatically appending standard instructions to all prompts (e.g., "Use concise responses for intermediate chunks").
3. External configuration management: Move configuration options to ~/.config/chunkwrap.json with CLI commands for managing settings.
- Make cross platform: local usage on Mac is good. My test machine is via ssh to a linux machine. The current code does not support this. Consider adding optional argument
chunkwrap [--output {clipboard|stdout|file}]to handle this situation.
Future considerations
- Chunk overlap: Add optional overlap between chunks to preserve context across boundaries
- Smart chunking: Break at natural boundaries (sentences, paragraphs) rather than arbitrary character counts
- Output formats: Support for different wrapper formats (XML tags, markdown blocks, etc.)
- Parallel processing: For very large file sets, allow processing multiple chunks simultaneously
- Integration modes: Direct API integration with popular LLM services
Requirements
-
Python 3.11+
-
pyperclip
License
GNU General Public License v3.0 --- see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chunkwrap-1.1.0.tar.gz.
File metadata
- Download URL: chunkwrap-1.1.0.tar.gz
- Upload date:
- Size: 47.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb6ea208c84000e526611a998f896118aae423d06cb0259b2cf9f4e88b1515c3
|
|
| MD5 |
bc3c52776a5be7256b498baf712547c6
|
|
| BLAKE2b-256 |
af681dfd5f4b22afbe04a054b6c226cc6d524f8eb204128898e77004b3aea955
|
File details
Details for the file chunkwrap-1.1.0-py3-none-any.whl.
File metadata
- Download URL: chunkwrap-1.1.0-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee976b64d71440535fe28fa3ec3b3998cdc088d76a70e166fe9a79d803156f9b
|
|
| MD5 |
de91585b89966e612b41ea0811e37672
|
|
| BLAKE2b-256 |
bb6c7be16245fa4fb915a1b6080e6e14db9369ba3f11d2dc39531694c6808530
|