Metadata-Version: 2.4
Name: obsidianki
Version: 0.9.1
Summary: Generate flashcards from Obsidian notes using AI and sync them to Anki
Author-email: ccmdi <ccmdi.dev@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/ccmdi/obsidianki
Project-URL: Repository, https://github.com/ccmdi/obsidianki
Project-URL: Issues, https://github.com/ccmdi/obsidianki/issues
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.25.0
Requires-Dist: python-dotenv>=0.19.0
Requires-Dist: rich>=13.0.0
Requires-Dist: urllib3>=1.26.0
Requires-Dist: pygments>=2.10.0
Requires-Dist: questionary>=2.0.0
Requires-Dist: httpx>=0.24.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"

# ObsidianKi

Automated flashcard generation to Anki from your Obsidian vault.

![Preview](images/preview.webp)

## Installation

```bash
# 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
```

## Why?
Obsidian is a knowledge store. You write notes without the explicit intention of reviewing them later. The knowledge in Obsidian is **unstructured** (natural language), and forcing flashcard review into Obsidian via manual question/answer pairs is making it something it fundamentally isn't.

Anki, on the other hand, is an application exactly for purposeful review. Anki is inherently **structured** via "question/answer" flashcard format. 

To get the best of both worlds, knowledge management in Obsidian and review scheduling in Anki, we need to translate the unstructured notes to structured flashcards. **Bridging this gap is the main goal of ObsidianKi**.

## Setup

Run:
```bash
obsidianki
```

This will start the interactive setup. Here's what you'll need:

1. **Obsidian access (pick one in setup):**
   - **Obsidian CLI** (Obsidian 1.12+): enable Command line interface in Settings → General and register the CLI.
   - **Local REST API**: install the [plugin](https://github.com/coddingtonbear/obsidian-local-rest-api) and copy the API key from its settings.

2. **AnkiConnect setup:**
   - Add-on code: `2055492159`
   - Keep Anki running

The interactive setup will guide you through model selection and configuration.

## Usage

```bash
oki                                # Generate from random old notes
oki --notes "React"                # Generate from specific note
oki --notes "frontend/*:3"         # Sample 3 notes from folder
oki -q "What is X?"                # Standalone query (no source note)
oki --notes "React" -q "hooks"     # Targeted extraction from note
```

See the [reference](docs/usage.md) for all commands and options.

## Index
* [How it works](docs/how-it-works.md)
* [Vector deduplication](docs/vectors.md) - best deduplication method
* [MCP server](docs/mcp.md) - for conversational use
* [Environment variables](docs/environment.md) - optional `.env` settings for Obsidian

* [Reference](docs/usage.md) - cli usage

## 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) |
| `vector_dedup` | `false` | Enable semantic deduplication via embeddings |
| `vector_threshold` | `0.7` | Similarity threshold for duplicate detection (0-1) |
