PrismDevRelOpen the app
How-to guides: How to give an AI agent the prism_prompt tool

Build

How to build a decision table appHow to build a policy decision appHow to build a state machine appHow to verify an app before you publish itHow to publish an app on GitHub PagesHow to give an AI agent the prism_prompt tool

// how-to guide · Build

How to give an AI agent the prism_prompt tool

Hand an agent the prism_prompt tool, so it writes prompts that the builder checks and builds.

prism_prompt is an MCP tool whose input is one prompt. Its title says what it does: Build a whole Prism app from one prompt.

The steps, in order1. Get the tool definition: node builder/cli.mjs schema 2. Register it with the agent: name, description, inputSchema 3. Ask the agent for an app: it answers with a tools/call 4. Check what it wrote: the call is a prompt01Get the tooldefinitionnodebuilder/cli.mjsschema02Register it withthe agentname, description,inputSchema03Ask the agentfor an appit answers with atools/call04Check what itwrotethe call is apromptThe steps, in order1. Get the tool definition: node builder/cli.mjs schema 2. Register it with the agent: name, description, inputSchema 3. Ask the agent for an app: it answers with a tools/call 4. Check what it wrote: the call is a prompt01Get the tool definitionnode builder/cli.mjs schema02Register it with the agentname, description, inputSchema03Ask the agent for an appit answers with a tools/call04Check what it wrotethe call is a prompt
The steps, in order. 4 steps. Each section below is one of them.
The data in this figure
StepWhat happens
1. Get the tool definitionnode builder/cli.mjs schema
2. Register it with the agentname, description, inputSchema
3. Ask the agent for an appit answers with a tools/call
4. Check what it wrotethe call is a prompt

1. Get the tool definition

Print the MCP tool prism_prompt, whose input is one prompt.

git clone https://github.com/afflom/prism-devrel.git && cd prism-devrel
node builder/cli.mjs schema > prism_prompt.json

The site serves the same file as the tool schema.

2. Register it with the agent

Add it to the agent's tools as it is: name prism_prompt, its description and its inputSchema. The input requires app.

3. Ask the agent for an app

Describe the app in a sentence. The agent answers with a call like this one.

3. Ask the agent for an app 305 lines
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "prism_prompt",
    "arguments": {
      "schema": "prism/prompt/1",
      "goal": "Find the next state of one Rule 30 cell from its neighbours, so every row of the pattern can be replayed and checked.",
      "pattern": "decisionTable",
      "repository": "afflom/rule30",
      "license": "MIT",
      "app": {
        "name": "rule-thirty-cell",
        "title": "Rule 30 cell",
        "purpose": "Decide the next state of a Rule 30 cell from its left neighbour, itself and its right neighbour.",
        "fields": [
          {
            "name": "left",
            "kind": "choice",
            "values": [
              "off",
              "on"
            ],
            "means": "the left neighbour now"
          },
          {
            "name": "center",
            "kind": "choice",
            "values": [
              "off",
              "on"
            ],
            "means": "the cell now"
          },
          {
            "name": "right",
            "kind": "choice",
            "values": [
              "off",
              "on"
            ],
            "means": "the right neighbour now"
          }
        ],
        "outcomes": [
          "off",
          "on"
        ],
        "meanings": {
          "on": "the cell is black in the next row",
          "off": "the cell is white in the next row"
        },
        "rules": [
          {
            "when": [
              {
                "field": "left",
                "op": "is",
                "value": "on"
              },
              {
                "field": "center",
                "op": "is",
                "value": "off"
              },
              {
                "field": "right",
                "op": "is",
                "value": "off"
              }
            ],
            "then": "on",
            "why": "rule30-lexlean/src/Core.lex.tex: rule a b c = bxor a (b || c), so 100 gives 1"
          },
          {
            "when": [
              {
                "field": "left",
                "op": "is",
                "value": "off"
              },
              {
                "field": "center",
                "op": "is",
                "value": "on"
              }
            ],
            "then": "on",
            "why": "rule30-lexlean/src/Core.lex.tex: with a off, rule is b || c, so 010 and 011 give 1"
          },
          {
            "when": [
              {
                "field": "left",
                "op": "is",
                "value": "off"
              },
              {
                "field": "right",
                "op": "is",
                "value": "on"
              }
            ],
            "then": "on",
            "why": "rule30-lexlean/src/Core.lex.tex: with a off, rule is b || c, so 001 gives 1"
          }
        ],
        "otherwise": "off",
        "otherwiseWhy": "rule30-lexlean/src/Core.lex.tex: bxor a (b || c) is 0 for 000, 101, 110 and 111",
        "properties": [
          {
            "kind": "never",
            "when": [
              {
                "field": "left",
                "op": "is",
                "value": "on"
              },
              {
                "field": "center",
                "op": "is",
                "value": "on"
              }
            ],
            "then": "on",
            "why": "Core.lex.tex: with a and b on, bxor true true is false, so 110 and 111 give 0"
          },
          {
            "kind": "always",
            "when": [
              {
                "field": "left",
                "op": "is",
                "value": "off"
              },
              {
                "field": "center",
                "op": "is",
                "value": "off"
              },
              {
                "field": "right",
                "op": "is",
                "value": "off"
              }
            ],
            "then": "off",
            "why": "a white neighbourhood stays white, the background of the Rule 30 diagram"
          }
        ],
        "examples": [
          {
            "request": "off off off",
            "response": "off"
          },
          {
            "request": "off off on",
            "response": "on"
          },
          {
            "request": "off on off",
            "response": "on"
          },
          {
            "request": "off on on",
            "response": "on"
          },
          {
            "request": "on off off",
            "response": "on"
          },
          {
            "request": "on off on",
            "response": "off"
          },
          {
            "request": "on on off",
            "response": "off"
          },
          {
            "request": "on on on",
            "response": "off"
          }
        ]
      },
      "stakeholders": [
        {
          "name": "Researcher",
          "text": "Studies the Rule 30 sequence for Prize Problem 1 and needs every cell of every row to be the one the rule gives.",
          "concerns": [
            "Correct answers",
            "Proved guarantees"
          ]
        },
        {
          "name": "Proof engineer",
          "text": "Extends the LexLean and Lean 4 formalization and needs the cell rule to stay the one Core.lex.tex and the prize kit define.",
          "concerns": [
            "Agreement with the prize kit",
            "Proved guarantees"
          ]
        }
      ],
      "concerns": [
        {
          "name": "Agreement with the prize kit",
          "text": "The local rule is the one Rule30PrizeKit defines, as rule30-bridge/Rule30Bridge.lean connects every paper theorem to Ruliology.CellularAutomata.Rule30Prize.",
          "model": "component"
        }
      ],
      "components": [
        {
          "name": "Rule30PrizeKit",
          "kind": "externalSystem",
          "text": "The Rule 30 Prize kit, Ruliology.CellularAutomata.Rule30Prize, whose definitions the bridge module ties the LexLean theorems to."
        },
        {
          "name": "r30 command surface",
          "kind": "cliAdapter",
          "text": "bin/r30: status, frontier, theorem add, check, verify and axioms, also served as an MCP server."
        }
      ],
      "threats": [
        {
          "name": "Rule drifts from the prize kit",
          "text": "The cell table differs from the Rule 30 the prize kit defines, so a replayed row is not the automaton the prize asks about.",
          "stride": "tampering",
          "asset": "source",
          "likelihood": "low",
          "impact": "critical",
          "control": {
            "name": "Bridged to the prize kit",
            "text": "Rule30Bridge.lean proves every LexLean paper theorem against the kit definition, and all eight neighbourhoods are acceptance examples.",
            "evidence": [
              {
                "kind": "review",
                "reference": "rule30-bridge/Rule30Bridge.lean"
              },
              {
                "kind": "gate",
                "reference": "make check-research"
              }
            ]
          }
        },
        {
          "name": "Classical choice in a proof",
          "text": "A proof of the rule depends on Classical.choice, which the repository forbids in its authored proof surfaces.",
          "stride": "tampering",
          "asset": "source",
          "likelihood": "low",
          "impact": "major",
          "control": {
            "name": "Choice forbidden",
            "text": "The kernel axiom audit accepts only propext and Quot.sound, and a source check rejects classical constants.",
            "evidence": [
              {
                "kind": "gate",
                "reference": "scripts/check_no_choice.py"
              },
              {
                "kind": "gate",
                "reference": "make check-research"
              }
            ]
          }
        },
        {
          "name": "Boundary cells guessed",
          "text": "A caller asks about a cell at the edge of a finite row and supplies a neighbour that is not in the row.",
          "stride": "tampering",
          "asset": "request",
          "likelihood": "medium",
          "impact": "minor",
          "accepted": "The app answers one neighbourhood exactly; the convention for cells beyond a finite row belongs to the caller that builds the row."
        }
      ],
      "quality": [
        {
          "characteristic": "Maintainability",
          "subcharacteristic": "Testability",
          "requirement": "Whole truth table pinned",
          "text": "Each of the eight neighbourhoods of three cells is an acceptance example, so the table is checked row by row against Core.lex.tex.",
          "measure": "Neighbourhoods without an example",
          "measureText": "Of the eight three-cell neighbourhoods, those no example states.",
          "threshold": 0
        }
      ],
      "journeys": [
        {
          "stakeholder": "Researcher",
          "steps": [
            "REQ-001",
            "REQ-002",
            "REQ-003",
            "otherwise",
            "INV-001",
            "INV-002"
          ]
        }
      ]
    }
  }
}

4. Check what it wrote

Save the call as call.json. The command line takes the whole call as the prompt.

node builder/cli.mjs check call.json

Exit codes: 0 done, 2 the prompt was refused (the reason is printed), 64 usage. On exit 2, give the printed reason back to the agent and ask again.

Next

how-to guideBuildMarkdown

Words on this page 2
MCP
Model Context Protocol: an open protocol through which AI agents call tools such as the Prism builder.
prompt
One JSON document that describes an app. The builder turns it into every facet of a Prism model.