ForgeCrowdBookWe don't sell the fish – we give you the rod.

Plugins: Tell the AI What You Need

Sooner or later you want something no module has: a guestbook, a poll, a price calculator for cakes, a quiz for your course. In WordPress you would search for a plugin, install code from a stranger, and hope. In ForgeCMS you describe what you want, the AI writes a small plugin, and you put it into your content repo. You can read every line of it, and it can only do what you allow.

Goal

By the end of this chapter you can:

  • ask the AI for a plugin and put it on a page,
  • understand what a plugin may do and what it may not,
  • change a plugin and see the change at once,
  • know the limits of plugins today.

What a plugin is

A plugin is two small files in your content repo, in a folder named after it:

plugins/guestbook/plugin.sml    what it is, and what it asks for
plugins/guestbook/plugin.sms    what it does

The first file is a short description:

Plugin {
    name:    "guestbook"
    title:   "Guestbook"
    version: "1.0.0"
    api:     1
    about:   "Visitors leave a short message; the newest are shown first."
    wants:   "store"
}

The second is a script in SMS, the small scripting language of the Forge family. It reads almost like plain English, and the AI writes it fluently. You do not have to learn it, but you will be able to follow it.

The plugin runs in a sandbox: a closed room. Inside, the script has the language itself and a handful of functions ForgeCMS hands in. It cannot read files on your server, cannot start programs, cannot send anything to the internet, cannot see your settings or other plugins. If it runs too long or uses too much memory, ForgeCMS stops it, and the rest of the page appears as usual.

Step 1: Ask for it

Claude needs to know how ForgeCMS plugins work. The whole description is one file in the ForgeCMS repository, sms/plugins/SPEC.md, so the request is short:

Please read the plugin API in sms/plugins/SPEC.md of the ForgeCMS repository and write a
guestbook plugin for my site: a form with name and message, the newest
entries below, ten at most. English and German. Put it into the content repo,
switch it on in app.sml, and add a page /guestbook with it.

The AI writes the two files, commits them to Codeberg, and adds the plugin to app.sml on the server:

Plugins {
    Plugin { name: "guestbook"  allow: "store" }
}

Read that block carefully, because it is the important part. The plugin asks for permissions in its plugin.sml (wants: "store", to keep its entries). Only app.sml grants them (allow: "store"). The content repo is public and can be changed from a browser; your server is not. So even if someone got into your Codeberg account, they could not switch a plugin on or give it more rights.

After a change to app.sml, ForgeCMS must be restarted; the AI does that.

On the page:

Plugin { name: "guestbook"  limit: "10" }

Every line besides name goes to the plugin as a setting. Here, limit says how many entries to show.

The guestbook plugin

Step 2: Change it

The plugin is in your content repo, so changing it works like changing a text. Ask the AI: "The guestbook should show the date as 3 November 2026 instead of 2026-11-03." It edits plugin.sms and pushes. Reload the page: the change is there. No restart, no installation. ForgeCMS notices that the script changed and loads the new one.

When something is wrong in the script, your local preview shows exactly where:

An error in a plugin

On the public site, visitors see the page without the plugin, and the error goes to the log. Show the message to the AI, and it fixes it.

A second example: a poll

To check that the description is enough, I gave it to the AI with one sentence: "A poll: one question, a few answers, results as bars." This came out, and worked on the first try:

Plugin { name: "poll"  id: "next-bread"
         question: "Which bread should we bake next?"
         answers: "Spelt, Pumpkin seed, Gluten-free" }

The poll plugin

Both plugins are in the example folder of this book.

What a plugin can do

A plugin can with
show text, headings, pictures, links, buttons, cards, tables, videos the page elements of ForgeCMS
show a form and receive what visitors send PluginForm
keep its own records on your server store, if app.sml allows it
write to the server log log
calculate with dates time

And what it cannot:

  • No HTML of its own. A plugin builds its part of the page from the same elements as your pages. ForgeCMS filters what comes back, so no script, no hidden frame, no javascript: link can get onto your page, even through a visitor's text.
  • No files, programs or network. The room has no doors.
  • No endless loops. Each call may take a million steps, a quarter of a second and 32 MB. Then it is stopped.
  • No knowing who the visitor is (yet). The poll above cannot stop someone from voting twice. For a bakery that is fine; for a vote that matters, use the feature request module.

Why this is different from WordPress plugins

A WordPress plugin is PHP code that runs with all the rights of your website. It can read your database, send mail in your name and change other plugins. One bad plugin, and your whole site is open.

A ForgeCMS plugin is the opposite: it starts with no rights at all, and you hand out the few it needs, in a file only you control. It is also small enough to read. A guestbook is about a hundred lines, and if you ask the AI "Explain this plugin to me line by line", it will.

Pitfalls

  • "Plugin … is not switched on": the Plugin { } entry in Plugins { } of app.sml is missing, or ForgeCMS was not restarted after adding it.
  • The plugin works, but keeps nothing: it wants store, but allow: "store" is missing in app.sml. The log says so.
  • A visitor's text breaks the layout: the plugin must put text into its output with sml.quote(...). Tell the AI; the spec says so too.

What you learned

  • A plugin is plugin.sml and plugin.sms in plugins/<name>/ of your content repo; Plugin { name } puts it on a page.
  • sms/plugins/SPEC.md is everything the AI needs to write one.
  • The plugin asks for permissions, app.sml grants them. Without a grant it has none.
  • It runs in a sandbox with limits; its output is filtered; changes are live at the next reload.