Generate flashcards from Obsidian notes using AI and sync them to Anki
Project description
ObsidianKi
Automated flashcard generation to Anki from your Obsidian vault.
Installation
# uv
uv tool install obsidianki
# uv (source)
uv tool install https://github.com/ccmdi/obsidianki.git
# pip
pip install obsidianki
# pip (source)
pip install https://github.com/ccmdi/obsidianki.git
Setup
Run:
obsidianki
This will start the interactive setup. Here's what you'll need:
-
Obsidian Local REST API plugin setup:
- Install plugin in Obsidian
- Copy the API key from plugin settings
-
Anthropic API key:
- Get from console.anthropic.com
-
AnkiConnect setup:
- Add-on code:
2055492159 - Keep Anki running
- Add-on code:
You can then follow the interactive setup and edit the configuration as you like.
Usage
obsidianki # Generate flashcards
oki # Alias
Configuration
oki config # Show config
oki config get max_cards # Get specific setting
oki config set max_cards 15 # Update setting
Tags
oki tag # Show tags
oki tag add python 2.0 # Add/update tag weight
oki tag remove python # Remove tag weight
oki tag exclude boring # Exclude notes with 'boring' tag
oki tag include boring # Remove 'boring' from exclusion list
Notes
# Process specific number of notes
oki --notes 5 # Sample 5 random notes
oki --notes 10 --cards 20 # Sample 10 notes, max 20 cards total
# Process specific notes by name
oki --notes "React" "JavaScript" # Process specific notes
oki --notes "React" --cards 6 # Process React note, max 6 cards
# Directory patterns with sampling
oki --notes "frontend/*" # Process all notes in frontend/
oki --notes "frontend/*:5" # Sample 5 notes from frontend/
oki --notes "docs/*.md:3" # Sample 3 markdown files from docs/
oki --notes "react*:2" "vue*:1" # Sample 2 React + 1 Vue note
# Mixed usage
oki --notes "React Hooks" "components/*:3" # Specific note + 3 from pattern
Query mode
# Make flashcard without source note
oki -q "how to center a div"
oki -q "CSS flexbox" --cards 8
# Targeted extraction from source note(s)
oki --notes "React" -q "error handling"
oki --notes "JavaScript" "TypeScript" -q "async patterns" --cards 6
Advanced
# Deck management
oki --deck "Programming" # Add cards to specific deck
oki deck # List all Anki decks
oki deck rename "Old" "New" # Rename a deck
# History
oki history stats # View generation statistics
oki history clear # Clear processing history
oki history clear --notes "React*" # Clear history for specific notes
# Templating
oki template add "programming" "--notes 'frontend/*' --cards 3' -b 1"
oki template use programming # runs the above command as "oki --notes 'frontend/*' --cards 3' -b 1"
How it works
Standard mode
- Finds old notes in your vault (configurable age threshold)
- Weights notes by tags and processing history (avoids over-processed notes)
- Generates flashcards using Claude 4 Sonnet
- Creates cards in Anki "Obsidian" deck (or
DECKset in config)
Query mode
- Standalone: Generates flashcards from AI knowledge alone based on your query
- Targeted: Extracts specific information from selected notes based on your query
Configuration options
| Setting | Default | Description |
|---|---|---|
max_cards |
6 |
Maximum cards per session |
notes_to_sample |
3 |
Number of notes to process in default mode |
days_old |
30 |
Only process notes older than N days |
sampling_mode |
"weighted" |
"weighted" or "uniform" note selection |
card_type |
"custom" |
"basic" or "custom" Anki card type |
deck |
"Obsidian" |
Default Anki deck name |
approve_notes |
false |
Review each note before processing |
approve_cards |
false |
Review each card before adding to Anki |
deduplicate_via_history |
false |
Avoid duplicates using processing history |
deduplicate_via_deck |
false |
Avoid duplicates by checking existing deck cards |
use_deck_schema |
false |
Match existing card formatting in deck |
syntax_highlighting |
true |
Enable code syntax highlighting |
upfront_batching |
false |
Process notes in parallel (faster) |
batch_size_limit |
20 |
Max notes per batch |
batch_card_limit |
100 |
Max cards per batch |
density_bias_strength |
0.5 |
Bias strength against over-processed notes (0-1) |
search_folders |
[] |
Limit processing to specific folders (array) |
MCP
There is an experimental MCP server that runs Obsidianki as a subprocess. Useful if you want to generate flashcards from daily use with an LLM, such as if you ask questions back and forth and want to generate flashcards from that material.
Project details
Release history Release notifications | RSS feed
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 obsidianki-0.8.1.tar.gz.
File metadata
- Download URL: obsidianki-0.8.1.tar.gz
- Upload date:
- Size: 44.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bfabbcbbf130f279dfe793b3fbf209a481a2aa90d121c60e3e700914d50b659
|
|
| MD5 |
3c9b72a10972fd0537630a43837707d5
|
|
| BLAKE2b-256 |
027b7138009f0c2ce369ec135561f635fdc51f84ebfd46c277e578cd018db79d
|
Provenance
The following attestation bundles were made for obsidianki-0.8.1.tar.gz:
Publisher:
release.yml on ccmdi/obsidianki
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
obsidianki-0.8.1.tar.gz -
Subject digest:
1bfabbcbbf130f279dfe793b3fbf209a481a2aa90d121c60e3e700914d50b659 - Sigstore transparency entry: 630397941
- Sigstore integration time:
-
Permalink:
ccmdi/obsidianki@2b95dc2b4455667c072f71e3c010b50a01c9c725 -
Branch / Tag:
refs/tags/v0.8.1 - Owner: https://github.com/ccmdi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b95dc2b4455667c072f71e3c010b50a01c9c725 -
Trigger Event:
push
-
Statement type:
File details
Details for the file obsidianki-0.8.1-py3-none-any.whl.
File metadata
- Download URL: obsidianki-0.8.1-py3-none-any.whl
- Upload date:
- Size: 48.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02d4b5dbd91ba3c16d0c236cd60ee7d27376cb1d3569880677c58e26ffc95026
|
|
| MD5 |
50605c0eb5d5e44d85a95b483ac557bf
|
|
| BLAKE2b-256 |
f4955b2fe384c43f39a80951a580a2f296a2e0786d70ea21e69d8e91224f2626
|
Provenance
The following attestation bundles were made for obsidianki-0.8.1-py3-none-any.whl:
Publisher:
release.yml on ccmdi/obsidianki
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
obsidianki-0.8.1-py3-none-any.whl -
Subject digest:
02d4b5dbd91ba3c16d0c236cd60ee7d27376cb1d3569880677c58e26ffc95026 - Sigstore transparency entry: 630397953
- Sigstore integration time:
-
Permalink:
ccmdi/obsidianki@2b95dc2b4455667c072f71e3c010b50a01c9c725 -
Branch / Tag:
refs/tags/v0.8.1 - Owner: https://github.com/ccmdi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b95dc2b4455667c072f71e3c010b50a01c9c725 -
Trigger Event:
push
-
Statement type: