Why the AI Assistant's ideas come from rules, and its conversations are saved per user on the server
The question: The assistant offered the same three generic starters on every screen and forgot the conversation on every refresh. Can it know where the person is and suggest what to do there — and keep the conversation — and if so, where should those suggestions and that history come from?
Context
The builder panel already sent the page outline with each request, but the site-wide assistant had no idea which admin screen it was opened on, so its starters ("Create a draft About page…") were the same on Settings → General as on the Dashboard. And the conversation lived only in the page's memory: a refresh wiped it, and with it the model's memory of what had been said, so a follow-up like "make that darker" stopped working.
Options considered
For the ideas:
- Ask the model to suggest what to do each time the panel opens. Tailored, but slow (a minute or more with free local AI), a paid request on every panel open with a provider key, and liable to suggest things the tools cannot actually do.
- Fixed rules over real facts, computed on the server when the screen loads: the tagline is still the WordPress default → "Write a tagline"; four published pages have no SEO description → "Write SEO descriptions for the 4 pages missing one"; three pages are in no menu → "Add them to the main menu".
For the history:
- Browser storage (
localStorage). Simplest, but lost when the cache is cleared, missing on another computer, and left behind on a shared machine. - User meta on the server, one row per user holding a small conversation per page / screen.
Decision
- The panel sends where the person is — the builder page (its typed title, never "Auto Draft", its section count, whether it has a call to action, its SEO state) or the admin screen, with a few real facts — with every request, so answers are about that place.
- The ideas are chosen by rules from those facts. Jobs queued by other extensions still show first. A model-generated "More ideas" button is left as an optional later addition.
- Conversations are saved in user meta (
upw_ai_chats), per user and per page / screen: the last 30 messages, 30 days, 60 places. They are restored on reload and sent back to the model. New chat clears one. Only text and the "what changed" lines are kept, never page trees. - A new
update-site-identityability (title, tagline, site icon), so the Settings → General ideas can actually be carried out, with undo.
Why
Rules make the ideas instant, free and always doable, and they are more specific than a generic model suggestion because they count real things. Server storage follows the person across browsers, survives a cache clear, stays private to that user, and is removed with the user — and it fits the assistant, which already keeps its revisions and settings on the server.
The trade-off, accepted: a restored reply cannot offer "Undo this change". That button needs the page as it was just before the change, and a reload resets the builder's own undo history anyway, so restored replies say "applied earlier" and point to the page's revisions or to asking the assistant to undo it.
