# Prompt reference

A prompt is the arguments of one call to the MCP tool prism_prompt. Its members, and the members of its app spec, are below.

**Figure: The shape of a prompt.** A prompt and its members, then the members of its app spec. The colour marks a required member.

| From | Link | To |
| --- | --- | --- |
| prompt | → | goal |
| prompt | → | app |
| prompt | → | stakeholders |
| prompt | → | concerns |
| prompt | → | components |
| prompt | → | threats |
| prompt | → | quality |
| prompt | → | journeys |
| prompt | → | pattern |
| prompt | → | machine |
| prompt | → | license |
| prompt | → | repository |
| prompt | → | axioms |
| app | → | name |
| app | → | title |
| app | → | purpose |
| app | → | fields |
| app | → | outcomes |
| app | → | meanings |
| app | → | rules |
| app | → | otherwise |
| app | → | otherwiseWhy |
| app | → | properties |
| app | → | limits |
| app | → | examples |

## Prompt members

| Member | Type | Presence | Meaning |
| --- | --- | --- | --- |
| goal | string | optional | The goal the app is built toward, in one sentence a developer would say. It becomes the spec purpose when app.purpose is left out. |
| app | object | required | The whole app as a prism/spec/1 spec, the input of prism-code's prism\_spec. Its members are below. |
| stakeholders | array | optional | Who the app is for. A Verifier, anyone who replays the holo before trusting it, is always added. |
| concerns | array | optional | What the stakeholders care about, each viewed in one model. |
| components | array | optional | Systems outside the app that send it requests or read its answers. |
| threats | array | optional | What can go wrong, beyond the threats every app has (an oversized or malformed request, a substituted holo or source, a granted capability, an answer a property rules out). |
| quality | array | optional | How good is good enough, as ISO/IEC 25010:2023 requirements with a measure and its threshold. |
| journeys | array | optional | Ordered steps a stakeholder takes. A step is a rule ID (REQ-001), a property ID (INV-001), otherwise or refuse. |
| pattern | one of | optional | The pattern the behavior follows: decisionTable (OMG DMN 1.5, hit policy FIRST, the default), policyDecision (OASIS XACML 3.0: the answers are exactly permit, deny, not-applicable and indeterminate) or stateMachine (OMG UML 2.5.1: the answer is the next state, and machine is required). |
| machine | object | optional | For a stateMachine: which choice field carries the current state, the initial state, and the final states. The answers are exactly the state values. The builder proves that a final state is never left and that no run from the initial state reaches a state outside the reachable set. |
| license | string | optional | The SPDX license expression; MIT OR Apache-2.0 when left out. |
| repository | string | optional | owner/name of the repository the app will live in, for its page and links. |
| axioms | object | optional | The exact axiom set a verify observed for a generated declaration, by declaration name, as prism-code records it when LexLean reports LLV7005. \`node builder/cli.mjs axioms\` writes it from a verify log. |

## app: the prism/spec/1 spec

| Member | Type | Presence | Meaning |
| --- | --- | --- | --- |
| name | string | optional | Lower case and hyphens, such as loan-approval. |
| title | string | optional |  |
| purpose | string | required | What the app decides, in one sentence. |
| fields | array | required | One request is these values in order, separated by spaces. |
| outcomes | array | required | Lower-case words; invalid is reserved. |
| meanings | object | optional | What each answer means, such as {"review": "a person must decide"}. |
| rules | array | required | In order; the first that matches decides. |
| otherwise | string | required | The answer when no rule matches. |
| otherwiseWhy | string | optional | Why, in a few words, such as "it enforces INV-001". |
| properties | array | optional | What must never or always happen; each becomes a theorem Lean proves. |
| limits | array | optional | What the app does not decide, and choices the rules make silently, such as "fair credit is treated as good". |
| examples | array | optional | Requests and their expected answers; each becomes an acceptance vector. |

## Patterns

| pattern | Name | Standard | What the builder checks and proves |
| --- | --- | --- | --- |
| decisionTable | Decision table | OMG DMN 1.5, hit policy FIRST | The rules are tried in order, and the first one that matches gives the answer. If none matches, the default answer applies. This is a DMN decision table with the FIRST hit policy. |
| policyDecision | Policy decision | OASIS XACML 3.0 policy decision point | The answer is one XACML 3.0 decision: permit, deny, not-applicable, indeterminate. A policy that applies gives permit or deny. If none applies, the answer is not-applicable. If the request cannot be judged, it is indeterminate. |
| stateMachine | State machine | OMG UML 2.5.1 behavioral state machine | The answer is the next state, given the current state and an event. This is a UML state machine written as one pure function. The state travels in the request, so the app keeps nothing between requests. The builder proves what holds over every run. |

## machine: the state machine

| Member | Type | Presence | Meaning |
| --- | --- | --- | --- |
| state | string | required | The choice field whose values are the states. |
| initial | string | required | The state every run starts in. |
| final | array | optional | States a run never leaves once it reaches them (UML FinalState). |

## Command line

| node builder/cli.mjs | Does |
| --- | --- |
| build \<prompt.json\> --out \<dir\> \[--last-modified \<instant\>\] | Write every file of the application into \<dir\>, laid out as a repository created from UOR-Foundation/template, and delete the template's example app there if it is present. |
| check \<prompt.json\> | Check the prompt and print what the app will claim, writing nothing. |
| schema | Print the MCP tool prism\_prompt, whose input is one prompt. |
| axioms \<prompt.json\> \<verify.log\> | Record in the prompt the exact axiom set each declaration was observed to use, from the LLV7005 diagnostics of a verify (as prism-code does). |
| list | Print the gallery's example names as a JSON array, the matrix the pages workflow builds and verifies one job per example from. |

Exit codes: 0 done, 2 the prompt was refused (the reason is printed), 64 usage.

## MCP tool call

```json
{
  "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"
          ]
        }
      ]
    }
  }
}
```
