On this page8
Part of the TFI PHP App. By Mohammad Javad Dastouri, full-stack and AI engineer.
AI that writes straight into a live page is a liability. In this platform, an answer is a suggestion that must pass the same checks as anything a person types.
At a glance
- Provider options
- 26, including OpenAI, Anthropic, Gemini, Mistral and self-hosted n8n
- Prompt
- Composed the same way every time
- Limits
- Per design, per screen size, per kind of answer
- API keys
- Write-only and encrypted
- Answers
- Suggestions, checked before use
- Provider options
- 26, including OpenAI, Anthropic, Gemini, Mistral and self-hosted n8n
- Prompt
- Composed the same way every time
- Limits
- Per design, per screen size, per kind of answer
- API keys
- Write-only and encrypted
- Answers
- Suggestions, checked before use
The decision
- Context
- A model can return wrong text, broken HTML or CSS that breaks a design.
- Decision
- Run every answer through the same allow-lists and limits as typing.
- Not chosen
- Relying on the admin to review each answer by eye. Much lighter to build, but people miss what a check does not.
- Cost
- A refused answer is wasted time and wasted provider cost.
- Result
- A broken answer stops at the check. Whether the words are right stays the admin's decision, and nothing is saved until they choose it.
- Context
- A model can return wrong text, broken HTML or CSS that breaks a design.
- Decision
- Run every answer through the same allow-lists and limits as typing.
- Not chosen
- Relying on the admin to review each answer by eye. Much lighter to build, but people miss what a check does not.
- Cost
- A refused answer is wasted time and wasted provider cost.
- Result
- A broken answer stops at the check. Whether the words are right stays the admin's decision, and nothing is saved until they choose it.
One prompt, built in a fixed order
Each request is assembled in one order: the task, the design, the site's rules, the admin's own words, then the page text marked clearly as data. The same input gives the same prompt, and every job stores a fingerprint of what was sent.
Marking the page text as data matters. Words inside an article must not be able to give the AI new instructions.
Each design writes its own brief
The limits are read live from the design record and the stylesheet, separately for phone and desktop and for text, HTML and CSS. Switch the design and the brief changes with it.
Admins can add their own lines for a design, a screen size or a task.
Answers are checked like typing
Text
Must fit the task's length limits.
HTML
Goes through the same allow-list as the editor.
CSS
May use only the design system's own properties and the right screen size.
Refused answers
Are shown with the reason and cannot be used.
Text
Must fit the task's length limits.
HTML
Goes through the same allow-list as the editor.
CSS
May use only the design system's own properties and the right screen size.
Refused answers
Are shown with the reason and cannot be used.
Running it safely
Requests run after the page has answered, with retries, and a crash fails one job, not the queue. Keys are never shown again after saving, only a short hint, and they are never written to a log.
One automated test renders an AI answer in every design record at phone and desktop width.
Why I built it this way
I wanted the speed of AI without giving up what the rest of the platform guarantees. The model is one replaceable part. The rules around it belong to the product.
How I run AI agents against my own code is written up in Connecting AI agents through MCP and auditing their work.
Hiring for AI that runs in production?
Tell me what your AI has to get right. Next: how search is built.
- Section
- Web platforms and migration
- Updated
- November 9, 2026
- Reading time
- 3 min read
Hiring for this kind of work?
Tell me about the role and I will reply by email.
Discuss a role with me
