what-if

A Roundhouse project · MCP server and CLI · Apache-2.0

Ask closed questions. Get answers your code can branch on.

Agents often ask a chat model a yes-or-no question and parse the prose. what-if asks a decision model instead: one pass, no generated text, a probability for every answer.

One static Go binary with four MCP tools, a CLI and a bundled Agent Skill, over standard endpoints.

what-if runs no model itself. Bring an endpoint.

requesttools/call decide

{
  "state": { "pr": 412, "changed": ["auth/jwt.go"] },
  "media": ["artifacts/trace.png"],
  "questions": {
    "safe_to_merge": {
      "type": "noul",
      "instructions": "No auth regression?"
    },
    "risk": {
      "type": "choice",
      "instructions": "Severity if merged",
      "criteria": { "low": null, "med": null, "high": null }
    }
  }
}

answerone pass

safe_to_mergenoulconfidence 0.88 Confident
true0.94
false0.06
riskchoiceconfidence 0.79 Confident
low0.86
med0.10
high0.04

tier fastcalibrated truemin_confidence 0.70

requesttools/call what_if

{
  "base_state": { "replicas": 2, "canary_pct": 10 },
  "scenarios": {
    "hold": { "patch": { "canary_pct": 10 } },
    "promote": {
      "patch": { "replicas": 4, "canary_pct": 50 }
    }
  },
  "questions": {
    "action": {
      "type": "choice",
      "instructions": "Gate decision",
      "criteria": { "ship": null, "pause": null }
    }
  }
}

answer2 scenarios in parallel

holdactionconfidence 0.76 Confident
pause0.88
ship0.12
promoteactionconfidence 0.16 Uncertain
ship0.58
pause0.42

picks hold=pause, promote=shipflipped truemin_margin 0.16min_confidence 0.70

requesttools/call rerank

{
  "query": "Which runbook covers a failed payout?",
  "documents": [
    "Onboarding checklist for new merchants",
    "Payout retries and failure codes",
    "Refunds: partial and full"
  ],
  "top_n": 3
}

answerranked, documents not echoed

resultsby relevance
#1 doc 10.92
#2 doc 20.41
#3 doc 00.06

POST /v1/rerankfalls back to noul checks on 404, 405 or 501

Illustrative values. Your model supplies the real ones.

A chat model writes an answer. A decision model gives the odds.

Routing, gating and checking need a number to compare with a threshold, not a paragraph to parse.

Asking a chat model

You get
Prose, or JSON to parse and check
When unsure
It picks an answer anyway
Cost
Tokens generated for every answer

Asking through what-if

You get
A probability for each allowed answer, and a confidence score
When unsure
uncertain: true below your floor, with the raw odds kept
Cost
One pass, no tokens generated, up to 400 questions per call
How to write good questions

Four tools, one question format.

All four take the same typed questions: noul (yes or no), choice, score, and span when enabled.

  1. 01

    decide

    Up to 400 questions about one state or a batch of records, with optional images, audio, video or PDFs.

  2. 02

    what_if

    2 to 16 variants of a state against the same questions, in parallel. Returns a ranking and flags any choice that flips.

  3. 03

    rerank

    Up to 256 documents in order of fit. Falls back to yes-or-no checks when the endpoint has no /v1/rerank.

  4. 04

    list_deciders

    The fast, accurate and omni tiers you set, and the decision models the endpoint offers.

The Agent Skill ships inside the binary. Clients with Skills over MCP load it from the server, so there is nothing to install. How it is served

Paths in, probabilities out.

Agents pass file paths, never base64. what-if reads each file inside the folders you allow and encodes it only as the request leaves, so media never reaches the prompt or the logs.

  1. Your callerAn agent over MCP, or a script using the CLI
  2. what-ifChecks paths and file types, converts audio, picks a tier, adds confidence and the uncertain flag
  3. Your endpoint/v1/systemone · /v1/decisions · /v1/rerank
Images
PNG, JPEG, WebP, GIF
Audio
WAV; MP3, FLAC, OGG, M4A via ffmpeg
Video
MP4, WebM, Matroska
Documents
PDF
Read the architecture

Install, point, ask.

Install the binary, point it at your endpoint, and connect your agent.

go install github.com/roundhouse-is/what-if/cmd/what-if@latest
{
  "mcpServers": {
    "what-if": {
      "command": "what-if",
      "args": ["mcp"],
      "env": {
        "WHAT_IF_BASE_URL": "http://127.0.0.1:7700",
        "WHAT_IF_API_KEY": "${RH_KEY}",
        "WHAT_IF_MODEL": "clef-flash",
        "WHAT_IF_MODEL_OMNI": "clef-omni"
      }
    }
  }
}
go install github.com/roundhouse-is/what-if/cmd/what-if@latest
what-if ask \
  --state @release-notes.json \
  --media screenshots/diff.png \
  --noul "breaking=Contains a breaking API change?" \
  --choice "tier=Release lane|patch,minor,major" \
  --fail-uncertain

# exit 0: every answer confident
# exit 2: at least one answer uncertain
podman pull ghcr.io/roundhouse-is/what-if:latest
podman run --rm -p 8790:8790 \
  -e WHAT_IF_BASE_URL=http://host.containers.internal:7700 \
  -e WHAT_IF_API_KEY="$RH_KEY" \
  -e WHAT_IF_SERVER_TOKEN="$MCP_GATEWAY_TOKEN" \
  -v "$PWD:/work:ro" -e WHAT_IF_MEDIA_ROOTS=/work \
  ghcr.io/roundhouse-is/what-if:latest

# MCP over Streamable HTTP at http://127.0.0.1:8790/_/mcp
# or OAuth 2.1 (JWKS or introspection): see Configuration
what-if doctor
base_url    = "http://127.0.0.1:7700"
api_key_env = "RH_KEY"
wire        = "auto"
lock_tiers  = false
media_roots = ["."]

[tiers.fast]
model          = "clef-flash"
min_confidence = 0.70

[tiers.accurate]
model          = "clef-27b"
min_confidence = 0.75

[tiers.omni]
model          = "clef-omni"
min_confidence = 0.70

Prebuilt for Linux and macOS on GitHub Releases. The container runs as non-root; the Alpine variant adds ffmpeg.

Works with the endpoint you have.

Each needs a base URL, a key and a model. No custom request headers.

In HTTP mode, require a server token or OAuth 2.1, and let each caller bring their own upstream key.

what-if runs no model itself, accepts no inline base64, and does not replace your rules, regexes or sandboxes.

Roundhouse
All three wires, plus model metadata
llama.cpp, vLLM, FastFlowLM, TypeSafe
Standard wire
OpenAI
OpenAI Decisions
OpenRouter, Liquid AI
Their own dialects, set with wire

“Good news, everyone! My What-If Machine no longer shows you a whole musical number about what might happen. It just gives you the odds.”

With apologies to Professor Farnsworth and his What-If Machine (Futurama, “Anthology of Interest I”)

Ask your first question.

Need an endpoint? Roundhouse serves models from the machines you own.