# tradememory-protocol - Doramagic AI Context Pack

> 定位：安装前体验与判断资产。它帮助宿主 AI 有一个好的开始，但不代表已经安装、执行或验证目标项目。

## 充分原则

- **充分原则，不是压缩原则**：AI Context Pack 应该充分到让宿主 AI 在开工前理解项目价值、能力边界、使用入口、风险和证据来源；它可以分层组织，但不以最短摘要为目标。
- **压缩策略**：只压缩噪声和重复内容，不压缩会影响判断和开工质量的上下文。

## 给宿主 AI 的使用方式

你正在读取 Doramagic 为 tradememory-protocol 编译的 AI Context Pack。请把它当作开工前上下文：帮助用户理解适合谁、能做什么、如何开始、哪些必须安装后验证、风险在哪里。不要声称你已经安装、运行或执行了目标项目。

## Claim 消费规则

- **事实来源**：Repo Evidence + Claim/Evidence Graph；Human Wiki 只提供显著性、术语和叙事结构。
- **事实最低状态**：`supported`
- `supported`：可以作为项目事实使用，但回答中必须引用 claim_id 和证据路径。
- `weak`：只能作为低置信度线索，必须要求用户继续核实。
- `inferred`：只能用于风险提示或待确认问题，不能包装成项目事实。
- `unverified`：不得作为事实使用，应明确说证据不足。
- `contradicted`：必须展示冲突来源，不得替用户强行选择一个版本。

## 它最适合谁

- **希望把专业流程带进宿主 AI 的用户**：仓库包含 Skill 文档。 证据：`skills/tradememory-bridge/SKILL.md` Claim：`clm_0003` supported 0.86

## 它能做什么

- **AI Skill / Agent 指令资产库**（可做安装前预览）：项目包含可被宿主 AI 读取的 Skill 或 Agent 指令文件，可用于把专业流程带入 Claude、Codex、Cursor 等宿主。 证据：`skills/tradememory-bridge/SKILL.md` Claim：`clm_0001` supported 0.86
- **命令行启动或安装流程**（需要安装后验证）：项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 证据：`CONTRIBUTING.md`, `docs/DAILY_REFLECTION_SETUP.md`, `docs/MT5_SYNC_SETUP.md`, `docs/QUICK_START.md` 等 Claim：`clm_0002` supported 0.86

## 怎么开始

- `curl http://localhost:8000/health` 证据：`docs/DAILY_REFLECTION_SETUP.md` Claim：`clm_0004` supported 0.86
- `git clone https://github.com/mnemox-ai/tradememory-protocol.git` 证据：`docs/deployment.md` Claim：`clm_0005` supported 0.86
- `curl https://mcp.mnemox.ai/api/v1/health` 证据：`docs/deployment.md` Claim：`clm_0006` supported 0.86
- `curl -s https://mcp.mnemox.ai/api/v1/health | python -m json.tool` 证据：`docs/deployment.md` Claim：`clm_0007` supported 0.86
- `pip install MetaTrader5 python-dotenv requests` 证据：`docs/MT5_SYNC_SETUP.md` Claim：`clm_0008` supported 0.86
- `curl http://localhost:8000/trade/get_active` 证据：`docs/MT5_SYNC_SETUP.md` Claim：`clm_0009` supported 0.86
- `pip install MetaTrader5` 证据：`docs/MT5_SYNC_SETUP.md` Claim：`clm_0008` supported 0.86, `clm_0010` supported 0.86
- `pip install -r requirements.txt` 证据：`docs/QUICK_START.md` Claim：`clm_0011` supported 0.86, `clm_0016` supported 0.86, `clm_0017` supported 0.86
- `pip install -r requirements-dashboard.txt` 证据：`docs/QUICK_START.md` Claim：`clm_0012` supported 0.86
- `curl -sSL https://raw.githubusercontent.com/mnemox-ai/tradememory-protocol/master/scripts/install.sh | bash` 证据：`docs/TUTORIAL_ZH.md` Claim：`clm_0013` supported 0.86

## 继续前判断卡

- **当前建议**：仅建议沙盒试装
- **为什么**：项目存在安装命令、宿主配置或本地写入线索，不建议直接进入主力环境，应先在隔离环境试装。

### 30 秒判断

- **现在怎么做**：仅建议沙盒试装
- **最小安全下一步**：先跑 Prompt Preview；若仍要安装，只在隔离环境试装
- **先别相信**：真实输出质量不能在安装前相信。
- **继续会触碰**：命令执行、宿主 AI 配置、本地环境或项目文件

### 现在可以相信

- **适合人群线索：希望把专业流程带进宿主 AI 的用户**（supported）：有 supported claim 或项目证据支撑，但仍不等于真实安装效果。 证据：`skills/tradememory-bridge/SKILL.md` Claim：`clm_0003` supported 0.86
- **能力存在：AI Skill / Agent 指令资产库**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`skills/tradememory-bridge/SKILL.md` Claim：`clm_0001` supported 0.86
- **能力存在：命令行启动或安装流程**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`CONTRIBUTING.md`, `docs/DAILY_REFLECTION_SETUP.md`, `docs/MT5_SYNC_SETUP.md`, `docs/QUICK_START.md` 等 Claim：`clm_0002` supported 0.86
- **存在 Quick Start / 安装命令线索**（supported）：可以相信项目文档出现过启动或安装入口；不要因此直接在主力环境运行。 证据：`docs/DAILY_REFLECTION_SETUP.md` Claim：`clm_0004` supported 0.86

### 现在还不能相信

- **真实输出质量不能在安装前相信。**（unverified）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。
- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。
- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。 证据：`CLAUDE.md`, `skills/tradememory-bridge/SKILL.md`
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。
- **安装命令是否需要网络、权限或全局写入？**（unverified）：这影响企业环境和个人环境的安装风险。 证据：`docs/DAILY_REFLECTION_SETUP.md`

### 继续会触碰什么

- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`CONTRIBUTING.md`, `docs/DAILY_REFLECTION_SETUP.md`, `docs/MT5_SYNC_SETUP.md`, `docs/QUICK_START.md` 等
- **宿主 AI 配置**：Claude/Codex/Cursor/Gemini/OpenCode 等宿主的 plugin、Skill 或规则加载配置。 原因：宿主配置会改变 AI 后续工作方式，可能和用户已有规则冲突。 证据：`CLAUDE.md`, `skills/tradememory-bridge/SKILL.md`
- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`CONTRIBUTING.md`, `docs/DAILY_REFLECTION_SETUP.md`, `docs/MT5_SYNC_SETUP.md`, `docs/QUICK_START.md` 等
- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。

### 最小安全下一步

- **先跑 Prompt Preview**：用安装前交互式试用判断工作方式是否匹配，不需要授权或改环境。（适用：任何项目都适用，尤其是输出质量未知时。）
- **只在隔离目录或测试账号试装**：避免安装命令污染主力宿主 AI、真实项目或用户主目录。（适用：存在命令执行、插件配置或本地写入线索时。）
- **先备份宿主 AI 配置**：Skill、plugin、规则文件可能改变 Claude/Cursor/Codex 的默认行为。（适用：存在插件 manifest、Skill 或宿主规则入口时。）
- **安装后只验证一个最小任务**：先验证加载、兼容、输出质量和回滚，再决定是否深用。（适用：准备从试用进入真实工作流时。）

### 退出方式

- **保留安装前状态**：记录原始宿主配置和项目状态，后续才能判断是否可恢复。
- **准备移除宿主 plugin / Skill / 规则入口**：如果试装后行为异常，可以把宿主 AI 恢复到试装前状态。
- **记录安装命令和写入路径**：没有明确卸载说明时，至少要知道哪些目录或配置需要手动清理。
- **如果没有回滚路径，不进入主力环境**：不可回滚是继续前阻断项，不应靠信任或运气继续。

## 哪些只能预览

- 解释项目适合谁和能做什么
- 基于项目文档演示典型对话流程
- 帮助用户判断是否值得安装或继续研究

## 哪些必须安装后验证

- 真实安装 Skill、插件或 CLI
- 执行脚本、修改本地文件或访问外部服务
- 验证真实输出质量、性能和兼容性

## 边界与风险判断卡

- **把安装前预览误认为真实运行**：用户可能高估项目已经完成的配置、权限和兼容性验证。 处理方式：明确区分 prompt_preview_can_do 与 runtime_required。 Claim：`clm_0023` inferred 0.45
- **命令执行会修改本地环境**：安装命令可能写入用户主目录、宿主插件目录或项目配置。 处理方式：先在隔离环境或测试账号中运行。 证据：`CONTRIBUTING.md`, `docs/DAILY_REFLECTION_SETUP.md`, `docs/MT5_SYNC_SETUP.md`, `docs/QUICK_START.md` 等 Claim：`clm_0024` supported 0.86
- **待确认**：真实安装后是否与用户当前宿主 AI 版本兼容？。原因：兼容性只能通过实际宿主环境验证。
- **待确认**：项目输出质量是否满足用户具体任务？。原因：安装前预览只能展示流程和边界，不能替代真实评测。
- **待确认**：安装命令是否需要网络、权限或全局写入？。原因：这影响企业环境和个人环境的安装风险。

## 开工前工作上下文

### 加载顺序

- 先读取 how_to_use.host_ai_instruction，建立安装前判断资产的边界。
- 读取 claim_graph_summary，确认事实来自 Claim/Evidence Graph，而不是 Human Wiki 叙事。
- 再读取 intended_users、capabilities 和 quick_start_candidates，判断用户是否匹配。
- 需要执行具体任务时，优先查 role_skill_index，再查 evidence_index。
- 遇到真实安装、文件修改、网络访问、性能或兼容性问题时，转入 risk_card 和 boundaries.runtime_required。

### 任务路由

- **AI Skill / Agent 指令资产库**：先基于 role_skill_index / evidence_index 帮用户挑选可用角色、Skill 或工作流。 边界：可做安装前 Prompt 体验。 证据：`skills/tradememory-bridge/SKILL.md` Claim：`clm_0001` supported 0.86
- **命令行启动或安装流程**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`CONTRIBUTING.md`, `docs/DAILY_REFLECTION_SETUP.md`, `docs/MT5_SYNC_SETUP.md`, `docs/QUICK_START.md` 等 Claim：`clm_0002` supported 0.86

### 上下文规模

- 文件总数：96
- 重要文件覆盖：40/96
- 证据索引条目：79
- 角色 / Skill 条目：1

### 证据不足时的处理

- **missing_evidence**：说明证据不足，要求用户提供目标文件、README 段落或安装后验证记录；不要补全事实。
- **out_of_scope_request**：说明该任务超出当前 AI Context Pack 证据范围，并建议用户先查看 Human Manual 或真实安装后验证。
- **runtime_request**：给出安装前检查清单和命令来源，但不要替用户执行命令或声称已执行。
- **source_conflict**：同时展示冲突来源，标记为待核实，不要强行选择一个版本。

## Prompt Recipes

### 适配判断

- 目标：判断这个项目是否适合用户当前任务。
- 预期输出：适配结论、关键理由、证据引用、安装前可预览内容、必须安装后验证内容、下一步建议。

```text
请基于 tradememory-protocol 的 AI Context Pack，先问我 3 个必要问题，然后判断它是否适合我的任务。回答必须包含：适合谁、能做什么、不能做什么、是否值得安装、证据来自哪里。所有项目事实必须引用 evidence_refs、source_paths 或 claim_id。
```

### 安装前体验

- 目标：让用户在安装前感受核心工作流，同时避免把预览包装成真实能力或营销承诺。
- 预期输出：一段带边界标签的体验剧本、安装后验证清单和谨慎建议；不含真实运行承诺或强营销表述。

```text
请把 tradememory-protocol 当作安装前体验资产，而不是已安装工具或真实运行环境。

请严格输出四段：
1. 先问我 3 个必要问题。
2. 给出一段“体验剧本”：用 [安装前可预览]、[必须安装后验证]、[证据不足] 三种标签展示它可能如何引导工作流。
3. 给出安装后验证清单：列出哪些能力只有真实安装、真实宿主加载、真实项目运行后才能确认。
4. 给出谨慎建议：只能说“值得继续研究/试装”“先补充信息后再判断”或“不建议继续”，不得替项目背书。

硬性边界：
- 不要声称已经安装、运行、执行测试、修改文件或产生真实结果。
- 不要写“自动适配”“确保通过”“完美适配”“强烈建议安装”等承诺性表达。
- 如果描述安装后的工作方式，必须使用“如果安装成功且宿主正确加载 Skill，它可能会……”这种条件句。
- 体验剧本只能写成“示例台词/假设流程”：使用“可能会询问/可能会建议/可能会展示”，不要写“已写入、已生成、已通过、正在运行、正在生成”。
- Prompt Preview 不负责给安装命令；如用户准备试装，只能提示先阅读 Quick Start 和 Risk Card，并在隔离环境验证。
- 所有项目事实必须来自 supported claim、evidence_refs 或 source_paths；inferred/unverified 只能作风险或待确认项。

```

### 角色 / Skill 选择

- 目标：从项目里的角色或 Skill 中挑选最匹配的资产。
- 预期输出：候选角色或 Skill 列表，每项包含适用场景、证据路径、风险边界和是否需要安装后验证。

```text
请读取 role_skill_index，根据我的目标任务推荐 3-5 个最相关的角色或 Skill。每个推荐都要说明适用场景、可能输出、风险边界和 evidence_refs。
```

### 风险预检

- 目标：安装或引入前识别环境、权限、规则冲突和质量风险。
- 预期输出：环境、权限、依赖、许可、宿主冲突、质量风险和未知项的检查清单。

```text
请基于 risk_card、boundaries 和 quick_start_candidates，给我一份安装前风险预检清单。不要替我执行命令，只说明我应该检查什么、为什么检查、失败会有什么影响。
```

### 宿主 AI 开工指令

- 目标：把项目上下文转成一次对话开始前的宿主 AI 指令。
- 预期输出：一段边界明确、证据引用明确、适合复制给宿主 AI 的开工前指令。

```text
请基于 tradememory-protocol 的 AI Context Pack，生成一段我可以粘贴给宿主 AI 的开工前指令。这段指令必须遵守 not_runtime=true，不能声称项目已经安装、运行或产生真实结果。
```

## 角色 / Skill 索引

- 共索引 1 个角色 / Skill / 项目文档条目。

- **tradememory-bridge**（skill）： 激活提示：当用户任务与“tradememory-bridge”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`skills/tradememory-bridge/SKILL.md`

## 证据索引

- 共索引 79 条证据。

- **⚙️ tradememory-protocol - AI Trading Memory Made Simple**（documentation）：⚙️ tradememory-protocol - AI Trading Memory Made Simple 证据：`README.md`
- **TradeMemory Protocol — Claude Code 指令**（documentation）：TradeMemory Protocol — Claude Code 指令 证据：`CLAUDE.md`
- **TradeMemory API Reference**（documentation）：TradeMemory exposes its functionality via HTTP endpoints. Any MCP-compatible AI agent or HTTP client can use these endpoints. 证据：`docs/API.md`
- **Architecture Overview**（documentation）：Internal architecture of TradeMemory Protocol: module structure, data flow, SQLite schema, and the 3-layer memory model. 证据：`docs/ARCHITECTURE.md`
- **Daily Reflection 自動化設定指南**（documentation）：1. 開啟「工作排程器」 Task Scheduler 2. 「建立基本工作」 3. 設定： - 名稱 ： TradeMemory Daily Reflection - 觸發程序 ：每天 - 時間 ：23:55 - 動作 ：啟動程式 - 程式： C:\OpenClawWork\tradememory-protocol\start daily reflection.bat - 條件 ：取消勾選「只有在電腦使用 AC 電源時才啟動工作」 证据：`docs/DAILY_REFLECTION_SETUP.md`
- **MT5 Sync Script 設定指南**（documentation）：mt5 sync.py 是非侵入式監控腳本，獨立運行於 NG Gold EA 之外。 证据：`docs/MT5_SYNC_SETUP.md`
- **Outcome-Weighted Memory OWM : A Cognitive Memory Architecture for AI Trading Agents**（documentation）：Outcome-Weighted Memory OWM : A Cognitive Memory Architecture for AI Trading Agents 证据：`docs/OWM_FRAMEWORK.md`
- **Quick Start Guide**（documentation）：Get TradeMemory Protocol running in 5 minutes. 证据：`docs/QUICK_START.md`
- **ReflectionEngine 使用指南**（documentation）：ReflectionEngine 是 TradeMemory Protocol 的核心模組，負責分析交易記錄並產生 AI 驅動的每日反思報告。 证据：`docs/REFLECTION_ENGINE_GUIDE.md`
- **Reflection Report Format Design**（documentation）：This document defines the output format for TradeMemory's reflection reports. These reports are what users see when their agent "reflects" on its trading performance. 证据：`docs/REFLECTION_FORMAT.md`
- **TradeMemory Data Schema**（documentation）：This document describes the core data structures used in TradeMemory Protocol. All examples show actual JSON payloads that you'll work with when calling MCP tools. 证据：`docs/SCHEMA.md`
- **TradeMemory Protocol — Complete Tutorial**（documentation）：TradeMemory Protocol — Complete Tutorial 证据：`docs/TUTORIAL.md`
- **TradeMemory Protocol — 完整教學**（documentation）：所需時間： 約 10 分鐘 前置需求： Python 3.10+、git 是否需要 API key： 不需要（demo 使用模擬資料） 证据：`docs/TUTORIAL_ZH.md`
- **Deployment Guide — mcp.mnemox.ai**（documentation）：TradeMemory Hosted API deployment using Docker Compose + Caddy auto-TLS . 证据：`docs/deployment.md`
- **TradeMemory Hosted API Specification**（documentation）：TradeMemory Hosted API Specification 证据：`docs/hosted-api-spec.md`
- **Contributing to TradeMemory Protocol**（documentation）：Contributing to TradeMemory Protocol 证据：`CONTRIBUTING.md`
- **TradeMemory Bridge for Binance**（skill_instruction）：Store Binance spot trades into persistent memory. Recall similar past trades before entering new positions. Detect behavioral biases overtrading, revenge trading . Track strategy performance across sessions. 证据：`skills/tradememory-bridge/SKILL.md`
- **License**（source_file）：Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files the "Software" , to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 证据：`LICENSE`
- **Changelog**（documentation）：All notable changes to this project will be documented in this file. Format follows Keep a Changelog https://keepachangelog.com/ . 证据：`CHANGELOG.md`
- **TradeMemory Protocol — 開發路線圖**（documentation）：這是 Mnemox AI 的主線開發計畫。Claude Code 每次開新 session 時讀取此檔案，找到第一個 ❌ 任務繼續執行。完成後標記 ✅ 並 commit。 证据：`ROADMAP.md`
- **Security Policy**（documentation）：Version Supported --------- ----------- 0.1.x Yes 证据：`SECURITY.md`
- **Awesome Lists — Submission Tracker**（documentation）：Track all awesome-mcp-servers list submissions for TradeMemory Protocol. 证据：`docs/AWESOME_LISTS.md`
- **Before/After: The Difference Memory Makes**（documentation）：Before/After: The Difference Memory Makes 证据：`docs/BEFORE_AFTER.md`
- **MT5 Account Configuration**（source_file）：MT5 Account Configuration Copy this file to .env and fill in your credentials 证据：`.env.example`
- **TradeMemory Protocol**（source_file）：Platform-agnostic AI trading memory system with Outcome-Weighted Memory OWM architecture via MCP. Accepts standardized trade data from any source MT5, Binance, Alpaca and provides structured memory with LLM-powered reflection. 证据：`llms.txt`
- **Init**（source_file）：version = "0.4.0" ⋮---- def main 证据：`src/tradememory/__init__.py`
- **Convert datetime if present**（source_file）：class Database ⋮---- def init self, db path: str = "data/tradememory.db" ⋮---- def get connection self - sqlite3.Connection ⋮---- conn = sqlite3.connect self.db path ⋮---- def init schema self ⋮---- conn = self. get connection ⋮---- def insert trade self, trade data: Dict str, Any - bool ⋮---- def update trade outcome self, trade id: str, outcome data: Dict str, Any - bool ⋮---- """ Update trade with exit outcome. Args: trade id: Trade ID outcome data: Exit data exit price, pnl, etc. Returns: True if successful """ ⋮---- Convert datetime if present ⋮---- Build UPDATE query fields = ⋮---- query = f"UPDATE trade records SET {', '.join fields } WHERE id = :id" ⋮---- def get trade self, trade i… 证据：`src/tradememory/db.py`
- **Models**（source_file）：class TradeDirection str, Enum ⋮---- LONG = "long" SHORT = "short" ⋮---- class TradeGrade str, Enum ⋮---- A = "A" B = "B" C = "C" D = "D" F = "F" ⋮---- class MarketContext BaseModel ⋮---- price: float atr: Optional float = None session: Optional str = None indicators: Dict str, Any = Field default factory=dict news sentiment: Optional float = None ⋮---- class TradeRecord BaseModel ⋮---- id: str = Field ..., description="Unique trade ID T-YYYY-NNNN " timestamp: datetime = Field ..., description="Decision timestamp UTC " symbol: str = Field ..., description="Trading instrument XAUUSD, BTCUSDT, etc. " direction: TradeDirection lot size: float strategy: str = Field ..., description="Strategy ta… 证据：`src/tradememory/models.py`
- **Init**（source_file）：all = 证据：`src/tradememory/owm/__init__.py`
- **Context**（source_file）：@dataclass class ContextVector ⋮---- symbol: Optional str = None price: Optional float = None ⋮---- atr d1: Optional float = None atr h1: Optional float = None atr m5: Optional float = None atr ratio h1 d1: Optional float = None ⋮---- regime: Optional str = None volatility regime: Optional str = None ⋮---- session: Optional str = None hour utc: Optional int = None day of week: Optional int = None ⋮---- spread points: Optional float = None spread as atr pct: Optional float = None ⋮---- drawdown pct: Optional float = None consecutive losses: Optional int = None confidence: Optional float = None ⋮---- CATEGORICAL WEIGHTS = ⋮---- NUMERICAL WEIGHTS = ⋮---- def context similarity c1: ContextVecto… 证据：`src/tradememory/owm/context.py`
- **TradeMemory Demo Video Script 2 min**（documentation）：TradeMemory Demo Video Script 2 min 证据：`drafts/demo-video-script.md`
- **FB Post — TradeMemory Protocol v0.3.0**（documentation）：FB Post — TradeMemory Protocol v0.3.0 证据：`drafts/fb-v030-zh.md`
- **MQL5 Freelance 啟動包**（documentation）：Sean 的 MQL5 帳號：Xuan Wai Peng（中國台灣 / 123 rating / 0 products / 0 jobs） 目標：本週拿到第一個案子 证据：`drafts/mql5-profile-and-proposals.md`
- **Demo Video Script — TradeMemory Protocol**（documentation）：Demo Video Script — TradeMemory Protocol 证据：`marketing/demo-script.md`
- **Forex Factory Post — TradeMemory Protocol**（documentation）：Forex Factory Post — TradeMemory Protocol 证据：`marketing/forex-factory-post.md`
- **MQL5.com Article / Forum Post — TradeMemory Protocol**（documentation）：MQL5.com Article / Forum Post — TradeMemory Protocol 证据：`marketing/mql5-post.md`
- **Reddit Post — TradeMemory Protocol**（documentation）：- Subreddit: r/algotrading primary , r/metatrader5 secondary - Title: I built an open-source memory layer for AI trading agents — it remembers what works across sessions - Flair: Strategy / Infrastructure depends on subreddit 证据：`marketing/reddit-post.md`
- **Mt5 Sync State**（structured_config）：{ "last synced ticket": 2351210003, "updated at": "2026-03-02T18:01:58.026461+00:00" } 证据：`mt5_sync_state.json`
- **Daily 2026 03 01**（structured_config）：{ "generated at": "2026-03-01T21:41:51.792681", "period days": 30, "account": { "balance": 9811.73, "open positions": 1, "open pnl": 557.69 }, "strategy summary": { "VolBreakout": { "trades": 3, "wins": 2, "total pnl": 1656.71 }, "NG Gold": { "trades": 2, "wins": 2, "total pnl": 125.30000000000001 }, "Manual": { "trades": 4, "wins": 1, "total pnl": -152.0 } }, "open positions": { "ticket": 2351006675, "symbol": "XAUUSD", "direction": "LONG", "volume": 0.07, "open price": 5200.59, "current price": 5280.26, "profit": 557.69, "magic": 260112, "strategy": "VolBreakout", "open time": "2026-02-27T15:58:37" } , "alerts": { "level": "MEDIUM", "type": "strategy silent", "strategy": "IntradayMomentum… 证据：`reports/daily_2026-03-01.json`
- **Weekly 2026 03 01**（structured_config）：{ "generated at": "2026-03-01T21:41:56.841800", "period start": "2026-02-15T21:41:56.839780", "strategy metrics": { "Manual": { "total trades": 4, "wins": 1, "losses": 3, "win rate": 0.25, "total pnl": -152.0, "profit factor": 0.27, "avg win": 55.0, "avg loss": 69.0, "expectancy": -38.0 }, "NG Gold": { "total trades": 2, "wins": 2, "losses": 0, "win rate": 1.0, "total pnl": 125.3, "profit factor": Infinity, "avg win": 62.65, "avg loss": 0, "expectancy": 62.65 }, "VolBreakout": { "total trades": 3, "wins": 2, "losses": 1, "win rate": 0.6666666666666666, "total pnl": 1656.71, "profit factor": 39.27, "avg win": 850.0, "avg loss": 43.29, "expectancy": 552.24 } }, "total trades": 9, "backtest ba… 证据：`reports/weekly_2026-03-01.json`
- **Server**（structured_config）：{ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", "name": "io.github.mnemox-ai/tradememory-protocol", "description": "MCP memory for AI trading agents. Store trades, recall similar setups, track strategy performance.", "repository": { "url": "https://github.com/mnemox-ai/tradememory-protocol", "source": "github" }, "version": "0.4.0", "packages": { "registryType": "pypi", "identifier": "tradememory-protocol", "version": "0.4.0", "transport": { "type": "stdio" }, "environmentVariables": } } 证据：`server.json`
- **.dockerignore**（source_file）：pycache / .pyc .pyo .env .db .sqlite data/ .git/ .github/ .internal/ .devcontainer/ scripts/debug/ .claude/ .pytest cache/ venv/ .egg-info/ docs/ tests/ .md !README.md LICENSE 证据：`.dockerignore`
- **Python**（source_file）：Python pycache / .py cod $py.class .so .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ .egg-info/ .installed.cfg .egg 证据：`.gitignore`
- **.Pre Commit Config**（source_file）：repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files args: '--maxkb=500' - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.4.4 hooks: - id: ruff args: --fix - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.10.0 hooks: - id: mypy additional dependencies: pydantic =2.5.3, fastapi =0.109.0 args: --ignore-missing-imports, --check-untyped-defs pass filenames: false entry: mypy src/tradememory/ 证据：`.pre-commit-config.yaml`
- **Install system dependencies**（source_file）：LABEL maintainer="Mnemox " LABEL description="TradeMemory Hosted API — Multi-tenant AI Trading Memory API" 证据：`Dockerfile`
- **Caddyfile**（source_file）：mcp.mnemox.ai { reverse proxy tradememory-api:8080 encode gzip log { output stdout } } 证据：`deploy/Caddyfile`
- **Docker Compose**（source_file）：services: tradememory-api: build: . container name: tradememory-api expose: - "8080" environment: - TM HOSTED DB=/app/data/hosted.db - TM API KEYS=${TM API KEYS:-} volumes: - tradememory-data:/app/data restart: unless-stopped healthcheck: test: "CMD", "python", "-c", "import urllib.request; urllib.request.urlopen 'http://localhost:8080/api/v1/health' " interval: 30s timeout: 5s retries: 3 caddy: image: caddy:2-alpine container name: tradememory-caddy ports: - "80:80" - "443:443" volumes: - ./deploy/Caddyfile:/etc/caddy/Caddyfile:ro - caddy-data:/data - caddy-config:/config depends on: tradememory-api: condition: service healthy restart: unless-stopped volumes: tradememory-data: caddy-data:… 证据：`docker-compose.yml`
- **Singleton DB — initialized on first use**（source_file）：DB PATH = os.environ.get "TM HOSTED DB", "hosted/hosted.db" ⋮---- app = FastAPI ⋮---- class HostedDB ⋮---- def init self, db path: str = DB PATH ⋮---- def conn self - sqlite3.Connection ⋮---- conn = sqlite3.connect self.db path ⋮---- def init schema self ⋮---- conn = self. conn ⋮---- seed = os.environ.get "TM API KEYS", "" ⋮---- entry = entry.strip ⋮---- parts = entry.split ":" key = parts 0 account id = parts 1 if len parts 1 else "default" plan = parts 2 if len parts 2 else "free" ⋮---- def save subscriber self, email: str, source: str = "waitlist" - bool ⋮---- inserted = conn.execute "SELECT changes " .fetchone 0 ⋮---- def get subscriber count self - int ⋮---- def validate key self, api… 证据：`hosted/server.py`
- **Pyproject**（source_file）：project name = "tradememory-protocol" version = "0.4.0" description = "MCP memory system for AI trading agents. Store, recall, and learn from past trades." authors = {name = "Mnemox", email = "contact@mnemox.ai"} license = {text = "MIT"} readme = "README.md" requires-python = " =3.10" keywords = "mcp", "trading", "ai", "memory", "agent", "reflection" classifiers = "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Topic :: Office/Business :: Financial", "Topic :: Scientific/Engineering :: Artificial Intelli… 证据：`pyproject.toml`
- **Render**（source_file）：services: - type: web name: tradememory-api env: python branch: master buildCommand: pip install -e . startCommand: uvicorn hosted.server:app --host 0.0.0.0 --port $PORT plan: free envVars: - key: TM HOSTED DB value: /tmp/hosted.db - key: TM API KEYS sync: false domains: - mcp.mnemox.ai 证据：`render.yaml`
- **Daily 2026 03 01**（source_file）：============================================================ Daily Trading Monitor — 2026-03-01 ============================================================ 证据：`reports/daily_2026-03-01.txt`
- **Weekly 2026 03 01**（source_file）：================================================================= Weekly Trading Report Period: 2026-02-15 → 2026-03-01 ================================================================= 证据：`reports/weekly_2026-03-01.txt`
- **Requirements Dashboard**（source_file）：streamlit =1.28.0 pandas =2.0.0 plotly =5.17.0 httpx =0.25.0 证据：`requirements-dashboard.txt`
- **Optional: MT5 integration required for mt5 sync.py**（source_file）：fastapi =0.109.0 fastmcp =2.0.0 uvicorn =0.27.0 pydantic =2.5.3 pytest =7.4.4 pytest-asyncio =0.23.3 httpx =0.26.0 python-dotenv =1.0.0 requests =2.31.0 证据：`requirements.txt`
- **Tradememory Autostart**（source_file）：Auto-start TradeMemory services tradememory server + mt5 sync.py on user login TradeMemory Protocol true PT30S InteractiveToken LeastPrivilege IgnoreNew false false true true false true true false false PT0S cmd.exe /c "C:\Users\johns\projects\tradememory-protocol\scripts\start services.bat" C:\Users\johns\projects\tradememory-protocol 证据：`scripts/TradeMemory_AutoStart.xml`
- **Fallback to legacy endpoint**（source_file）：BINANCE API KEY = os.getenv "BINANCE API KEY", "" BINANCE API SECRET = os.getenv "BINANCE API SECRET", "" BINANCE BASE URL = os.getenv "BINANCE BASE URL", "https://api.binance.com" TRADEMEMORY API = os.getenv "TRADEMEMORY API", "http://localhost:8000" SYNC INTERVAL = int os.getenv "BINANCE SYNC INTERVAL", "60" ⋮---- WATCH SYMBOLS = ⋮---- last trade id: Dict str, int = {} ⋮---- def sign params: Dict str, Any - str ⋮---- query string = urllib.parse.urlencode params ⋮---- def binance get endpoint: str, params: Optional Dict str, Any = None, signed: bool = False - Any ⋮---- url = f"{BINANCE BASE URL}{endpoint}" params = params or {} ⋮---- headers = {"X-MBX-APIKEY": BINANCE API KEY} resp = reque… 证据：`scripts/binance_sync.py`
- **Show open positions**（source_file）：path = r'C:\Users\johns\AppData\Roaming\MetaTrader 5\terminal64.exe' ⋮---- info = mt5.account info ⋮---- Show open positions positions = mt5.positions get ⋮---- Recent deals now = datetime.now timezone.utc deals = mt5.history deals get now - timedelta days=3 , now ⋮---- t = datetime.fromtimestamp d.time, tz=timezone.utc dtype = "BUY" if d.type == 0 else "SELL" if d.type == 1 else f"type={d.type}" 证据：`scripts/check_mt5.py`
- **5. Large open position risk**（source_file）：PROJECT ROOT = Path file .parent.parent ⋮---- MAGIC TO STRATEGY = { ⋮---- DB PATH = PROJECT ROOT / "data" / "tradememory.db" ⋮---- BACKTEST BASELINE = { ⋮---- def get db trades days back=30 ⋮---- conn = sqlite3.connect str DB PATH ⋮---- cutoff = datetime.now - timedelta days=days back .isoformat rows = conn.execute ⋮---- def get mt5 open positions ⋮---- mt5 path = os.getenv "MT5 PATH", "" init kwargs = dict ⋮---- positions = MT5.positions get account = MT5.account info balance = account.balance if account else 0 ⋮---- result = ⋮---- strategy = MAGIC TO STRATEGY.get p.magic, f"Unknown {p.magic}" ⋮---- def detect anomalies trades, open positions, balance ⋮---- alerts = ⋮---- strategy trades =… 证据：`scripts/daily_monitor.py`
- **Truncate to Discord embed limit 4096 chars**（source_file）：TRADEMEMORY API = os.getenv 'TRADEMEMORY API', 'http://localhost:8000' PROJECT DIR = os.path.dirname os.path.abspath file OUTPUT DIR = os.getenv 'REFLECTION OUTPUT DIR', os.path.join PROJECT DIR, 'reflections' DISCORD WEBHOOK URL = os.getenv "DISCORD WEBHOOK URL", "" ⋮---- def send discord title: str, message: str, color: int = 0x9B59B6 ⋮---- """Send a Discord embed notification. Silently fails if no webhook configured.""" ⋮---- Truncate to Discord embed limit 4096 chars ⋮---- message = message :3997 + "..." payload = { ⋮---- def generate daily reflection target date: date = None - str ⋮---- target date = date.today ⋮---- date str = target date.isoformat ⋮---- response = requests.post ⋮----… 证据：`scripts/daily_reflection.py`
- **========== Section 4: Session Heatmap ==========**（source_file）：API BASE URL = os.getenv "TRADEMEMORY API URL", "http://localhost:8000" API TIMEOUT = float os.getenv "API TIMEOUT", "10.0" REFLECTIONS DIR = Path os.getenv "REFLECTIONS DIR", "./reflections" ⋮---- def check api health ⋮---- response = client.get f"{API BASE URL}/health" ⋮---- def fetch trade history days=7 ⋮---- response = client.post ⋮---- data = response.json ⋮---- trades = data.get "trades", ⋮---- cutoff date = datetime.now - timedelta days=days recent trades = ⋮---- def load reflections days=7 ⋮---- """讀取最近 N 天的 reflection 報告""" reflections = ⋮---- target date = datetime.now - timedelta days=i filename = f"reflection {target date.strftime '%Y-%m-%d' }.txt" filepath = REFLECTIONS DIR /… 证据：`scripts/dashboard.py`
- 其余 19 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

## 宿主 AI 必须遵守的规则

- **把本资产当作开工前上下文，而不是运行环境。**：AI Context Pack 只包含证据化项目理解，不包含目标项目的可执行状态。 证据：`README.md`, `CLAUDE.md`, `docs/API.md`
- **回答用户时区分可预览内容与必须安装后才能验证的内容。**：安装前体验的消费者价值来自降低误装和误判，而不是伪装成真实运行。 证据：`README.md`, `CLAUDE.md`, `docs/API.md`

## 用户开工前应该回答的问题

- 你准备在哪个宿主 AI 或本地环境中使用它？
- 你只是想先体验工作流，还是准备真实安装？
- 你最在意的是安装成本、输出质量、还是和现有规则的冲突？

## 验收标准

- 所有能力声明都能回指到 evidence_refs 中的文件路径。
- AI_CONTEXT_PACK.md 没有把预览包装成真实运行。
- 用户能在 3 分钟内看懂适合谁、能做什么、如何开始和风险边界。

---

## Doramagic Context Augmentation

下面内容用于强化 Repomix/AI Context Pack 主体。Human Manual 只提供阅读骨架；踩坑日志会被转成宿主 AI 必须遵守的工作约束。

## Human Manual 骨架

使用规则：这里只是项目阅读路线和显著性信号，不是事实权威。具体事实仍必须回到 repo evidence / Claim Graph。

宿主 AI 硬性规则：
- 不得把页标题、章节顺序、摘要或 importance 当作项目事实证据。
- 解释 Human Manual 骨架时，必须明确说它只是阅读路线/显著性信号。
- 能力、安装、兼容性、运行状态和风险判断必须引用 repo evidence、source path 或 Claim Graph。

- **项目概览与快速上手**：importance `high`
  - source_paths: README.md, docs/QUICK_START.md, docs/TUTORIAL.md, docs/TUTORIAL_ZH.md, .env.example
- **系统架构与核心模块**：importance `high`
  - source_paths: docs/ARCHITECTURE.md, docs/API.md, docs/SCHEMA.md, src/tradememory/__init__.py, src/tradememory/models.py
- **OWM 认知记忆与复盘引擎**：importance `high`
  - source_paths: docs/OWM_FRAMEWORK.md, docs/REFLECTION_ENGINE_GUIDE.md, docs/REFLECTION_FORMAT.md, docs/DAILY_REFLECTION_SETUP.md, src/tradememory/owm/__init__.py
- **多平台集成、部署与运维**：importance `high`
  - source_paths: docs/MT5_SYNC_SETUP.md, docs/deployment.md, docs/hosted-api-spec.md, SECURITY.md, ROADMAP.md

## Repo Inspection Evidence / 源码检查证据

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `ee4ff073f57df848cdadde98c17d717661eb52ef`
- inspected_files: `Dockerfile`, `README.md`, `docker-compose.yml`, `pyproject.toml`, `requirements.txt`, `docs/API.md`, `docs/ARCHITECTURE.md`, `docs/AWESOME_LISTS.md`, `docs/BEFORE_AFTER.md`, `docs/DAILY_REFLECTION_SETUP.md`, `docs/MT5_SYNC_SETUP.md`, `docs/OWM_FRAMEWORK.md`, `docs/QUICK_START.md`, `docs/REFLECTION_ENGINE_GUIDE.md`, `docs/REFLECTION_FORMAT.md`, `docs/SCHEMA.md`, `docs/TUTORIAL.md`, `docs/TUTORIAL_ZH.md`, `docs/deployment.md`, `docs/hosted-api-spec.md`

宿主 AI 硬性规则：
- 没有 repo_clone_verified=true 时，不得声称已经读过源码。
- 没有 repo_inspection_verified=true 时，不得把 README/docs/package 文件判断写成事实。
- 没有 quick_start_verified=true 时，不得声称 Quick Start 已跑通。

## Doramagic Pitfall Constraints / 踩坑约束

这些规则来自 Doramagic 发现、验证或编译过程中的项目专属坑点。宿主 AI 必须把它们当作工作约束，而不是普通说明文字。

### Constraint 1: 涉及密钥、隐私或敏感领域

- Trigger: 项目文本出现 secret/private key/privacy/trading/finance 等敏感关键词。
- Host AI rule: 补敏感数据流、密钥存储和权限边界审查。
- Why it matters: 金融、交易、隐私和密钥场景必须比普通工具更保守。
- Evidence: packet_text.keyword_scan | https://github.com/Eltano1985/tradememory-protocol | matched secret / private key / privacy / trading / finance keyword
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 能力判断依赖假设

- Trigger: README/documentation is current enough for a first validation pass.
- Host AI rule: 将假设转成下游验证清单。
- Why it matters: 假设不成立时，用户拿不到承诺的能力。
- Evidence: capability.assumptions | https://github.com/Eltano1985/tradememory-protocol | README/documentation is current enough for a first validation pass.
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 3: 维护活跃度未知

- Trigger: 未记录 last_activity_observed。
- Host AI rule: 补 GitHub 最近 commit、release、issue/PR 响应信号。
- Why it matters: 新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。
- Evidence: evidence.maintainer_signals | https://github.com/Eltano1985/tradememory-protocol | last_activity_observed missing
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

- Trigger: no_demo
- Evidence: downstream_validation.risk_items | https://github.com/Eltano1985/tradememory-protocol | no_demo; severity=medium
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 存在评分风险

- Trigger: no_demo
- Why it matters: 风险会影响是否适合普通用户安装。
- Evidence: risks.scoring_risks | https://github.com/Eltano1985/tradememory-protocol | no_demo; severity=medium
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: issue/PR 响应质量未知

- Trigger: issue_or_pr_quality=unknown。
- Host AI rule: 抽样最近 issue/PR，判断是否长期无人处理。
- Why it matters: 用户无法判断遇到问题后是否有人维护。
- Evidence: evidence.maintainer_signals | https://github.com/Eltano1985/tradememory-protocol | issue_or_pr_quality=unknown
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 7: 发布节奏不明确

- Trigger: release_recency=unknown。
- Host AI rule: 确认最近 release/tag 和 README 安装命令是否一致。
- Why it matters: 安装命令和文档可能落后于代码，用户踩坑概率升高。
- Evidence: evidence.maintainer_signals | https://github.com/Eltano1985/tradememory-protocol | release_recency=unknown
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。
