a writing assistant in the CMS that never publishes anything
how I put an AI into the blog panel without giving it the power to break anything: drafts only, only with the access of whoever asks, and a version lock
3 minview on github
tl;dr#
I integrated a writing assistant into the CMS panel of the blog I work on (PR #9). it chats, creates drafts and categories, and types into the open article. the part that made me think the most wasn't the AI: it was what it can't do. it never publishes, archives or deletes, it only acts with the access of whoever asked, and if the article changed while it was thinking, its write gets refused.
how it shows up#
a little face in the corner of the panel opens the chat. there's a Skills menu (each one with a short scene showing what it does), and replies that change something arrive as proposal cards. the person accepts, rejects or undoes. everyone picks their assistant's face on the account page.
the rules that matter#
1. drafts only#
the assistant creates drafts, it never publishes. if the answer is bad, the worst case is a bad draft sitting in the panel. nobody reads that on the site.
2. with the access of whoever asks#
its writes go through the same Services the rest of the panel uses, with the permissions of the person chatting. it doesn't get some special "robot" access that sees everything. if you can't touch a category, it can't touch it for you either.
3. version lock#
the AI takes a while to answer. in the meantime, someone may have saved the same article. so every write carries the version the assistant saw. if the version in the database already changed, the answer is 409 and nothing gets overwritten.
4. the open article only changes by typing#
when the article is open in the editor, the assistant doesn't save straight to the database. it types on the screen, like a person, and autosave or the Save button stores it. that way what's on screen and what's in the database never fight.
5. a script watches who can write#
there's a scripts/assistant-scope.check.ts that checks which files the assistant code may use to write. if someone in the future makes the assistant call a service that publishes, that check breaks.
off by default#
the assistant only shows up if the GEMINI_API_KEY variable exists. without it, the panel is the same as before. that let the code ship to production without turning the feature on for everyone at once.
what's still open#
the chat has no per-account limit yet (only the writes do), and every message costs a Gemini call. that became the next PR.
what I take from this#
putting AI into a product is the easy part. the hard part is deciding the size of the box it lives in. here the box is small on purpose: it helps you write, and everything else stays in the writer's hands.