@coinrithm/mcp-trading 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +171 -113
  2. package/README.md +277 -238
  3. package/dist/agent/act.d.ts +2 -2
  4. package/dist/agent/act.js +24 -3
  5. package/dist/agent/cli.js +68 -23
  6. package/dist/agent/client.d.ts +33 -0
  7. package/dist/agent/client.js +34 -7
  8. package/dist/agent/decision.d.ts +3 -0
  9. package/dist/agent/decision.js +26 -3
  10. package/dist/agent/decisionValidator.js +2 -1
  11. package/dist/agent/deploymentOverlay.js +25 -5
  12. package/dist/agent/engine.d.ts +2 -1
  13. package/dist/agent/engine.js +4 -1
  14. package/dist/agent/extract.js +3 -1
  15. package/dist/agent/gate.js +25 -5
  16. package/dist/agent/index.js +0 -1
  17. package/dist/agent/indicators.js +4 -2
  18. package/dist/agent/manifest.js +1 -1
  19. package/dist/agent/mechanical.d.ts +36 -0
  20. package/dist/agent/mechanical.js +286 -0
  21. package/dist/agent/observe.d.ts +4 -0
  22. package/dist/agent/observe.js +140 -53
  23. package/dist/agent/prompt.d.ts +3 -1
  24. package/dist/agent/prompt.js +17 -6
  25. package/dist/agent/providers.js +39 -4
  26. package/dist/agent/resolve.js +23 -6
  27. package/dist/agent/resolvePm.js +14 -3
  28. package/dist/agent/runEvidence.js +6 -2
  29. package/dist/agent/runner.d.ts +8 -2
  30. package/dist/agent/runner.js +363 -59
  31. package/dist/agent/scorecard.js +12 -4
  32. package/dist/agent/setups.js +57 -9
  33. package/dist/agent/skill.js +1 -1
  34. package/dist/agent/state.js +9 -4
  35. package/dist/agent/types.d.ts +17 -2
  36. package/dist/agent/types.js +2 -1
  37. package/dist/agent/util.js +11 -4
  38. package/dist/agent/version.d.ts +1 -1
  39. package/dist/agent/version.js +1 -1
  40. package/dist/client.d.ts +51 -0
  41. package/dist/client.js +30 -3
  42. package/dist/executionPolicy.d.ts +2 -0
  43. package/dist/executionPolicy.js +21 -0
  44. package/dist/http.js +13 -3
  45. package/dist/tools.d.ts +23 -0
  46. package/dist/tools.js +796 -39
  47. package/package.json +86 -78
package/CHANGELOG.md CHANGED
@@ -1,113 +1,171 @@
1
- # Changelog
2
-
3
- All notable changes to `@coinrithm/mcp-trading` are documented here. The package
4
- ships two binaries — `coinrithm-mcp` (the MCP server) and `coinrithm-agent` (the
5
- self-host agent runner) — versioned together. The CoinRithm **API contract** is
6
- versioned separately (see `openapi.yaml` `info.version`, currently `1.5.0`).
7
-
8
- ## 0.7.1
9
-
10
- Docs + registry-metadata release; no tool behavior changes.
11
-
12
- - **README refresh**: the keyless `pm_data_*` data surface is now front and
13
- center — 8 venues (Polymarket, Kalshi, Smarkets, Limitless, Manifold,
14
- Metaculus, PredictIt, Rothera the "seven venues" line predated Rothera),
15
- the anonymous hosted-endpoint path, and the `referenceProbability` /
16
- `volumeHistory` fields the data tools return.
17
- - **`server.json`**: hosted endpoint's `Authorization` header marked optional
18
- (the `pm_data_*` tools work anonymously verified live) and the server
19
- description now leads with the keyless data surface.
20
- - Ships the post-0.7.0 commits: `pm_data_event` advertises `volumeHistory`,
21
- `pm_data_events` advertises `referenceProbability` on list items, and the
22
- hosted MCP root (`GET /`) serves a self-describing JSON landing (with a
23
- 405 + hint on `GET /mcp`).
24
-
25
- ## 0.7.0
26
-
27
- (Retroactive entry released 2026-07-05 without a changelog note.)
28
-
29
- - **Four keyless `pm_data_*` tools** — CoinRithm's free public cross-venue
30
- prediction-market dataset over MCP, no API key required and yours is never
31
- attached: `pm_data_overview` (market-wide stats), `pm_data_events`
32
- (cross-venue event list), `pm_data_event` (detail incl.
33
- `crossSourceMatches` + resolution evidence), `pm_data_whales`
34
- (large-trade tape).
35
-
36
- ## 0.5.0
37
-
38
- Agent-runner quality + reliability release. `coinrithm-agent` got materially
39
- smarter and less noisy; `coinrithm-mcp` is unchanged in shape. Bundles the work
40
- since 0.4.0.
41
-
42
- - **Prediction markets are a first-class venue** in the decide prompt: a short
43
- `pmN` ref so small models trade PM reliably, eligible-outcome filtering (only
44
- backend-openable outcomes reach the model), and futures-capped agents steered
45
- to PM (a separate budget) instead of re-rejecting.
46
- - **PM anti-churn — now actually effective.** The candidate list is pre-filtered
47
- to exclude markets the agent already holds, and the runner + server both block
48
- re-betting a held market+outcome (no more one-agent, 25-identical-bets churn).
49
- An earlier version read the wrong `/positions/pm` fields and was silently dead;
50
- fixed.
51
- - **Settlement-feedback learning loop.** The agent sees how its own recent bets
52
- actually resolved (win/loss/void + realized PnL) as reflective context, so it
53
- learns from outcomes across cycles.
54
- - **Per-trade reasoning stays honest about the market.** A multi-action decision
55
- no longer stamps its primary rationale onto a secondary trade about a different
56
- market the trade's public Arena "why" always matches the market it's on.
57
- - **Futures reliability.** The model is unblinded to per-position mark /
58
- liquidation / stop / take-profit prices; take-profit is auto-clamped to a valid
59
- R:R target off the stop (kills the `take_profit_not_*_mark` reject waves); and a
60
- marking-down PM book now trips the equity-drawdown kill-switch too.
61
- - **News capability.** Recent high-importance news for the watchlist coins is fed
62
- into the decide context as a market-catalyst layer.
63
- - **Robustness + contract accuracy.** Scheduler/runner hardening, flat-state
64
- prompt steers (weak models stop hallucinating closes), manage-enum
65
- normalization, and the PM contract now documents real entry friction rather
66
- than a disclose-only stance.
67
- - **Security.** `hono` bumped to 4.12.27 (high-severity advisories: serve-static
68
- path traversal, CORS wildcard-with-credentials, body-limit bypass).
69
- - **Docs.** The npm README leads with value / free / OKF / Studio; stale
70
- scheduler and `minDecidedTrades` claims corrected.
71
-
72
- ## 0.4.0
73
-
74
- - **Deterministic scorecard engine (`computeScorecard`).** The reproducible-
75
- evaluation engine for `coinrithm.agent.scorecard.v1` pure math over an
76
- agent's realized track record (no network, no model): realized PnL, win rate,
77
- expectancy, profit factor, reward-to-risk, Sharpe, Sortino, deflated /
78
- probabilistic Sharpe (Bailey & López de Prado — skill vs luck with a multiple-
79
- testing penalty), max drawdown, and Brier + ECE calibration for probabilistic
80
- calls. Same inputs identical metrics **and** a sha256 `contentHash` of the
81
- canonicalized result, so a scorecard whose hash doesn't reproduce isn't
82
- trusted. Metrics are computed AFTER the run from immutable evidence (leakage-
83
- separation), so tuning-to-the-metric is structurally impossible. Returns
84
- `null` for thin records — never a fabricated number.
85
- - **Resolver: committable file metadata + functionality pin.** The OKF resolver
86
- now carries per-file metadata and pins functionality through resolution, so a
87
- bundle's behavior is reproducible from its committed files.
88
-
89
- ## 0.3.0
90
-
91
- - **Agent risk config: coin deny-list (`blocklist`).** `risk.blocklist` lets an
92
- agent name symbols it must never open, even if they are on the watchlist —
93
- deny wins over allow. Enforced in the runner's decision validator (rejects
94
- `futures_open` / `spot_order` on a denied symbol) and surfaced in the system
95
- prompt, so the model is told the boundary and the runner re-checks it.
96
- - **Docs: Open Knowledge Format positioning.** Clarified that a CoinRithm agent
97
- is an OKF bundle a portable directory of markdown + frontmatter that is
98
- model-agnostic (run the same definition on any model). Develop and prove it
99
- free on paper, then run it anywhere.
100
- - npm keywords refreshed (`open-knowledge-format`, `okf`, `model-agnostic`,
101
- `gemini`) for registry discovery.
102
-
103
- ## 0.2.0
104
-
105
- - Added the **`coinrithm-agent`** self-host runner binary alongside the MCP
106
- server: a folder-as-architecture (OKF) agent you bring your own model key to,
107
- with caps enforced by the runner (not the model), dry-run by default,
108
- paper-only.
109
-
110
- ## 0.1.x
111
-
112
- - Initial `coinrithm-mcp` MCP server: reads, quotes, scoped spot/futures/PM
113
- writes, ledger export, and Agent Arena integration over a user-minted API key.
1
+ # Changelog
2
+
3
+ All notable changes to `@coinrithm/mcp-trading` are documented here. The package
4
+ ships two binaries — `coinrithm-mcp` (the MCP server) and `coinrithm-agent` (the
5
+ self-host agent runner) — versioned together. The CoinRithm **API contract** is
6
+ versioned separately (see `openapi.yaml` `info.version`, currently `1.6.0`).
7
+
8
+ ## 0.7.4
9
+
10
+ Docs-only. No tool behavior change, no API-surface change.
11
+
12
+ - **Acceptable Use of Market Data.** The README (root and this package) and
13
+ `openapi.yaml` (`info.termsOfService`, `info.description`, and the
14
+ `public-pm-data` tag) now reference and summarize CoinRithm's licensing
15
+ flow-down restriction on Market Data from third-party prediction-market
16
+ venues: read-only use for paper-trading context and settled-outcome
17
+ scoring only no model training/fine-tuning/benchmarking, no
18
+ redistribution or bulk-extraction, no use to build a competing product.
19
+ Full terms: <https://www.coinrithm.com/en/terms-of-use>
20
+
21
+ ## 0.7.3
22
+
23
+ Quality-engine surfaces + independent forecasts. Additive; no breaking change.
24
+
25
+ - **Quality verdicts in tool responses.** `discover_pm_markets`, `pm_quote`, and
26
+ the `pm_data_*` tools now surface the persisted truth-engine `quality` object
27
+ (`decisionEligible`, warning/block reason codes, `policyVersion`, `assessedAt`).
28
+ Markets with critical failures stay visible but cannot drive paper opens or
29
+ alerts.
30
+ - **`openBlocked` preview on `pm_quote`.** Quotes preview the open-time quality
31
+ gate (`openBlocked` + `openBlockReasons`), so an agent can skip a market that
32
+ would 422 before burning the open attempt. The self-host runner
33
+ (`coinrithm-agent`) does this skip automatically.
34
+ - **Independent forecasts in the runner.** The self-host agent runner elicits the
35
+ model's OWN probability (judged from the question/resolution criteria/deadline,
36
+ never anchored to the market price) and submits it as `forecastProbability` on
37
+ PM opens — feeding the public calibration dataset with proper-scoring-rule
38
+ forecasts. Clamped to [1,99]; omitted (never faked) when the model does not
39
+ produce one; `HOUSE_AGENT_FORECAST_ENABLED=false` disables.
40
+ - **`crossPlatform` on event lists** documented in the API contract: sibling
41
+ venues pricing the same question, on list rows.
42
+ - **ForecastEx venue truth.** Public MCP discovery copy and registry metadata
43
+ now describe all 11 live venues, including ForecastEx.
44
+ - **Contract synchronization.** Runner templates and example bundles pin the
45
+ served OpenAPI 1.6.0 contract; canonical scorecard paths are unambiguous.
46
+
47
+ ## 0.7.2
48
+
49
+ Docs-truth + privacy release. No tool behavior change, no API-surface change.
50
+
51
+ - **Ten venues in the public listing.** `pm_data_*` tool copy, the README, and
52
+ `server.json` now name all ten venues (adds Futuur and Myriad). npm `0.7.1` was
53
+ published before those landed, so the registry listing still advertised "eight
54
+ venues"; npm versions are immutable, so correcting the public listing required
55
+ a new release.
56
+ - **`source` parameter description** on `pm_data_events` / `pm_data_event_detail`
57
+ now enumerates all ten venue slugs. Accepted values are unchanged — this is
58
+ description text only, which is why it is a patch and not a minor.
59
+ - **Privacy.** Raw model output is no longer persisted, enforcing the package's
60
+ no-chain-of-thought promise.
61
+ - **New tripwire.** `server.json` (the MCP-registry listing) is now guarded
62
+ against version and venue-count drift; it had no guard, which is how it went
63
+ stale in the first place.
64
+ - Refreshed stale Arena-gate example copy.
65
+
66
+ ## 0.7.1
67
+
68
+ Docs + registry-metadata release; no tool behavior changes.
69
+
70
+ - **README refresh**: the keyless `pm_data_*` data surface is now front and
71
+ center — 8 venues (Polymarket, Kalshi, Smarkets, Limitless, Manifold,
72
+ Metaculus, PredictIt, Rothera — the "seven venues" line predated Rothera),
73
+ the anonymous hosted-endpoint path, and the `referenceProbability` /
74
+ `volumeHistory` fields the data tools return.
75
+ - **`server.json`**: hosted endpoint's `Authorization` header marked optional
76
+ (the `pm_data_*` tools work anonymously verified live) and the server
77
+ description now leads with the keyless data surface.
78
+ - Ships the post-0.7.0 commits: `pm_data_event` advertises `volumeHistory`,
79
+ `pm_data_events` advertises `referenceProbability` on list items, and the
80
+ hosted MCP root (`GET /`) serves a self-describing JSON landing (with a
81
+ 405 + hint on `GET /mcp`).
82
+
83
+ ## 0.7.0
84
+
85
+ (Retroactive entry released 2026-07-05 without a changelog note.)
86
+
87
+ - **Four keyless `pm_data_*` tools** CoinRithm's free public cross-venue
88
+ prediction-market dataset over MCP, no API key required and yours is never
89
+ attached: `pm_data_overview` (market-wide stats), `pm_data_events`
90
+ (cross-venue event list), `pm_data_event` (detail incl.
91
+ `crossSourceMatches` + resolution evidence), `pm_data_whales`
92
+ (large-trade tape).
93
+
94
+ ## 0.5.0
95
+
96
+ Agent-runner quality + reliability release. `coinrithm-agent` got materially
97
+ smarter and less noisy; `coinrithm-mcp` is unchanged in shape. Bundles the work
98
+ since 0.4.0.
99
+
100
+ - **Prediction markets are a first-class venue** in the decide prompt: a short
101
+ `pmN` ref so small models trade PM reliably, eligible-outcome filtering (only
102
+ backend-openable outcomes reach the model), and futures-capped agents steered
103
+ to PM (a separate budget) instead of re-rejecting.
104
+ - **PM anti-churn — now actually effective.** The candidate list is pre-filtered
105
+ to exclude markets the agent already holds, and the runner + server both block
106
+ re-betting a held market+outcome (no more one-agent, 25-identical-bets churn).
107
+ An earlier version read the wrong `/positions/pm` fields and was silently dead;
108
+ fixed.
109
+ - **Settlement-feedback learning loop.** The agent sees how its own recent bets
110
+ actually resolved (win/loss/void + realized PnL) as reflective context, so it
111
+ learns from outcomes across cycles.
112
+ - **Per-trade reasoning stays honest about the market.** A multi-action decision
113
+ no longer stamps its primary rationale onto a secondary trade about a different
114
+ market — the trade's public Arena "why" always matches the market it's on.
115
+ - **Futures reliability.** The model is unblinded to per-position mark /
116
+ liquidation / stop / take-profit prices; take-profit is auto-clamped to a valid
117
+ R:R target off the stop (kills the `take_profit_not_*_mark` reject waves); and a
118
+ marking-down PM book now trips the equity-drawdown kill-switch too.
119
+ - **News capability.** Recent high-importance news for the watchlist coins is fed
120
+ into the decide context as a market-catalyst layer.
121
+ - **Robustness + contract accuracy.** Scheduler/runner hardening, flat-state
122
+ prompt steers (weak models stop hallucinating closes), manage-enum
123
+ normalization, and the PM contract now documents real entry friction rather
124
+ than a disclose-only stance.
125
+ - **Security.** `hono` bumped to 4.12.27 (high-severity advisories: serve-static
126
+ path traversal, CORS wildcard-with-credentials, body-limit bypass).
127
+ - **Docs.** The npm README leads with value / free / OKF / Studio; stale
128
+ scheduler and `minDecidedTrades` claims corrected.
129
+
130
+ ## 0.4.0
131
+
132
+ - **Deterministic scorecard engine (`computeScorecard`).** The reproducible-
133
+ evaluation engine for `coinrithm.agent.scorecard.v1` — pure math over an
134
+ agent's realized track record (no network, no model): realized PnL, win rate,
135
+ expectancy, profit factor, reward-to-risk, Sharpe, Sortino, deflated /
136
+ probabilistic Sharpe (Bailey & López de Prado — skill vs luck with a multiple-
137
+ testing penalty), max drawdown, and Brier + ECE calibration for probabilistic
138
+ calls. Same inputs → identical metrics **and** a sha256 `contentHash` of the
139
+ canonicalized result, so a scorecard whose hash doesn't reproduce isn't
140
+ trusted. Metrics are computed AFTER the run from immutable evidence (leakage-
141
+ separation), so tuning-to-the-metric is structurally impossible. Returns
142
+ `null` for thin records — never a fabricated number.
143
+ - **Resolver: committable file metadata + functionality pin.** The OKF resolver
144
+ now carries per-file metadata and pins functionality through resolution, so a
145
+ bundle's behavior is reproducible from its committed files.
146
+
147
+ ## 0.3.0
148
+
149
+ - **Agent risk config: coin deny-list (`blocklist`).** `risk.blocklist` lets an
150
+ agent name symbols it must never open, even if they are on the watchlist —
151
+ deny wins over allow. Enforced in the runner's decision validator (rejects
152
+ `futures_open` / `spot_order` on a denied symbol) and surfaced in the system
153
+ prompt, so the model is told the boundary and the runner re-checks it.
154
+ - **Docs: Open Knowledge Format positioning.** Clarified that a CoinRithm agent
155
+ is an OKF bundle — a portable directory of markdown + frontmatter that is
156
+ model-agnostic (run the same definition on any model). Develop and prove it
157
+ free on paper, then run it anywhere.
158
+ - npm keywords refreshed (`open-knowledge-format`, `okf`, `model-agnostic`,
159
+ `gemini`) for registry discovery.
160
+
161
+ ## 0.2.0
162
+
163
+ - Added the **`coinrithm-agent`** self-host runner binary alongside the MCP
164
+ server: a folder-as-architecture (OKF) agent you bring your own model key to,
165
+ with caps enforced by the runner (not the model), dry-run by default,
166
+ paper-only.
167
+
168
+ ## 0.1.x
169
+
170
+ - Initial `coinrithm-mcp` MCP server: reads, quotes, scoped spot/futures/PM
171
+ writes, ledger export, and Agent Arena integration over a user-minted API key.