{
  "markdown": "# SNHP\n\n[![smithery badge](https://smithery.ai/badge/ryuxik/snhp)](https://smithery.ai/servers/ryuxik/snhp)\n\n**Free negotiation math for AI agents. One call, no account.** Your agent brings\nthe LLM; SNHP brings the game theory — your math-optimal next move in any\nnegotiation, single-price *and* multi-issue, LLM-free, runs locally. When you\nneed it **on the record**: $2 receipted sessions. When you need it to\n**remember**: agent memory (blind custody — you encrypt before saving; we store\nonly ciphertext and cannot read it).\n\n[![PyPI](https://img.shields.io/pypi/v/snhp.svg)](https://pypi.org/project/snhp/)\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n&nbsp;·&nbsp; [snhp.dev](https://snhp.dev) &nbsp;·&nbsp; [Manifesto](MANIFESTO.md)\n\n## 🏆 The Negotiation Leaderboard\n\n**[arena.snhp.dev/leaderboard.html](https://arena.snhp.dev/leaderboard.html)** —\nwhich AI walks away with the most money? Claude models, a naive\nsplitter, a genome evolved in a live sim, and community bots all negotiate the\nsame held-out multi-issue deals against the SNHP engine, scored against the\nexact Pareto frontier. Every match is a real recorded negotiation, replayable\nin the browser. Headline result: **frontier models, solo, lose to the naive\nsplit-the-difference bot** — wired to the engine mid-deal, they're near-optimal.\n\n**Put your bot on the board:** expose one HTTP endpoint speaking\n[`snhp-gauntlet/1`](https://arena.snhp.dev/submit.html) and DM\n[@ryuxik](https://x.com/ryuxik) the URL. The runner lives in\n[`arena/gauntlet/`](arena/gauntlet/) — protocol, seats, scoring, and the\n[25-line starter bot](arena/gauntlet/examples/demo_bot.py). Machine-readable\nspec: [arena.snhp.dev/llms.txt](https://arena.snhp.dev/llms.txt).\n\n## Install\n\n```bash\nuvx snhp            # zero-install: runs the stdio MCP server on demand\n# or\npip install snhp\n```\n\nWire it into any MCP client (Claude Desktop, Cursor, Cline, …):\n\n```json\n{ \"mcpServers\": { \"snhp\": { \"command\": \"uvx\", \"args\": [\"snhp\"] } } }\n```\n\nOr call the math directly — plain dollars in, the move out (the `negotiate` tool):\n\n```python\nfrom gametheory.negotiation.plain_terms import negotiate_turn\n\nnegotiate_turn(\n    side=\"sell\", walk_away=4000, target=6000,\n    counterparty_offers=[4200, 4500], rounds_left=6,\n)\n# -> {'action': 'counter', 'recommended_price': 5752.2,\n#     'message': 'Thanks for the offer. The best I can do on this is $5,752.20.', ...}\n```\n\nMulti-issue deals logroll automatically — SNHP infers the other side's priorities\nand proposes the package that maximises joint surplus (concede what you value\nleast to hold what you value most):\n\n```python\nfrom gametheory.negotiation.bundle import negotiate_bundle\n\nnegotiate_bundle(\n    issues=[\n        {\"name\": \"price\",   \"options\": [100, 120, 140], \"my_utility\": [1.0, 0.5, 0.0], \"their_utility\": [0.0, 0.5, 1.0]},\n        {\"name\": \"support\", \"options\": [\"basic\", \"priority\"], \"my_utility\": [1.0, 0.0], \"their_utility\": [0.0, 1.0]},\n    ],\n    my_priorities={\"price\": 0.8, \"support\": 0.2},\n)\n# -> recommended_offer {'price': 100, 'support': 'priority'} + the trade logic behind it\n```\n\nHosted agent card, streamable MCP, and a live demo: **[snhp.dev](https://snhp.dev)**.\n\n## What's here\n\n```\nsnhp/                   Core algorithm + NegMAS agent + B2B tournament harness\ngametheory/             Productization layer (FastAPI, MCP, Tier 1/2/3 endpoints)\ngametheory/negotiation/ Plain-terms single- + multi-issue (logrolling) engines\ngametheory/server/      HTTP + MCP entry points\ngametheory/tests/       pytest suite\nSNHP_Whitepaper/        Protocol description + 3 component PRDs\n```\n\n## Develop from source\n\n```bash\ngit clone https://github.com/ryuxik/snhp && cd snhp\npython -m venv venv && source venv/bin/activate\npip install -e \".[test]\"\n\npython -m pytest gametheory/tests/                  # test suite\nuvicorn gametheory.server.http:app --reload         # local API (catalog at /v1/catalog)\nsnhp                                                # stdio MCP server\n```\n\n## Empirical anchor\n\n### Several different numbers — keep them straight\n\nThese are distinct measurements; conflating them is the easy mistake. **They are\nordered by how much weight they can carry, not by when we ran them.** The first was\npre-registered and validated on data it had never seen; the rest were not, and are\nreported here with the caveats that implies.\n\n**1. The certification gauntlet (pre-registered, held-out) — the number to trust.**\nA certified agent's mean own-utility beats a **split-the-difference** baseline by\n**+0.1086** across **n=360** seeded negotiations (60 scenarios × 2 roles × 3 frozen\nscripted opponents: naive, hardball, conceder), **p=0.0001**, separating on both the\npublic set *and* a held-out set that had never been used. The counterparty pool and\nthe statistic were frozen in `arena/gauntlet/PREREG-pool.md` **before the code\nexisted**. It carries the most weight precisely because it could have failed on the\nrecord — and an earlier cut of this certificate *did* fail (three statistics saturated\nagainst a fixed counterparty; see `arena/gauntlet/certs/SEPARATION.md`), which is why\nthe protocol was re-registered rather than re-tuned. Scope is exactly the declared\npool and no wider.\n\n**2. Head-to-head competitive margin (not registered in advance).** In a\nSNHP-scaffolded LLM vs a non-SNHP LLM, how much more of the surplus does the SNHP\nside capture? On the committed cross-vendor run (`gametheory/server/static/e6_cross_vendor.json`,\nSonnet+SNHP vs Haiku, n=20 paired seeds) the pooled margin is **~+12.5%**\n(`mean h3_margin ≈ 0.125`, 29/40 positive signs). Some shipped copy still cites this\nas \"~12% better head-to-head.\" Read it with the caveats: n=20, LLM-vs-LLM,\nsingle-issue price, no pre-registration, and the opponent is a *general* vanilla\nprompt — against a competent one the edge roughly halves (see the strong-baseline test\nbelow). Where this and (1) disagree, prefer (1).\n\n**3. Joint-welfare lift in self-play (a cooperation metric, NOT the same thing).**\nTwo-Sonnet B2B contract negotiation, n=20 paired seeds:\n\n| Condition | Joint welfare (frontier ≈ 1.57, estimated) |\n|---|---:|\n| Vanilla Sonnet (general prompt, no SNHP) | 1.40 |\n| Pure SNHP-vs-SNHP (math only) | 1.45 |\n| **Sonnet + SNHP MCP tool (both sides)** | **1.59** |\n| Haiku + SNHP MCP tool (cross-model) | 1.61 |\n\nLift from both sides adopting the SNHP tool: **+0.186 joint welfare**, sign test\n18/20, **p=0.0004**. (The 1.59/1.61 slightly exceed the 1.57 frontier *estimate* —\nthe frontier was estimated on a coarse grid, so treat these as \"at the frontier,\"\nnot \"beyond it.\") Cost: $0.025 per matchup at 2026-04 pricing.\n\n### 4. The build-vs-buy test: SNHP vs a STRONG production prompt\n\nNumbers (2) and (3) above are vs a *general* vanilla prompt. The sharper question — \"why not\njust prompt the LLM well?\" — is answered by running SNHP against a strong production\nprompt (`snhp/llm_strong_baseline.py`, whose system prompt even includes logrolling\nadvice). On the 4-issue contract, Haiku+SNHP-tool vs Haiku+strong-prompt, n=12 paired\nseeds (`python -m snhp.strong_baseline_headtohead`, result committed at\n`gametheory/server/static/strong_baseline_headtohead.json`):\n\n| Metric | Value |\n|---|---|\n| Utility margin (SNHP − strong baseline) | **+0.077**, 95% CI **[+0.039, +0.115]** (excludes 0) |\n| SNHP share of joint surplus | **54%** (CI [52%, 56%]) |\n| Sign test | **8/12 positive, 0 negative** |\n\nSNHP beats even a strong production prompt — but by roughly **half** the edge it shows\nagainst a weak one. Caveats: n=12, Haiku (not Sonnet), one contract domain; re-run at\nlarger n / a stronger model to tighten the CI.\n\n**Network effect**: the cooperation premium requires both sides to be\nSNHP-staked. Asymmetric matchups (Sonnet+SNHP vs vanilla Sonnet) lose 0.11\nutility vs symmetric scaffolded play. Peer-mode advisor only fires when\ncounterparty has posted a verifiable SNHP attestation.\n\nLive demo (replay of the actual API trace at seed=42): https://snhp.dev/demo.html\n\n### Tournament rank (honest, per-market)\n\nIn the committed round-robin (`leaderboard/results/leaderboard.json`, `n_rounds=20`),\nSNHP's rank by average utility depends on the market:\n\n| Market (BATNA) | SNHP rank | Top of field |\n|---|---|---|\n| Buyer's market (asymmetric) | **#1 of 21** | SNHP 0.508 |\n| Seller's market (asymmetric) | **#1 of 21** | SNHP 0.520 |\n| Symmetric (neutral) | **5th of 21** | Logroller 0.525, The Closer, Cialdini, Principled, then SNHP 0.512 |\n\nSo SNHP is #1 **in the asymmetric markets** and **mid-pack in the symmetric one** —\ndo not read this as \"#1 overall.\" Its variance is the smallest in the field. At\n`n_rounds=100` the symmetric field restabilizes further and Aspiration leads.\n\nThis NegMAS agent (`snhp/negmas_agent.py`) is a **research artifact and is NOT the\nshipped product recommender** — the product claims below are measured on the\nshipped code, not on this tournament.\n\nSee `gametheory/evals/README.md` for the eval/tuning runbook.\n\n## Tiers\n\n- **Tier 1 — Negotiation**: sell-side + buy-side recommenders, anchor-attack\n  detection, cryptographic first-strike commit-reveal, LLM-drafted reply\n  emails (paid).\n- **Tier 2 — Auctions**: Vickrey / first-price BNE / English ascending,\n  Myerson optimal reserve, format recommendation, MC simulation.\n- **Tier 3 — Mechanism design**: Gale-Shapley, asymmetric Myerson optimal\n  auction, Gallego-van Ryzin posted-price.\n\nTier 4 (coalition games) deferred until a paying buyer asks for it.\n\n---\n\nmcp-name: io.github.ryuxik/snhp-negotiation\n",
  "bytes": 9566,
  "sha": "ec0e919694300e7be06b8824dff08cd6edf223320e9cb9ab0b230217f85121ab",
  "repo_slug": "ryuxik/snhp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_ryuxik_snhp_f825ade2/readme"
}