Agent-first flashcard CLI with FSRS scheduling and .apkg support
Project description
spacedrep
Spaced repetition you can script. A CLI and MCP server for flashcards — so an AI agent can generate cards from what you're learning, quiz you in conversation, and manage your deck alongside you.
Import your existing Anki decks to get started. Scheduling uses FSRS (same algorithm as Anki 23.10+). Everything is JSON in, JSON out — pipe it, script it, or let an agent drive it. Why build a CLI this way.
You: Quiz me on my AWS deck.
Agent: What does S3 stand for, and what is it used for?
You: Simple Storage Service, it's object storage.
Agent: Correct. Rated good — next review in 4 days. What is the CAP theorem?
You: Something about distributed systems... I forget.
Agent: CAP: pick 2 of 3 — consistency, availability, partition tolerance. Rated again — it'll come back shortly. 12 cards left.
Install
pip install spacedrep
Optional extras: spacedrep[mcp] for the MCP server, spacedrep[optimizer] for FSRS parameter optimization (requires torch).
Features
- FSRS scheduling — same algorithm as Anki 23.10+, with parameter optimization from your review history
- Cloze deletions —
{{c1::answer}}syntax, auto-expands into multiple cards - Anki-native storage — single SQLite file using Anki's schema for full round-trip compatibility
- Rich filtering — by deck, tags, state, date ranges, FSRS properties, and more
- Agent-friendly — duplicate detection, leech detection, review preview, bury/unbury, review history
MCP Server
Connect spacedrep to an AI agent as an MCP tool server:
pip install spacedrep[mcp]
Claude Code:
claude mcp add spacedrep -e SPACEDREP_DB=/path/to/collection.anki21 -- uv run --directory /path/to/spacedrep spacedrep-mcp
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"spacedrep": {
"command": "uv",
"args": ["run", "--directory", "/path/to/spacedrep", "spacedrep-mcp"],
"env": {
"SPACEDREP_DB": "/path/to/collection.anki21"
}
}
}
}
Set SPACEDREP_DB to configure the database path for the MCP server (default: ./collection.anki21). The CLI uses --db instead.
CLI Quick Start
spacedrep db init # create the database
spacedrep deck import ~/Downloads/deck.apkg # or import an existing Anki deck
spacedrep card add "What is CAP theorem?" "Pick 2 of 3: consistency, availability, partition tolerance" --deck AWS
spacedrep card add-cloze "{{c1::Ottawa}} is the capital of {{c2::Canada}}" --deck Geo
spacedrep card next # get the next due card
spacedrep review submit <card_id> good # again | hard | good | easy
See spacedrep --help and spacedrep <command> --help for all options.
Cloze Deletions
Each {{c1::answer}} becomes a separate card. Hints are supported: {{c1::Ottawa::capital city}} shows [capital city] as the blank.
spacedrep card update-cloze 42 "{{c1::Ottawa}} is in {{c2::Canada}}, {{c3::North America}}"
Search and Filters
spacedrep card list --search "Lambda" --deck AWS --state review
spacedrep card list --due-before "2026-12-31" --leeches
spacedrep card bury 42 --hours 4
spacedrep deck export out.apkg
Filters work on card list and card next. See --help for the full list.
Anki Compatibility
spacedrep operates directly on Anki's native SQLite schema. Importing an .apkg replaces the working database; exporting writes it back. FSRS scheduling state survives the round-trip — cards reviewed in spacedrep show correct due dates when opened in Anki.
Media files, JavaScript templates, and nested cloze deletions are not supported.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spacedrep-0.3.0.tar.gz.
File metadata
- Download URL: spacedrep-0.3.0.tar.gz
- Upload date:
- Size: 133.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3d359c8b369ba4b483a5c2c4eaf88fee9ca1c7d7ec93010583230661a905cf3
|
|
| MD5 |
5ea12b31dc9222a5465ea1113efcd7c9
|
|
| BLAKE2b-256 |
849327f767ec4dde92e13df91677945479ca4f88acf1c20793ef8e5e713357c8
|
Provenance
The following attestation bundles were made for spacedrep-0.3.0.tar.gz:
Publisher:
publish.yml on wpwilson10/spacedrep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spacedrep-0.3.0.tar.gz -
Subject digest:
a3d359c8b369ba4b483a5c2c4eaf88fee9ca1c7d7ec93010583230661a905cf3 - Sigstore transparency entry: 1303526451
- Sigstore integration time:
-
Permalink:
wpwilson10/spacedrep@41f36759eae2506d03cdeeec51425b80d03c7b61 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/wpwilson10
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@41f36759eae2506d03cdeeec51425b80d03c7b61 -
Trigger Event:
push
-
Statement type:
File details
Details for the file spacedrep-0.3.0-py3-none-any.whl.
File metadata
- Download URL: spacedrep-0.3.0-py3-none-any.whl
- Upload date:
- Size: 48.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
694b7066fda0e7ca5631ceaac32fc2913c26eceeb0482db2adf0b78a1351d549
|
|
| MD5 |
0d97bd4b4667e16034f8c7b8f7c91797
|
|
| BLAKE2b-256 |
ff1bf1b118ae0316bc007031967ae63ef8f61499b7b6c49f4473a3da787838dd
|
Provenance
The following attestation bundles were made for spacedrep-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on wpwilson10/spacedrep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spacedrep-0.3.0-py3-none-any.whl -
Subject digest:
694b7066fda0e7ca5631ceaac32fc2913c26eceeb0482db2adf0b78a1351d549 - Sigstore transparency entry: 1303526512
- Sigstore integration time:
-
Permalink:
wpwilson10/spacedrep@41f36759eae2506d03cdeeec51425b80d03c7b61 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/wpwilson10
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@41f36759eae2506d03cdeeec51425b80d03c7b61 -
Trigger Event:
push
-
Statement type: