Metadata-Version: 2.5
Name: annotheca
Version: 0.7.0
Summary: A local, bilingual notebook and reference manager for research projects: BibTeX, PDFs, highlights, a dated journal with TikZ diagrams, to-dos, and MCP tools for AI assistants.
Project-URL: Homepage, https://github.com/melissa-colin/annotheca
Author: Melissa Colin
License-Expression: MIT
License-File: LICENSE
Keywords: annotation,bibliography,bibtex,pdf,reference-manager,research
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: fastapi>=0.110
Requires-Dist: httpx>=0.27
Requires-Dist: mcp<3,>=2
Requires-Dist: uvicorn>=0.29
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/src/annotheca/static/favicon.svg" width="72" alt="">
</p>

<h1 align="center">Annotheca</h1>

<p align="center">
  <b>A calm, local notebook for your research projects and their bibliography.</b><br>
  Paste a reference, get the BibTeX and the PDF, highlight, take notes, export one clean <code>.bib</code>.<br>
  Keep a dated journal of the project, with images and TikZ diagrams, and a to-do list.<br>
  Let Claude and other AI assistants file the papers they find, with verified metadata, and write in the journal.
</p>

<p align="center">
  <a href="https://pypi.org/project/annotheca/"><img src="https://img.shields.io/pypi/v/annotheca" alt="PyPI"></a>
  <a href="https://pypi.org/project/annotheca/"><img src="https://img.shields.io/pypi/pyversions/annotheca" alt="Python versions"></a>
  <a href="https://github.com/melissa-colin/annotheca/actions/workflows/tests.yml"><img src="https://github.com/melissa-colin/annotheca/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/docs/library.png" alt="The library view of Annotheca" width="900">
</p>

## Why

Research projects live in stages (state of the art, method, experiments,
writing) and the same paper often matters in several of them, for different
reasons. Annotheca organises references the way the project is organised, and
keeps track of how the project moves forward:

- **Projects and stage folders.** Annotheca opens on your projects; a
  project opens on its journal, and the sidebar lists its folders. Every project starts with a `SoA`
  (state of the art) folder; add as many folders as your project has stages.
- **Paste anything.** BibTeX (one or many entries), DOIs, arXiv IDs, links to
  paper pages (publishers, HAL, IACR ePrint...), or a formatted citation
  copied from a paper (APA, IEEE, ...). Annotheca resolves it into clean
  BibTeX through doi.org, arXiv, Crossref and the page's own metadata, and
  refuses a citation it cannot match with certainty rather than guess.
- **PDFs found for you.** Open-access PDFs are downloaded automatically from
  arXiv, Semantic Scholar and OpenAlex, following repository landing pages to
  their PDF. Otherwise, drop the PDF on the paper.
- **Highlights, sticky notes and reading notes.** Highlight passages in five
  colours, pin draggable post-its on the page, and write as many dated
  reading notes on each paper as you like, next to it in the list or beside
  the PDF. Every reading note, and every comment written on a highlight or a
  post-it, also appears in the journal with a link that opens the paper.
- **One paper, several folders, separate notes.** A paper filed in two folders
  is stored once, but its highlights and notes are specific to each folder:
  what you underline for the state of the art is not what you underline for
  the method.
- **A dated journal.** Write down what you did, decided or found, outside
  any paper. Entries are dated automatically, grouped by day, and written in
  Markdown. Tag them as an idea, experiment, result, problem, decision or
  reading, or with categories of your own, and show one or several
  categories at a time when you need to. Link an entry to a paper
  of the project, or to a new one, to make it a reading note on it. Paste or
  drop images (plots, photos of a whiteboard), and write a ` ```tikz ` block
  to get a LaTeX TikZ diagram drawn in place.
- **Attached files, versioned with the journal.** Attach any file to an
  entry, such as a script, a dataset or a config: it is kept as it was that
  day and downloads in one click. PDFs, such as slides, are previewed in the
  entry: turn the pages there, or open them larger. A newer version goes in a newer entry, so
  the journal becomes the history of your work and of its files.
- **A to-do list** for what comes next, with an optional priority and
  deadline (marked when it is near or past), and the date each task was
  done.
- **Draft a paper with [PaperOrchestra](https://github.com/google-research/paper-orchestra).**
  The *PaperOrchestra* button downloads the project as raw materials for
  this multi-agent paper writer from Google Research: the journal as the
  experimental log, its ideas in the idea file, its images as figures, the papers with your notes and
  the `.bib`. Describe the idea in `idea_sparse.md` and run it; the archive's
  README explains how. PaperOrchestra is installed separately and runs on
  your own API keys.
- **A trash.** Deleted projects and papers go to the trash with their
  folders, notes and highlights, and can be restored for 30 days before they
  are deleted for good.
- **Share a project.** *Share* downloads the project, with its folders,
  notes, highlights, PDFs, journal and attached files, as one `.annotheca`
  file; whoever receives it
  opens it with the import button of the sidebar.
- **Works with AI assistants.** Claude (or any MCP client) can file the papers
  it finds into your projects, add notes, read yours, get the `.bib`, write
  journal entries with diagrams and images, and manage the to-do list. See
  [AI assistants](#ai-assistants).
- **One clean `.bib`.** Export the whole project in one click; papers filed in
  several folders appear only once, with stable, unique citation keys.
- **English and French**, light and dark themes, everything stored locally.

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/docs/reader.png" alt="Reading a paper with highlights and a sticky note" width="900">
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/docs/journal.png" alt="The project journal: categories, a TikZ diagram written by Claude, attached files and a plot" width="900">
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/docs/todo.png" alt="The to-do list of a project, with tasks added by Claude" width="900">
</p>

## Install

Three steps, about a minute. You do not need Python installed: the installer
below takes care of it.

**1. Install [uv](https://docs.astral.sh/uv/)**, the tool that installs
Annotheca and the Python it needs. Copy this into a terminal:

- Linux and macOS:

  ```sh
  curl -LsSf https://astral.sh/uv/install.sh | sh
  ```

- Windows (PowerShell):

  ```powershell
  powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  ```

Then **close the terminal and open a new one**, so that it finds `uv`.

**2. Install Annotheca:**

```sh
uv tool install annotheca
```

**3. Start it:**

```sh
annotheca
```

Your browser opens on Annotheca. That's it.

Optional, to let Claude use your library (see [AI assistants](#ai-assistants)):

```sh
annotheca connect
```

To update later: `uv tool upgrade annotheca`.

<details>
<summary>Something went wrong?</summary>

- **`uv: command not found`** right after step 1: open a new terminal, or run
  `source $HOME/.local/bin/env` (Linux and macOS).
- **`annotheca: command not found`** after step 2: run
  `uv tool update-shell`, then open a new terminal.
- **Already using pipx?** `pipx install annotheca` works too.

</details>

## Use

```sh
annotheca
```

The interface opens in your browser at <http://127.0.0.1:8737>. Running the
command again while Annotheca is running simply reopens it.

| Option or command | Effect |
| --- | --- |
| `--port PORT` | Serve on another local port (default `8737`). |
| `--data-dir DIR` | Keep the library somewhere else. |
| `--no-browser` | Do not open the browser. |
| `connect` | Make Annotheca available to Claude (see below). |
| `mcp` | Serve the tools for AI assistants over stdio (used by `connect`). |

Tips:

- `Ctrl+Enter` adds what you pasted, or posts a journal entry.
- Click a citation key to copy `\cite{key}`.
- Drop a PDF file on a paper to attach it.
- In the reader, select text to highlight it; switch to *Sticky note* and
  click on the page to pin a note; click a highlight to recolour or delete it;
  `Esc` goes back.
- In the to-do list, double-click a task to edit it.
- TikZ diagrams are compiled in the browser by
  [TikZJax](https://github.com/drgrice1/tikzjax), downloaded the first time a
  diagram is shown, so they need a connection that time. The libraries
  positioning, arrows.meta, calc, fit and shapes.geometric are always loaded;
  load others with `\usetikzlibrary`. A diagram that does not compile shows
  its source with a message instead.

## AI assistants

When an assistant writes references itself, it can get a title, an author or a
year wrong. With Annotheca, the assistant only says *which* paper it means (a
DOI, an arXiv ID, a citation); Annotheca fetches the metadata from doi.org,
arXiv and Crossref, files the paper with its PDF, and answers with the exact
citation key, title and authors to use. Every paper, journal entry and task an
assistant adds is marked with its name, so you can always see, and filter,
what it relied on and what it wrote.

`annotheca connect` registers Annotheca as an
[MCP](https://modelcontextprotocol.io) server for **Claude Code** (in every
project) and **Claude Desktop** when they are installed, and prints the
configuration to paste into other MCP clients (Cursor, Codex, Gemini CLI...).
The assistant then just needs to be asked:

> Find recent papers on contact-implicit trajectory optimisation and add the
> three most relevant to the SoA of my PhysProx project, with a note on each.

> What did I highlight in posa2013direct? Write the related-work paragraph
> citing the papers of the Method folder.

> Log what we found today in the journal of PhysProx, with a TikZ diagram of
> the pipeline, and add the remaining experiments to its to-do list.

| Tool | What the assistant can do |
| --- | --- |
| `list_projects` | See the projects, their folders and journal categories. |
| `create_project`, `create_folder` | Create them. |
| `add_references` | File papers from DOIs, arXiv IDs, BibTeX or citations, with a note; get back verified metadata. |
| `list_papers` | List the papers of a project with your notes. |
| `read_paper` | Read a paper's BibTeX, your reading notes, highlights and sticky notes, and the path of its PDF. |
| `add_note` | Add a dated, signed reading note on a paper; it appears in the journal. |
| `get_bibtex` | Get the project's `.bib`. |
| `add_journal_category` | Add a journal category of the project's own. |
| `read_journal`, `add_journal_entry` | Read the project journal, or one category of it, with the local path of attached files; write a dated, signed entry in Markdown, with a category, TikZ diagrams, images and attached files. |
| `list_todos`, `add_todo`, `complete_todo` | Read the to-do list, add to it with a priority and a deadline, tick tasks off. |

Nothing else is needed: the server explains itself to the assistant. What it
adds appears in the interface as soon as you come back to the window.

## Your data

Everything stays on your machine, in `~/.local/share/annotheca` (or
`$XDG_DATA_HOME/annotheca`, or `$ANNOTHECA_HOME`):

```
library.db   SQLite database: projects, folders, BibTeX, notes, annotations,
             journal, to-do lists, trash
pdfs/        one PDF per paper
images/      images of the journal
files/       files attached to the journal
```

Back it up by copying that directory. The only network requests are the
lookups of references and PDFs, sent to doi.org, arXiv, Crossref, Semantic
Scholar, OpenAlex and the repositories they point to.

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/docs/trash.png" alt="The trash, with a project and a paper to restore" width="700">
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/docs/library-dark.png" alt="Dark theme" width="700">
</p>

## Development

```sh
git clone https://github.com/melissa-colin/annotheca
cd annotheca
uv venv && uv pip install -e '.[test]'
.venv/bin/pytest
.venv/bin/annotheca --data-dir /tmp/annotheca-dev
```

Releases are made by the maintainer: only accounts with write access to this
repository can push tags, and PyPI only accepts packages built by this
repository's release workflow from a `v*` tag. To release, set the new
`version` in `pyproject.toml`, commit, then push a matching tag; the tests run
and the package is published:

```sh
git tag v0.7.0 && git push origin v0.7.0
```

The code follows the Google Python and JavaScript style guides. The backend is
a small [FastAPI](https://fastapi.tiangolo.com/) app over SQLite
(`src/annotheca`); the interface is dependency-free JavaScript modules with
[pdf.js](https://mozilla.github.io/pdf.js/) vendored, so there is no build
step. Journal entries are rendered with
[marked](https://marked.js.org/) and sanitized with
[DOMPurify](https://github.com/cure53/DOMPurify), both vendored too.

```
src/annotheca/
  cli.py         command line entry point
  api.py         HTTP API and static files
  library.py     storage: projects, folders, papers, placements, annotations
  bundle.py      .annotheca files to share a project
  paper_orchestra.py  raw materials to draft a paper with PaperOrchestra
  mcp_server.py  tools for AI assistants (Model Context Protocol)
  models.py      validated shapes shared by the API and the bundles
  bibtex.py      BibTeX parsing, formatting, citation keys, identifiers
  sources.py     doi.org, arXiv, Crossref, Semantic Scholar, OpenAlex lookups
  static/        web interface; js/main.js routes between the project
                 picker, the trash (trash.js) and the views of a project:
                 papers.js (a folder), journal.js, todos.js; notes.js lists
                 the reading notes on a paper, markdown.js renders journal
                 text and pdf-preview.js previews attached PDFs
```

## License

MIT. Vendored libraries keep their licenses, next to them in
`src/annotheca/static/vendor/`: pdf.js (Apache License 2.0), marked (MIT),
DOMPurify (MPL 2.0 or Apache License 2.0). TikZJax (GPL 3.0) is not
distributed with Annotheca: the browser downloads it from jsDelivr when a
diagram is shown.
