blattbot
v0.3.0
Published
Agentic LaTeX editing for Overleaf — Claude edits a synced working copy, verifies by compiling, and shows you a reviewable diff before anything is pushed. Local-first, with an integrated citation pipeline.
Maintainers
Readme
🍃 BlattBot (beta)
A local bridge and review layer for Overleaf projects. BlattBot mirrors a project into a git checkout on your machine and syncs it with any Overleaf instance — including Community Edition and self-hosted servers that have no git bridge at all, which it reaches through your existing browser session. Git-bridge instances and pure-local projects work too.
Every change, whether you typed it or the built-in agent made it, lands as a reviewable diff. Approving pushes it to Overleaf; nothing lands without your approval. Before a push, BlattBot checks the remote for changes made in the meantime: remote-only edits are absorbed, and a push that would overwrite someone's work is blocked until you resolve it. Document updates are applied in place over Overleaf's own realtime protocol, so comments, tracked changes, and per-document history survive a push.

A real agent session: literature search, citations added to the bibliography and cited in the text, then approved and pushed. Sped up.
Overleaf (any instance) ⇄ local git mirror ⇄ editor + Claude agent
⇩
you review the diff → approve → pushQuickstart
npx blattbotThis starts the app on http://127.0.0.1:4560 and opens your browser. On first run BlattBot checks your environment and offers to download tectonic if no TeX engine is found. Run npx blattbot --help for flags and npx blattbot doctor to see what it detects.
You need Node 20 or newer, git, and Claude Code installed and logged in. BlattBot reuses the Claude Code login, so there is no API key to configure. An OpenAI-compatible endpoint can be configured instead in Settings.
Sync without clobbering
- Drift detection. Approving a change first fetches a fresh snapshot from Overleaf. Files that changed both remotely and locally block the push with a per-file conflict list; you can discard your version per file, or force the push — in which case the remote versions are backed up locally first.
- Selective merge. Remote changes to files you have not touched are merged into your mirror as their own commit, both during a normal sync and after a push.
- In-place updates. Edited documents are updated through Overleaf's realtime protocol rather than deleted and re-uploaded, so entity ids are preserved and comments, tracked changes, and per-document history stay attached. If an in-place update fails, BlattBot falls back to a plain upload and tells you.
The agent
The agent works in the local git mirror and every turn ends in a diff you approve or discard. It compiles after editing and fixes its own LaTeX errors before showing you anything.
- Citations. A pipeline searches OpenAlex, Semantic Scholar, DBLP, and Crossref, fetches BibTeX, dedupes against your bibliography (by DOI and title), normalizes entries, upgrades arXiv preprints to the published version when one exists, and inserts the right cite keys. A deterministic audit checks every entry against Crossref/OpenAlex and badges it verified, unresolved, or mismatched.
- Rendered PDF diff. Besides the text diff, the Proof tab can render the current and pre-change PDFs and highlight the pages and regions that visually changed — the latexdiff use case, without Perl.
- Cost transparency. Every turn shows its cost (or token count), each project shows a running total, and a disclosure generator writes an AI-use statement from your actual usage logs — useful for venue and institutional AI policies.
- Review mode. A structured referee-report mode with a venue-style rubric; file edits are blocked in it.
- Understand mode. A read-only Q&A mode that explains the project's text, math, and arguments, grounding every answer in quoted passages from your files; file edits are blocked in it too.
Honesty notes
- The local compile is a preflight using Tectonic (or your local TeX). Overleaf runs its own TeX Live, which can differ — the "Verify on Overleaf" button runs Overleaf's own compiler on the pushed state and shows you that PDF.
- Cookie-session sync drives Overleaf's internal web API, which is unofficial. It is primarily intended for Community Edition and self-hosted servers that have no git bridge; see SECURITY.md.
- Your project text and the context you attach are sent to the model provider you configure (Anthropic via Claude Code, or an OpenAI-compatible endpoint). Check your venue's and institution's AI policy — the disclosure generator helps with that.
Why not just Claude Code?
Claude Code in a folder can edit LaTeX. BlattBot adds what a bare CLI session doesn't have: sync with Overleaf instances that have no git bridge, a review/approval gate so no agent output reaches your document unchecked, entity-preserving pushes that keep comments and tracked changes alive, a compile preflight plus verification on Overleaf's own compiler, rendered PDF diffs, and a citation pipeline with deterministic auditing instead of model-remembered BibTeX.
Connecting
Sign in once per Overleaf instance. The easiest way is "Sign in from browser session", which imports the login you already have in Firefox, Chrome or most other browsers.
Instances with the git bridge (paid overleaf.com plans, Server Pro) can also be connected through a git URL.
Security
The server binds to 127.0.0.1 only, checks the Host header on every request and requires a local auth token for the API, so other users and web pages cannot drive it. Secrets live in ~/.local/share/blattbot with 0600 permissions. Treat that folder like ~/.ssh. Overleaf cookies are only ever sent to your own Overleaf instance. The agent is blocked from running git commit or push. Details, including what data leaves your machine and how to revoke credentials, are in SECURITY.md.
Install from source
git clone https://github.com/LckyLke/blattbot.git
cd blattbot
npm install
npm run build --workspace=web
npm run devThe app then runs on http://127.0.0.1:4560, same as the npx version.
Development
npm workspaces. server/ is Fastify and TypeScript, web/ is React and Vite.
npm install
npm run dev # server on :4560
npm run dev:web # Vite dev server on :4561
npm test # unit tests
npx tsx server/scripts/ui-verify.ts # browser UI verification without agent turns
npx tsx server/scripts/e2e.ts # full loop with a real agent turn
npm run release:pack # build and pack the npm tarballCI runs the suite on Ubuntu, macOS and Windows. Release notes live in CHANGELOG.md.
License
Source-available under PolyForm Noncommercial 1.0.0, Luke Friedrichs. Free for personal, academic, and other noncommercial use.
