Anki Add Frequency
Overview
This skill provides a procedural workflow for evaluating the conversational frequency of words or phrases within Anki notes. It specifically targets notes where the frequency field is currently empty. It extracts the learning target from Anki cloze formatting and maps its commonality to a number between 1 (very common) and 1000 (rare).
Parameters
When this skill is triggered, respect the following parameters (usually provided as flags or in the request):
--deck: (Required) The Anki Deck Name to process.--target-field: (Optional) The name of the field where the frequency number will be stored. Defaults toFrequency.--limit: (Optional) Maximum number of notes to process in one run. Defaults to20.--batch-size: (Optional) The number of strings to evaluate in a single evaluation request. Defaults to5.--dry-run: (Optional) If enabled, show a preview of extracted words and evaluated frequencies but do NOT update Anki.
Workflow
To evaluate and add frequency to an Anki deck using these parameters, follow these steps:
1. Fetch and Filter Notes (Strictly Empty Target)
Query AnkiConnect for notes in the specified --deck where the --target-field is unset (empty).
AnkiConnect Query Example:
curl -s -X POST http://localhost:8765 -d '{
"action": "findNotes",
"version": 6,
"params": {
"query": "deck:\"'"$DECK"'\" \"'"$TARGET_FIELD"':\""
}
}'
- Fetch note details using
notesInfofor the resulting IDs. - Infer the primary language of the deck from the deck name or first note content.
- Limit the list to
--limit.
2. Extract Learning Targets
Identify the specific word or words the user is learning from the Expression field (or the first field if multiple).
- Look for Anki cloze markers:
{{c1::target::hint}}or{{c1::target}}. - Extract: Use your available extraction tools or logic to get just the
targetpart.- Logic: Find the content between
{{c1::and the first::(or the closing}}).
- Logic: Find the content between
- Deduplicate: Identify unique strings to minimize evaluation overhead.
3. Evaluate Frequency
Evaluate the frequency of the unique strings.
Evaluation Instruction:
"Evaluate how often the following strings appear in a conversational setting in [Language]. Map each to a number between 1 and 1000, where 1 represents a word used very often (e.g., pronouns, basic verbs) and 1000 represents a word that is rarely used. Provide the result as a JSON object mapping the original string to its frequency number."
4. Apply Updates
Map the evaluated frequencies back to the original Note IDs.
- If
--dry-run: Print a table ofID | Extracted Target | Frequencyand stop. - Otherwise: Update Anki in batches using the
multiaction to bundle multipleupdateNoteFieldsandaddTagsrequests into a single network call.
Guidelines
- Smart Fill Rule: NEVER process notes that already have content in the
--target-field. - Scale Consistency: Ensure 1 is most frequent, 1000 is least frequent.
- Batching: Respect the
--batch-sizewhen evaluating strings. - Cost Awareness: Summarize the number of evaluations to be performed before starting.