Choose your path:
- Trader Track — I use Claude to help with trading decisions
- Developer Track — I'm building a trading bot or agent
For traders using Claude Desktop or Claude Code. No coding required.
pip install tradememory-protocolAdd to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"tradememory": {
"command": "uvx",
"args": ["tradememory-protocol"]
}
}
}Restart Claude Desktop. TradeMemory is now connected.
Other platforms (Claude Code, Cursor, Windsurf)
# Claude Code
claude mcp add tradememory -- uvx tradememory-protocol
# Cursor — add to .cursor/mcp.json
# Windsurf — add to Windsurf MCP config
# All platforms: run `tradememory config` for your exact snippetBefore trading — ask what happened last time:
"I'm thinking about buying AAPL. Have I traded AAPL before? What happened?"
Claude checks your memory and returns past trades in similar conditions — what you did, why, and whether it worked.
Check your state:
"How's my trading state right now? Am I on a losing streak?"
Claude returns your confidence level, current drawdown, and a recommendation (normal / reduce size / stop trading).
After a completed trade — record it:
"Record this trade: I bought 100 shares of AAPL at $195 and sold at $205 for a $1,000 profit. Reason: earnings beat expectations and institutional buying volume was high."
One call. Five memory layers update automatically:
- Episodic — the full event with context
- Semantic — updates your AAPL strategy win rate belief
- Procedural — updates average hold time and position sizing
- Affective — updates confidence, tracks the win streak
- Audit — SHA-256 hashed record of the decision
Based on how real users run TradeMemory in production:
Before every trade:
1. "What happened in similar conditions?"
2. "What's my current trading state?"
3. "Should I take this trade?"
→ The system returns: full size / reduced size / skip
After every trade:
4. "Record this trade with full context"
Daily:
5. "Run my daily trading review"
Weekly:
6. "Give me my weekly strategy breakdown"
Technical: which MCP tools power each step
| Step | MCP Tool / REST Endpoint |
|---|---|
| 1 | recall_memories |
| 2 | get_agent_state |
| 3 | check_trade_legitimacy |
| 4 | remember_trade |
| 5 | REST: /reflect/run_daily |
| 6 | REST: /reflect/run_weekly |
If any pre-flight check returns a red flag — high drawdown, bad streak, low legitimacy score — pause and review before trading.
- Be specific with context. "Bought AAPL because of earnings beat" is better than "Bought AAPL." The more context you give, the better recall works next time.
- Record losses too. The system learns more from losses than wins.
- Check memory before trading, not after. The biggest value is preventing repeat mistakes.
For developers integrating TradeMemory into trading bots or AI agents.
pip install tradememory-protocol
# Start MCP server
python -m tradememory
# Or via uvx (no install needed)
uvx tradememory-protocolMCP SSE endpoint: http://localhost:8001/sse
REST API: http://localhost:8000
Docker
git clone https://github.com/mnemox-ai/tradememory-protocol.git
cd tradememory-protocol
docker compose up -dWrite — record a completed trade:
# MCP tool: remember_trade
{
"symbol": "AAPL",
"direction": "long",
"entry_price": 195.0,
"exit_price": 205.0,
"pnl": 1000.0,
"strategy_name": "EarningsBreakout",
"market_context": "Post-earnings gap up, institutional volume spike, RSI 62"
}
# → Writes to all 5 memory layers automaticallyRead — recall similar past trades:
# MCP tool: recall_memories
{
"symbol": "AAPL",
"market_context": "Pre-earnings, IV rising, support at 190"
}
# → Returns ranked memories weighted by outcome quality + context similarityState — check agent health:
# MCP tool: get_agent_state
# → { "confidence": 0.72, "drawdown_pct": 3.2, "recommended_action": "normal" }# Record a trade decision
curl -X POST http://localhost:8000/trade/record_decision \
-H "Content-Type: application/json" \
-d '{"symbol": "AAPL", "direction": "long", "entry_price": 195.0, "strategy_name": "EarningsBreakout", "market_context": "Post-earnings gap up"}'
# Record outcome
curl -X POST http://localhost:8000/trade/record_outcome \
-H "Content-Type: application/json" \
-d '{"trade_id": "...", "exit_price": 205.0, "pnl": 1000.0}'
# Daily reflection
curl -X POST http://localhost:8000/reflect/run_daily
# Weekly reflection
curl -X POST http://localhost:8000/reflect/run_weekly- API Reference — All 35+ REST endpoints
- MCP Tools — All 19 MCP tools
- OWM Framework — Outcome-Weighted Memory theory
- Architecture — System design