Analysis updated 2026-05-18
Pipe a large Markdown file through doc-lok before sending it to an LLM to cut token costs on unchanged external links.
Integrate doc-lok as a TypeScript library in an AI agent workflow to condense documents programmatically before each prompt.
Run doc-lok --check --json to inspect which URLs in a document have changed before deciding whether to re-run an AI analysis.
| jl037/doc-lok | arashthr/hugo-flow | argeneau12e/kairos-tx | |
|---|---|---|---|
| Stars | 2 | 2 | 2 |
| Language | TypeScript | TypeScript | TypeScript |
| Setup difficulty | easy | moderate | hard |
| Complexity | 2/5 | 3/5 | 4/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
doc-lok is a Node.js library and command-line tool that reduces the number of tokens your Markdown documents consume when you feed them to an AI model. It works by detecting every external URL in a Markdown file, checking whether the content at that URL has changed since you last ran it, and replacing any unchanged links with a tiny HTML comment placeholder. Only links that have actually changed are left visible to the model. The token savings come from the fact that URLs and the text around them take up space in the AI's context window. If a documentation link or external reference has not changed since your last prompt, the model does not need to see it again. doc-lok caches the content hash and HTTP ETag of each URL in a local lockfile, then checks freshness with a lightweight network request before deciding whether to compress a link. The README claims up to 99.5% reduction per cached link. The restore command reverses the operation, turning the compact placeholders back into full links. This round-trip is lossless because each placeholder embeds the hash needed to look up the original URL in the lockfile. You can use it from the command line by piping a Markdown file through it before sending the result to an LLM, or as a TypeScript library inside a larger automation. It also outputs JSON for machine-readable integration with AI agent frameworks. A Windsurf workflow skill file is included. The library has zero runtime dependencies and requires Node.js 18 or later. The license is MIT.
A Node.js tool that shrinks Markdown files before sending them to AI models by replacing unchanged external links with tiny placeholders, cutting token usage by up to 99.5%.
Mainly TypeScript. The stack also includes TypeScript, Node.js.
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.