If you're building AI trading agents, this solves the memory problem. Your agent can execute trades but can't remember what happened last time it saw similar conditions. TradeMemory gives you 17 MCP tools to record trades across five memory layers (episodic, semantic, procedural, affective, trade records) and recall them with outcome-weighted scoring. Before trading, query recall_memories to see past setups. After, call remember_trade to log everything. You get confidence tracking, drawdown alerts, and SHA-256 audit trails for compliance. Works with any broker or market since it only stores decisions, never executes. Particularly useful if you're running pre-flight checklists or need MiFID II documentation for algorithmic trading decisions.
claude mcp add tradememory-protocol -- uvx tradememory-protocolRun in your terminal. Replace YOUR_* placeholders with real values; add --scope user to install for every project.
Review the command, arguments, and environment values before installing — MCP servers run with your local permissions.
Verified live against the running server on Jun 11, 2026.
store_trade_memoryStore a trade decision with full context into memory. Call this after executing a trade to build your memory bank. Include market_context and reflection for better recall later.10 paramsStore a trade decision with full context into memory. Call this after executing a trade to build your memory bank. Include market_context and reflection for better recall later.
pnlvaluesymbol*stringtrade_idvaluedirection*stringtimestampvalueexit_pricevaluereflectionvalueentry_price*numberstrategy_name*stringmarket_context*stringrecall_similar_tradesFind past trades with similar market context. Use this before making a trade to learn from past experience. Returns trades with their reflections and outcomes. Uses OWM scoring when episodic memories exist, falls back to keyword matching.4 paramsFind past trades with similar market context. Use this before making a trade to learn from past experience. Returns trades with their reflections and outcomes. Uses OWM scoring when episodic memories exist, falls back to keyword matching.
limitintegersymbol*stringstrategy_namevaluemarket_context*stringget_strategy_performanceGet aggregate performance stats per strategy. Use this to evaluate which strategies are working and which need adjustment.2 paramsGet aggregate performance stats per strategy. Use this to evaluate which strategies are working and which need adjustment.
symbolvaluestrategy_namevalueget_trade_reflectionGet the full context and reflection for a specific trade. Use this to deep-dive into a particular trade's reasoning and lessons.1 paramsGet the full context and reflection for a specific trade. Use this to deep-dive into a particular trade's reasoning and lessons.
trade_id*stringremember_tradeStore a trade into OWM multi-layer memory with automatic updates. Writes to episodic memory and automatically updates semantic (Bayesian), procedural (running averages), and affective (EWMA confidence/streaks). Also writes to trade_records for backward compatibility.15 paramsStore a trade into OWM multi-layer memory with automatic updates. Writes to episodic memory and automatically updates semantic (Bayesian), procedural (running averages), and affective (EWMA confidence/streaks). Also writes to trade_records for backward compatibility.
pnl*numberpnl_rvaluesymbol*stringtrade_idvaluedirection*stringtimestampvalueconfidencenumberexit_price*numberreflectionvalueentry_price*numberstrategy_name*stringcontext_atr_d1valuecontext_regimevaluemarket_context*stringmax_adverse_excursionvaluerecall_memoriesRecall memories using OWM outcome-weighted scoring. Queries episodic and semantic memories, scores them by outcome quality, context similarity, recency, confidence, and affective modulation. Returns ranked memories with score breakdown.7 paramsRecall memories using OWM outcome-weighted scoring. Queries episodic and semantic memories, scores them by outcome quality, context similarity, recency, confidence, and affective modulation. Returns ranked memories with score breakdown.
limitintegersymbol*stringmemory_typesvaluestrategy_namevaluecontext_atr_d1valuecontext_regimevaluemarket_context*stringget_behavioral_analysisGet behavioral analysis from procedural memory. Returns aggregate trading behavior stats: hold times, disposition ratio, lot sizing variance, and Kelly criterion comparison.2 paramsGet behavioral analysis from procedural memory. Returns aggregate trading behavior stats: hold times, disposition ratio, lot sizing variance, and Kelly criterion comparison.
symbolvaluestrategy_namevalueget_agent_stateGet the current agent affective state (confidence, risk, drawdown). Returns confidence level, risk appetite, drawdown percentage, win/loss streaks, equity tracking, and a recommended action based on current drawdown severity.Get the current agent affective state (confidence, risk, drawdown). Returns confidence level, risk appetite, drawdown percentage, win/loss streaks, equity tracking, and a recommended action based on current drawdown severity.
No parameters — call it with no arguments.
create_trading_planCreate a prospective trading plan that activates when conditions are met. Stores a rule-based plan in prospective memory. The plan stays active until triggered, expired, or manually cancelled.6 paramsCreate a prospective trading plan that activates when conditions are met. Stores a rule-based plan in prospective memory. The plan stays active until triggered, expired, or manually cancelled.
prioritynumberreasoning*stringexpiry_daysintegertrigger_type*stringplanned_action*stringtrigger_condition*stringcheck_active_plansCheck active trading plans against current market context. Queries all active prospective plans, expires any past their expiry date, and matches remaining plans against the provided context.2 paramsCheck active trading plans against current market context. Queries all active prospective plans, expires any past their expiry date, and matches remaining plans against the provided context.
context_atr_d1valuecontext_regimevalueevolution_fetch_market_dataFetch OHLCV market data from Binance for evolution analysis. Downloads historical price bars for backtesting and pattern discovery. Use this before discover_patterns or run_backtest to get data.3 paramsFetch OHLCV market data from Binance for evolution analysis. Downloads historical price bars for backtesting and pattern discovery. Use this before discover_patterns or run_backtest to get data.
daysintegersymbol*stringtimeframestringevolution_discover_patternsDiscover trading patterns from market data using LLM analysis. Uses Claude to analyze OHLCV data and generate candidate trading patterns with entry/exit conditions. Each pattern can be backtested afterward.5 paramsDiscover trading patterns from market data using LLM analysis. Uses Claude to analyze OHLCV data and generate candidate trading patterns with entry/exit conditions. Each pattern can be backtested afterward.
daysintegercountintegersymbol*stringtimeframestringtemperaturenumberevolution_run_backtestBacktest a candidate pattern against historical OHLCV data. Takes a pattern dict (from discover_patterns) and runs a vectorized backtest. Returns fitness metrics: Sharpe ratio, win rate, trade count, max drawdown, total PnL.4 paramsBacktest a candidate pattern against historical OHLCV data. Takes a pattern dict (from discover_patterns) and runs a vectorized backtest. Returns fitness metrics: Sharpe ratio, win rate, trade count, max drawdown, total PnL.
daysintegersymbolstringtimeframestringpattern_dict*objectevolution_evolve_strategyRun full evolution loop — generate, backtest, select, eliminate. Multi-generation strategy evolution: generates candidate patterns via LLM, backtests on in-sample data, validates survivors on out-of-sample data, eliminates weak hypotheses. Returns graduated strategies and grav...5 paramsRun full evolution loop — generate, backtest, select, eliminate. Multi-generation strategy evolution: generates candidate patterns via LLM, backtests on in-sample data, validates survivors on out-of-sample data, eliminates weak hypotheses. Returns graduated strategies and grav...
daysintegersymbol*stringtimeframestringgenerationsintegerpopulation_sizeintegerevolution_get_logGet the log of past evolution runs from this session. Returns a list of all evolution runs with their results, including graduated strategies, graveyard, token usage, and backtest counts. Data is in-memory (resets on server restart).Get the log of past evolution runs from this session. Returns a list of all evolution runs with their results, including graduated strategies, graveyard, token usage, and backtest counts. Data is in-memory (resets on server restart).
No parameters — call it with no arguments.
export_audit_trailExport Trading Decision Records for audit and compliance review. Provides a complete, tamper-evident record of trading decisions including the memory context (similar trades, beliefs) that informed each decision.5 paramsExport Trading Decision Records for audit and compliance review. Provides a complete, tamper-evident record of trading decisions including the memory context (similar trades, beliefs) that informed each decision.
endvaluelimitintegerstartvaluestrategyvaluetrade_idvalueverify_audit_hashVerify the integrity of a Trading Decision Record. Recomputes the SHA256 data_hash from stored inputs and compares with the hash computed at decision time. A mismatch indicates tampering.1 paramsVerify the integrity of a Trading Decision Record. Recomputes the SHA256 data_hash from stored inputs and compares with the hash computed at decision time. A mismatch indicates tampering.
trade_id*string
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.
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.
pip install tradememory-protocol
Add 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 -d
Full walkthrough: Getting Started (Trader Track + Developer Track)
| 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 | Read more → | Read more → | Read more → |
remember_trade writes to five memory layers: episodic, semantic, procedural, affective, and trade records| Category | Tools | Description |
|---|---|---|
| Memory | remember_trade · recall_memories | Record and recall trades with outcome-weighted scoring |
| State | get_agent_state · get_behavioral_analysis | Confidence, drawdown, streaks, behavioral patterns |
| Planning | create_trading_plan · check_active_plans | Prospective plans with conditional triggers |
| Risk | check_trade_legitimacy | 5-factor pre-trade gate (full / reduced / skip) |
| Audit | export_audit_trail · verify_audit_hash | SHA-256 tamper detection + bulk export |
| Category | Tools |
|---|---|
| Core Memory | get_strategy_performance · get_trade_reflection |
| OWM Cognitive | remember_trade · recall_memories · get_behavioral_analysis · get_agent_state · create_trading_plan · check_active_plans |
| Risk & Governance | check_trade_legitimacy · validate_strategy |
| Evolution | evolution_fetch_market_data · evolution_discover_patterns · evolution_run_backtest · evolution_evolve_strategy · evolution_get_log |
| Audit | export_audit_trail · verify_audit_hash |
REST API: 35+ endpoints for trade recording, reflections, risk, MT5 sync, OWM, evolution, and audit. Full reference →
| 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 |
| Get Started → | Coming soon | dev@mnemox.ai |
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.
Every trading decision your agent makes — including decisions not to trade — is recorded as a Trading Decision Record (TDR). Per-record SHA-256 content hashes are linked into a forward-chained audit ledger; every UTC day is summarised by a Merkle root which itself chains across days. Tampering with any historical record invalidates every subsequent link.
| 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 Article 12 | Automatic, tamper-resistant logs over system lifetime | Linked SHA-256 chain + daily Merkle roots (RFC 3161 TSA in Phase 1.5) |
# Verify a single record hasn't been tampered with
verify_audit_hash(trade_id="MT5-7047640363")
# → {"verified": true, "chain_entry": {"sequence_num": 42, ...}}
# Walk the entire chain (or a slice) end-to-end
verify_audit_chain(from_seq=1, to_seq=None)
# → {"verified": true, "checked_count": 1284, "first_break_at": null}
# Daily Merkle root — single 32-byte anchor over every TDR for that day
get_daily_root(date="2026-05-14")
# → {"verified": true, "root_hash": "a05544...", "record_count": 18}
# Bulk export for regulatory submission
GET /audit/export?strategy=VolBreakout&start=2026-03-01&format=jsonl
See LIMITATIONS.md for the full audit-chain maturity statement, including what's not in v0.5.2 yet (TSA timestamping, external anchoring, zkML proof of inference).
Need a custom deployment for your fund? → dev@mnemox.ai
TradeMemory's OWM framework is grounded in cognitive science (Tulving 1972) and reinforcement learning (Schaul et al. 2015). Current status:
| Doc | Description |
|---|---|
| Getting Started | Install → first trade → pre-flight checklist |
| Use Cases | 3 real-world production scenarios |
| API Reference | All REST endpoints |
| OWM Framework | Outcome-Weighted Memory theory |
| Architecture | System design & layer separation |
| Tutorial | Detailed walkthrough |
| MT5 Setup | MetaTrader 5 integration |
| Research Log | Evolution experiments & data |
| Failure Taxonomy | 11 trading AI failure modes |
| 中文版 | Traditional Chinese |
See Contributing Guide · Security Policy
MIT — see LICENSE. For educational/research purposes only. Not financial advice.
io.github.ericm1018/skillfm-llm-cost-optimizer-openai-anthropic-usage
io.github.mikerawsonnz/llm-orchestration-agent
io.github.mikerawsonnz/authenticated-llm-agent
labforgedev/copilot-memory-mcp
csoai-org/agent-prompt-injection-firewall-mcp
io.github.mikerawsonnz/authenticated-multi-llm-agent