Guides · Editing

Prompt editing

Editors change a page by typing what they want, on the canvas, on the site or one field at a time in the entry form. What the model may change, the prompt box, and using your own model through a signed prompt endpoint.

4 min read

Editors who may edit content can change a page by typing what they want, in a box at the bottom of your site: "make the hero heading shorter", "translate this block's text into plain English", "add a call to action under the pricing table". It works on the canvas, where a request can also cover the whole site, and when editing on your site.

What happens to a prompt

  • It is about the selected block, or the whole entry when none is selected, in the locale chosen in the editor (on the site: the page's <html lang>). With a block selected, only that block can change; "add a section" puts new blocks right after it (or before, when you say so), and nothing else on the page is touched. On the whole entry, an answer that would drop blocks you didn't ask to remove is refused.
  • New sections are blocks: the model picks the block type whose description fits the request best. Every content type has a description for this; write it as what the block is for ("A list of questions with answers").
  • A shared block is one line in what the model sees, never its fields: a prompt can insert a shared block the page's field allows ("add the promo banner"), keep or remove one, but never change its content, which would land on every page that shows it. Publishing the block is a separate decision, not a side effect of a page prompt.
  • The change lands in the unsaved draft, so it shows on your site straight away; Undo puts back what was there before. Nothing is stored until the editor presses Save, and closing the tab with unsaved changes asks first.
  • The model sees and edits only the current locale, and can't point at entries or assets the content didn't already use. Its answer is checked like any save; if it isn't valid after a second try, nothing changes.
  • On the site, New page writes a whole page from a path and a prompt and stores it as a draft, and JSON mode shows what the model sees so you can change it by hand.
  • Each person can prompt (or make a new page) 20 times a minute; past that, prompts are refused (429) until the minute is up.

Write with AI in the entry form

On an entry's page, text, long text, rich text and blocks fields have Write with AI: the same prompt for that one field (or blocks list) instead of the whole page. "A warmer intro", "three questions about delivery", "shorter, for mobile".

  • The model sees and may change only that field, in the language you are editing, written against your unsaved form, so it picks up what you just typed. A field inside a block is that block's.
  • Its answer is checked like any save, and like on the canvas a blocks list may not lose blocks you didn't ask to remove; if it isn't valid after a second try, nothing changes.
  • The suggestion shows the field before and after. Keep it puts it in the form as an unsaved change, saved with Save like your own edits (and recorded in activity as your save); Try another asks again with the same prompt; Dismiss drops it.
  • It runs on the environment's own model when one is set, and counts towards the same 20 prompts a minute.

The prompt box

Every bridge comes with it: the bridge.js script tag, getContentBridge() from @obelism/content/bridge and <ContentBridge /> from @obelism/content-react. It is plain DOM in a shadow root, no framework.

  • Leave it out with data-prompt="false" on the tag, getContentBridge({ prompt: false }) or <ContentBridge prompt={false} />.
  • Change its labels: getContentBridge({ prompt: { labels: { open: 'Bewerk met een prompt' } } }).
  • Mount it yourself later with mountPromptBox(document, bridge).
  • Or build your own UI with bridge.prompt(text), bridge.undo() and the change event, or useContentPrompt() in React.

Your own model

By default, prompts run on Workers AI. To use your own model, set a prompt endpoint under Settings → Preview and site → Prompt editing. Each prompt is then a POST to it, signed like a webhook (Standard Webhooks) with the secret shown when you save the URL:

{
	"type": "content.prompt",
	"system": "You edit content in Obelism Content…",
	"messages": [{ "role": "user", "content": "Request: …" }],
	"schema": {
		"type": "object",
		"properties": { "intent": {}, "changes": {}, "summary": {} }
	}
}

Answer { "output": … } within 60 seconds, where output is the model's answer, { "intent": "add", "changes": { … }, "summary": "…" }, as an object or as JSON text. intent (add, change, remove or none) is what the model took the request to be: an add that adds no block is sent back once. Answers without it are still accepted. createPromptHandler from @obelism/content/prompt verifies the request and shapes the response; you supply the model call:

app/api/content-prompt/route.ts
import { createPromptHandler } from '@obelism/content/prompt'

export const POST = createPromptHandler({
	secret: process.env.CONTENT_PROMPT_SECRET!, // whsec_… from Settings
	generate: async ({ system, messages, schema }) => {
		// call any model; return its JSON answer (object or text)
	},
})

Like the preview URL, the prompt endpoint belongs to one environment, and agents can set it outside production with PATCH …/settings.

On this page

Marks in the margin

  • Note
  • Watch out
  • Updated

Scribes marked doubtful lines in the margin. That practice is called obelism.

Stuck on a step?