Skip to main content

A project that splits files and copies them to paste buffer with context for an LLM.

Reason this release was yanked:

1.0.0 released

Project description

PLATFORM SUPPORT AND EARLY TESTING

This project aims for cross-platform, browser-based accessibility. Early testing results:

  • Works as intended on:

    • Chrome on macOS (tested on MacBook Air)

    • Chrome on Android (tested on Samsung S24 FE)

    • (Likely also works on Edge and recent Chromium-based browsers)

  • Known limitation:

    • Chrome on iPad (iOS): The "Play Welcome" button displays and the welcome text appears after clicking, but speech synthesis does not play audio. This appears to be a limitation of Chrome and/or Web Speech API support on iOS/iPadOS, which often blocks or fails to implement certain audio APIs for non-Safari browsers.
  • Safari/iOS support:

    • Not yet tested or prioritized. Apple's browser restrictions may block speech synthesis or speech input features in web apps.

Workaround:
Users on iPad/iOS devices can still read the welcome message text and use the rest of the app, but won't hear synthesized speech until browser/OS support improves. Desktop and Android users get full audio.

If you have feedback or success/failure reports for other browsers/devices, please open an issue!chunkwrap

A Python utility for splitting large files into manageable chunks, masking secrets, and wrapping them with custom prompts for Large Language Model (LLM) processing.

Overview

chunkwrap helps you process large files with LLMs by splitting them into smaller chunks, masking sensitive data, and wrapping each chunk with your specified prompt. It tracks your place between runs, so you can work incrementally.

Features

  • Automatic chunking: Split files into chunks of configurable size (default: 10,000 characters)

  • Multi-file support: Combine and process multiple input files seamlessly

  • Secret masking: Use TruffleHog regex patterns to redact secrets

  • State management: Resume where you left off using a saved chunk index

  • Clipboard integration: Automatically copies the wrapped chunk to your clipboard

  • Prompt flexibility: Use different prompts for regular and final chunks

  • Progress tracking: Indicates current chunk number out of total

Installation

  1. Clone this repository

  2. Install required dependencies:

    pip install pyperclip
    

Usage

Basic Usage

python chunkwrap.py --prompt "Analyze this code:" --file file1.txt

With Multiple Files

python chunkwrap.py --prompt "Review content:" --file file1.py file2.md

With Secret Masking

Place a truffleHogRegexes.json file in the same directory. Example:

{
  "AWS": "AKIA[0-9A-Z]{16}",
  "Slack": "xox[baprs]-[0-9a-zA-Z]{10,48}"
}

Each matching string will be replaced with ***MASKED-<KEY>***.

With a Custom Chunk Size

python chunkwrap.py --prompt "Summarize:" --file notes.txt --size 5000

Custom Prompt for Final Chunk

python chunkwrap.py --prompt "Process chunk:" --lastprompt "Wrap up and summarize:" --file main.md

Reset State and Start Over

python chunkwrap.py --reset

Output Format

Your prompt here (chunk 2 of 5)
"""
[chunk content with secrets masked]
"""

The final chunk uses --lastprompt (if provided) and omits the chunk counter.

State File

A .chunkwrap_state file is created in the current directory to track your current chunk index. Delete this file or use --reset to begin again.

Requirements

  • Python 3.11+

  • pyperclip library

License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

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.

  1. Configurable prompt suffixes: Add support for automatically appending standard instructions to all prompts (e.g., "Use concise responses for intermediate chunks").

  2. External configuration management: Move configuration options to ~/.config/chunkwrap.json with CLI commands for managing settings.

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

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

chunkwrap-0.6.3.tar.gz (46.5 kB view details)

Uploaded Source

Built Distribution

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

chunkwrap-0.6.3-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file chunkwrap-0.6.3.tar.gz.

File metadata

  • Download URL: chunkwrap-0.6.3.tar.gz
  • Upload date:
  • Size: 46.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for chunkwrap-0.6.3.tar.gz
Algorithm Hash digest
SHA256 b9c93595e662a392aeeb5416c4e269deacec7fa184e7ccd0c88bfc6c765bf68e
MD5 bb426fb4a02926f9cf18a0b53b4da8dc
BLAKE2b-256 f4baa0916515a682befaf8f4ea6dab29bccec62b65f778ab9c77b94124144722

See more details on using hashes here.

File details

Details for the file chunkwrap-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: chunkwrap-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for chunkwrap-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e8334df08d7c2a152df7f6fdae982631f21860995ed0e36de12872735121f686
MD5 962a977a5ce1d1c29987537369c77f0f
BLAKE2b-256 5221d3a906659606ae913200bafce5d1f0b318d70d06bdd9ea865d296172b1a4

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