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 https://github.com/ccmdi/obsidianki.git

# pip
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 commands
oki config list              # List all settings
oki config get max_cards     # Get specific setting
oki config set max_cards 15  # Update setting

Tag Management

oki tag                      # Show tag commands
oki tag list                 # List tag weights and exclusions
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

oki --notes "React" "JavaScript"     # Process specific notes
oki --cards 10                       # Generate up to 10 cards total
oki --notes "React" "JavaScript" --cards 6  # Generate ~3 cards per note (6 total)
oki --notes "React" --cards 6        # Generate ~6 cards from React note

# Directory patterns
oki --notes "path/to/files/*"      # Process all notes in directory
oki --notes "path/*" --sample 5          # Sample 5 random notes from directory
oki --notes "path/*" --sample 10 --bias 1 # Sample with maximum bias against over-processed notes

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

Deck Management

oki --deck "Programming"             # Add cards to specific deck
oki -q "Python basics" --deck "CS"  # Query mode with custom deck
oki config set deck "MyDeck"         # Change default deck

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

Other features

Custom flashcard type: Includes clickable "Origin" field that opens the source note

Deduplication: History-based and deck-based options to avoid the same repeated content

Statistics: View generation history and top notes

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.5.1.tar.gz (32.2 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.5.1-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: obsidianki-0.5.1.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.11

File hashes

Hashes for obsidianki-0.5.1.tar.gz
Algorithm Hash digest
SHA256 cf0e8d925c5418b5f1cb290f60442a8157f17743f8f87c418fce719f6714dd52
MD5 a2edc3868e7bcf9dffc68e283f4ceeae
BLAKE2b-256 b329340be1d71f5f0224c9df27b47746967f700ce18d13092f106b6dcaaf7df8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: obsidianki-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 35.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.11

File hashes

Hashes for obsidianki-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75fa2e775f2177bc0ec140f32251de6b9d219fcdc9453fadafba3787e71e0a28
MD5 748b1fe5775c077f13cdb12be199e4be
BLAKE2b-256 24f33cc7e633d3abc3216e880ca0f30591944c0cb7aca9adbb4fde02f5d0a284

See more details on using hashes here.

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