# Decision Tree Solver

> Turn a fork-in-the-road decision into a computed expected-value tree — settle or sue, launch or wait, fix or replace — rolled back by the bundled script, with the break-even probability where the answer flips. Use when asked should we settle or go to trial, build a decision tree, what probability makes this worth it, or compare options under uncertainty. Produces the structured tree, the rollback with the best choice at every fork, the break-even probabilities, and the honest list of what the numbers leave out. Decision support, not advice — the probabilities are yours.

- Skill: `mohitagw15856/decision-tree-solver` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add mohitagw15856/decision-tree-solver`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mohitagw15856/decision-tree-solver/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Mohit Aggarwal (https://skillmd.com/u/mohitagw15856)
- Updated: 2026-09-07
- Page: https://skillmd.com/skills/mohitagw15856/decision-tree-solver

---


# Decision Tree Solver

"Should we settle or go to trial" is not answered by instinct or by whoever argues longest — it is three numbers and a probability, and most people have never actually multiplied them. This skill extracts the tree hiding inside a messy decision (the choices, the chances, the payoffs, the costs of playing), computes the rollback with the bundled script, and — the part instinct can never do — finds the break-even: the probability at which the recommendation *flips*. Because "trial is worth it if you win 60% of the time" is an opinion, but "the answer flips at 90% — are you more than 90% sure?" is a decision made tractable. The script is deterministic, stdlib-only, and shows its arithmetic.

## What This Skill Produces

- **The extracted tree** — decisions, chance nodes with probabilities, outcomes with values, and the costs of each path, pulled from the situation as described
- **The rollback** — expected value at every node, the best choice named at every fork, from the script
- **The break-even scan** — for each two-way uncertainty, the probability at which the top-level choice flips, which is the number that makes probability arguments productive
- **The robustness read** — whether the answer survives the probabilities being argued about, or hinges on a number nobody can defend
- **The leaves-out list** — what expected value cannot see here: risk appetite, one-shot vs repeated, the unquantified costs

## Required Inputs

Ask for these if not provided:
- **The choices** — the real options on the table, including the do-nothing one
- **The uncertainties** — what could happen under each choice, and the requester's honest probability for each (pushing back on false precision is part of the job)
- **The payoffs and costs** — the money (or a stated proxy) at each end point, and what each path costs to walk: fees, time priced honestly, deposits
- **The stakes context** — one-shot or repeatable, and whether the worst branch is survivable — because expected value is the right tool for repeatable bets and needs a caveat for ruinous one-shots

## Framework: Extract, Roll Back, Stress the Probabilities

1. **Extract before computing.** The tree is usually mis-drawn before it is mis-computed: options that are really the same option, a "risk" that is actually two sequential risks, a payoff that forgot the cost of getting it. Draw it in the script's JSON, read it back to the requester, fix it *there*.
2. **Run the rollback.**
   ```
   python3 scripts/decision_tree.py --input tree.json          # tree with EVs and best choices
   python3 scripts/decision_tree.py --input tree.json --json   # machine-readable
   python3 scripts/decision_tree.py --demo                     # settle-vs-trial worked example
   ```
   Outcomes carry values; chance nodes take probability-weighted sums; decisions take the best child; costs subtract along the way. The best path falls out, with the arithmetic visible.
3. **Read the break-even before the recommendation.** The scan reports where the choice flips. A decision that holds from p=0.3 to p=0.9 is robust and the probability argument can stop; one that flips at 0.55 when the room believes 0.5-to-0.6 is *the argument itself*, now named precisely.
4. **Stress the values too.** Nudge the big payoffs ±30% and rerun. An answer that survives sloppy values and sloppy probabilities is a real answer; one that does not is a request for better information, and the tree shows exactly which information.
5. **Say what EV cannot see.** A 10% chance of ruin is not "priced in" by multiplication for someone who cannot survive it once; reputational and relationship costs sit outside the tree unless explicitly valued. The recommendation carries these as words, not silently.

## Output Format

### Decision tree: [the decision] · [date]

**The tree** (as computed — from `decision_tree.py`)
```
[rendered tree: choices ▣, chances ◔, outcomes •, EV at every node, best marked]
```

**Recommendation:** [the best path] · **EV [amount]** vs next-best [amount]

**Break-even scan**
| Uncertainty | Flips the choice at | You believe | Verdict |
|---|---|---|---|
| [chance node] | p ≈ [x] | [their estimate] | robust / hinges here |

**Value stress:** [the payoffs nudged ±30% — held / flipped, and on which number]

**What the numbers leave out:** [ruin risk on the worst branch · one-shot vs repeated framing · the unpriced costs, named]

> Decision support, not legal, financial, or any other advice. The probabilities are the requester's own beliefs made explicit — the tree cannot make them true, only make their consequences consistent.

## Quality Checks
- [ ] The tree was read back and corrected before anything was computed
- [ ] Every path's costs are on the path, not forgotten at the leaves
- [ ] The break-even scan appears and is compared against the requester's stated belief
- [ ] Values were stressed, not just probabilities
- [ ] The leaves-out list names ruin risk explicitly when the worst branch is severe
- [ ] The recommendation states robustness, not just the EV winner

## Anti-Patterns
- **Computing the mis-drawn tree.** Ten minutes of extraction beats any amount of arithmetic on the wrong structure.
- **False precision in probabilities.** "About 60%" is honest; "62.5%" from nowhere is decoration — the break-even scan is the cure, since it shows whether the difference even matters.
- **EV-maximising a ruinous one-shot.** The tool's cleanest failure mode; the caveat is mandatory, not optional.
- **Hiding the arithmetic.** The script prints every node's EV because a recommendation nobody can check convinces nobody who matters.
- **Letting the tree end the conversation.** It ends the *circular* part; the values conversation it surfaces is the productive one.

