PrismDevRelOpen the app
How-to guides: How to verify an app before you publish it

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 verify an app before you publish it

Build the app from its prompt in a copy of the template, and pass its whole gate in the locked SDK.

The pages workflow does this for every example before the site goes live. Do the same for your own prompt before you push it.

The steps, in order1. Clone prism-devrel: the builder and the lock 2. Check the prompt: refused prompts stop here 3. Build and run the gate: just vv in the locked SDK 4. Record observed axioms: only when LLV7005 is reported 5. Find the holo: the verified app01Cloneprism-devrelthe builderand the lock02Check thepromptrefusedprompts stophere03Build andrun the gatejust vv inthe lockedSDK04Recordobservedaxiomsonly whenLLV7005 isreported05Find theholothe verifiedappThe steps, in order1. Clone prism-devrel: the builder and the lock 2. Check the prompt: refused prompts stop here 3. Build and run the gate: just vv in the locked SDK 4. Record observed axioms: only when LLV7005 is reported 5. Find the holo: the verified app01Clone prism-devrelthe builder and the lock02Check the promptrefused prompts stop here03Build and run the gatejust vv in the locked SDK04Record observed axiomsonly when LLV7005 is reported05Find the holothe verified app
The steps, in order. 5 steps. Each section below is one of them.
The data in this figure
StepWhat happens
1. Clone prism-devrelthe builder and the lock
2. Check the promptrefused prompts stop here
3. Build and run the gatejust vv in the locked SDK
4. Record observed axiomsonly when LLV7005 is reported
5. Find the holothe verified app

1. Clone prism-devrel

git clone https://github.com/afflom/prism-devrel.git && cd prism-devrel

The clone has the builder, frame.lock (the template commit) and prismpm.lock (the SDK image).

2. Check the prompt

node builder/cli.mjs check examples/rule-30-cell.prompt.json

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

3. Build and run the gate

Save this as verify.sh, with PROMPT set to your prompt. It is the pages workflow's own steps for an example.

3. Build and run the gate 36 lines
set -euo pipefail
PROMPT=examples/rule-30-cell.prompt.json
RUNNER_TEMP=$(mktemp -d)
field() { node -e 'process.stdout.write(JSON.parse(require("fs").readFileSync("frame.lock", "utf8")).source[process.argv[1]])' "$1"; }
instance="$RUNNER_TEMP/instance"
git init -q "$instance"
git -C "$instance" fetch -q --depth 1 "https://github.com/$(field repository)" "$(field commit)"
git -C "$instance" checkout -q --detach FETCH_HEAD
test "$(git -C "$instance" rev-parse HEAD)" = "$(field commit)"
node builder/cli.mjs build "$PROMPT" --out "$instance"
image=$(sed -n 's/.*"sdk_image":"\([^"]*\)".*/\1/p' prismpm.lock)
if [[ ! $image =~ ^[a-z0-9.-]+(:[0-9]{1,5})?/[a-z0-9./_-]+@sha256:[0-9a-f]{64}$ ]]; then
  printf '%s\n' 'prismpm.lock does not select an immutable SDK image' >&2
  exit 64
fi
docker_config=$(mktemp -d)
# The SDK's /tmp is a private directory on the runner's own disk, so the
# build's scratch space is bounded by the disk the runner has, not by a
# fixed size; it is removed with the credentials when the step ends.
scratch=$(mktemp -d)
mkdir -p "$scratch/prismpm-home/.docker"
trap 'rm -rf "$docker_config" "$scratch"' EXIT
printf '{}\n' >"$docker_config/config.json"
docker run --rm \
  --user "$(id -u):$(id -g)" \
  --group-add "$(stat -c '%g' /var/run/docker.sock)" \
  --volume "$scratch:/tmp" \
  --volume "$instance:$instance" \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume "$docker_config:/tmp/prismpm-home/.docker:ro" \
  --workdir "$instance" \
  --env DOCKER_CONFIG=/tmp/prismpm-home/.docker \
  --env BUILDX_CONFIG=/tmp/prismpm-buildx \
  --env HOME=/tmp/prismpm-home \
  --env PRISMPM_EPHEMERAL_HOME=1 \
  "$image" just vv

It calls git, node and docker.

bash verify.sh 2>&1 | tee verify.log

4. Record observed axioms

If the log reports LLV7005, record what the verify observed. 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).

node builder/cli.mjs axioms examples/rule-30-cell.prompt.json verify.log

Then run verify.sh again.

5. Find the holo

When the gate passes, the verified holo is in the instance the script made. Add this line to the end of verify.sh to print where.

ls "$instance"/app/.prism/build/*/*.holo

Next

how-to guideBuildMarkdown

Words on this page 4
record
One entry in a facet: a component, a threat, a measure or a journey step, with the place in the source it came from.
holo
The app Prism builds: one signed, verified file that a browser or a device runs.
SDK
Software development kit. Here, the PrismPM container image that builds, checks and verifies Prism models.
prompt
One JSON document that describes an app. The builder turns it into every facet of a Prism model.