← Jesse Ifrah

Alfred, an assistant that lives in Telegram

Alfred · 2026 · TypeScript on Cloudflare Workers

I'm in school full time and running a business around it, so my day is split across a class timetable, client work, things I'm trying to learn and things I promised people. Alfred is the one place all of it lands. He is a Telegram bot, because Telegram is already open on my phone, and he is a single serverless function, because I wanted him always on without a server to look after.

3,100lines of TypeScript
10database tables
2models, both on Workers AI
$0a month to run

Architecture

One Cloudflare Worker handles everything. It has no long-running process and holds nothing in memory between requests. State lives in D1, Cloudflare's SQLite database, and each request reads what it needs, acts, and writes back.

Telegram webhook Instagram webhook CLI over HTTPS Worker D1 (SQLite) Workers AI
Entry pointWhat arrives
POST /telegramEvery message I send, and messages in the work group chats he sits in
/instagramReels and posts sent to his own Instagram account by direct message
POST /apiTasks, reminders and status from a command-line tool, with a bearer token
POST /api/fileA file from my computer, delivered to my phone (up to 50 MB)
Cron, every minuteDue reminders, the morning report, the weekly learning list

The morning report

Each morning Alfred sends one message: the priority of the day, my schedule, what I'm learning this week, where the business stands and the open tasks. He never picks the priority. I set it the night before, and he repeats it back to me first thing.

The learning list is stored as a queue, not a calendar. Marking something done ticks off the next unfinished item, so working ahead moves everything forward and the report can say how far ahead or behind plan I am. Ticking by name uses fuzzy matching, so a message full of typos still finds the right items.

Everything feeds him

The part I use most is the least visible. Every coding session on my computer can write to Alfred through a small command-line tool. When a deadline or a follow-up comes up while I'm building something, it is added there and then, and it shows up in the next morning's report without me copying it anywhere.

alfred task "Send the revised proposal" --due 2026-11-20
alfred remind 2026-11-23T09:00 "Science fair registration closes Feb 19"
alfred status "Three pilots running. Next decision: which track to keep."

The inbox

I save a lot of reels and links with a half-formed thought attached, and then never look at them again. Now I send them to Alfred. The order of operations matters: he saves the item first, so nothing is lost if a later step fails, and only then does the slower work.

Save the link Fetch the video Whisper transcript Llama 3.3 files it Summary + next step
-- one row per saved item
CREATE TABLE inbox (
  id         INTEGER PRIMARY KEY AUTOINCREMENT,
  source     TEXT NOT NULL,   -- instagram | telegram | cli
  url        TEXT,
  media_url  TEXT,            -- direct media link; expires
  note       TEXT,            -- what I wrote with it
  transcript TEXT,            -- what is said in the video
  project    TEXT,
  kind       TEXT,            -- ad idea | content idea | reference | to learn | tool
  summary    TEXT,
  next_step  TEXT,
  done_at    TEXT,
  created_at TEXT NOT NULL
);

Two small details made it feel right. A link sent within two minutes of a thought is merged into the same item instead of creating two, because that is how people actually send things. And the filing step is given my list of projects and must answer in a fixed JSON schema, so the result is always a valid project, a kind from the list, a summary and a next step.

Keeping a small model honest

Most of what Alfred does is fixed code with no model involved: commands, reminders, the report layout. Open questions go to Llama 3.3 70B on Cloudflare's free daily allowance, and transcription goes to Whisper large v3 turbo. Running on a free model taught me more than a paid one would have.

// what the model is allowed to return
{
  "reply": "Done. I'll remind you Monday at 9.",
  "actions": [
    { "type": "reminder", "at": "2026-11-23T09:00", "text": "…" }
  ]
}

Next

Alfred is being rebuilt as a layer that connects everything I work in. Telegram stays as the phone channel. On the computer, the plan is a menu-bar app, so he is one click away while I work.