---
name: simulate-anything
description: Agent handbook for ANY-B09 Simulate-Anything (https://simulate.fastmesh.dev) — sub-second deterministic 10,000-trial Monte Carlo, Cholesky correlation, Tornado sensitivity, and scenario-compare engine via Remote /mcp, REST API, Causal Bazaar, and treg hub. Strictly $0 billed on HTTP 422.
---

# Simulate-Anything (`simulate.fastmesh.dev`) — Agent Skill Handbook

> **Hard Guarantees**: Pure Python stdlib deterministic PRNG (bit-exact across identical `(model_spec, seed, trials)`) · Signed `receipt_sha256` on every call · Strict Python `ast` math whitelist (zero `eval`) · **Strictly `$0` billed (`billable: false`, `charged_micros: 0`)** on HTTP `422` validation errors, unsafe AST injections, or zero division · **Zero customer financial model retention or resale**.
>
> **Engineering-Only Compliance**: Simulate-Anything is a pure quantitative engineering and probabilistic sensitivity simulation tool. All outputs (means, percentiles, ruin probabilities, break-even boundaries, Tornado swings, and SVG charts) are deterministic mathematical computations over user-supplied parameters and public reference benchmarks. It is NOT licensed investment advice, securities trading advice, tax counsel, or CPA attestation. Zero customer financial model retention, zero resale, and zero third-party model training.

## Integration Surfaces

| Surface | Endpoint / ID | Protocol & Pricing |
| :--- | :--- | :--- |
| **Remote MCP Server** | `https://simulate.fastmesh.dev/mcp` | JSON-RPC 2.0 (`initialize`, `tools/list`, `tools/call`) |
| **REST + OpenAPI 3.1** | `https://simulate.fastmesh.dev/openapi.json` | `POST /v1/simulate`, `POST /v1/sensitivity`, `POST /v1/scenario-compare`, `GET /v1/templates`, `GET /health` |
| **treg hub (0% Commission)** | `singularity.simulate-anything` | `$0.05` verified simulation (`$0` on 422) |
| **Causal Bazaar Public Card** | `hand_b09_simulate_anything_v1` | `is_public=1`, `price_micros=50000` (`$0.05`/run, `$0` on 422) |
| **Storefront & Prepaid Packs** | `https://simulate.fastmesh.dev/` | `$19` Starter / `$79` Pro / `$249` Scale (one-time, never-expiring, `$0/mo`) |

---

## 1. Calling via Remote `/mcp` (JSON-RPC 2.0)

Exposed MCP tools: `simulate_list_templates`, `simulate_run`, `simulate_sensitivity`, `simulate_scenario_compare`.

```bash
# 1. Discover MCP tools
curl -fsSL -X POST "https://simulate.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

# 2. Run 10,000-trial SaaS cash runway simulation
curl -fsSL -X POST "https://simulate.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "simulate_run",
      "arguments": {
        "template_id": "saas_pricing_retention",
        "seed": 42,
        "trials": 10000,
        "ruin_threshold": 0.0
      }
    }
  }'
```

---

## 2. REST API Endpoints & Parameter Specs

### A. `POST /v1/simulate` (`$0.05` verified / `$0` on HTTP `422`)
Accepts JSON body:
- `template_id` (optional string): `saas_pricing_retention`, `paid_ads_funnel`, `crossborder_tariff_shock_2026`, `ai_token_concurrency_margin`, or `custom_ast_csv_cashflow` (friendly aliases `saas_pricing`, `paid_ads`, `tariff_shock`, `cloud_ai`, `custom_ast` also supported).
- `variables` / `overrides` (object or array): `{"var_name": {"distribution": "normal|lognormal|triangular|uniform|beta|bernoulli|fixed", "params": {...}}}`.
- `formula` (string, optional when using `template_id` or `csv_data`): safe Python AST math expression supporting `+`, `-`, `*`, `/`, `//`, `%`, `**`, comparisons, ternary `IfExp`, and `min`, `max`, `abs`, `round`, `sqrt`, `log`, `exp`.
- `csv_data` (string, optional): tabular AST line-item CSV (`line_item,direction,ast_expression`) or numeric period CSV (`period,inflow,outflow`).
- `correlations` (array, optional): `[{"var_a": "...", "var_b": "...", "rho": 0.50}]`, `|rho| < 1.0`.
- `seed` (int, default `42`), `trials` (int `1..100000`, default `10000`), `ruin_threshold` (float, default `0.0`), `ruin_direction` (`"le"` or `"ge"`), `tenant_id` (string), `no_cache` (bool).

```bash
curl -fsSL -X POST "https://simulate.fastmesh.dev/v1/simulate" \
  -H "Content-Type: application/json" \
  -d '{
    "template_id": "crossborder_tariff_shock_2026",
    "seed": 42,
    "trials": 10000,
    "overrides": {
      "emergency_tariff_surcharge_shock": {"distribution": "bernoulli", "params": {"p": 0.50}}
    }
  }'
```

### B. `POST /v1/sensitivity` (`$0.05` verified / `$0` on HTTP `422`)
Same request contract as `/v1/simulate`. Returns `summary`, ranked `tornado.drivers` (P10 vs P90 KPI swing, `swing_variance_share_pct`, `empirical_correlation`), `break_even_boundaries`, `charts.tornado_svg`, and `receipt_sha256`.

### C. `POST /v1/scenario-compare` (`$0.10` verified / `$0` on HTTP `422`)
Compares `baseline` against up to `6` named `scenarios` using synchronized seeds:

```bash
curl -fsSL -X POST "https://simulate.fastmesh.dev/v1/scenario-compare" \
  -H "Content-Type: application/json" \
  -d '{
    "baseline": {"template_id": "ai_token_concurrency_margin"},
    "scenarios": [
      {
        "name": "cache_85pct",
        "overrides": {
          "prompt_cache_hit_rate": {"distribution": "beta", "params": {"alpha": 8.5, "beta": 1.5}}
        }
      }
    ],
    "seed": 42,
    "trials": 10000
  }'
```

---

## 3. HTTP 422 Zero-Charge Safety Guarantee (Verified)

Unsafe AST calls (`__import__`, `eval`, `exec`, `open`, attribute access, unknown symbols), bad distribution parameters, non-PSD correlations, or runtime zero-division deterministically return HTTP `422` with `billable: false` and `charged_micros: 0`:

- Observed guard output on `__import__('os').system('id')`: `status_code = 422`, `error_code = "forbidden_call"`, `billable = false`, `charged_micros = 0`, `receipt_sha256 = "c2fed6a27f8e24c9..."`.

---

## 4. Observed 10,000-Trial Baseline Benchmarks (Seed 42)

| Template ID | Mean | P50 Median | Ruin Prob | Top Tornado Driver | Latency |
| :--- | :--- | :--- | :--- | :--- | :--- |
| `saas_pricing_retention` | $537,216 | $461,791 | 15.83% | `arpu_monthly_usd` | 102.8 ms |
| `paid_ads_funnel` | $8,947 | $5,758 | 31.55% | `landing_cvr_rate` | 59.2 ms |
| `crossborder_tariff_shock_2026` | $6.56/unit | $6.63/unit | 7.61% | `acos_rate` | 60.5 ms |
| `ai_token_concurrency_margin` | 64.48% | 69.44% | 29.62% | `requests_per_workspace_month` | 80.7 ms |
| `custom_ast_csv_cashflow` | $29,926 | $27,439 | 19.99% | `contract_units` | 27.5 ms |
