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").

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

  1. 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

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.7.0.tar.gz (47.4 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.7.0-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for chunkwrap-0.7.0.tar.gz
Algorithm Hash digest
SHA256 6414cbc2a1c656d7556a267ffa06eeb275fbd73d38f5c647d85f25a050101c48
MD5 eb468c5d5aa9bc62f2da300dbfafa3cf
BLAKE2b-256 bce41d8ac56810b02450ed210ea09bcc36591fb38d3697a63710a8a9f5cd989d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chunkwrap-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 31.2 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.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 171520072e9c546ce6f13693c402f328668439531bfd3aeb654d56675a005c08
MD5 ea09f3a14cd9f7d85049a0f8a5e8b31b
BLAKE2b-256 a5fb6a6424528af7866e6c939340e1657de55096cf42130f3235331d3faff62c

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