Repolode
mnemox-ai

mnemox-ai/tradememory-protocol

Local-first memory and pre-order brake for AI trading agents, recording decisions in a tamper-evident SHA-256 audit chain and exposing 20 MCP tools.

Stars
1,440
Forks
170
Open issues
10
Last commit
14 days ago

Repolode describes open-source projects and does not give investment advice. Trading and investing can lose money: assess the risk yourself and follow the laws where you live before using this project.

What is it?

TradeMemory Protocol gives AI trading agents a memory of their own trading history. It syncs closed trades from Hyperliquid and Alpaca (and MT5 or Binance spot through scripts), then points out where past trades lost money, such as losing streaks tied to oversized positions. Before a new trade, an agent can call recall_memories to see losing trades from similar conditions ranked first. Everything is stored in a local SQLite file.

An optional proxy extra sits between an agent and Alpaca's MCP server. It forwards read-only tools unchanged and evaluates order-placing calls against a user-defined policy covering symbol lists, notional and position limits, bracket stops, and daily-loss limits. Refused and allowed decisions are both written to the audit log. Orders above a set notional threshold wait for explicit approval, and the proxy forwards each approved order at most once.

Every decision record is SHA-256 hashed and linked to the previous one, with daily Merkle roots that can be timestamped via RFC 3161. The project is MIT licensed, and its own documentation says the empirical sample is small and it is for research and education, not financial advice.

Key features

  • 01Syncs closed trades from Hyperliquid and Alpaca into a local database
  • 02Recall ranks losing trades from similar conditions first before a new order
  • 03Proxy checks order-placing MCP calls against a user-defined policy before they reach the broker
  • 04Refused and allowed decisions are written to a hash-chained audit log
  • 05Daily Merkle roots with optional RFC 3161 timestamping
  • 06Exposes 20 MCP tools and a REST API

Use cases

  • Reviewing your own trade history to find which conditions or position sizes preceded losses
  • Giving an MCP-connected agent a pre-trade check against its past losing trades
  • Placing a policy layer between an Alpaca-connected agent and paper or live orders
  • Keeping a tamper-evident record of agent decisions, including decisions not to trade

Quick start

  1. 1

    Install the package from PyPI

    pip install tradememory-protocol
  2. 2

    Sync your Hyperliquid trade history (public fills, no key needed)

    tradememory sync hyperliquid --address 0xYourAddress
  3. 3

    Register the server with Claude Code

    claude mcp add tradememory -- uvx tradememory-protocol

Things to know

  • The broker brake (proxy extra) is a preview and currently supports only Alpaca.
  • The proxy extra requires Python 3.12 or newer.
  • Hyperliquid's API returns only recent fills, so older history is lost unless you sync early.
  • The audit chain is tamper-evident, not tamper-proof, and records are not signed with a private key.

In collections

Topics

FAQ

What is tradememory-protocol?
Local-first memory and pre-order brake for AI trading agents, recording decisions in a tamper-evident SHA-256 audit chain and exposing 20 MCP tools. TradeMemory Protocol gives AI trading agents a memory of their own trading history. It syncs closed trades from Hyperliquid and Alpaca (and MT5 or Binance spot through scripts), then points out where past trades lost money, such as losing streaks tied to oversized positions. Before a new trade, an agent can call recall_memories to see losing trades from similar conditions ranked first. Everything is stored in a local SQLite file.
Is tradememory-protocol free to use? What license does it have?
tradememory-protocol is open source under the MIT license. Check the license terms before using it in commercial products.
Is tradememory-protocol still maintained?
Actively maintained. The last commit to tradememory-protocol was on Oct 23, 2026.
What can I use tradememory-protocol for?
Reviewing your own trade history to find which conditions or position sizes preceded losses Giving an MCP-connected agent a pre-trade check against its past losing trades Placing a policy layer between an Alpaca-connected agent and paper or live orders Keeping a tamper-evident record of agent decisions, including decisions not to trade
How do I install tradememory-protocol?
Install the package from PyPI: pip install tradememory-protocol Sync your Hyperliquid trade history (public fills, no key needed): tradememory sync hyperliquid --address 0xYourAddress Register the server with Claude Code: claude mcp add tradememory -- uvx tradememory-protocol
Where can I get tradememory-protocol?
The source code and installation instructions are on GitHub: https://github.com/mnemox-ai/tradememory-protocol

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects