mnemox-ai/tradememory-protocol
Local-first MCP server for trading-agent memory, decision audits, and order guardrails
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
TradeMemory is a local-first Python MCP server, not a broker or execution engine. The default runtime stores records in SQLite and uses FastMCP >=3.2.0,<4 for MCP, with a separate FastAPI REST surface served by Uvicorn. One remember_trade call writes to episodic, semantic, procedural, affective, and trade-record layers. Recall reads that history before a proposed trade, while reflection tools surface changes in behavior or strategy performance over time.
Execution control is a separate, opt-in path. The proxy extra sits between the agent and Alpaca's MCP server and delegates order policy evaluation to Mnemox Control. The proxy forwards eligible orders and records allow and refuse decisions in the audit chain; the default memory server cannot send orders. Broker credentials are passed to the upstream broker process rather than stored by TradeMemory. That separation lets teams evaluate memory and audit behavior before putting the proxy in the order path.
Key Capabilities & Differentiators
The 20 MCP tools span memory, agent state, conditional plans, risk checks, strategy research, and audit verification, with more than 35 REST endpoints. Outcome-weighted recall combines outcome quality, context similarity, recency, confidence, and emotional state. recall_memories(order="losses_first") also searches the symbol's recent losing trades and puts comparable losses before non-losses. Default recall favors stronger outcomes, using R multiples where recorded, while reserving at least 20% of the list for losses. Hyperliquid and Alpaca fill sync add closed trades incrementally and report descriptive loss patterns.
The audit path hashes Trading Decision Records with SHA-256, links records in sequence, and summarizes each UTC day with a Merkle root linked across days. Verification covers individual records and chain ranges, with bulk export available as JSONL. The Alpaca proxy preview adds checks for allowed symbols, position and notional limits, protective stops, loss thresholds, and manual approval above a configured notional. Memory recall is advisory; the proxy enforces policy only on orders routed through it.
Trade-offs & Limitations
Compared with direct broker MCP controls such as fixed size limits or human-only submission, TradeMemory adds context from the user's own fills and can preserve a reviewable record of policy decisions. That advantage comes with another component in the order path: the proxy preview covers Alpaca, and an unavailable quote or unevaluable order can cause a refusal. If broker-native controls already meet the requirement, the default memory server can add context without adding an execution dependency. Hyperliquid sync only reaches the recent fills exposed by its API, so an initial import cannot establish a complete history.
Treat the ledger as tamper-evident, not immutable. A database writer can rebuild the local chain; retaining an independently verifiable timestamp token gives reviewers an external reference for the anchored root, but it cannot establish who authored a record or whether any decision was omitted. Likewise, loss summaries describe past trades, and the 14-trade empirical validation is too small to establish a performance benefit. The MIT license permits commercial self-hosting with notice retention, but neither the license nor the audit features establish regulatory compliance.
Hardware & Deployment Guide
The base package requires Python 3.10+ and can run as a local MCP process via uvx tradememory-protocol or from source with pip install -e . and python -m tradememory. Claude Code can register it with claude mcp add tradememory -- uvx tradememory-protocol. The Alpaca proxy requires Python 3.12+ and is installed with pip install "tradememory-protocol[proxy]". The development docker-compose.yml starts timescale/timescaledb-ha:pg18 for PostgreSQL with TimescaleDB and pgvector, maps port 5432, and persists data in pgdata. It provisions the database, not the full application stack; SQLite remains the default for local MCP use.
Local storage does not mean offline operation. RFC 3161 timestamping sends a 32-byte root by default and can be disabled with TRADEMEMORY_TSA=off; fill sync, market data, and optional model services have their own network requirements. No GPU is specified for the default SQLite and outcome-weighted recall path. Size for retained history and request concurrency; optional embeddings add model-dependent cost. Release v0.5.4 hardened anchor handling, v0.5.5 restricted dashboard static serving to dashboard/dist, and v0.5.6 added fill sync and loss-first recall.
Teams that want a Claude Code or other MCP agent to consult its own fills before proposing trades and retain a verifiable decision history. Start with memory-only mode; test the Alpaca policy proxy in paper trading before putting it in the live order path.
You need a production execution gateway for multiple brokers, proof that every decision was logged, or empirical evidence that the system improves returns.
Quick Start & Installation
pip install tradememory-protocol # Hyperliquid: public fills, no key needed tradememory sync hyperliquid --address 0xYourAddress # Alpaca: read-only calls with your own keys, kept in a local file tradememory sync alpaca --env-file ~/.secrets/alpaca.env
Comparison vs. Top Agents & Frameworks Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| tradememory-protocol ★ | 1.5k | +5 | Python | MIT | Local-first MCP server for trading-agent memory, decision audits, and order guar |
| obscura | 38.8k | +1.1k | Rust | Apache-2.0 | Rust/V8 headless browser for agent automation and capture without Chromium |
| WrenAI | 18.5k | +66 | Python | — | An MCP-ready semantic engine that gives AI agents governed SQL and dashboard wor |
| rocketride-server | 19.9k | +22 | Python | MIT | C++ workflow engine for building and running extensible AI pipelines |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/mnemox-ai/tradememory-protocol.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about tradememory-protocol
Can I add TradeMemory without replacing my broker MCP connection?
tradememory proxy doctor to check the account ID and upstream tool names. Orders sent directly to the broker bypass the proxy.What hardware does a self-hosted instance need?
Can we self-host it commercially and use the audit trail as compliance evidence?
How does it compare with a broker's native MCP controls?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy