Markdown Chunker for RAG
Chunks that keep their headings.
Fixed-size splitting cuts code blocks in half and throws away the heading a paragraph belongs to, so retrieval returns "Run the build command" with no idea which product or step it is. This guide chunks a short deploy guide and shows the result.
This is the exact input and an excerpt of the report Markdown Chunker for RAG returns for it. The full report also carries input and report SHA-256 hashes for verification.
{
"markdown": "# Deploy guide\n\nThis guide covers deploys.\n\n## Requirements\n\nNode 24 and a Cloudflare account.\n\n## Steps\n\n### Build\n\nRun the build command. It writes the worker bundle to dist/.\n\n```bash\nnpm run build\nnpx wrangler deploy\n```\n\n### Roll back\n\nUse the dashboard to promote the previous version.",
"maxChars": 200
}{
"chunkCount": 4,
"chunks": [
{
"index": 0,
"id": "58b8558248327aaa",
"headingPath": [
"Deploy guide"
],
"startLine": 1,
"endLine": 3,
"charCount": 42,
"text": "# Deploy guide\n\nThis guide covers deploys."
},
{
"index": 1,
"id": "b086e21106d00566",
"headingPath": [
"Deploy guide",
"Requirements"
],
"startLine": 5,
"endLine": 7,
"charCount": 50,
"text": "## Requirements\n\nNode 24 and a Cloudflare account."
},
{
"index": 2,
"id": "eaf69e8f6df672ff",
"headingPath": [
"Deploy guide",
"Steps",
"Build"
],
"startLine": 9,
"endLine": 18,
"charCount": 128,
"text": "## Steps\n\n### Build\n\nRun the build command. It writes the worker bundle to dist/.\n\n```bash\nnpm run build\nnpx wrangler deploy\n```"
},
{
"index": 3,
"id": "b8849db643db29be",
"headingPath": [
"Deploy guide",
"Steps",
"Roll back"
],
"startLine": 20,
"endLine": 22,
"charCount": 65,
"text": "### Roll back\n\nUse the dashboard to promote the previous version."
}
]
}No account is needed to pay: an agent with its own wallet answers the HTTP 402 quote, or a human approves each payment through the local Agent Spend bridge. Payment settles before delivery; there is no automatic refund.
The four chunks come back with paths such as ["Deploy guide", "Steps", "Build"]. Prepend the path to the text you embed, or store it as metadata, and a query for "how do I roll back a deploy" can match the right section even though the paragraph never says "deploy".
The bash block with npm run build and npx wrangler deploy lands in one chunk together with the sentence that explains it. A fenced block is only split if it alone is larger than maxChars.
A heading with no text of its own — "## Steps" directly followed by "### Build" — is carried into the next chunk instead of becoming a chunk that only contains a title.
Each chunk has a 16-character id derived from its position, heading path and text, plus startLine and endLine in the source. Re-chunking the same document with the same settings gives the same ids, so you can upsert into a vector store instead of duplicating.
Budgets are in characters, not tokens: about four characters per English token. Optional overlap repeats the end of the previous chunk and is added on top of maxChars.
Up to 65,536 characters per call, with maxChars between 200 and 8,000 and overlap up to a quarter of maxChars.
No. It works on the Markdown you send. Convert saved HTML with HTML → Clean Markdown first.
Ids are stable for identical input and settings. Editing a section changes the ids of chunks from that point on.
0.011112 USDC per call on Base mainnet, including the platform fee. The exact 402 quote is authoritative.
Chunks that keep their headings.
A local MCP bridge that proposes each paid call and waits for you to approve it.
Replace API keys, JWTs, emails, card numbers, IPs and phone numbers in logs with consistent placeholders before an agent pastes them into a model, a ticket or a vector store.
Check a batch of raw model outputs against one JSON Schema and get the valid rate, the outputs that needed repair, and the exact paths and rules that fail most often.
Check MCP, OpenAI function and Anthropic tool definitions for short descriptions, undocumented arguments, open objects and OpenAI strict-mode problems, with JSON-pointer paths for every finding.