An iMessage language-learning buddy
2 minTexts you like a bilingual friend. It chats mostly in your native language and naturally sprinkles in the language you're learning — picking words and phrases that fit the conversation, glossing what you don't know, gently modeling corrections, and remembering things about you across chats. No app, no lessons. Just a thread.
It reuses the self-hosted iMessage transport (forked from the marco/Bedrock stack): a dylib injected into Messages.app for sending + typing dots + read receipts, and a chat.db poller for inbound. The language-buddy agent loop is built on top.
| Path | What it does |
|---|---|
| config.mjs | languages, level, model, whitelist (reads .env) |
| server.mjs | wires poller → agent → helper (run this) |
| core/agent.mjs | persona + Claude call + remember tool → reply bubbles |
| core/memory.mjs | per-handle profile + rolling conversation (.memory.json) |
| imessage/ | ported transport (poller, helper, injected dylib) — unchanged |
.env (already present, ported from marco). Needs your Anthropic key, plus any product knobs you want to override:
ANTHROPIC_API_KEY=sk-ant-...
TARGET_LANGUAGE=Korean # the language you're learning (default: Korean)
NATIVE_LANGUAGE=English # what the buddy mostly speaks (default: English)
LEVEL=beginner # beginner | intermediate | advanced
AGENT_NAME=Lingo # the buddy's name
MODEL=claude-opus-4-8 # snappier/cheaper: claude-sonnet-4-6
# ALLOW_FROM=you@icloud.com # optional: only engage these handles
imessage/README.md.DESIGN.md for the why/how).npm install
npm run messages # terminal 1: launches Messages.app with the helper injected
npm start # terminal 2: listens for the helper, polls chat.db, replies
Text the agent's Apple ID from your iPhone. You'll see read receipts, typing dots, and a few short bubbles back.
MODEL=claude-sonnet-4-6.core/.memory.json (gitignored), keyed by handle. Delete it to start fresh. The buddy writes to it via its remember tool.core/agent.mjs (buildSystemPrompt). That's the make-or-break — if the conversation feels good, the rest follows.