Skip to content

Repository files navigation

NotaBene

NotaBene converts Kindle highlights (My Clippings.txt) into an Anki .apkg deck, with filtering, dedupe, triage, and optional LLM-assisted card suggestions.

Demo

Web review workflow (30s)

Web review workflow

From raw highlights to export:

  1. Open review queue.
  2. Triage (keep, manual, discard).
  3. Run AI suggestion (Suggest Best) when useful.
  4. Edit card fields inline.
  5. Export .apkg.

Output in AnkiDroid

Card front Card back
AnkiDroid card front AnkiDroid card back

What this project does

  • Parses Kindle clippings into structured highlights.
  • Removes malformed, duplicate, and low-value snippets.
  • Generates card candidates (cloze, qa, apply).
  • Lets you review/edit decisions in terminal or a local web UI.
  • Exports selected notes to Anki package format.

High-level flow

  1. Parse My Clippings.txt.
  2. Run dedupe + quality filters + triage scoring.
  3. Review in terminal (--review) or web (--review-web).
  4. Optionally run AI suggestions in the web review UI.
  5. Save progress and export to .apkg.

Install

python -m venv .venv
source .venv/bin/activate
pip install .

Quick start

nota-bene "/path/to/My Clippings.txt" out.apkg

Useful flags:

  • --verbose for pipeline stats
  • --on-duplicate skip|update|keep-both
  • --skip-book "Book Title" (repeatable)

Review modes

Terminal review:

nota-bene --review "/path/to/My Clippings.txt" out.apkg

Web review:

nota-bene --review-web "/path/to/My Clippings.txt" out.apkg

Or with make (builds web/dist if needed, then starts web review):

make web-review CLIPPINGS="/path/to/My Clippings.txt" OUT="out.apkg"

If your project Python is not .venv/bin/python, override it:

make web-review PYTHON=/path/to/python CLIPPINGS="/path/to/My Clippings.txt" OUT="out.apkg"

The web review UI supports:

  • triage queue (swipe/keyboard/buttons)
  • keep/manual/discard/duplicate decisions
  • per-book rules (visibility + preferred card type)
  • inline note editing and undo
  • AI suggestion actions (Suggest Best, format-specific suggestions)

Web UI screenshots

Review queue Book rules
Review queue with triage controls Per-book visibility and card-type rules
Inline edit AI suggestion
Inline field editing before export Suggest Best result and chosen format reason
Export result
Export complete with output artifacts

Save vs Export

  • Save:
    • Persists current review edits/state (notes, rules, settings).
    • Does not produce a deck file.
  • Export:
    • Persists state and runs final export pipeline.
    • Produces the final .apkg deck and sidecar artifacts.

Use Save while iterating, Export when you want an importable deck.

Optional AI suggestions

By default, the backend proxies /api/llm to a local OpenAI-compatible endpoint (for example LM Studio).

Server-side env vars:

  • K2A_LLM_API_URL (default: http://127.0.0.1:1234/v1/chat/completions)
  • K2A_LLM_MODEL (default: gemma-3-12B-it-QAT-Q4_0.gguf)
  • K2A_LLM_CONNECT_TIMEOUT (default: 1.5 seconds, quick availability check)
  • K2A_LLM_REQUEST_TIMEOUT (default: 60 seconds, upstream request timeout)

When LM Studio is down/unreachable, requests fail quickly with a clear 502 proxy error instead of hanging for a long time.

Client-side env vars:

  • VITE_LLM_API_URL (optional, bypasses proxy; may hit CORS)
  • VITE_LLM_MODEL (model field sent from UI)

Web UI development

Build once for local serving via Python:

cd web
npm install
npm run build

Dev server (separate terminal):

cd web
VITE_API_BASE=http://127.0.0.1:38435 npm run dev

Output files

Common generated artifacts:

  • out.apkg exported Anki deck
  • *.review.json review-state JSON
  • *.review.rules.json saved rule decisions
  • *.review.settings.json saved settings
  • *.dedupe.json dedupe report
  • *.feedback.json feedback examples

These are ignored by .gitignore by default.

Who this is for

NotaBene is for readers who already collect Kindle highlights and want high-quality Anki cards with a local-first review workflow. It is not a hosted sync service; you run it locally and import the final deck into Anki.

Privacy & safety

  • Clippings are processed locally by default.
  • The web UI and review backend run on 127.0.0.1.
  • LLM use is optional but encouraged.
  • If K2A_LLM_API_URL is set, requests go to that endpoint.

Known limitations

  • Chapter/section extraction is limited by source clipping metadata.
  • Card quality still depends on highlight quality and review choices.
  • LLM suggestions may require manual edits.
  • Anki import is a separate final step after .apkg export.

Project layout

  • nota_bene/cli.py entrypoint and command wiring
  • nota_bene/pipeline.py end-to-end processing pipeline
  • nota_bene/clippings.py Kindle parsing
  • nota_bene/dedupe.py duplicate detection/reporting
  • nota_bene/triage.py scoring and card-worthiness logic
  • nota_bene/review_web.py local review API + web serving
  • nota_bene/anki_export.py final .apkg export
  • web/src/ React review UI
  • tests/ parser/pipeline/quality/triage test coverage

About

NotaBene converts Kindle highlights (`My Clippings.txt`) into an Anki `.apkg` deck, with filtering, dedupe, triage, and optional LLM-assisted card suggestions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages