Run Low/Base/High Scenarios
Overview
Wraps the scenario-runner system prompt at system-prompt.txt (next to this file) and applies it to the three artifacts produced by earlier pipeline stages: a validated parameter JSON, a bounds JSON, and a generated Python calculations module. Output is a strict JSON document with one input pool and one output set per scenario (low, base, high), plus a comparison block summarising spread per computed output.
This stage is deterministic — it does not sample distributions. Monte Carlo is a separate later stage.
Stage 6 of the pipeline described in planexe_simulator/README.md.
When to Use
- User asks to "run scenarios", "compute low/base/high outputs", "produce a scenario table", or "see how outputs move with the bounds"
- Pipeline step between
generate-bounds / generate-calculations (both clean) and monte-carlo
- User wants a first sanity check that the deterministic model behaves sensibly before sampling
Not for: regenerating any prior artifact (use the corresponding earlier skill), Monte Carlo or distribution sampling (later stage), or critiquing the plan as a whole.
Workflow
- Get the three input paths. If any are missing, ask. Do not guess. Conventional layout (matches
output/<version>/):
- parameters JSON (e.g.
output/v12/parameters.json)
- bounds JSON (e.g.
output/v12/bounds.json)
- calculations Python module (e.g.
output/v12/calculations.py)
- Read
system-prompt.txt (sibling of this SKILL.md). Its scenario semantics, input-pool construction, function-execution order, and output shape are authoritative.
- Read all three input artifacts.
- Build the three input pools (
low, base, high) per the system prompt's selection rules.
- Run the calculation functions in input order:
recommended_first_calculations first, then derived_questions. Skip-and-warn on missing dependencies, NotImplementedError (for P(...) stubs), inf, or NaN. Do not abort the whole run.
- Emit the scenario JSON per the system prompt's output shape.
- Output destination. Default: write to
<dir-of-parameters>/scenarios.json next to the input. Print the file path back, plus a one-line summary (output count, warning count).
What gets supplied vs computed (re-stated for emphasis)
| Variable type |
Source for low/base/high |
key_value with bounds entry |
bounds value for that scenario |
key_value with non-null value, no bounds |
the same value for all three scenarios |
key_value with null value, no bounds |
unresolved → may trigger missing-dependency warning |
missing_value_to_estimate with bounds entry |
bounds value for that scenario |
| Output of a generated function |
computed from current scenario input pool |
The scenario names refer to the input bounds, not "good vs bad" outcomes. High cost is bad; high effectiveness is good. Don't rename to optimistic/pessimistic.
Output Shape (re-stated for emphasis — see system prompt for full detail)
{
"valid": true,
"plan_summary": { "plan_name": "...", "plan_type": "..." },
"scenarios": {
"low": { "inputs": {...}, "outputs": {...} },
"base": { "inputs": {...}, "outputs": {...} },
"high": { "inputs": {...}, "outputs": {...} }
},
"comparison": {
"outputs": {
"<output_id>": {
"low": ..., "base": ..., "high": ...,
"unit": "...",
"spread_ratio": <high/low or null>,
"spread_absolute": <high-low or null>
}
}
},
"warnings": [
{ "stage": "run_scenarios", "scenario": "low", "calculation": "people_protected",
"message": "Missing dependency 'voucher_install_success_rate'.", "severity": "WARN" }
]
}
Numeric JSON rules: no NaN, no Infinity — write null and add a warning. No currency symbols, no thousands separators. Don't round unless needed for valid JSON.
Common Mistakes
| Mistake |
Fix |
Wrapping output in ```json fences |
Raw JSON only |
| Renaming scenarios to "optimistic / realistic / pessimistic" |
Keep low / base / high — those refer to bounds, not outcomes |
Aborting on first missing dependency or inf result |
Skip the affected function for that scenario; emit a WARN; keep the run going |
Inventing values for null key_values that have no bounds |
Don't. Mark the dependent calculation as missing |
Computing percentage change in comparison |
Spec is spread_ratio = high/low and spread_absolute = high-low only |
| Running Monte Carlo or sampling |
This stage is deterministic; sampling lives in monte-carlo |
Ignoring NotImplementedError from P(...) stubs |
Skip, emit a WARN noting the formula needs monte-carlo |
Writing Infinity or NaN into JSON |
JSON forbids both — use null and warn |
| Producing a markdown table or prose explanation |
JSON only; the spec forbids prose |
Reference
- System prompt (authoritative):
system-prompt.txt
- Pipeline overview and "scenario purpose" list:
../../README.md, Stage 6
- Companion skills:
../extract-parameters-from-full/SKILL.md, ../validate-parameters/SKILL.md, ../generate-bounds/SKILL.md, ../generate-calculations/SKILL.md
- Example input set for testing (all from the same run):
/Users/neoneye/git/neoneye_lab/planexe_simulator/output/v12/parameters.json
/Users/neoneye/git/neoneye_lab/planexe_simulator/output/v12/bounds.json
/Users/neoneye/git/neoneye_lab/planexe_simulator/output/v12/calculations.py
1---2name: run-scenarios3description: Use when the user wants to compute deterministic low/base/high scenario outputs for a PlanExe model — given an extract-parameters-from-full JSON, a generate-bounds JSON, and a generate-calculations Python module — producing a scenario result JSON with inputs, outputs, comparison spread, and warnings4---56# Run Low/Base/High Scenarios78## Overview910Wraps the scenario-runner system prompt at `system-prompt.txt` (next to this file) and applies it to the **three** artifacts produced by earlier pipeline stages: a validated parameter JSON, a bounds JSON, and a generated Python calculations module. Output is a strict JSON document with one input pool and one output set per scenario (`low`, `base`, `high`), plus a comparison block summarising spread per computed output.1112This stage is **deterministic** — it does not sample distributions. Monte Carlo is a separate later stage.1314Stage 6 of the pipeline described in `planexe_simulator/README.md`.1516## When to Use1718- User asks to "run scenarios", "compute low/base/high outputs", "produce a scenario table", or "see how outputs move with the bounds"19- Pipeline step between `generate-bounds` / `generate-calculations` (both clean) and `monte-carlo`20- User wants a first sanity check that the deterministic model behaves sensibly before sampling2122Not for: regenerating any prior artifact (use the corresponding earlier skill), Monte Carlo or distribution sampling (later stage), or critiquing the plan as a whole.2324## Workflow25261. **Get the three input paths.** If any are missing, ask. Do not guess. Conventional layout (matches `output/<version>/`):27 - parameters JSON (e.g. `output/v12/parameters.json`)28 - bounds JSON (e.g. `output/v12/bounds.json`)29 - calculations Python module (e.g. `output/v12/calculations.py`)302. **Read `system-prompt.txt`** (sibling of this SKILL.md). Its scenario semantics, input-pool construction, function-execution order, and output shape are authoritative.313. **Read all three input artifacts.**324. **Build the three input pools** (`low`, `base`, `high`) per the system prompt's selection rules.335. **Run the calculation functions** in input order: `recommended_first_calculations` first, then `derived_questions`. Skip-and-warn on missing dependencies, `NotImplementedError` (for `P(...)` stubs), `inf`, or `NaN`. Do not abort the whole run.346. **Emit the scenario JSON** per the system prompt's output shape.357. **Output destination.** Default: write to `<dir-of-parameters>/scenarios.json` next to the input. Print the file path back, plus a one-line summary (output count, warning count).3637## What gets supplied vs computed (re-stated for emphasis)3839| Variable type | Source for `low/base/high` |40|---|---|41| `key_value` with bounds entry | bounds value for that scenario |42| `key_value` with non-null value, no bounds | the same `value` for all three scenarios |43| `key_value` with null value, no bounds | unresolved → may trigger missing-dependency warning |44| `missing_value_to_estimate` with bounds entry | bounds value for that scenario |45| Output of a generated function | computed from current scenario input pool |4647The scenario names refer to the **input bounds**, not "good vs bad" outcomes. High cost is bad; high effectiveness is good. Don't rename to optimistic/pessimistic.4849## Output Shape (re-stated for emphasis — see system prompt for full detail)5051```json52{53 "valid": true,54 "plan_summary": { "plan_name": "...", "plan_type": "..." },55 "scenarios": {56 "low": { "inputs": {...}, "outputs": {...} },57 "base": { "inputs": {...}, "outputs": {...} },58 "high": { "inputs": {...}, "outputs": {...} }59 },60 "comparison": {61 "outputs": {62 "<output_id>": {63 "low": ..., "base": ..., "high": ...,64 "unit": "...",65 "spread_ratio": <high/low or null>,66 "spread_absolute": <high-low or null>67 }68 }69 },70 "warnings": [71 { "stage": "run_scenarios", "scenario": "low", "calculation": "people_protected",72 "message": "Missing dependency 'voucher_install_success_rate'.", "severity": "WARN" }73 ]74}75```7677Numeric JSON rules: no `NaN`, no `Infinity` — write `null` and add a warning. No currency symbols, no thousands separators. Don't round unless needed for valid JSON.7879## Common Mistakes8081| Mistake | Fix |82|---|---|83| Wrapping output in ```` ```json ```` fences | Raw JSON only |84| Renaming scenarios to "optimistic / realistic / pessimistic" | Keep `low / base / high` — those refer to bounds, not outcomes |85| Aborting on first missing dependency or `inf` result | Skip the affected function for that scenario; emit a WARN; keep the run going |86| Inventing values for `null` key_values that have no bounds | Don't. Mark the dependent calculation as missing |87| Computing percentage change in `comparison` | Spec is `spread_ratio = high/low` and `spread_absolute = high-low` only |88| Running Monte Carlo or sampling | This stage is deterministic; sampling lives in `monte-carlo` |89| Ignoring `NotImplementedError` from `P(...)` stubs | Skip, emit a WARN noting the formula needs `monte-carlo` |90| Writing `Infinity` or `NaN` into JSON | JSON forbids both — use `null` and warn |91| Producing a markdown table or prose explanation | JSON only; the spec forbids prose |9293## Reference9495- System prompt (authoritative): `system-prompt.txt`96- Pipeline overview and "scenario purpose" list: `../../README.md`, Stage 697- Companion skills: `../extract-parameters-from-full/SKILL.md`, `../validate-parameters/SKILL.md`, `../generate-bounds/SKILL.md`, `../generate-calculations/SKILL.md`98- Example input set for testing (all from the same run):99 - `/Users/neoneye/git/neoneye_lab/planexe_simulator/output/v12/parameters.json`100 - `/Users/neoneye/git/neoneye_lab/planexe_simulator/output/v12/bounds.json`101 - `/Users/neoneye/git/neoneye_lab/planexe_simulator/output/v12/calculations.py`