chenxiachan/textfold
Fold papers, web pages, files, and AI replies into five levels of detail. Zoom from an overview to the original text.
TextFold – Read long documents at the speed you want
What it is
- A desktop‑plus‑CLI tool that lets you fold any piece of text (research papers, web articles, PDFs, Word docs, code READMEs, even an LLM’s own replies) into five progressively shorter levels, from the full paragraph down to a one‑line topic map.
- The folding is done by a local LLM you already have (Claude, OpenAI, Anthropic, Ollama, etc.) – TextFold never sends your content to a third‑party server.
How it works
- Input – paste a URL (arXiv, PubMed, Wikipedia, GitHub, any web page) or drop a file (PDF, Word, PowerPoint, Excel, EPUB, Markdown, CSV, images). It can also read items directly from your Zotero library.
- Model‑driven summarisation – the connected LLM creates five hierarchical “levels”:
- 1 Full – original text.
- 2 Brief – one‑to‑three key sentences, verbatim.
- 3 Key – the main point and its reasoning (derived from the brief sentences).
- 4 Takeaway – a single line per section.
- 5 Topic – a few words that turn the whole document into a navigable map.
- Interactive UI – zoom in/out with pinch or scroll, jump to a level with keys 1‑5, click a paragraph to expand, highlight and add margin notes that persist across levels.
- Agent integration – a Claude Code plugin and a Pi extension automatically fold every LLM reply into the same five levels, letting you skim or dive without a second summarisation model.
- Export – save a page as a single HTML file (including notes, optional PDF, or as Markdown/JSON) or use the CLI
textfold getto stream folded text to any script.
Key features
- Multi‑source support: arXiv, PubMed Central, bioRxiv, medRxiv, Wikipedia, GitHub READMEs, any web article, PDFs (including scanned PDFs via a built‑in PDF engine), Word/PowerPoint/Excel, EPUB, CSV, images.
- Language coverage: twelve languages, translated sentence‑by‑sentence while preserving formulas.
- Local‑only: runs on your computer (macOS, Windows, or any OS via the Python package). No accounts, no API keys unless you choose to add one.
- Zotero integration: browse your Zotero collections, open items directly, and keep original metadata.
- Agent‑ready CLI:
python3 -m textfold get <source> --level <level> [--section N]for pipelines that need a coarse‑to‑fine view of a document. - Open format: folded documents follow a documented JSON‑like schema (
docs/format.md) so other tools can read/write them.
Getting started
- Desktop app – download the signed macOS or Windows bundle from the GitHub Pages site; it includes its own Python runtime.
- Python package –
pip install textfoldthenpython -m textfold serveto launch a local web UI athttp://localhost:3017. - Connect a model – the UI will detect Claude Code, Codex, or Pi automatically. You can also link a ChatGPT plan, use OpenRouter’s free models, or add any OpenAI‑compatible endpoint via Settings.
- Try it – paste a paper URL, pick a language, and use the
1‑5keys or pinch‑zoom to explore.
Typical use cases
- Researchers: skim dozens of new papers, keep highlights, and ask the LLM questions that cite the exact paragraph.
- Students: turn long textbook chapters into a navigable map, study only the takeaway level, then drill down as needed.
- Developers: fold lengthy README or code‑generation replies in Claude Code or Pi, reducing token usage while preserving the original wording.
- Automation: feed folded sections to downstream scripts (e.g., summarisation pipelines, knowledge‑base ingestion) via the CLI.
License
- Apache 2.0 – you can use, modify, and redistribute the code freely.
Links
- Demo gallery: https://chenxiachan.github.io/textfold/gallery/
- Documentation:
docs/format.md,docs/DEVELOPMENT.md - Contribute: see
CONTRIBUTING.md
Related
- Project
- Project
- Project
- Project