This post contains a referral link.
What you’ll learn in this post: how Claude Code can work with Anki directly through AnkiConnect (an add-on that lets programs control Anki). A real example of handing AI the duplicate-card check I had been doing by hand, from memory, for duplicates spread across different decks. And how to find the duplicates that Anki’s own duplicate finder missed, because some of my word cards, made by copying and pasting from articles in the browser, had HTML tags mixed into the front.
Duplicate cards mean studying the same thing twice, which lowers efficiency, so I finally got up to sort them out.
- 1 Eight years of Anki decks, and I no longer knew how many duplicates were buried in them
- 2 Wait, can Claude Code even connect to Anki?
- 3 I asked to see the deck list first, and it was more detailed than I expected
- 4 Checking where the duplicate tags stood (but telling it not to do anything yet)
- 5 English Memo and EX Grade 1 had different ways of registering words to begin with
- 6 The case of mixed-in HTML tags, found through a screenshot
- 7 I opened the list to check it: “That’s perfect”
- 8 Double-checking: the other decks are really untouched, right?
- 9 Tagging and suspending the 307 cards, on the EX Grade 1 side only
- 10 An unexpected ambush: mysterious old duplicate tags
- 11 Putting the suspension policy into words
- 12 Deleting the unneeded tags and restoring the card suspended by mistake
- 13 Agreeing on what “unchecked” meant, and deciding exact matches were enough
- 14 Summary: AI working directly with my local Anki was more amazing than I expected
- 15 English expressions I learned (B2–C1)
Eight years of Anki decks, and I no longer knew how many duplicates were buried in them
When you use Anki for almost eight years, the words just keep piling up. I just counted, and I have 13 vocabulary decks. Of those, four are my main study decks right now: “English Memo,” “DUO,” “DUO Derivatives” and “EX Grade 1”, and each of the four was born in a different way.
Here are my decks. Some of them I hardly use…

(The deck names in the screenshot are in Japanese.)
My English study started with importing every single card of DUO (a popular Japanese vocabulary book). Anki has a wonderful feature called Shared Decks, a cloud where users can make and upload card decks, and anyone can download and use decks other people made. The words from DUO 3.0 were already there.
https://ankiweb.net/shared/decks?search=Duo3.0
From what I can see, there are about seven DUO 3.0 shared decks now, and you can take one that suits you and use it for your own memorization. Someone else made them, so there were a few mistakes and typos.
After working through DUO 3.0 thoroughly, I built the DUO Derivatives deck next, typing in derivative words from the DUO 3.0 book by hand.
Then, as I started taking English conversation lessons, made friends overseas and talked more, and read English articles, I made an “English Memo” deck where I add words I don’t know or good expressions I want to remember, by hand. For me, English Memo is defined as the deck where anything goes: words I got stuck on, words I want to learn, things from newspaper articles, things pointed out in conversation lessons.
Apart from the DUO 3.0 cards from Shared Decks, these two, the DUO Derivatives deck and the English Memo deck, were basically typed by hand, so they were set up so duplicate cards never appeared in the first place. If I thought, “Oh, this word is already in DUO,” I didn’t put it in Memo, and if I thought, “I saw this in Memo the other day and added it, skip,” I didn’t put it in DUO Derivatives. They were decks I grew while checking in my head.
But after passing Eiken Grade Pre-1, I bought a vocabulary book for Grade 1, the EX book, photographed the whole thing page by page with my camera, had AI turn it all into a CSV, made a new deck in Anki called EX Grade 1, and imported it all at once. For Grade Pre-1, I typed in unknown words by hand from several vocabulary books and workbooks, so it took a lot of years. I think it really took about three years. But AI has improved so much that the whole Eiken Grade 1 EX vocabulary book was in Anki in less than a month.
However, because I imported it in bulk from a CSV, I didn’t exclude any duplicates at all. I poured in a whole book mechanically, so a huge number of duplicate cards appeared. First, Anki has a feature that checks for duplicates and lets you tag them, so I could find the ones where the word on the front matched exactly. But as I mentioned at the start, I had been copying and pasting from the browser by hand, so some cards had HTML tags or CSS mixed in, and those couldn’t get the duplicate tag. I was checking them one by one with my own eyes and leaving out the ones I knew were in other decks, but there were so many that I wondered if there was a better way.
If they stay duplicated, I study the same word twice, but suspending each one whenever I notice, “Oh, this is a duplicate,” during review is a real pain. So I decided, “Let’s suspend all the duplicate cards in one go!” and asked Claude for help.
Wait, can Claude Code even connect to Anki?
It can. Claude Code can connect to all kinds of apps, and for Anki, if you install a plugin called AnkiConnect in the Anki software itself, you can flexibly edit and add things from Claude. When I opened a new chat in Claude and asked, “I could connect to my Anki from here, right?”, Claude started hitting something like this with curl.
curl -s -X POST http://localhost:8765 -d '{"action":"version","version":6}'What came back was
{"result": 6, "error": null}AnkiConnect (an add-on that lets programs control Anki) runs an API on localhost:8765, and Claude is just talking to it with curl. Just by chatting, commands are flying straight to the local Anki app in the background ( ゚д゚)
I asked to see the deck list first, and it was more detailed than I expected
All 13 decks, with the card counts and the breakdown of new, learning and review, came out as a table in one go.
| Deck | Cards | Breakdown (new / learning / review) |
|---|---|---|
| EX Grade 1 | 2,834 | 2 new, 21 learning, 78 review |
| English Memo | 6,558 | 0 new, 22 learning, 158 review |
| DUO (English_Duo_Tango) | 2,566 | 0 new, 1 learning, 17 review |
| DUO Derivatives | 2,842 | 0 new, 3 learning, 36 review |
Not having to click through Anki’s Deck List screen one by one and count is simply easier. It’s so easy that it works in plain language.
Checking where the duplicate tags stood (but telling it not to do anything yet)
Here, I made a point of warning Claude: “Can you show me the tags first? Just look, don’t do anything yet.” After all, it would be a problem if a huge number of cards were suddenly changed without asking, right?
So I had it send a query like this with an API called findCards.
curl -s -X POST http://localhost:8765 -d '{"action":"findCards","version":6,"params":{"query":"deck:\"1English::EX Grade 1\" tag:duplicate"}}'The result, out of all 2,834 cards in the EX Grade 1 deck:
- With the duplicate tag: 844 cards
- Of those, already suspended: 809 cards
- With the duplicate tag but not suspended: 35 cards
Compared with the words I’d met in my English study so far, EX Grade 1 had 844 exact-match duplicates, and these were the ones tagged duplicate with Anki’s own feature.
Next, the ones that weren’t exact matches. For example, if there are two cards for accentuate, they match exactly, and Anki alone can suspend them. But in decks like English Memo, I wrote things like accentuate ... after the word. Anyone who has studied with DUO will probably get this: I started learning words with DUO too, so I got into the habit of adding ... to transitive verbs. After all, I registered everything by hand… (;´∀`) More than 6,000 cards… This is the moment you realize steady work beats everything. So, for example, these two cards,
accentuate
accentuate …
can’t be treated as duplicates by Anki. So I had decided to look at them with my own eyes and tag the duplicates in the Eiken Grade 1 EX deck myself.
I must have stopped halfway and forgotten about it, because the moment I saw the 35 cards that were tagged but not suspended, I knew right away: “Oh, these are the ones I tagged myself and forgot to suspend.”
So I asked, “I tagged those thirty-five cards myself, so please suspend them,” and it handled them quickly.
English Memo and EX Grade 1 had different ways of registering words to begin with
This is the heart of this post. When I asked to see the rest of the unchecked cards, I explained one thing to Claude.
“In Memo and DUO, transitive verbs have … or ~ added. That’s how I registered them from the start. But EX only has the word.”
When I had it show me samples, this is what they looked like.
English Memo deck (part)
pass one's …
at the age of ~
help oneself to (drinks, food)
love 〜ing
I suck at ...EX Grade 1 deck (part)
squander
flimsy
incision
lethargic
pinnacleThe ways of registering them are completely different. Memo uses “pattern” registration, showing the object of a transitive verb with ... or ~, while EX Grade 1 uses simple registration with just the word. In other words, a simple exact-match check misses duplicates because of these differences in notation.
Take the word inundate (to flood, to overwhelm) that I described above. In EX Grade 1 it’s registered as just inundate, but in Memo I registered it as inundate ... with ..., so even though they look almost the same, as strings they’re completely different, and a simple exact-match check lets them slip right through.
By the way, I also looked for ones with ~ or 〜, but most were phrases made of several words, like at the age of ~, and I didn’t find many duplicate pairs of single words. That made me realize a separate issue: “Things registered as whole phrases are hard to compare with EX Grade 1, which is single words, to begin with.”
The case of mixed-in HTML tags, found through a screenshot
Then one more problem came up. I showed Claude a screenshot of Anki’s browser screen. It was a card for “pharmacist,” and on screen it just showed pharmacist, but when I looked at what was actually in the field (the code part), it was
<em><strong>pharmacist</strong></em><br>That’s what it was. It looks like the HTML tags came along when I copied and pasted the word from another site. The card shows a normal word, but inside it’s full of code. If I hadn’t noticed, it would have kept slipping through the duplicate check forever.
Having it build normalization logic
So I asked, “Don’t run anything yet, but can you just list the duplicates?”, and had it compare them with the rules below.
- Remove HTML tags and
[sound:...](audio tags) - Remove notes inside () and ()
- Remove
…...~〜 - Trim spaces at both ends and make everything lowercase
- Only when the normalized strings match exactly does it count as a possible duplicate (partial matches don’t count)
To be safe, I also gave a concrete example: “If EX has put and Memo has put run on, that’s not a duplicate. Please check for duplicates using exactly the same word.” Here’s the Python code that was actually used.
import json, re, subprocess, sys
def ankiconnect(action, **params):
payload = json.dumps({"action": action, "version": 6, "params": params})
result = subprocess.run(
["curl", "-s", "-X", "POST", "http://localhost:8765", "-d", payload],
capture_output=True, text=True
)
return json.loads(result.stdout)["result"]
def strip_html(text):
text = re.sub(r'\[sound:[^\]]*\]', '', text)
text = re.sub(r'<[^>]+>', '', text)
text = text.replace(' ', ' ').replace('&', '&').replace('<', '<').replace('>', '>')
return text
def normalize(text):
t = strip_html(text)
t = re.sub(r'\([^)]*\)', '', t)
t = re.sub(r'([^)]*)', '', t)
t = t.replace('…', '').replace('...', '').replace('~', '').replace('〜', '')
t = re.sub(r'\s+', ' ', t).strip().lower()
return tIt compared all 11,678 words in Memo, DUO and DUO Derivatives (unique after normalization) with the 1,990 unchecked cards in EX Grade 1, one by one, and found 307 exact matches.
I opened the list to check it: “That’s perfect”
I had it format the 307 matches as a markdown table and save it to a file, then said, “Please open it, I’ll check it once,” and opened it normally in Finder to check it with my own eyes.
When I looked inside, I couldn’t help saying, “That’s perfect.”
It brought back only words that were clearly duplicates, so I think this is the kind of thing Claude is really good at.
Double-checking: the other decks are really untouched, right?
Before asking it to add the tags, there was one thing I really wanted to confirm. I asked, “You won’t touch the cards in DUO or the other decks that had code or color codes in them, right?”
The normalization removes HTML tags and so on, so it’s a natural worry: surely it didn’t rewrite the original cards too? The answer was, “Normalization is done only on a temporary copy on the Python side, and for Memo, DUO and DUO Derivatives, only the read-only notesInfo was called.” I could move on after checking properly, so I felt safe leaving this to it.
Tagging and suspending the 307 cards, on the EX Grade 1 side only
I asked, “Please add the duplicate tag to the ones in the list you just made and suspend them, and leave every card outside EX Grade 1 untouched,” and it ran.
addTagsadded theduplicatetag to the 307 notes on the EX Grade 1 sidesuspendsuspended only those 307 cards
As a result, the total with the duplicate tag in EX Grade 1 came to 809 + 35 + 307 = 1,151 cards. The numbers for the other three decks matched exactly before and after, confirming they were untouched. Below is a screenshot of the card count statistics, but there’s one extra…
Still, the total was 15,147 cards, and 1,152 were suspended.

An unexpected ambush: mysterious old duplicate tags
Then I asked, “Are there duplicates in the other decks too?”… and out came some mysterious tags.
- English Memo: 624
- DUO: 133
- DUO Derivatives: 138
These were duplicate tags I didn’t even remember adding, and they had been there all along. All I could say was, “I don’t remember why they’re there,” as if it were someone else’s work, even though it was mine ( ̄∇ ̄). Many of them came with the leech tag (Anki’s standard tag for cards you keep getting wrong), so I think they’re left over from something I did long ago for another purpose.
Putting the suspension policy into words
Here, I put my policy clearly into words.
“Basically, I don’t want to suspend anything in Memo, DUO or DUO Derivatives, and I want to leave the duplicates out of EX Grade 1 (because EX Grade 1 is the one with a blank study history).”
When you think about it, it’s obvious. Memo, DUO and DUO Derivatives have years of review history, and EX Grade 1 is a brand-new deck. If they’re duplicated, you just leave out the one with no history.
When it checked, none of the 895 old duplicate tags in Memo, DUO and DUO Derivatives were actually suspended (0). It was already the way I wanted. However, it found one card in DUO Derivatives that was suspended for a reason unrelated to the duplicate tag (“shrinkage”).
“I don’t remember suspending that one either, so I think it got in by accident. Please put it back.”
So this was another thing I had no memory of.
Deleting the unneeded tags and restoring the card suspended by mistake
So what to do with these 895 tags that meant nothing?
“You don’t need the duplicate tags in those three decks, right?”
Claude asked, and since they really were labels that didn’t do anything (0 suspended), it gave me two choices: delete them or keep them. I chose “delete (recommended)” and it ran.
- Deleted all 895 duplicate tags in the three decks with
removeTags - Restored the “shrinkage” card with
unsuspend
With that, Memo, DUO and DUO Derivatives were back to a completely clean state.
Agreeing on what “unchecked” meant, and deciding exact matches were enough
At the end, there was one more round of getting on the same page. Claude had said something like, “There are 1,683 unchecked cards left,” so I asked,
“Please tell me what the remaining unchecked EX Grade 1 cards mean.”
It turned out that calling them “unchecked” was misleading. EX Grade 1’s 2,834 cards = 1,151 tagged + 1,683 remaining, and those 1,683 were cards that had been checked and had no exact-match duplicates.
“So the exact matches have been taken out, right?”
I confirmed, and when I saw the numbers add up exactly, I was relieved.
Then I gave the final rule.
“Basically, exact matches are all I need. Even if adjectives, nouns or adverbs from the same word family are on separate cards, or one card has several parts of speech, like the noun meaning is this and the adjective is that, that’s fine under my rules.”
I decided on purpose not to do “loose matching” that also catches different parts of speech (derivatives like acrimony and acrimonious) this time. Trying to raise accuracy also raises false positives, so understanding that trade-off, I could decide that “exact matches are enough.”
Summary: AI working directly with my local Anki was more amazing than I expected
Honestly, I thought Claude Code was “a tool that writes code for you.”
But what I learned this time is that it can send commands directly to an app running locally through an API, and read and write data. And because I could keep checking along the way, “Just look, don’t do anything yet,” “The other decks are untouched, right?”, I felt safe leaving it to process more than 10,000 cards at once.
I think I’ll try a “loose” duplicate check that includes different parts of speech another time, when I need it. For now, one thing that had been bugging me for eight years, the neglected duplicates, feels cleared up ♪( ´▽`)
🃏 I’ve also put all my Anki posts together on one page, sorted by what you need: getting started, settings, keeping it up, automation, audio and troubleshooting.
Referral link: if you sign up through it, I may receive free lesson minutes.
🃏 The English on 10,000 cards is meant to be spoken
Once your cards are tidy, the next step is a place to use the words you’ve learned. I also put words that come up in conversation into Anki and try using them in my Cambly lessons. You can talk with a native tutor any time, 24 hours a day, without booking. Through my referral link, you get 10 extra minutes when you buy a trial. I’ve been taking lessons on Cambly since July 2021.
Try Cambly with my referral link →
The referral program isn’t available in every region.
English expressions I learned (B2–C1)
I’m aiming for Eiken Grade 1, so I had AI pick out some useful phrases from this topic.
① squander (to waste)
She squandered all of her savings on overpriced skincare.
It means to waste money, time, chances and so on. It was a word in my EX Grade 1 deck, and it also came up in the samples for this duplicate check.
② mesmerize (to captivate, to enchant)
The performance mesmerized the entire audience.
Its origin carries the nuance of drawing someone in as if hypnotized, and it’s used for a stronger sense of absorption than just “interesting.”
③ propensity (a tendency, usually an undesirable one)
He has always had a propensity for violent behavior.
A word often used for an unwelcome habit or tendency. It sounds a little more formal than tendency, which has a similar meaning.
(I picked these from words that actually appeared as Anki cards in this post.)
☕ Enjoyed this post?
I'm a Japanese blogger who spent 8 years relearning English from scratch.
If this post helped you, a coffee would mean a lot — thank you for reading!

























Leave a Reply