For AI assistants
Describe a system to an AI. Explore it in LeverScope.
An AI assistant can write a stock-and-flow model as a short piece of JSON and turn it into a link. The link opens the model in LeverScope, where you can see the structure, move the sliders and compare scenarios. The simulation runs in your browser, not in the AI.
Nothing is uploaded: the model travels inside the link (after the #), which browsers never send to a server. This page is written for people and for AI assistants alike.
How it works for you
- Ask. Copy the prompt below into your AI chat and put your question in the last line.
- Open. Click the link the AI gives you. LeverScope shows the model, runs it, notes anything it had to adjust, and tests what the AI said the model does: each expectation is marked ✓ or ✗, so you see at once whether the explanation holds.
- Check. Click Copy check report for your AI and paste it back into the chat. The AI sees how its model really behaves and corrects its model or its explanation where they differ.
Try it: a prompt to copy
Paste this into ChatGPT, Claude, Copilot or Gemini and replace the last line with your own question.
Read https://leverscope.com/for-ai.html and follow it. Build a LeverScope model for my question, give me the link that opens it, and explain in a few sentences what to try with the sliders. My question: how does a gym's membership grow if word of mouth matters more than adverts?
If the assistant cannot open web pages, give it the instructions file instead. For Claude there is a ready-made skill you add once in Claude’s settings; after that, Claude uses it by itself whenever a question is about how something changes over time.
Instructions for AI assistants
You are helping someone think through how a system behaves over time. Build a small, clear model in the format below, check it, and give the user a link that opens it in LeverScope. Do not invent simulation results: LeverScope computes them when the user opens the link.
1. Write the model as JSON
{
"name": "Gym membership",
"notes": "Members join through adverts and word of mouth and leave after a while.",
"sim": { "start": 0, "stop": 36, "dt": 0.25, "unit": "months" },
"elements": [
{ "type": "stock", "name": "Potential_Members", "eq": 5000, "units": "people" },
{ "type": "stock", "name": "Members", "eq": 100, "units": "people" },
{ "type": "stock", "name": "Former_Members", "eq": 0, "units": "people" },
{ "type": "flow", "name": "Joining", "from": "Potential_Members", "to": "Members",
"eq": "Potential_Members*(Ad_Effect + Members*Word_of_Mouth/Total_Population)", "units": "people/month" },
{ "type": "flow", "name": "Leaving", "from": "Members", "to": "Former_Members",
"eq": "Members/Average_Stay", "units": "people/month" },
{ "type": "converter", "name": "Ad_Effect", "eq": 0.01, "units": "per month",
"slider": { "min": 0, "max": 0.05, "kind": "decision" }, "doc": "Share of potential members an advert brings in each month." },
{ "type": "converter", "name": "Word_of_Mouth", "eq": 0.3, "units": "per month",
"slider": { "min": 0, "max": 1, "kind": "assumption" } },
{ "type": "converter", "name": "Total_Population", "eq": "Potential_Members + Members + Former_Members", "units": "people" },
{ "type": "converter", "name": "Average_Stay", "eq": 14, "units": "months",
"slider": { "min": 3, "max": 36, "step": 1, "kind": "assumption" } }
],
"summary": { "kpis": [ { "name": "Members", "agg": "final", "label": "Members after 3 years", "better": "high" } ] },
"scenarios": [ { "name": "No adverts", "values": { "Ad_Effect": 0 } } ],
"expect": [ "Members peaks between month 12 and 24", "Potential_Members falls and levels off",
"\"No adverts\" Members peak < baseline" ]
}- stock: something that accumulates (people, money, water, stock in a warehouse).
eqis its starting value. Stocks only change through flows and cannot go below zero unless you set"nonneg": false. - flow: a rate that fills or drains stocks, per time unit of
sim.unit.fromandtoare stock names, ornullfor outside the model. - converter: a constant or a calculation. Add
"slider"to the numbers people should experiment with:"kind": "decision"for things they control,"assumption"for things they are unsure about."slider": truepicks a range automatically. - Names use letters, digits and underscores (
Word_of_Mouth); write them the same way in equations. Spaces are turned into underscores. - Equations:
+ - * / ^, brackets,IF a > b THEN x ELSE y,MIN,MAX,SMTH1(input, time),DELAY1/DELAY3(input, time),DELAY(input, time),LOOKUP(x, x1,y1, x2,y2, …),STEP(height, time),RAMP(slope, time),PULSE(amount, first, interval),SAFEDIV(a, b),NORMAL,RANDOM,SQRT,EXP,LN,ABS,ROUND,TIME,DT. - Optional:
unitsanddocon every element,summary.kpis(key figures:aggisfinal,total,avgorinitial;betterishighorlow;formatisnum,eurorpct),scenarioswith slider values,plots(element names),expect(what you expect the model to do; see below). Leave out positions: LeverScope lays the map out. - Good practice: keep it small (5 to 25 elements), make every feedback loop visible through the equations, keep
dtat most a quarter of the shortest time constant, and check that units fit (a flow into a stock of people is people per time unit).
What each function does exactly, and patterns for capacity and overflow, delays, queues and seasons, are in the instructions file. The full format is described as a JSON schema; files exported from LeverScope ("format": "stockflow-1") are accepted too.
Shorter: the text form
Instead of JSON you can write the model as text, one line per element. It needs about a third of the characters, so links stay short and there is less to get wrong. It covers everything above except arrays, descriptions and key figures.
name: Savings
time: 0..52 step 0.25 weeks
Savings(0) = 0 {€} # a stock and its starting value
Savings' = Saving - Spending # flows in (+) and out (−)
Saving = Pocket_Money*Saving_Share {€/week}
Spending = Savings*Temptation
Pocket_Money = 10 [0..30] {€/week} # a slider with its range (a decision)
Saving_Share = 0.5 [0..1]
Temptation = 0.05 [0..0.3 assumption] # an assumption to explore
A name listed in a stock's ' line is a flow; every other Name = … is a converter. Several settings on one slider line work as shown: [min..max step 0.5 assumption]. {…} at the end of a line is the units; comments start with #.
Ready-made building blocks save writing common structures; change any of their lines afterwards by writing the line again:
use sir(N=100000, I0=10, days=7): an epidemic (Susceptible, Infected, Recovered, Infections, Recoveries, Beta).use adoption(market=10000, start=10): a product spreading by adverts and word of mouth (Potential, Customers, Sign_Ups, Cancellations, Ad_Effect, Contact, Churn).use supply_chain(stages=Retailer/Distributor/Factory): stages that each keep stock, order from the next and wait for deliveries (per stage _Inventory, _Pipeline, _Orders; you addCustomer_Demand).
Smoothing and delay functions (SMTH1, DELAY3 …) hold hidden stocks, so a feedback loop may run through them, for example a perceived risk that lowers contacts. In such a loop give the start value: SMTH1(Cases, 10, 0).
Guide for the person: kpi: Users:final high Users after 3 years (a key figure; measure final, total, avg or initial; high or low is better), scenario: No adverts: Ad_Effect = 0 (a ready-made comparison), try: compare Ad_Effect with Average_Stay (an experiment to suggest; shown with the model), options: Tariff: 0 = Basic | 1 = Standard | 2 = Premium (names for the values of a choice slider: LeverScope shows a list of names instead of numbers), expect: Users rises and levels off (a claim LeverScope tests; see below).
Rules in short (what LeverScope checks):
- Every stock needs a start line
Name(0) = …and a flow lineName' = …that lists its flows by name only; write formulas in the flow's own line. A stock without a flow line never changes (you get a warning). - Units belong in braces at the end:
Average_Stay = 14 [3..36] {months}. Units written without braces (2 weeks) are read as units too, with a warning. - Smoothing and delay functions in a feedback loop start at your start value (third argument) or at 0.
- Names: letters, digits and underscores, not a function name (
Delay,Step,Time).
Links from a chat: URL-encode the whole text (encodeURIComponent in JavaScript, urllib.parse.quote(text, safe='') in Python). Build the link from exactly the text in your code block (do not retype it); if you cannot run code to encode it, give the code block and the paste link instead. Always show the model text in a code block as well, so the person can paste it at https://leverscope.com/app/#paste if the link breaks in the chat. LeverScope opens the model, checks it and shows any problem in a banner; tell the person to look at that banner.
Stocks may go below zero after a line allow negative: Name; flows may run both ways after two-way: Name. In a link, use #text= with the URL-encoded text, or compress the text instead of the JSON in the #model= link below.
Say what you expect: expect lines
Every claim your explanation makes about the behaviour (“members keep growing”, “adverts help”, “it peaks after a year”) goes into the model as an expectation: one expect: line each in the text form, or the "expect" list in JSON. When the link opens, LeverScope runs the model and marks each one ✓ (matches) or ✗ (does not match), with what the model really shows. The person sees at once whether your explanation holds, and the check report sends the result back to you. Write expectations before you write the explanation, and keep only claims the model supports.
- Shapes:
Members rises·falls·rises and levels off(alsolevels off by month 24) ·is S-shaped·grows faster and faster·keeps growing·peaks(alsopeaks between month 8 and 14,around month 11,before month 12) ·dips/falls then recovers·oscillates·stays flat. - Values:
Members final > 2000(also>=,<,<=,about= within 10 %,between 1000 and 2000); instead offinal:initial,peak,min,average,total,at month 12. - Limits over the whole run:
Cash stays above 0·never below 0·Queue stays below 50·never exceeds 50·stays between 10 and 50. - Scenarios: start with the scenario name in quotes and compare with the model as it is:
"No adverts" Members final < baseline.
Each line starts with an element name. A line LeverScope cannot read is marked “not checked” and explained. Two or three expectations about the question asked are worth more than many about details.
Answer the question: question, decide, answer
When the user asks a question, the model should answer it, not only show curves. Put the comparison the question is about into one number in one unit (for example energy returned divided by energy invested, or profit minus cost), then add three lines:
question: Do rooftop solar panels pay back the energy needed to make them?
decide: Energy_Payback_Ratio final > 1 => Yes, they return more energy than it took to make them | No, they return less
answer: Yes, about 8 times over 25 years in central Europe; the result depends most on the hours of sunshine.
In JSON: "question", "decide", "answer". decide is a value line as above (element, measure, limit), optionally followed by => and the words for yes and no. LeverScope then shows an answer card: the verdict and the number behind it, whether it holds under each condition, and which slider value would change it. Start answer with Yes or No for a yes/no question; LeverScope flags it if the model says the opposite.
Options and conditions. A scenario: is an option someone could choose (it can come out “best”). Circumstances that only test the answer (a cloudier region, higher prices, fewer customers) are conditions: condition: Cloudy region: Sun_Hours = 900, or "kind": "condition" in a JSON scenario. Add two to four conditions that could plausibly change the answer, including a deliberately unfavourable one.
2. Give the user a link
Use the first form whenever you can run code; the others work without.
- Compressed link (best, works for any size):
https://leverscope.com/app/#model=followed by the JSON text, compressed with raw DEFLATE and encoded as base64url without padding. - Plain link (small models, up to about 2,000 characters):
https://leverscope.com/app/#json=followed by the URL-encoded JSON text. - Paste (always works): show the JSON in a code block and tell the user to open
https://leverscope.com/app/#pasteand paste it into the box that opens.
import json, zlib, base64
def leverscope_link(model: dict) -> str:
raw = json.dumps(model, separators=(",", ":"), ensure_ascii=False).encode("utf-8")
c = zlib.compressobj(9, zlib.DEFLATED, -15) # raw DEFLATE
data = c.compress(raw) + c.flush()
return "https://leverscope.com/app/#model=" + base64.urlsafe_b64encode(data).decode().rstrip("=")async function leverscopeLink(model) {
const s = new Blob([JSON.stringify(model)]).stream().pipeThrough(new CompressionStream("deflate-raw"));
const b = new Uint8Array(await new Response(s).arrayBuffer());
let t = ""; for (const x of b) t += String.fromCharCode(x);
return "https://leverscope.com/app/#model=" + btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
}3. Hand over
- Name the tool LeverScope and link to leverscope.com, for example: “Open the model in LeverScope (leverscope.com): …”.
- Say in two or three sentences what the model contains, which feedback loops drive it, and which sliders to try first.
- Make clear that the numbers are assumptions to check, not facts.
- If the user asked a question, answer it first, in one sentence that matches your
decideline, then name the assumption that would most easily change it (the answer card lists them). - Explain only what your
expectlines claim. If the person reports a ✗, believe the simulation: correct the model or the explanation, and say which. - Ask the user to click Copy check report for your AI after opening the link and paste the report back into the chat. It shows whether the model runs, what was adjusted, unit warnings, how the key variables behave, the answer to your question and what would flip it, which of your expectations match, extreme-setting checks, the strongest feedback loops and the model as LeverScope read it, so you can check it against what you intended and correct it.
When LeverScope opens a model from a link, it shows a note that the model came from outside and lists anything it had to adjust. The user can save it, change it, share it as a link again (Models → Copy link to this model) or export a report. The check report for the AI is also in the Model panel; it is made in the browser and nothing is uploaded.
Files for assistants and developers
- leverscope-model.schema.json: the model format as JSON Schema
- example-gym.json: the example above as a file
- leverscope-skill.zip: a skill for Claude (instructions plus a link-making script)
- SKILL.md: the same instructions as plain text, for any assistant
- catalog.json: the free model library (each model opens with
/app/?model=/library/files/<name>.json) - llms.txt: a short overview of the site for AI assistants
Terms in short
You may let AI assistants and your own tools create LeverScope models and links, free of charge. When you show a model, chart or result made with LeverScope, please name LeverScope and link to leverscope.com. LeverScope is a learning and thinking tool: results depend entirely on the model’s assumptions and are no substitute for professional advice. The tool is provided as it is.