Until this week, everything my assistant did, it did for me. My calendar, my notes, my feeds. If it got something wrong, the only person who saw it was me, usually at 1 a.m., usually muttering.

This week it went into a group chat. A real one, on Instagram, with people from my department in it.

That changes everything about what “good enough” means. A wrong answer in my own chat is a bug. A wrong answer in a group chat is a bug with an audience.

The commits all landed between Thursday and Saturday. It was a long three days.

Thursday: moving in

The bridge itself had been sitting in a development folder for a while. On Thursday, at half past two in the morning, it got promoted to production.

Here’s how it works. A small service on the Raspberry Pi polls my Instagram inbox. Plain messages never reach a model. When someone in a configured group mentions the bot’s handle, the bridge builds a prompt from the recent chat, sends it to a LibreChat agent, and posts one reply back to the group. Most requests go to Gemma 4 E2B running on the Pi through LiteRT-LM. One group can ask for Qwen on my workstation instead. It reads photos, shared reels, voice notes and videos too.

It’s built on instagrapi, which is an unofficial client for a personal account, not Meta’s API. I want to be upfront about that. It can trigger login challenges, and it can break the day Instagram changes something. So nothing in it hides what it is: no fingerprint tricks, no proxies, no challenge solving. And the failure handling got as much attention as the happy path:

  • A failed poll backs off from 60 seconds to an hour, instead of hammering a session Instagram might already be rejecting.
  • If the process dies mid-reply, that mention is closed as “check manually”. It is never replayed. Two copies of a reply in a group chat is worse than none.
  • A send whose outcome is unknown is never resent, either.

The README went from 703 lines to about 190 the same night. It had become a diary. Diaries belong in Git history.

The bot knew too much

Then came the moment I’m least proud of.

The department group’s agent answers from a set of files: things like the study guide and course information. At first, two of those files were my own research notes. Notes about my plans.

When someone asked, it told them.

It wasn’t malicious. It just had no idea what “private” means. But it’s the exact failure I keep writing about here, and I walked straight into it: give a model a document, and that document is now something it will happily say out loud to whoever asks. By Thursday afternoon the group searched five general Markdown files written for any student instead, kept outside the repo. Nothing personal in them, so nothing personal to leak.

Thursday afternoon: the Thinker that wasn’t needed

My first design was clever. A small “dispatcher” agent took the message and, if it needed documents, handed it to a “Thinker” agent with file search.

Clever, and slow. And weird in a way I didn’t predict. With thinking turned off, the dispatcher answered short requests by repeating them. “translate to english” got back… “translate to english”.

So I measured it. Same real prompt, eight fresh requests, twice each:

DispatcherEchoed replies
Thinking off6 of 16
Thinking on0 of 16

Thinking on cost 30 to 40 seconds more per reply. Then a document question went dispatcher, Thinker, file search, and took 591 seconds. Nine minutes and change. The bridge’s timeout was 600.

By Thursday night the whole two-agent setup was gone. Each group now gets one agent, thinking on, with its own tools. No delegation. Fewer moving parts, fewer handoffs to get lost in.

I also turned off automatic translation on the Pi. Running Greek through a translation model and back had been garbling dates and characters. Gemma writes Greek well enough on its own.

A long reply to the group just… didn’t arrive. And my error handling had thrown away the reason.

So the first fix was boring and right: log every failure properly. The error type, Instagram’s own reply, the HTTP status, the file and line. Cookies, passwords and tokens redacted.

Thirty-nine minutes later, the new logging caught the real cause. instagrapi sends any text containing “http” as a link message, and Instagram refuses link text over 1,000 characters. The error even has a name: LinkTextTooLong. Plain text is fine at nearly double that. A 1,922-character reply without links went through.

The fix took a few rounds:

  1. Long replies split into ordered parts, at paragraph, line, sentence, comma or word breaks. Still one reply as far as the bridge cares: one receipt, one send slot.
  2. Parts with a link are capped at 900 characters, the rest at 1,900.
  3. A link is never cut in half between two parts. A test reply with twelve sources kept eleven of them whole before this. Now all twelve.
  4. On Saturday I learned Instagram shows only one link preview per message. So the text is first cut into pieces with at most one link each, each link staying with the line that names it.

And the sources line itself had to change. In LibreChat my answers end with a Markdown “Sources” line. On Instagram that showed up raw: brackets, a thousand characters in one line, in English under a Greek answer. Now it’s at most three numbered links, labelled «Πηγές» or “Sources” by the reply’s language, with duplicates and private addresses dropped. A real reply went from 1,895 characters to 1,087, and from three messages to two.

On Saturday a reply had two source lists: one the model wrote in Greek, one the server added. My citation filter only knew the English header. It knows «Πηγές» now.

Friday: Greek costs double

Someone in the group shared a Greek video and mentioned the bot. Nothing came back.

The bridge had a prompt budget of 2,400 bytes for the Pi model. In UTF-8 a Greek letter takes two bytes. So the caption plus the transcript didn’t fit, and the bridge did what I’d told it to: refuse rather than cut. Correctly. Pointlessly.

Every budget is in characters now. 4,000 for the Pi, 16,384 for Qwen. Greek gets the same room as English. It’s such a small thing, and it’s the kind of small thing that tells you who the software was really written for.

Friday: a 27B model on a 10 GB card

In the middle of all that, Qwen got bigger.

Last week’s Qwen3.5-9B was replaced by Qwen3.8-27B, squeezed down to a very aggressive 2-bit quant (UD-IQ2_XXS). Every layer fits on the Arc B570 in about 8.6 GiB. It runs at around 15 tokens a second, with a 20k-token window. One surprise from the llama.cpp Vulkan build: flash attention off was 2.5× faster than on.

Of course something broke immediately. The Instagram side checked that the server was serving a model called qwen3.5-9b. Once it wasn’t, every Qwen mention quietly fell back to the Pi. Now it accepts whatever model the server lists.

Then a mention thought for the entire 8,192-token budget, 609 seconds, and never answered. So thinking is capped at 6,144 tokens with --reasoning-budget. The detail I found interesting: the message that ends the thinking is written as the model’s own last thought. When I wrote it as an order, the model just kept working in the visible reply and hit 8,192 anyway. Tested on a hard counting problem: it stopped and gave a short answer. A wrong one. That’s what happens when you cut a thinker off, and I’d rather have a wrong answer in seven minutes than no answer in ten.

The bigger model meant a smaller window, so the “large” tools from last week had to shrink. A 16,000-character web page measured 7,000 Qwen tokens in English and 9,100 in Greek. One read filled the whole window. Pages are now read 6,000 characters at a time.

Friday: tools that do the maths

The department agent got some tools only a physics student would want:

  • symbolic_math, on SymPy: derivatives, integrals, equations. Input goes through a whitelisted parser, and each call runs in its own child process that gets killed after 15 seconds.
  • physics_units, on Pint: conversions and unit checks.
  • academic_calendar: the university’s official 2026–27 calendar, transcribed into a data file, with each answer linking the decision it came from.

That last one taught me something. The tool wrote dates in English. The Pi model translated them into Greek for the group, and got the weekdays wrong. Monday 18 January became «Κυριακή», Sunday. Now the tool writes Greek first, English in brackets, and the model just copies it. Same lesson as last week: don’t let the model do the part a lookup table can do.

Each request also now starts with “Today is …”, in Greek and English. Before that, the Pi model couldn’t tell an upcoming exam from a past one.

And I tried, and failed, to make it prefer the files over web search. One prompt line: “file search first for any question about the school”. In a live test of five questions it still went to the web for one, gave no reply for another, and searched files only twice. I took the line out after 23 minutes. Some things a prompt just can’t make a 2B model do.

Friday night: “who am I?”

This was my favourite bug of the week, because it’s so human.

The bot kept speaking as other people. It took a line one member had written to another and said it as its own. It talked about the person who asked it a question in the third person.

And when I looked at what it was actually given, it made perfect sense. The history had no “you” in it. Its own earlier replies were dropped. Its handle was never named as itself. Speakers were shown by display name, while the messages tagged people by @username. It was reading a transcript of a party it didn’t know it was at.

So now there’s a legend before the history: you are this handle; each line is a speaker and their text; members also talk to each other. Its last two replies appear as “you”. And for the small Pi model, I went further on Saturday: it sees only the messages that mention it, plus its own last few replies to the person asking. The rest of the chat isn’t shown, and a line says so. Less context, less confusion.

Saturday: the feed that froze

The group also gets a news feed: new announcements from the department and the university, plus student events, posted straight from FreshRSS. No model involved. By Saturday a post is just the links, one per message, because Instagram’s preview already shows the title.

It posts only items FreshRSS fetched since the last poll. That matters: when I moved a feed into a new category, it brought eleven items fetched up to 18 days earlier. Not news, so not posted.

Then the feeds stopped. For 38 hours. No error anywhere.

The cause was me. On Thursday I’d run a FreshRSS command with docker exec as root, and it left cache files owned by root. The web server couldn’t overwrite them, so those feeds just… stayed where they were. Silently.

Two fixes. FreshRSS now resets its own data permissions before every refresh. And the container goes unhealthy when any feed hasn’t refreshed for three of its intervals plus an hour. A thing that fails silently isn’t running. I keep relearning that one.

Saturday: everything goes to sleep

The workstation is shared with other work. The Pi held its model in memory around the clock. Neither made much sense for a bot that’s quiet most of the day.

Now both let go after ten minutes idle.

  • Qwen uses llama-server’s --sleep-idle-seconds. Asleep, its VRAM goes from 8,571 MiB to 52 MiB. Waking up and replying takes about 3 seconds.
  • LiteRT-LM loads models lazily but never unloads them, so I patched it. Between requests it closes the cached conversations and both engines, then hands the memory back. 2.2–2.4 GiB loaded becomes 273 MiB. A cold request takes 11–13 seconds.

On a Pi with about 1 GiB free, that’s not an optimisation. That’s breathing room.

Shopping, sort of

Speaking of breathing room: on Friday I measured both machines and wrote down what I’d actually buy with $500–1,000. The Pi had 1 GiB of RAM free, 4.9 GB in swap, 63 containers, a load average of 27 and a disk 95% full. The backups live on the same Pi they protect.

The list surprised me. Number one isn’t a GPU. It’s a UPS, because a power cut is the likeliest way I’ll lose data. Then off-site backup for about €4 a month. Then a used one-litre office PC with 32 GB of RAM to take load off the Pi. And before any of that: free space, and keep a second copy of the backups on the workstation, for nothing. RAM, SSD and GPU prices are up two to four times this year, so the GPU waits.

The small stuff

  • Calendar events can now repeat (daily, weekdays, weekly, or “mon,wed”) until a date, so a routine is one series instead of twenty copies. Timed events get reminders a day, an hour and ten minutes before.
  • The descriptions of tools I didn’t write get rewritten shorter for the Pi model. The department agent’s tool schemas went from 11.7k characters to 6.2k. Adding “RSS feeds” to one description was enough for it to pick the feed tool when asked to “check the RSS feed”.
  • LibreChat’s background memory requests no longer push a chat out of the Pi’s prefix cache.
  • Automatic summarisation is off for the group agents. Every empty reply on Friday came right after it kicked in: it dropped the one message that mattered, the request, and replaced it with an empty summary.

The takeaway

I spent most of the week on things that have nothing to do with AI. Link length limits. Bytes versus characters. File ownership. Who “you” is in a transcript. The model was the easy part. Getting its answer into a group chat, correctly, once, in the right language, without leaking anything, was the job.

So if you’re about to put a bot where other people can see it: before you tune a single prompt, read the exact text it’s given, as if you were the model. Ask whether you’d know who you are, what day it is, and what you’re allowed to say. Then remove every document you wouldn’t read aloud to the whole room. Mine got through that test on day two. I’d rather you got there on day one.


Sources