Skip to main content

Generate flashcards from Obsidian notes using AI and sync them to Anki

Project description

ObsidianKi

Automated flashcard generation to Anki from your Obsidian vault.

Preview

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:

  1. Obsidian Local REST API plugin setup:

    • Install plugin in Obsidian
    • Copy the API key from plugin settings
  2. Anthropic API key:

  3. AnkiConnect setup:

    • Add-on code: 2055492159
    • Keep Anki running

You can then follow the interactive setup and edit the configuration as you like.

Usage

Basic Usage

obsidianki                   # Generate flashcards
oki                          # Alias

Configuration Management

oki config                   # Show config
oki config get max_cards     # Get specific setting
oki config set max_cards 15  # Update setting

Tag Management

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

Note Selection

# 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 Features

# 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 and statistics
oki history stats                    # View generation statistics
oki history clear                    # Clear processing history
oki history clear --notes "React*"   # Clear history for specific notes

How it works

Standard Mode

  1. Finds old notes in your vault (configurable age threshold)
  2. Weights notes by tags and processing history (avoids over-processed notes)
  3. Generates flashcards using Claude 4 Sonnet
  4. Creates cards in Anki "Obsidian" deck (or DECK set in config)

Query Modes

  • 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)
tag_schema_file "tags.json" File for tag weights configuration
processing_history_file "processing_history.json" File for processing history tracking

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

obsidianki-0.6.1.tar.gz (40.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obsidianki-0.6.1-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

Details for the file obsidianki-0.6.1.tar.gz.

File metadata

  • Download URL: obsidianki-0.6.1.tar.gz
  • Upload date:
  • Size: 40.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for obsidianki-0.6.1.tar.gz
Algorithm Hash digest
SHA256 23483778b7bad066d5089785ba08bf8bd8a08a2b723da267f13fb09c529ebfd2
MD5 3af36fa02389d426704216beb8d682dd
BLAKE2b-256 c47a1c1fa1b4440cdebcb637aa9c0bc678b60e77a9a91eeb01283bbde5a09326

See more details on using hashes here.

Provenance

The following attestation bundles were made for obsidianki-0.6.1.tar.gz:

Publisher: release.yml on ccmdi/obsidianki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file obsidianki-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: obsidianki-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 44.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for obsidianki-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b23c3e1ecbbd2179f1ea4de1614bb238d7a06a7e1f9b81596a1665eb6c38eedd
MD5 e2279119f1cc624b2b355101f2bd97a7
BLAKE2b-256 5ad0c74d3db6959f9ae57fb3b52c0131f6745c8972ddd3cafe2ac13a9f42065f

See more details on using hashes here.

Provenance

The following attestation bundles were made for obsidianki-0.6.1-py3-none-any.whl:

Publisher: release.yml on ccmdi/obsidianki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page