31 March 2026
How an Iraqi Play About Cain and Abel Led Me to Build My Own Duolingo
Testing twenty years of ideas about language learning, finally building the ultimate app for myself
I've been thinking about how languages should be learned for most of my life. I used Esperanto to find a job as an English-teacher in China, I’ve dabbled in Russian, learnt some Hindi, and recently I’ve been working on Latin and ancient Greek. Along the way, I’ve experimented with building an Indonesian reading tool, building custom ebooks with Icelandic/Norwegian (or ancient Greek/modern Greek/English), and in a previous post I described a tool I built that extended Anki in a way that made it powerful for reading classical texts – like the bible in ancient Greek.

As I kept iterating, some ideas about how I personally learn languages well have stayed consistent, with more detail and insight as I’ve tried and come across different tools. I think I discovered the concept of “comprehensible input” before I knew the term; intuitively I felt that after having worked through a chapter in a language textbook, with lots of new grammar, lots of new vocabulary, and a short text or dialogue, I wanted a long story to read with zero new vocabulary or grammar. I wanted to feel what it’s like to read fluently in a language, and consolidate all that I had learnt. I felt this keenly all the way back when studying Chinese in Sweden in 2000!
Part of what pulled me into learning ancient Greek and Latin, when I was “only” going to learn modern Greek was actually the incredibly high quality of the teaching materials. Far from our prejudice about dusty old verb-conjugation tables, I found teachers playing Minecraft in ancient Greek, tweeting in Latin, but more importantly the amazing Lingua Latina Per Se Illustrata, and Athenaze. Both of these are based on extremely carefully designed texts only in the target language (with some illustrations), which start with extremely simple sentences (“Roma in Italia est. Estne Roma in Asia? Non, Roma in Asia non est.”), and works its way into a complex and interesting narrative. You just keep reading, and while you read, you’re learning. Reminds me of the genius of my Italian teacher in Italy, who spoke only Italian from the first day of class, but was so adept at choosing vocabulary and body language that we could somehow comprehend. Or the fantastic Michel Thomas audio-courses.

However, for most languages we don’t have access to such high quality resources. My experiments with generating interactive cards for Anki was a significant step forwards, but it was very awkward, and had many limitations. And I thought – the next time I start learning a new language, maybe the AI models have gotten far enough that I can build a fully custom app that really works how I want it to?
How I Stumbled Into Arabic
I like to have a project every year. In 2024, I read through the Norwegian newspapers from 1814 — the year Norway got its constitution — day by day, and blogged about it throughout the year. For 2026, I decided to read the Old Testament, which I'd never actually read cover to cover (although I know many of the stories). My plan was to read it not just in one language but in three — Latin, Greek, and the King James Version — and to hunt for the cultural artifacts each story had inspired over the centuries.
January was Genesis, and the rabbit holes were so much fun. I read Byron's poem Cain, read a Spanish novel based on Cain and Abel, listened to Haydn's The Creation and Scarlatti's Il Primo Omicidio, looked at paintings in the Sistine Chapel and of the Tower of Babel, began studying an Italian poem on the creation (Torquato Tasso). Each biblical episode turned out to be a cultural node connecting thousands of years of poets, painters, composers, and novelists, all treating the material in different ways (Byron’s treatment of Cain is very different from Scarlatti’s!)
As I pushed my research deeper, I came across something I hadn't known: many Old Testament stories also appear in the Quran. The story of Cain and Abel is there, as is Adam and Eve, Joseph in Egypt... So of course I sent ChatGPT out to find cultural representations of these stories based on the Quranic source, rather than the bible.
It dug up a play called "Cain's Rock" on an Arabic theatre website. I couldn’t find anything written about the play or the author in English, but through translation I was able to find out that the author was Nahawand al-Kindi — a self-taught woman from Basra, mother of six, with only a middle school education. She has at least seven published scripts circulating through Arabic theatre websites, and now I could read one of them.

I used ChatGPT to translate the play and generate a custom Kindle version for me (with an introduction that included linguistic and cultural notes). Of course I would have preferred a professional translation, but this idea of being able to read a play written by a woman from Basra in Iraq, in any form, was so tantalizing. The play itself was minimalistic, two men in a single room, post-apocalyptic setting. Both very foreign and very familiar – an exotic and unfamiliar setting to a familiar story, filtered through the Quran instead of the bible… And as I saw some of the Arabic words in the cultural introduction, I began trying to trace the letters and pronounce them…


This was not entirely new. I'd traveled in Iran twenty years ago and remember trying to read the street signs, which use the Arabic alphabet. I've also attempted to learn Urdu a few times — I speak some Hindi, and Urdu is almost the same language, just written in a different, flowing calligraphic script that is remarkably difficult to read. But that was long ago – and since then I had been reading extensively about ancient Greek and Rome, but also about the growth of Islam, the incredible expansion from Mecca to a culture stretching from the border of China to the border of France in 100 years, the contact between the Byzantine empire and the Islamic world, the crusades. So maybe I was primed…
In any case, I opened Duolingo and started the Arabic course. Just for fun, just for curiosity, with no intention to continue. (A bit like when I downloaded an ancient Greek text book a few years ago… to have a look…). And it was that sensation that anyone who has learned a language with a different script will recognize — the feeling of suddenly being able to see where before there was only pattern noise. I still remember recognizing my first few characters in Chinese, even though what I was reading was ridiculously simple. It felt like gaining a new sense. Arabic was the same. I kept going for about a week, just having fun with it — the pronunciations, the simple sentences, the slow accumulation of words I could actually recognize.
And then Duolingo asked me to spell an Arabic word.

I have no interest in learning to spell in Arabic. I'm learning for reading comprehension — for the ability to pick up a text and understand it, not to produce correct orthography. This is true for my Latin and Greek study as well — it's actually why I stopped using Duolingo for Latin. I refuse to memorize which of several similar-sounding letters appear in a particular word when that has nothing to do with my goals. And the fact that you can't just go into settings and turn spelling exercises off — that was enough. I said, more or less, "Fuck it. I'll build my own."
Building Alif

One sentence for the vision, one sentence for the first step. Claude launched 43 research agents in parallel — Arabic NLP tools, TTS services, spaced repetition algorithms, morphology analyzers, open datasets. Two hours later the landscape was mapped.
Sentences, with words mapped individually
I had a pretty good idea of what I wanted to build, although many of the details were filled in along the way, through trial and error. The main idea was that I always wanted to see full sentences, not individual words. I had known about spaced repetition for a long time, first for language learning, then I got interested in it more broadly through Michael Nielsen’s essay about using it to understand a complex academic field. However, whenever I had tried to use it to learn vocabulary, I gave up out of boredom, and frustration. A typical pattern would be seeing a word you don’t remember, flip the card, say “ah”, and the next morning - the same pattern. Don’t remember, flip the card. Never actually learning.
With whole sentences, there are many more context clues. In the sentence “The man packed his XX and prepared to leave”, you can narrow down what XX might be. Maybe cheating, but the real world works like this as well, we constantly use context to interpret what we read or hear. Reading sentences is also much more interesting, decoding a sentence is almost like playing a puzzle, with a sort of payoff when you realize what it all says, a satisfaction you don’t get from quizzing single words.
However, my previous attempt had been based on complex sentences (from the bible) where I already had a good grounding in the language. In Arabic I was at square 1. I liked the interface of being able to see the whole translation, but also look up each individual word. But I wanted sentences generated in the “Goldilocks”-zone of difficulty (not too easy, not too hard), and I wanted to track each individual word’s performance. This is the key principle of Alif: You review sentences, and if you mark two words as unknown, not only is their knowledge state updated, but every other word in the sentence is marked as known.
In this way, a simple review session with 20 sentences can generate more than 100 learning signals to update the knowledge model, giving the app a very detailed understanding of your knowledge of words (which is not binary!). Turning this knowledge into the perfect sentences was not trivial, and is not something the LLMs can “one-shot”, it requires a careful pipeline of prompt generation, LLM activity, quality gating and post-processing.
But when it all comes together, you’re actually reading sentences that are interesting, fun, surprising, sometimes poetic or devastating… at the perfect difficulty level. It can be as frustrating to keep getting the same simple sentences you’ve seen five times, or sentences with five-six new words (cognitive overload). But when it works! The delight in putting together a puzzle. The quiet joy of seeing a word again that you know you haven’t seen for a week – but you still remember it! Seeing the number of known words growing regularly, and trusting that it actually represents words you still know, not just have seen.

The crucial distinction: learning versus remembering
An insight I had while tweaking the algorithm is that spaced repetition algorithms, like FSRS-6 which Alif uses (and Anki) are good for modelling recall of a learned fact, but not for the actual initial “encoding” or learning, the first transition from short-term memory to long-term memory. This might be well known in the language-learning community, but was something I hadn’t thought about. There’s a few ways I tried to address this. The first was scheduling – I now differentiate between a card being “acquired” and a card that has been learnt. For new cards, I make sure they show up at least 3 times during the same session, and I have a separate system based on Leitner-boxes (an early form of spaced repetition), with three “boxes” of 4 hours, 1 day and 3 days that the cards have to move through. Once through, they “graduate” to the normal FSRS scheduling.
Another thing I first noticed years ago when I was using spaced repetition for academic concepts — researchers in computer science, key papers, that sort of thing — was the value of rich “hooks”. When I couldn't remember someone, the solution was never to simplify the card. It was to add more — their photo, a biographical detail, the context of their key paper, an anecdote. The richer the card, the more hooks for memory. It's counterintuitive but it works consistently.
For Arabic, this translates directly: etymology, root families, memory hooks, cognates with languages I already know. And this is where large language models turn out to be genuinely useful — if there's one thing LLMs are good at, it's language. The system auto-generates rich context cards for every new word, which is the piece that makes sentence-first learning practical without hours of manual preparation. This is shown as an intro card when a new word is first introduced, and always available on tapping the word.

The micro/deep cycle, analogue/digital
The digital medium is infinitely malleable, and in theory the perfect textbook is an iPad where everything can be generated on-demand, every word is interactive, you can always go deeper. In practice, I love living in a house surrounded by old and beautiful books, and sitting down with a physical book in front of the fireplace and immersing myself is mentally a completely different experience from sitting in front of a screen. The energy on a Saturday morning when I sit in front of the fireplace, and my son comes drowsily out of his room and sits on my lap while reading Harry Potter, does not call for me clicking on a device.

One of the best things about the Anki-approach I’ve described for reading the bible, is that it seemed to give me the best of both worlds – I could do “reps” during the week, five minutes here, ten minutes there, and in the weekend I could sit down and open up the bible, and actually read ancient Greek fluently. An amazing experience, and more motivating to me than any streak or gold coin or jumping mascot could ever be!
(I’m still struck by the fact that a week after leaving Duolingo, I got an email saying “If you don’t log in soon, you’ll lose your streak!”… Imagine if they had written: “You’ve already learnt 100 words, spend two more days, and you can read a poem in Arabic”. At least for me, that latter would have been so much more inspiring and motivating).
With Alif, I’ve extended this framework into two different modes. We can use Alif and micro-learning to prepare for deep-focus, or we can use it to follow up on a deep-focus session. The first is the Story mode. Alif can generate its own stories based only on the words you know. But more interestingly, you can take pictures of the pages of a children’s book (or any book). Alif analyzes all of the words (lemmas), and tells you that there are 100 words that you don’t know, and that reading this book right now will probably be a difficult experience. But don’t worry, just use Alif like usual for a few days, the words from the book will be introduced gradually, in simple sentences surrounded by words you already know, until you understand them well. Then the book is “unlocked”, and you can sit down in the weekend and read the beautiful children’s book (or poem, or manifesto) fluently.

On the other hand, maybe you like studying from a physical textbook? I found a series of two textbooks designed for Norwegian high school, and I enjoy reading the dialogues and stories in the weekend. However, each chapter introduces a huge amount of new words without too much text to follow. If I were in a classroom situation, my teacher would be guiding me through repetition and use of those words (the book even has an online resource, which I can’t access because I borrowed it from the library). But I take pictures of the pages, and Alif knows that I have learnt those words (already seen words are marked as “repeated” on that day, and new words are introduced). I work my way through them, and next weekend when I open the book again, I am confident that I have not forgotten any of what I learnt.

Iteration, data ownership
With Duolingo, the app is collecting a lot of data on you, but it’s quite hard to get it out. I had to listen to some network requests to extract the list of words that I knew to bootstrap Alif. With Alif, I not only have access to the full learner model, but I also added very detailed logging to all my interactions with the app. Thus I can ask Claude to analyze all the learner logs, and suggest changes to the algorithm, to the interface etc.
Although I have not written any of the code of Alif myself (or indeed read it!), it was not a single “push play”. Rather, I’ve iterated with Claude on it during around 80 different sessions. Some of it has been exploring new functionality or design – I’ve used the design explorer to iterate on layouts, experimented with generating better memory hooks – and a lot has been around tweaking the algorithms. I’ve even run A/B testing, for example I experimented with whether having an intro card to a new word is better or worse for learning (it was conclusive, and now all new words get intro-cards). The fact that the system generates so many “learning signals” per day means that even with a single user, it’s possible to do some analysis/experimentation.
There's a deeper point here about building for one person. Because I'm the only user, I can build ridiculously advanced features that probably no company trying to build for the “average user” would invest in. Too niche, too weird, too specific for a product. But that's exactly the point. I can iterate without compromise, chase hunches, break things and fix them in the same evening. And paradoxically, I suspect that the things I discover by building so specifically for myself — the warmup effect, the sentence-first principle, the micro/deep cycle, the leech recovery sliding window — might turn out to be quite general. The best way to find something universal might be to make it perfectly specific first.
From Reading to Listening
I’m primarily interested in input and comprehension, but that covers not only reading but also listening. I have been watching a lot of Arabic content on Tiktok (there is a lot of it! a whole new world. From Indonesian students introducing their school, to great songs, to Quran recitations, to the obligatory Palestinian rap battles). I’ve also been listening to Michel Thomas’ MSA course for ten hours. But after that, I needed something more.
Early on, I did some experimentation with ElevenLabs to generate Arabic speech that was comprehensible for a learner (one trick was putting a comma between each word to force a small pause), but I realized I never ended up using the audio quiz in my app – when sitting down with my phone, I often don’t have headphones. Instead, I wanted to see if I could generate something where I could go for a half an hour walk and just listen, without having to stop to look things up. Even the simplest Arabic podcasts are still too advanced for me. The Michel Thomas format is perfect, but how to generate something like that?
The answer was to not rely on a single “script” prompt into ElevenLabs, but to generate an episode based on hundreds of small snippets. After some iteration (I asked Claude to generate many different formats so I could try them out during a walk), we landed on two formats that work well. The first generates simple stories based on words that I know well, and introduces them really slowly – first each sentence in English, then in slow Arabic, then normal Arabic, after three sentences we hear all three in a row, after six, we hear all six etc. It builds up very slowly and in the end you are listening to several minutes of continuous Arabic speech.

From Sentences to Scripture
The most recent addition came full circle. Remember that this whole project started because of the Quran — I was tracing the story of Cain and Abel from the Bible into Arabic and Islamic tradition. A few weeks in, I'd been casually listening to Quran recitations and catching individual words. But "catching words" and "reading" are very different things.
So I added a Quran reading mode. The entire Quran — all 6,236 verses — is stored in the app, and verses are scheduled for spaced reading practice, interleaved into my regular review sessions. I see a verse, try to work through it, tap any word to look it up, then flip to see the translation. Every word is tappable — content words show the full etymology, root family, and morphological pattern; function words show a quick gloss.
The real “proof of the pudding” of language learning comes from exposure to authentic content. Therefore it’s special to sit down with a children’s book, even if it’s very simple, and see that what you learnt in an app or a text book is somehow “real”. Yesterday I watched the devastating and beautiful Palestinian film “All that’s left of you”, and surprisingly I was able to catch quite a few words. From the scene in the beginning when the father teaches his son a poem about the ocean (as a metaphor for the Arabic language), to the devastating scene where the son (grandson of the father we began with – the film follows three generations) is put to rest in a cemetery, and the imam recites the beginning of the Quran (Al Fatiha), which I had just been studying, and which I understood perfectly…
Bism Allāh al-Raḥmān al-Raḥīm. al-Ḥamdu lillāh rabb al-ʿālamīn. al-Raḥmān al-Raḥīm. Mālik yawm al-dīn. Īyāka naʿbudu wa-īyāka nastaʿīn. Ihdinā al-ṣirāṭ al-mustaqīm. Ṣirāṭ al-ladhīna anʿamta ʿalayhim ghayr al-maghḍūb ʿalayhim wa-lā al-ḍāllīn.
Beginner Gains
There's a concept in weightlifting called "beginner gains" — when you first start lifting, you make rapid, visible progress that experienced lifters would kill for. It doesn't last. Eventually the gains slow down, and the work gets harder relative to the improvement.
I'm in my beginner gains right now, and I know it. Nearly 1,300 words known in eight weeks, reading children's books, parsing Quran verses word by word, working through a textbook at double speed, listening to personalized Arabic podcasts on walks. That's roughly 3x the pace of the US Defense Language Institute and about 15x university Arabic — though the comparison is unfair, since I'm only doing reading and listening, not production. The median word takes about 5 days and 7 encounters to graduate from acquisition to long-term memory. The numbers are going up, the daily sessions are satisfying, and the whole thing feels almost magical.
One recent milestone: for well-known words — those with FSRS stability over 90 days — the app now hides the diacritical marks (the vowel dots that make Arabic readable for beginners). This means I'm practicing reading Arabic the way it's actually written in newspapers and books, where the diacritics are omitted. It's harder, and I sometimes stumble, but the system tracks when I do and brings those words back sooner. The cards also alternate between three Arabic fonts — a clean learner-friendly typeface and a traditional print-style one with aggressive ligatures — so I get used to both.
It won't last. At some point — probably in a few months — the easy high-frequency words will be exhausted, the learning rate will decelerate, and I'll need to shift from this structured vocabulary-acquisition approach to something more like real reading. Struggling with authentic texts, encountering words in the wild, dealing with the messiness of actual Arabic rather than the clean sentences my app generates. That's typically where you stop seeing clear progress, and where a lot of language learners give up.
But for now, I'm trying to make the beginner gains last as long as possible. And the system seems to be doing its job — each day I can read things that were invisible to me the day before, and each week opens up new texts and new possibilities. And I’m sure I’ll come up with interesting new interaction possibilities once my language skills have progressed – ways of integrating and “building a bridge” to more native content, like books, podcasts, movies, poems. I have ambitious goals – I want to read Ibn Battuta, philosophers from Al Andalus, diaries from the crusades (from the “other side”), poems written in Sicily 1000 years ago. And I want to read the other plays written by Nahawand al-Kindi, but in the original!
Several people have asked me if they can use the app. I’ve published the source code, and a technical write-up. It’s currently built as a single-person app, there isn’t even a concept of users, it’s very focused on Arabic, and it requires a server and API-keys for LLMs and ElevenLabs, so making it widely available would be a big lift. But if you are a bit resourceful, you can probably point your Claude to it, and figure it out. My coworker asked Claude to turn it into a French-learning app, and it worked.
أنا البَحْرُ في أحْشائِهِ الدُّرُّ كَامِنٌ ... فَهَلْ سَأَلوا الغَوَّاصَ عَنْ صَدَفاتي؟
I am the sea; in whose depths the pearls are hidden,
Have they ever asked the diver about my shells?
(from Hafez Ibrahim’s “The Arabic Language”)
Next
All writing →
This is the Babel fish we've been waiting for
100% input
The language learning holy grail
Learning effectively with podcasts