# Repository Briefing: mnemox-ai/tradememory-protocol
> Source: https://repoforai.com/repo/mnemox-ai/tradememory-protocol (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/mnemox-ai/tradememory-protocol
- **Official Docs / Website**: https://mnemox.ai/tradememory/
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: Python
- **License**: MIT
- **Engineering Health**: A+ (89/100 · Maintenance 35/35 · Adoption 17/25 · Releases 17/20 · License 20/20)
- **Latest Release**: v0.5.6 (2026-10-02) — https://github.com/mnemox-ai/tradememory-protocol/releases
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Docker, Self-Hosted, MCP, CLI
- **Momentum**: 1,458 ★ total (+2 24h / +5 7d) · 172 forks
- **Topics**: `agentic-trading`, `ai-agents`, `audit-trail`, `claude`, `compliance`, `crypto`, `evolution-engine`, `forex`, `mcp`, `mcp-server`, `memory`, `mt5`
- **When to Use**: Best for: 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. Skip if: You need a production execution gateway for multiple brokers, proof that every decision was logged, or empirical evidence that the system improves returns.

## Overview
```text
### Architecture & 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.
```

## Key Capabilities
```text
- MCP and REST: FastMCP 3.x exposes 20 tools; the FastAPI surface includes more than 35 endpoints.
- Fill ingestion: Hyperliquid sync reads public recent fills without a key; Alpaca sync reads with locally supplied credentials and avoids reimporting closed trades.
- Loss-first retrieval: A separate recent-loss search for the symbol helps surface losing trades that a recency-only query would miss.
- Audit integrity: Per-record SHA-256 links, chained UTC daily Merkle roots, RFC 3161 timestamps, and JSONL export support independent review.
- Order policy: The Alpaca preview proxy uses Mnemox Control and binds threshold approvals to the reviewed terms and the same client_order_id.
- Research boundary: Backtesting and strategy evolution are exposed as tools, but the empirical validation summarized at 14 trades is inconclusive.
```

## Quick Start / Clone
```bash
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
```
