Split large contexts intelligently. Semantic chunking. Overlap control.
npm install ctxsplitSplit large contexts intelligently. Semantic chunking. Overlap control.
``bash`
npm install -g ctxsplit
`bashSplit file into chunks
ctxsplit large-doc.txt
Strategies
- size (default): Split by token count with overlap
- sentence: Split at sentence boundaries
- paragraph: Split at paragraph boundaries
- header: Split markdown by headers
Output
`
$ ctxsplit doc.txt --info
ctxsplit - pnkd.dev
───────────────────
Input: doc.txt
Size: 45,678 tokens
Strategy: size (4000 tokens)
Overlap: 200 tokens Chunks: 12
Range: 3,800 - 4,000 tokens
Average: 3,806 tokens
$ ctxsplit doc.txt --output chunks/
✓ Created chunks/chunk-01.txt (3,923 tokens)
✓ Created chunks/chunk-02.txt (4,001 tokens)
✓ Created chunks/chunk-03.txt (3,856 tokens)
3 chunks written to chunks/
``MIT
---
pnkd.dev - glitch the system