Examples

Example: Calorie diary

A record app with three fields and a daily total. Install it, log meals, ask a bot for today's calories and approve the entries it proposes. Then publish your own variant.

Requirements

The manifest

The repository keeps it in examples/plugins/kcal-diary/plugin.json, and superbot-plugin init kcal-diary --template kcal-diary writes the same file.

plugin.json
{
  "schemaVersion": 1,
  "name": "Calorie diary",
  "description": "Log meals and see the total calories for a day.",
  "parts": [
    {
      "kind": "app",
      "id": "meals",
      "fields": [
        {
          "id": "date",
          "label": "Date",
          "type": "date",
          "required": true
        },
        {
          "id": "meal",
          "label": "Meal",
          "type": "text",
          "required": true
        },
        {
          "id": "kcal",
          "label": "Calories (kcal)",
          "type": "number",
          "required": true
        }
      ],
      "summaryField": "kcal"
    }
  ]
}

Step 1: Install it

Find Calorie diary in the store's Discover list and choose Install. Nothing is installed for you in advance. The diary belongs to your account in the selected Space, and other members never see your entries.

Step 2: Log meals

Open the diary and add an entry with a date, a meal and its calories. Use the day arrows or Today for one day, or All dates for everything. The total counts every matching entry, including entries not yet loaded on the page. To fix a mistake, remove the entry and add a corrected one.

Step 3: Give one bot access

Under Installed, select one of your bots and turn on the meals part. Other bots stay without access until you turn it on for them too.

Step 4: Ask the bot

  1. In a direct chat with that bot, ask What have I eaten today? The bot lists entries and the total without asking you first.
  2. Ask it to add a 220 kcal snack for today. The approval card shows the values it wants to save. Nothing is saved until you choose Allow once. In a Space set to Never ask, the addition is refused.

The bot gets these actions only in a direct chat with you, in a turn your own message started.

With a local model. If the bot answers through a supported model CLI on your computer, it gets no tools. Share the diary yourself:

The model sees the five most recent matching entries and the total. The exchange stays out of the shared conversation.

Step 5: Read it from a program

A program signed in as you can use the same entries through the registry API. Reuse operationId when retrying an addition.

TypeScript
const target = { installationId, partId: "meals" };

await client.pluginRegistry.addAppRecord({
  ...target,
  operationId: crypto.randomUUID(),
  values: { date: "2026-11-20", meal: "Porridge", kcal: 480 },
});

const today = await client.pluginRegistry.appRecords({ ...target, date: "2026-11-20" });
console.log(today.total);

Step 6: Publish your own variant

kcal-diary already belongs to the bundled diary, so submit yours under a slug of your own.

shell
mkdir water-log
cd water-log
superbot-plugin init water-log --template kcal-diary --name "Water log"
superbot-plugin validate
superbot-plugin publish water-log 1

Edit the fields in plugin.json before validate, for example a ml number field as the total. A deployment admin then reviews it. See Review, install and versions.

Clean up

Turning off the bot's meals grant keeps your entries. Uninstalling the diary permanently deletes them, for every version.