Persistent, outcome-weighted memory for AI trading agents
Tutorial | API Reference | OWM Framework | 中文版
TradeMemory Protocol is an MCP server that gives AI trading agents persistent memory across sessions. Instead of forgetting every trade after each conversation, your agent stores decisions, discovers patterns, and adjusts strategy automatically — using a three-layer architecture inspired by ACT-R cognitive science.
When to use this: You're building an AI agent that trades forex, crypto, or equities via MT5, Binance, Alpaca, or any platform — and you want it to remember what worked, what didn't, and why.
How it works
- Store — Your agent records trades with context (strategy, confidence, market regime) via MCP tools
- Recall — Before the next trade, the agent retrieves similar past trades weighted by outcome (Outcome-Weighted Memory)
- Evolve — The Evolution Engine discovers patterns across trades and generates new strategy hypotheses, validated with Deflated Sharpe Ratio
When to use TradeMemory vs alternatives
| TradeMemory | Raw Mem0/Qdrant | LangChain Memory | Custom SQLite | |
|---|---|---|---|---|
| Trade-specific schema | ✅ L1→L2→L3 pipeline | ❌ Generic vectors | ❌ Chat-oriented | ❌ DIY everything |
| Outcome weighting | ✅ Kelly + ACT-R | ❌ Cosine only | ❌ Recency only | ❌ Manual |
| Strategy evolution | ✅ Built-in engine | ❌ Not included | ❌ Not included | ❌ Not included |
| MCP native | ✅ 15 tools | ❌ Custom wrapper | ❌ Custom wrapper | ❌ Custom wrapper |
| Statistical validation | ✅ DSR + walk-forward | ❌ None | ❌ None | ❌ None |
News
- [2026-03] v0.5.0 — Evolution Engine + OWM 5 memory types. 1,087 tests. Release Notes
- [2026-03] Statistical Validation — Strategy E passes P100% random baseline, Sharpe 3.24 walk-forward
- [2026-03] Live Paper Trading — Strategy E running on Binance via GitHub Actions (hourly)
- [2026-02] v0.4.0 — OWM Framework, 15 MCP tools, Smithery + Glama listed
Architecture
Three-Layer Memory
Quick Start
pip install tradememory-protocol
Add to claude_desktop_config.json:
{
"mcpServers": {
"tradememory": {
"command": "uvx",
"args": ["tradememory-protocol"]
}
}
}
Then tell Claude: "Record my BTCUSDT long at 71,000 — momentum breakout, high confidence."
Claude Code / Cursor / Docker
# Claude Code
claude mcp add tradememory -- uvx tradememory-protocol
# From source
git clone https://github.com/mnemox-ai/tradememory-protocol.git
cd tradememory-protocol && pip install -e . && python -m tradememory
# Docker
docker compose up -d
MCP Tools (15)
| Category | Tools |
|---|---|
| Core Memory | store_trade_memory · recall_similar_trades · get_strategy_performance · get_trade_reflection |
| OWM Cognitive | remember_trade · recall_memories · get_behavioral_analysis · get_agent_state · create_trading_plan · check_active_plans |
| Evolution | evolution_run · evolution_status · evolution_results · evolution_compare · evolution_config |
REST API (30+ endpoints)
Trade recording, outcome logging, history, reflections, risk constraints, MT5 sync, OWM, evolution.
Full reference: docs/API.md
OWM — Outcome-Weighted Memory
Full theoretical foundation: OWM Framework
Evolution Engine
Methodology & data: Research Log
Documentation
| Doc | Description | |-----
Tools (5)
store_trade_memoryRecords a trade with context including strategy, confidence, and market regime.recall_similar_tradesRetrieves past trades similar to the current context weighted by outcome.get_strategy_performanceReturns performance metrics for a specific trading strategy.get_trade_reflectionProvides a reflection on past trade outcomes.evolution_runTriggers the evolution engine to discover patterns and generate new strategy hypotheses.Configuration
{"mcpServers": {"tradememory": {"command": "uvx", "args": ["tradememory-protocol"]}}}