TradeMemory Protocol
TradeMemory Protocol is an MCP server that gives AI trading agents persistent, outcome-weighted memory across sessions — enabling learning from past trades, behavioral analysis, and adaptive strategy adjustments.
Core Trade Memory
store_trade_memory— Record a trade decision with symbol, direction, entry/exit prices, strategy, market context, P&L, and reflectionsrecall_similar_trades— Retrieve past trades with similar context; auto-upgrades to outcome-weighted scoring (OWM) when episodic data exists, otherwise falls back to keyword matchingget_strategy_performance— View aggregate win rates, P&L, and performance stats per strategy and/or symbolget_trade_reflection— Deep-dive into a specific trade's full context, reasoning, and lessons learned
OWM Cognitive Memory (Advanced)
remember_trade— Store a trade across all five cognitive memory layers simultaneously (Episodic, Semantic/Bayesian, Procedural, Affective/EWMA, Prospective) with richer context like R-multiples, market regime, ATR, and confidencerecall_memories— Retrieve outcome-weighted memories scored by outcome quality × context similarity × recency × confidence × affective modulation; supports filtering by memory type, strategy, and regimeget_behavioral_analysis— Detect behavioral biases including overtrading, revenge trading, disposition effect, hold time patterns, lot sizing variance, and Kelly criterion comparisonget_agent_state— Check the agent's current affective state: confidence level, risk appetite, drawdown %, win/loss streaks, and a recommended actioncreate_trading_plan— Store a conditional prospective plan (e.g., "if regime changes to ranging, skip breakout trades") with trigger conditions, expiry, and prioritycheck_active_plans— Match active prospective plans against current market context and auto-expire stale plans
Analysis & Strategy Adjustment
Runs daily/weekly/monthly reflection cycles for pattern discovery and generates rule-based strategy adjustments (e.g., disabling losing strategies, adjusting lot sizes)
Supports context-weighted position sizing via the Kelly criterion derived from recalled trade outcomes
Integration
Works with Claude Desktop, Claude Code, and Cursor via 10 MCP tools
Exposes a REST API for programmatic trade logging, history queries, reflections, and risk management
Built-in connectors for automatic trade sync from MetaTrader 5 and Binance
Includes a Streamlit dashboard for visualizing trading data and insights
Synchronizes trading data from Binance into the memory protocol to provide AI agents with historical context and outcome-weighted insights for improved trade decision-making.
Enables users to interact with the trading memory protocol through WhatsApp via an OpenClaw agent, allowing for remote trade journaling and performance analysis.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TradeMemory Protocolanalyze my recent trades to identify patterns and behavioral biases"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Getting Started | Use Cases | API Reference | OWM Framework | 中文版
Your trading AI has amnesia. And regulators are starting to notice.
It makes the same mistakes every session. It can't explain why it traded. It forgets everything when the context window ends. Meanwhile, MiFID II is raising the bar for algorithmic decision documentation (Article 17). The EU AI Act demands systematic logging of AI actions (Article 14). Your competitors' agents are learning from every trade.
The AI trading stack is missing a layer. Every MCP server handles execution — placing orders, fetching prices, reading charts. None handle memory.
Your agent can buy 100 shares of AAPL but can't answer: "What happened last time I bought AAPL in this condition?"
TradeMemory is the memory layer. One pip install, and your AI agent remembers every trade, every outcome, every mistake — with SHA-256 tamper-proof audit trail.
Used in production by traders running pre-flight checklists before every position, and by EA systems logging thousands of decisions daily.
What it does
Before trading: ask your memory — what happened last time in this market condition? How did it end?
After trading: one call records everything — five memory layers update automatically
Safety rails: confidence tracking, drawdown alerts, losing streak detection — the system tells you when to stop
Works with any market (stocks, forex, crypto, futures), any broker, any AI platform. TradeMemory doesn't execute trades or touch your money — it only records and recalls.
Quick Start
pip install tradememory-protocolAdd to Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"tradememory": {
"command": "uvx",
"args": ["tradememory-protocol"]
}
}
}Then tell Claude: "Record my AAPL long at $195 — earnings beat, institutional buying, high confidence."
# 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 -dFull walkthrough: Getting Started (Trader Track + Developer Track)
Who uses TradeMemory
US Equity Trader | Forex EA System | Compliance Team | |
Market | Stocks (AAPL, TSLA, ...) | XAUUSD (Gold) | Multi-asset |
How | Pre-flight checklist before every trade | Automated sync from MT5 | Full decision audit trail |
Key value | Discipline system — memory before every decision | Record why signals were blocked, not just executed | SHA-256 tamper-proof records for regulators |
Details |
How it works
Recall — Before trading, retrieve past trades weighted by outcome quality, context similarity, recency, confidence, and emotional state (OWM Framework)
Record — After trading, one call to
remember_tradewrites to five memory layers: episodic, semantic, procedural, affective, and trade recordsReflect — Daily/weekly/monthly reviews detect behavioral drift, strategy decay, and trading mistakes
Audit — Every decision is SHA-256 hashed at creation. Export anytime for review or regulatory submission
MCP Tools
Category | Tools | Description |
Memory |
| Record and recall trades with outcome-weighted scoring |
State |
| Confidence, drawdown, streaks, behavioral patterns |
Planning |
| Prospective plans with conditional triggers |
Risk |
| 5-factor pre-trade gate (full / reduced / skip) |
Audit |
| SHA-256 tamper detection + bulk export |
Category | Tools |
Core Memory |
|
OWM Cognitive |
|
Risk & Governance |
|
Evolution |
|
Audit |
|
REST API: 35+ endpoints for trade recording, reflections, risk, MT5 sync, OWM, evolution, and audit. Full reference →
Pricing
Community | Pro | Enterprise | |
Price | Free | $29/mo (Coming Soon) | Contact Us |
MCP tools | 17 tools | 17 tools | 17 tools |
Storage | SQLite, self-hosted | Hosted API | Private deployment |
Dashboard | — | Web dashboard | Custom dashboard |
Compliance | Audit trail included | Audit trail included | Compliance reports + SLA |
Support | GitHub Issues | Priority support | Dedicated support |
Coming soon |
Need Help Integrating?
Building a trading AI agent and want battle-tested memory architecture?
Free 30-min strategy call — we'll map your agent's memory needs and design guardrails for your specific workflow.
We've helped traders build pre-flight checklists, connect MT5/Binance, and design custom guardrails for forex, equities, and crypto.
Enterprise & Compliance
Every trading decision your agent makes — including decisions not to trade — is recorded as a Trading Decision Record (TDR), SHA-256 hashed at creation for tamper detection.
Regulation | Requirement | TradeMemory Coverage |
MiFID II Article 17 | Record every algorithmic trading decision factor | Full decision chain: conditions, filters, indicators, execution |
EU AI Act Article 14 | Human oversight of high-risk AI systems | Explainable reasoning + memory context for every decision |
EU AI Act Logging | Systematic logging of every AI action | Automatic per-decision TDR with structured JSON |
# Verify any record hasn't been tampered with
GET /audit/verify/{trade_id}
# → {"verified": true, "stored_hash": "a3f8c9...", "computed_hash": "a3f8c9..."}
# Bulk export for regulatory submission
GET /audit/export?strategy=VolBreakout&start=2026-03-01&format=jsonlNeed a custom deployment for your fund? → dev@mnemox.ai
Security
Never touches API keys. TradeMemory does not execute trades, move funds, or access wallets.
Read and record only. Your agent passes decision context to TradeMemory. It stores it. That's it.
No external network calls. The server runs locally. No data is sent to third parties.
SHA-256 tamper detection. Every record is hashed at creation. Verify integrity anytime.
1,324 tests passing. Full test suite with CI.
Research Status
TradeMemory's OWM framework is grounded in cognitive science (Tulving 1972) and reinforcement learning (Schaul et al. 2015). Current status:
OWM five-factor scoring: implemented, tested (1,300+ tests)
Statistical validation: DSR, MBL implemented (Bailey-de Prado 2014)
Audit trail: SHA-256 tamper-proof TDR
Evolution engine: research phase (strategy generation works, statistical gate pass rate under optimization)
Hybrid recall: OWM-only mode active, vector fusion available when embeddings configured
Empirical validation: ongoing (n=40 trades, target n>=100 for statistical significance)
Documentation
Doc | Description |
Install → first trade → pre-flight checklist | |
3 real-world production scenarios | |
All REST endpoints | |
Outcome-Weighted Memory theory | |
System design & layer separation | |
Detailed walkthrough | |
MetaTrader 5 integration | |
Evolution experiments & data | |
11 trading AI failure modes | |
Traditional Chinese |
Contributing
See Contributing Guide · Security Policy
MIT — see LICENSE. For educational/research purposes only. Not financial advice.
Maintenance
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mnemox-ai/tradememory-protocol'
If you have feedback or need assistance with the MCP directory API, please join our Discord server