Skip to main content

reelith

CI PyPI License: MIT Python 3.11+

A local, offline-capable film recommender for your Letterboxd history.

Your client LLM acts as a semantic router: it turns "something cynical and slick" into anchor films like Fight Club and Nightcrawler, and a local vector engine does the actual search. Nothing about your taste leaves your machine, and the recommendations come from arithmetic over your own ratings rather than from a model's memory.

How it works

your mood
   │
   ▼
client LLM (BYO: Claude Desktop, ...)      ← semantic router, no recommendations of its own
   │  MCP over stdio, three tools
   ▼
Python MCP server  ──────────────┐
   │                             │
   ▼                             ▼
Rust/PyO3 vector engine      SQLite local state
(cosine + Hilbert + Lehmer)  (history, policy, cache)
  • Anchors → vector. Your positive anchors become a centroid; the policy blends it with a learned vector s_t (state S₀ is a flat, unweighted centroid of your rated history — the MDP starting state).
  • Search. Cosine scores over the whole catalog, then a top-m region ordered by Hilbert rank and sampled by weighted Lehmer unranking. Sampling without replacement, no duplicates, tunable temperature. As temperature approaches zero, the output converges exactly to greedy.
  • Feedback. accept / reject_dislike move s_t; reject_seen_it only masks.

Requirements

  • Python 3.11+
  • uv

That is all a user needs. The Rust extension ships as a prebuilt abi3 wheel (one wheel covers every Python 3.11+), and the recommendation index builds itself on first run, so there is no compiler and no setup step.

Install (users)

The server entry is always the same — uvx reelith, stdio transport. No compiler, no config file, nothing to build.

uvx reelith doctor        # check this machine, then prints your client entry

Then add it to any MCP client:

{ "mcpServers": { "reelith": { "command": "uvx", "args": ["reelith"] } } }

Claude Code:

claude mcp add reelith -- uvx reelith

reelith doctor is worth running first: the first recommendation downloads the index, and in most MCP clients that progress goes to a stderr stream the host never shows. Running it in a terminal once means the download happens where you can see it.

The download (what it is and why)

reelith needs a vector index to rank films: one vector per film, learned from 10.2 million Letterboxd ratings. That is the model. It is not a cache of the site, and it is not your data — it is what makes recommendations arithmetic instead of an LLM guessing.

It comes as three files totalling ~40 MB, fetched once into ~/.reelith/artifact/:

File Size What it is
embeddings.bin 34 MB 138,016 films × 64 floats. The actual vectors.
films.sidecar.parquet 6.1 MB Per-film metadata: slug, title, and year for the subset that has one.
meta.json 300 B Dimensions and build provenance, used for integrity checks.

Why not ship them inside the package? A wheel is downloaded per virtualenv, per platform. The index is fetched once per machine and shared by every client that uses reelith.

Why not fetch live from Letterboxd? Rediscovering 138k films on every query would be slow, rate-limited, and robots.txt forbids the browse pages. Live Letterboxd is used only to bridge a film the index has never seen.

After the first run there is no network requirement. Queries are answered from the mmap'd vectors on disk.

If the bundle is unreachable, reelith falls back to rebuilding from the public Letterboxd 10M ratings dataset: /prep/fetch-letterboxd (~107 MB) then letterboxd, ~30 s of CPU. Same index, more bytes. A self-hoster is never stuck.

Override the location with REELITH_HOME, point at a bundle or mirror with REELITH_BUNDLE_URL, use a prebuilt index with REELITH_ARTIFACT_DIR, or set REELITH_NO_BOOTSTRAP=1 to get the old loud failure instead (useful in CI and offline runs).

Install (per client)

The entry is identical everywhere — uvx reelith, stdio transport — because uvx resolves the package without you choosing a Python or a venv. Copy the row for your client.

Claude Code

claude mcp add reelith -- uvx reelith

Claude Desktop — claude_desktop_config.json (Windows: %APPDATA%\Claude\, macOS: ~/Library/Application Support/Claude/, Linux: ~/.config/Claude/):

{ "mcpServers": { "reelith": { "command": "uvx", "args": ["reelith"] } } }

Restart Claude Desktop afterwards.

Cursor — ~/.cursor/mcp.json:

{ "mcpServers": { "reelith": { "command": "uvx", "args": ["reelith"] } } }

VS Code — .vscode/mcp.json:

{ "servers": { "reelith": { "type": "stdio", "command": "uvx", "args": ["reelith"] } } }

Codex CLI

codex mcp add reelith -- uvx reelith

Gemini CLI — ~/.gemini/settings.json:

{ "mcpServers": { "reelith": { "command": "uvx", "args": ["reelith"] } } }

DeepSeek Harness — ~/.dsh/profiles/<profile>/cordis.patch.yml:

- id: reelith
  command: 'uvx'
  args: ['reelith']

Anything else that speaks MCP over stdio: the command is uvx, the args are ["reelith"]. That is the whole interface.

Do not have uv? Install it first: powershell -c "irm https://astral.sh/uv/install.ps1 | iex" (Windows) or curl -LsSf https://astral.sh/uv/install.sh | sh (macOS/Linux).

Without uvx

pip install reelith     # compiles Rust; needs a toolchain
reelith doctor

Then use "command": "reelith" with no args. Prefer uvx: it needs no compiler and no venv.

Develop

uv sync                       # builds the Rust extension from source
uv run pytest                 # 238 tests, no network needed

The prep dependency group (dataset build only) is not installed by default: it is large and the server never imports it. Add it with uv sync --group prep when you build an artifact.

Try it against the committed synthetic fixture before building a real artifact:

uv run python examples/quickstart.py

That drives all three tools over a real MCP client session — ingest a sample export, query, record feedback — and prints what comes back. No client to configure, no network, no API key. To use a real artifact instead:

uv run python examples/quickstart.py --artifact data/artifacts/dev --state data/demo.db

To run the actual server (what a client launches), use uv run reelith with the environment variables from docs/client-config.md.

Build a real artifact

The committed fixture is 200 synthetic films — enough to exercise every code path, not enough to recommend anything. For real use, build from a ratings dataset:

uv run --group prep python -m reelith.prep build \
    --dataset <huggingface-dataset> \
    --outdir data/artifacts/dev

This produces three files, which travel together:

File Contents
embeddings.bin LREC magic, version, N, dim, then N×dim float32 unit vectors
films.sidecar.parquet slug, title, year, runtime, director, genres, hilbert_rank (several are empty: see below)
meta.json build parameters, dim, row count, checksums

Expected scale: ~159k films × 64 dims ≈ 41 MB. See docs/FULL-BUILD.md for the full-size build and docs/OFFLINE-BUILD.md for a no-network build.

Connect a client

See docs/client-config.md. Short version: register reelith as a stdio MCP server, point REELITH_ARTIFACT_DIR at your artifact, and paste docs/SYSTEM-PROMPT.md into the client's custom instructions.

The three tools

Tool Purpose
ingest_letterboxd_data(username | local_zip_path) Load history from a public profile or export zip. Exactly one argument.
query_embedding_space(positive_anchor_movies, ...) Recommend films near the anchors. Supports k, negatives, director/year/runtime filters, include_watched.
record_rl_feedback(movie_id, feedback_type) accept / reject_dislike / reject_seen_it.

Anchors are film titles, not moods — the client LLM supplies the semantics. Titles outside the local index come back in missing_anchors with a reason (no_api_key, no_tmdb_result, no_proxy, network) so the client can say so honestly instead of guessing.

Prompts and resources

Two more MCP surfaces, both read-only, for jobs that are not tool calls:

Surface Name What it does
prompt recommend Takes a mood, expands it into the "find anchors, then query" instruction.
prompt onboard The setup flow: ask for a username or export zip, then ingest.
resource reelith://index Films, dimensions, ratings and history size — the index's provenance.
resource reelith://history Your films with the rating that counts, newest first.
resource reelith://films/{slug} One film record.

Resources are what a person can attach to a conversation; tools are what the model calls. Inspect engine state without burning a turn on a tool call.

Caveat on reelith://films/{slug}: the artifact carries year for only 22,289 of 138,016 films, and no genres, director or runtime at all. Those fields are null, not zero — the ratings dump does not include them.

Layout

src/reelith/
  server.py      MCP server, three tools
  context.py     startup wiring: artifact, engine, state, policy, resolver
  prompts.py     the system prompt (canonical copy)
  artifact.py    artifact loading
  state.py       SQLite: history, policy, trajectories, TMDB cache
  rl.py          policy: S0, query blending, feedback updates, temperature
  oov.py         out-of-vocabulary resolution + TMDB proxy imputation
  ingest/        zip parsing, scraping, pagination
  prep/          artifact build: ALS, dimensionality reduction, Hilbert keys
crates/reelith-engine/   Rust: mmap vectors, Fenwick sampling, Hilbert ordering
spec/                   per-module specs
tasks/                  plan, task list, checkpoints

Testing

uv run pytest                    # everything
uv run pytest tests/server -q    # MCP tools through a real client session
cargo test --offline             # Rust: sampling, Fenwick, Hilbert

The test suite needs no network. Scraper tests use synthetic HTML fixtures that reproduce Letterboxd's documented markup conventions — they pin our parsers' behavior, but they were not recorded from the live site, so a future DOM change would not be caught by them. The parsers fail loudly rather than silently dropping rows.

Known limits

  • Coverage is the artifact's vocabulary. Films outside it are resolved through TMDB proxies or reported missing; they are never invented.
  • Scraping is best-effort. Letterboxd has no public API and may change its markup. The zip export path is the stable fallback.
  • Embeddings are trained geometry, not semantics. A random-projection fallback replaces UMAP when umap-learn is unavailable; recommendations remain coherent but less sharp.
  • Single user, single process. stdio transport, one state database, no auth.

License

Not yet chosen.

Metadata

Release files for reelith 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reelith 0.0.1
File Size Uploaded Provenance Actions
reelith-0.0.1.tar.gz 56.5 kB With provenance Details for reelith-0.0.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for reelith 0.0.1
File Actions
reelith-0.0.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for reelith-0.0.1-cp311-abi3-win_amd64.whl
reelith-0.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for reelith-0.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
reelith-0.0.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for reelith-0.0.1-cp311-abi3-macosx_11_0_arm64.whl
reelith-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for reelith-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 1.3 MB

Release files / reelith-0.0.1.tar.gz

Download URL reelith-0.0.1.tar.gz
Size 56.5 kB
Tags Source
SHA-256 checksum
How to use checksums
20b0b29d03dd3f5e2997a255cdfce175782f9a9f965a3f51aa9251ae5e1ca9be
BLAKE2b-256 checksum
How to use checksums
cc51adf769d7f4a0aed66a8da3180f970164276ac0fbfb0e196247fe9ed39d2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / reelith-0.0.1-cp311-abi3-win_amd64.whl

Download URL reelith-0.0.1-cp311-abi3-win_amd64.whl
Size 220.5 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
516f629ec6e67d7e744ab4f0c320a8605edc30c7fbab690a616d0de54a6829cf
BLAKE2b-256 checksum
How to use checksums
53f0c3243b5a44835dbc8264b508c1d33eaf6dfd80ab10419651f6e6096d7a88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / reelith-0.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL reelith-0.0.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 354.6 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
03e31daba9008910399ff4432cb88a990552cf91bfac7c96bdefde006948ff9a
BLAKE2b-256 checksum
How to use checksums
64c790e05d951785b8d21057ff08f015722eb019e0b0beb512312d584b25918a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / reelith-0.0.1-cp311-abi3-macosx_11_0_arm64.whl

Download URL reelith-0.0.1-cp311-abi3-macosx_11_0_arm64.whl
Size 315.7 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9166ab148b2fd2e917394df62a3fc7f9b74d60f0ce58a12bbb80a90bb9cfd89d
BLAKE2b-256 checksum
How to use checksums
c885d6eea017375a89906ce1e6cc2ce0fccff2faa1dcbf46cfc9371b25bd120e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / reelith-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL reelith-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 314.8 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ed43367305d369dbbadb9c04f089f5f6f6e7771fb74b38ad65bf7a260ee4630b
BLAKE2b-256 checksum
How to use checksums
51e6f7c79dbfbeb55a25eb056889bc77278b80127a87b7801c8feee4363cbd88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for reelith 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for reelith-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page