I watched an episode of the All-In Podcast where Chamath discussed this idea, then spent an afternoon putting this together. I wanted to explore how an LLM and a game-theory solver could help reason through a strategic decision.
This project currently contains a TypeScript specification: data contracts and a seven-stage pipeline. The agent runtime, solver, prompts, tests, and user interface still need to be implemented.
The intended workflow starts with an LLM turning a messy decision into players, incentives, strategies, assumptions, and payoff criteria. A solver computes equilibrium candidates. The LLM then explains the strategic result and the assumptions that would flip it.
The core TypeScript contract lives in src/nash-agent.spec.ts. Despite the filename, it is a specification, not a test suite.
The existing types pass this check with Node.js and npm installed:
npm exec --yes --package [email protected] -- tsc --project tsconfig.jsonThis checks the contracts only. There is no application to run yet.
Goal: help a decision maker reason about strategic situations where other actors respond from their own incentives.
Non-goal: asking an LLM to "calculate Nash equilibrium" directly from prose.
Primary output: a decision memo that separates:
- equilibrium strategy
- exploitative strategy
- defensive or unexploitable strategy
- high-upside but fragile strategy
- assumptions that would change the answer
Version 0 should support two-player normal-form games:
- user provides decision context
- LLM frames players, incentives, strategies, and payoff criteria
- LLM decomposes utilities into auditable weighted scorecards
- adversarial reviewer checks the model
- pure best-response checker finds pure Nash equilibria
- mixed-equilibrium solver adapter can be added later
- final memo explains the result in business terms
Recommended implementation order:
- Set up repeatable checks. Add a package manifest, a pinned TypeScript dependency, a lockfile, a focused test suite, and CI. Rename the contract file when adding tests so it is not mistaken for a test suite.
- Finish the model contracts and validation. For the normal-form path,
generateStrategiescurrently returns a game that already requires payoff matrices, beforedecomposePayoffscreates them. Separate the intermediate stages and explicitly reject unsupported game types in version 0. Validate two distinct players, strategy ownership, identifier references, matrix dimensions, complete payoff entries, and finite numbers. Define how criterion weights, score normalization, and minimization produce each player's utility, then derive matrices from those calculated scorecards. - Implement the pure-equilibrium solver. Calculate best responses and all pure equilibria. Test unique equilibria, multiple equilibria, tied payoffs, rectangular matrices, and games with no pure equilibrium. Distinguish no pure equilibrium found from invalid input, unsupported solvers, and solver failure.
- Connect the LLM pipeline. Implement the runtime, prompts, validated model responses, and orchestration. Add a bounded review-and-revision loop that prevents an untrustworthy model from reaching the solver or final memo.
- Make sensitivity analysis and recommendations concrete. Define how changed assumptions or criteria alter numeric payoffs, rebuild the matrices, and solve each case again. Define the rule for selecting a recommendation so changes can be compared consistently. Derive or qualify exploitative, defensive, and fragile-upside claims using explicit opponent assumptions and calculations; an equilibrium result alone does not supply those analyses.
- Deliver one complete example. Start with a small command-line entry point that accepts a decision and produces a memo with the modeled game, solver results, and assumptions. Include an offline fixture, setup instructions, model configuration, and a license.
The first useful milestone is a validated, hand-authored two-player game that produces correct solver results without an LLM. After that, connect decision input through to a memo and verify the complete path with fixed model responses before testing a live model.
Pipeline:
frame_game: extract players, incentives, constraints, and game type.generate_strategies: create concrete moves for each player.decompose_payoffs: score each strategy profile by criteria.review_model: attack missing players, fake strategies, payoff errors, and hidden assumptions.solve_equilibrium: compute best responses and equilibria with solver code.run_sensitivity: change assumptions and re-solve.write_memo: produce the strategic memo.
The important boundary is strict: LLMs model and explain; solvers compute.
Recommended sequence:
- MVP: pure best-response checker for two-player normal-form games.
- Next: support enumeration for mixed equilibria.
- Later: Gambit adapter for formal finite games.
- Later: OpenSpiel adapter for repeated, sequential, and imperfect-information games.
The spec defines:
NashAgentInputPlayerStrategyPayoffCriterionProfilePayoffTwoPlayerNormalFormGameSolverRequestSolverResultGameModelReviewSensitivityCaseDecisionMemoNashAgentRuntime
Use these types as the boundary between prompt orchestration, payoff estimation, solver adapters, and final memo generation.