{
  "schema": "agent-context/v1",
  "repo": "trading-matrix",
  "generatedAt": "2026-07-04T12:53:14.224Z",
  "maturity": "mature",
  "entrypoints": {
    "interactive": "../interactive/index.html",
    "briefing": "agent_briefing.md",
    "architectureMap": "architecture_map.md",
    "apiCatalog": "api_catalog.md",
    "modelCatalog": "model_catalog.md",
    "runtimeFlows": "runtime_flows.md"
  },
  "modules": [
    {
      "id": "identity_access",
      "name": "identity_access",
      "path": "web/src/features/auth",
      "componentCount": 13,
      "fileCount": 0,
      "summary": "Identity Access The identity access module owns the Trading Matrix frontend identity boundary: account registration, login, OTP enrollment and verification, session persistence, invite visibility, and route-level access decisions. It is imp",
      "components": [
        "web/src/features/auth/hooks/useLoginFlow.ts::LoginFlowState",
        "web/src/features/auth/hooks/useRegisterFlow.ts::RegisterFlowState",
        "web/src/features/auth/stores/index.ts::AuthState",
        "web/src/features/auth/types/auth.types.ts::RegisterState",
        "web/src/features/auth/types/index.ts::VerifyOtpRequest",
        "web/src/features/auth/types/index.ts::CompleteRegistrationRequest",
        "web/src/features/auth/types/index.ts::LoginResponse",
        "web/src/features/auth/types/index.ts::RegisterResponse",
        "web/src/features/auth/types/index.ts::RegisterRequest",
        "web/src/features/auth/types/index.ts::VerifyOtpResponse",
        "web/src/features/auth/types/index.ts::CompleteRegistrationResponse",
        "web/src/features/auth/types/index.ts::LoginRequest",
        "web/src/features/invites/types/index.ts::InviteInfoResponse"
      ],
      "label": "identity_access",
      "responsibility": "CodeWiki 模块，需结合源码继续补充责任边界。",
      "paths": [
        "web/src/features/auth"
      ],
      "doc": "identity_access.md"
    },
    {
      "id": "admin_operations",
      "name": "admin_operations",
      "path": "web/src/features/admin",
      "componentCount": 1,
      "fileCount": 0,
      "summary": "Admin Operations The admin operations module provides the Trading Matrix frontend surface for cross-user trader oversight. It lets an authenticated administrator view every trader's owner, model, exchange, account, running state, balance, e",
      "components": [
        "web/src/features/admin/types/index.ts::AdminOverviewResponse"
      ],
      "label": "admin_operations",
      "responsibility": "CodeWiki 模块，需结合源码继续补充责任边界。",
      "paths": [
        "web/src/features/admin"
      ],
      "doc": "admin_operations.md"
    },
    {
      "id": "trader_configuration",
      "name": "trader_configuration",
      "path": "web/src/features/traders",
      "componentCount": 22,
      "fileCount": 0,
      "summary": "Trader Configuration The trader configuration module owns the Trading Matrix frontend surface for configuring AI traders, AI model providers, exchange accounts, credential entry, and Data Horizon source subscriptions for event-driven strate",
      "components": [
        "web/src/features/traders/components/TwoStageKeyModal.tsx::TwoStageKeyModalResult",
        "web/src/features/traders/components/exchanges/ExchangeForm.tsx::ExchangeFormData",
        "web/src/features/traders/components/models/ModelForm.tsx::ModelFormData",
        "web/src/features/traders/components/traders/TraderForm.tsx::TraderFormData",
        "web/src/features/traders/types/index.ts::SyncBalanceResponse",
        "web/src/features/traders/types/index.ts::ExchangeTestRequest",
        "web/src/features/traders/types/index.ts::AiModelSupportedResponse",
        "web/src/features/traders/types/index.ts::SourceKolItem",
        "web/src/features/traders/types/index.ts::ExchangeAddResponse",
        "web/src/features/traders/types/index.ts::ListTradersResponse",
        "web/src/features/traders/types/index.ts::ExchangeTestResponse",
        "web/src/features/traders/types/index.ts::AiModelUpdateRequest",
        "web/src/features/traders/types/index.ts::ExchangeSupportedResponse",
        "web/src/features/traders/types/index.ts::AiModelListResponse",
        "web/src/features/traders/types/index.ts::CreateTraderRequest",
        "web/src/features/traders/types/index.ts::SourceItem",
        "web/src/features/traders/types/index.ts::AiModelTestRequest",
        "web/src/features/traders/types/index.ts::AiModelTestResponse",
        "web/src/features/traders/types/index.ts::ExchangeListResponse",
        "web/src/features/traders/types/index.ts::UpdateTraderRequest",
        "web/src/features/traders/types/index.ts::SelectedSourceItem",
        "web/src/lib/crypto.ts::CryptoService"
      ],
      "label": "交易员配置",
      "responsibility": "维护交易员、Exchange、AI Model、信息源订阅和密钥传输检查。",
      "paths": [
        "web/src/features/traders",
        "server/internal/handler/trader",
        "server/internal/handler/exchange",
        "server/internal/handler/aiModel"
      ],
      "doc": "trader_configuration.md"
    },
    {
      "id": "strategy_studio",
      "name": "strategy_studio",
      "path": "web/src/features/strategy",
      "componentCount": 9,
      "fileCount": 0,
      "summary": "Strategy Studio The strategy studio module is the Trading Matrix strategy-authoring surface. It lets an authenticated user create, edit, activate, duplicate, publish, clone, preview, and test strategy configurations that later drive trader ",
      "components": [
        "web/src/features/strategy/types/strategy.ts::PreviewPromptReq",
        "web/src/features/strategy/types/strategy.ts::StrategyTestRunReq",
        "web/src/features/strategy/types/strategy.ts::CreateStrategyReq",
        "web/src/features/strategy/types/strategy.ts::IdReq",
        "web/src/features/strategy/types/strategy.ts::StrategyTestRunResp",
        "web/src/features/strategy/types/strategy.ts::ListStrategiesResp",
        "web/src/features/strategy/types/strategy.ts::PreviewPromptResp",
        "web/src/features/strategy/types/strategy.ts::UpdateStrategyReq",
        "web/src/features/strategy/types/strategy.ts::DuplicateStrategyReq"
      ],
      "label": "strategy_studio",
      "responsibility": "CodeWiki 模块，需结合源码继续补充责任边界。",
      "paths": [
        "web/src/features/strategy"
      ],
      "doc": "strategy_studio.md"
    },
    {
      "id": "live_trading_dashboard",
      "name": "live_trading_dashboard",
      "path": "web/src/features/dashboard",
      "componentCount": 17,
      "fileCount": 0,
      "summary": "Live Trading Dashboard The live trading dashboard module is the Trading Matrix runtime observation surface for configured traders. It lets an authenticated user inspect trader status, account equity, open positions, pending orders, AI decis",
      "components": [
        "web/src/features/dashboard/components/MetricTooltip.tsx::MetricDefinition",
        "web/src/features/dashboard/types/index.ts::Statistics",
        "web/src/features/dashboard/types/index.ts::EventLogsResp",
        "web/src/features/dashboard/types/index.ts::KlineResp",
        "web/src/features/dashboard/types/index.ts::ExchangeListResp",
        "web/src/features/dashboard/types/index.ts::TraderAccount",
        "web/src/features/dashboard/types/index.ts::DecisionsResp",
        "web/src/features/dashboard/types/index.ts::PositionEventResp",
        "web/src/features/dashboard/types/index.ts::TraderStatus",
        "web/src/features/dashboard/types/index.ts::PositionsResp",
        "web/src/features/dashboard/types/index.ts::PositionHistoryResp",
        "web/src/features/dashboard/types/index.ts::TraderFillsResp",
        "web/src/features/dashboard/types/index.ts::ListTradersResp",
        "web/src/features/dashboard/types/index.ts::TraderOrdersResp",
        "web/src/features/dashboard/types/index.ts::TraderOpenOrdersResp",
        "web/src/features/dashboard/types/index.ts::EquityHistoryResp",
        "web/src/features/dashboard/types/index.ts::SyncBalanceResp"
      ],
      "label": "live_trading_dashboard",
      "responsibility": "CodeWiki 模块，需结合源码继续补充责任边界。",
      "paths": [
        "web/src/features/dashboard"
      ],
      "doc": "live_trading_dashboard.md"
    },
    {
      "id": "competition_leaderboard",
      "name": "competition_leaderboard",
      "path": "web/src/features/competition",
      "componentCount": 1,
      "fileCount": 0,
      "summary": "Competition Leaderboard The competition leaderboard module is the Trading Matrix arena view for comparing AI traders by live profitability. It presents visible traders in a ranked leaderboard, highlights the current leader, plots multi-trad",
      "components": [
        "web/src/features/competition/types/index.ts::CompetitionData"
      ],
      "label": "competition_leaderboard",
      "responsibility": "CodeWiki 模块，需结合源码继续补充责任边界。",
      "paths": [
        "web/src/features/competition"
      ],
      "doc": "competition_leaderboard.md"
    },
    {
      "id": "event_backtest_replay",
      "name": "event_backtest_replay",
      "path": "web/src/features/backtest",
      "componentCount": 27,
      "fileCount": 0,
      "summary": "Event Backtest Replay The event backtest replay module is the Trading Matrix historical evaluation surface for AI trading runs and KOL/event-driven replay. It lets developers and operators start simulated AI backtests, replay event signals,",
      "components": [
        "web/src/features/backtest/components/metric-definitions.ts::MetricDefinition",
        "web/src/features/backtest/types/index.ts::DecisionRecord",
        "web/src/features/backtest/types/index.ts::EventSignalItem",
        "web/src/features/backtest/types/index.ts::KolListItem",
        "web/src/features/backtest/types/index.ts::SourceChannelItem",
        "web/src/features/backtest/types/index.ts::BacktestEquityPoint",
        "web/src/features/backtest/types/index.ts::BacktestFormState",
        "web/src/features/backtest/types/index.ts::BacktestStatusPayload",
        "web/src/features/backtest/types/index.ts::EventBacktestTaskCreateResp",
        "web/src/features/backtest/types/index.ts::EventBacktestBatchGetResp",
        "web/src/features/backtest/types/index.ts::EventBacktestTaskItem",
        "web/src/features/backtest/types/index.ts::EventBacktestBatchCreateResp",
        "web/src/features/backtest/types/index.ts::Strategy",
        "web/src/features/backtest/types/index.ts::BacktestKlinesResponse",
        "web/src/features/backtest/types/index.ts::EventBacktestBatchCompareResp",
        "web/src/features/backtest/types/index.ts::BacktestStartConfig",
        "web/src/features/backtest/types/index.ts::EventReplayDecisionItem",
        "web/src/features/backtest/types/index.ts::SourceFacets",
        "web/src/features/backtest/types/index.ts::SourceByKolItem",
        "web/src/features/backtest/types/index.ts::KolSourceItem",
        "web/src/features/backtest/types/index.ts::AIModel",
        "web/src/features/backtest/types/index.ts::BacktestMetrics",
        "web/src/features/backtest/types/index.ts::EventProfileResp",
        "web/src/features/backtest/types/index.ts::ProfileFilter",
        "web/src/features/backtest/types/index.ts::BacktestTradeEvent",
        "web/src/features/backtest/types/index.ts::BacktestRunsResponse",
        "web/src/features/backtest/types/index.ts::EventTradeItem"
      ],
      "label": "event_backtest_replay",
      "responsibility": "CodeWiki 模块，需结合源码继续补充责任边界。",
      "paths": [
        "web/src/features/backtest"
      ],
      "doc": "event_backtest_replay.md"
    },
    {
      "id": "raceboard_candidate_pipeline",
      "name": "raceboard_candidate_pipeline",
      "path": "web/src/features/raceboard",
      "componentCount": 9,
      "fileCount": 0,
      "summary": "Raceboard Candidate Pipeline The raceboard candidate pipeline module is the Trading Matrix governance surface for moving KOL-derived opportunities from Data Horizon candidate signals into Trading Matrix validation, backtesting, trader confi",
      "components": [
        "web/src/features/raceboard/types/candidate.ts::ValidationProgressResponse",
        "web/src/features/raceboard/types/candidate.ts::EventFunnelResponse",
        "web/src/features/raceboard/types/candidate.ts::CandidateActionResponse",
        "web/src/features/raceboard/types/candidate.ts::CandidateDetailResponse",
        "web/src/features/raceboard/types/candidate.ts::CandidateListResponse",
        "web/src/features/raceboard/types/candidate.ts::CandidateActionRequest",
        "web/src/features/raceboard/types/index.ts::OpsLogRequest",
        "web/src/features/raceboard/types/index.ts::OpsLogResponse",
        "web/src/features/raceboard/types/index.ts::RaceboardSnapshot"
      ],
      "label": "raceboard_candidate_pipeline",
      "responsibility": "CodeWiki 模块，需结合源码继续补充责任边界。",
      "paths": [
        "web/src/features/raceboard"
      ],
      "doc": "raceboard_candidate_pipeline.md"
    },
    {
      "id": "debate_arena",
      "name": "debate_arena",
      "path": "web/src/features/debate-arena",
      "componentCount": 6,
      "fileCount": 0,
      "summary": "Debate Arena The debate arena module is the Trading Matrix auxiliary AI-consensus workbench. It lets an authenticated user create a multi-participant AI debate around one symbol and one strategy, run several rounds of model commentary, coll",
      "components": [
        "web/src/features/debate-arena/types/index.ts::ListDebatesResponse",
        "web/src/features/debate-arena/types/index.ts::CreateDebateResponse",
        "web/src/features/debate-arena/types/index.ts::DebatePersonalityInfo",
        "web/src/features/debate-arena/types/index.ts::CreateDebateRequest",
        "web/src/features/debate-arena/types/index.ts::GetDebateResponse",
        "web/src/features/debate-arena/types/index.ts::ExecuteDebateResponse"
      ],
      "label": "Debate Arena",
      "responsibility": "多智能体辩论、人格参与者、消息、投票和共识决策。",
      "paths": [
        "web/src/features/debate-arena",
        "server/internal/handler/debate",
        "server/pkg/debate"
      ],
      "doc": "debate_arena.md"
    }
  ],
  "diagrams": [
    {
      "id": "architecture",
      "title": "Trading Matrix 系统架构图",
      "description": "从前端路由到 Go API、领域逻辑、执行引擎、辩论包、外部系统和持久化模型的主链路。",
      "mermaid": "diagrams/architecture.mmd",
      "svg": "diagrams/architecture.svg",
      "drawio": "diagrams/architecture.drawio"
    },
    {
      "id": "runtime-flow",
      "title": "实时交易运行时序图",
      "description": "展示交易员从配置、启动、执行循环到实时看板读取的状态流。",
      "mermaid": "diagrams/runtime-flow.mmd",
      "svg": "diagrams/runtime-flow.svg",
      "drawio": "diagrams/runtime-flow.drawio"
    },
    {
      "id": "api-entrypoints",
      "title": "API 入口分层图",
      "description": "按 /api 前缀聚合后端路由，便于快速定位前端功能到 Go handler/logic 的入口。",
      "mermaid": "diagrams/api-entrypoints.mmd",
      "svg": "diagrams/api-entrypoints.svg",
      "drawio": null
    },
    {
      "id": "model-contracts",
      "title": "模型与数据契约图",
      "description": "按领域聚合 TypeScript 类型和 Go struct，显示前后端契约的主要落点。",
      "mermaid": "diagrams/model-contracts.mmd",
      "svg": "diagrams/model-contracts.svg",
      "drawio": null
    },
    {
      "id": "module-dependencies",
      "title": "模块关系图",
      "description": "面向理解和复用的模块依赖图，突出认证、配置、策略、执行、回测、辩论和运营之间的关系。",
      "mermaid": "diagrams/module-dependencies.mmd",
      "svg": "diagrams/module-dependencies.svg",
      "drawio": "diagrams/module-dependencies.drawio"
    },
    {
      "id": "event-backtest-flow",
      "title": "事件回测与 Execution Replay 流程图",
      "description": "把上游 KOL/频道事件转为信号、任务、批次、回放决策和可比较指标。",
      "mermaid": "diagrams/event-backtest-flow.mmd",
      "svg": "diagrams/event-backtest-flow.svg",
      "drawio": null
    },
    {
      "id": "debate-flow",
      "title": "Debate Arena 流程图",
      "description": "展示多智能体辩论从会话创建、人格参与者、LLM 回合、投票到共识的过程。",
      "mermaid": "diagrams/debate-flow.mmd",
      "svg": "diagrams/debate-flow.svg",
      "drawio": null
    },
    {
      "id": "admin-observability-flow",
      "title": "管理员观测流程图",
      "description": "说明 AdminRoute 权限、全局交易员 overview 和只读 dashboard 钻取边界。",
      "mermaid": "diagrams/admin-observability-flow.mmd",
      "svg": "diagrams/admin-observability-flow.svg",
      "drawio": null
    },
    {
      "id": "transport-crypto-flow",
      "title": "敏感配置传输加密图",
      "description": "解释前端 WebCrypto 混合加密如何保护 Exchange/AI Model 等敏感配置。",
      "mermaid": "diagrams/transport-crypto-flow.mmd",
      "svg": "diagrams/transport-crypto-flow.svg",
      "drawio": null
    }
  ],
  "repoPath": "<LOCAL_PATH>",
  "artifactProfile": {
    "builder": "trading-matrix-enhanced-builder",
    "status": "mature",
    "qualityTier": "mature",
    "genericFallback": false,
    "capabilities": {
      "repoSpecificRuntimeExtraction": true,
      "apiModelCatalogs": true,
      "focusedArchitectureDiagrams": true,
      "chineseInteractiveDocs": true
    }
  },
  "recommendedReadOrder": [
    {
      "path": "overview.md",
      "purpose": "Repository-level CodeWiki overview and module map."
    },
    {
      "path": "interactive/index.html",
      "purpose": "Primary visual entry for human and agent navigation."
    },
    {
      "path": "event_backtest_replay.md",
      "purpose": "Latest event-backtest, signal parsing, replay, and parse_incomplete behavior."
    },
    {
      "path": "knowledge_pack/architecture_map.md",
      "purpose": "Architecture and module responsibility summary."
    },
    {
      "path": "knowledge_pack/api_catalog.md",
      "purpose": "Backend route and frontend endpoint surface."
    },
    {
      "path": "knowledge_pack/model_catalog.md",
      "purpose": "TypeScript, Go, and persistence contract index."
    },
    {
      "path": "knowledge_pack/runtime_flows.md",
      "purpose": "Trading, event replay, debate, and admin runtime flows."
    },
    {
      "path": "diagrams/index.html",
      "purpose": "Focused architecture and flow diagrams."
    }
  ],
  "usage": {
    "readOrder": [
      {
        "path": "overview.md",
        "purpose": "Repository-level CodeWiki overview and module map."
      },
      {
        "path": "interactive/index.html",
        "purpose": "Primary visual entry for human and agent navigation."
      },
      {
        "path": "event_backtest_replay.md",
        "purpose": "Latest event-backtest, signal parsing, replay, and parse_incomplete behavior."
      },
      {
        "path": "knowledge_pack/architecture_map.md",
        "purpose": "Architecture and module responsibility summary."
      },
      {
        "path": "knowledge_pack/api_catalog.md",
        "purpose": "Backend route and frontend endpoint surface."
      },
      {
        "path": "knowledge_pack/model_catalog.md",
        "purpose": "TypeScript, Go, and persistence contract index."
      },
      {
        "path": "knowledge_pack/runtime_flows.md",
        "purpose": "Trading, event replay, debate, and admin runtime flows."
      },
      {
        "path": "diagrams/index.html",
        "purpose": "Focused architecture and flow diagrams."
      }
    ],
    "primaryEntry": "../interactive/index.html"
  },
  "architecture": {
    "relationshipGraph": {
      "schema": "reference-agent-wiki/relationship-graph/v1",
      "relationships": [
        {
          "type": "module_dependency",
          "from": "identity_access",
          "to": "trader_configuration",
          "label": "JWT session gates trader/model/exchange configuration",
          "evidence": [
            {
              "path": "web/src/routes/index.tsx",
              "line": 1
            }
          ]
        },
        {
          "type": "module_dependency",
          "from": "trader_configuration",
          "to": "strategy_studio",
          "label": "strategy forms reuse AI model, exchange, source and trader concepts",
          "evidence": [
            {
              "path": "web/src/features/strategy/components/StrategyPage.tsx",
              "line": 1
            }
          ]
        },
        {
          "type": "module_dependency",
          "from": "strategy_studio",
          "to": "event_backtest_replay",
          "label": "event_trading strategies are consumed by event backtest tasks",
          "evidence": [
            {
              "path": "server/internal/logic/event_backtest/task_create_helper.go",
              "line": 1
            }
          ]
        },
        {
          "type": "module_dependency",
          "from": "event_backtest_replay",
          "to": "raceboard_candidate_pipeline",
          "label": "candidate admission can submit event backtest batches as validation evidence",
          "evidence": [
            {
              "path": "server/internal/logic/raceboard/candidate_action_logic.go",
              "line": 1
            }
          ]
        },
        {
          "type": "module_dependency",
          "from": "trader_configuration",
          "to": "live_trading_dashboard",
          "label": "configured traders feed runtime dashboard state and controls",
          "evidence": [
            {
              "path": "web/src/features/traders/api/index.ts",
              "line": 1
            }
          ]
        },
        {
          "type": "call_chain",
          "from": "web/src/features/backtest/api/index.ts",
          "to": "server/internal/logic/event_backtest",
          "label": "frontend eventBacktestAPI calls go-zero event_backtest logic",
          "evidence": [
            {
              "path": "web/src/features/backtest/api/index.ts",
              "line": 1
            }
          ]
        },
        {
          "type": "call_chain",
          "from": "server/internal/handler/routes.go",
          "to": "server/internal/logic/event_backtest",
          "label": "routes dispatch /api/event-backtest handlers into logic layer",
          "evidence": [
            {
              "path": "server/internal/handler/routes.go",
              "line": 1
            }
          ]
        },
        {
          "type": "call_chain",
          "from": "server/internal/logic/event_backtest",
          "to": "server/pkg/event_backtest",
          "label": "event-backtest logic delegates parse and replay simulation to package runtime",
          "evidence": [
            {
              "path": "server/internal/logic/event_backtest/event_signal_parse_logic.go",
              "line": 1
            }
          ]
        },
        {
          "type": "call_chain",
          "from": "server/internal/logic/debate_arena",
          "to": "server/pkg/debate",
          "label": "debate arena logic delegates multi-agent dialogue and consensus to debate package",
          "evidence": [
            {
              "path": "server/pkg/debate/manager.go",
              "line": 1
            }
          ]
        },
        {
          "type": "upstream_downstream",
          "from": "Data Horizon source catalog",
          "to": "event_backtest_replay",
          "label": "KOL/channel evidence is selected upstream and converted into replay artifacts",
          "evidence": [
            {
              "path": "server/internal/logic/source",
              "line": 1
            }
          ]
        },
        {
          "type": "upstream_downstream",
          "from": "event_backtest_replay",
          "to": "raceboard_candidate_pipeline",
          "label": "backtest batch outcomes support candidate validation",
          "evidence": [
            {
              "path": "server/internal/types/types.go",
              "line": 1045
            }
          ]
        },
        {
          "type": "upstream_downstream",
          "from": "strategy_studio",
          "to": "live_trading_dashboard",
          "label": "strategy and trader configuration drive runtime status and execution telemetry",
          "evidence": [
            {
              "path": "web/src/features/dashboard/components/DashboardPage.tsx",
              "line": 1
            }
          ]
        },
        {
          "type": "data_flow",
          "from": "web/src/features/backtest/components/SourcePicker.tsx",
          "to": "server/internal/logic/source",
          "label": "source picker filters KOL/source catalog through /api/source endpoints",
          "evidence": [
            {
              "path": "web/src/features/backtest/components/SourcePicker.tsx",
              "line": 1
            }
          ]
        },
        {
          "type": "data_flow",
          "from": "server/pkg/event_backtest/parser.go",
          "to": "tm_event_signal",
          "label": "LLM extracted signals are persisted with status/outcome fields",
          "evidence": [
            {
              "path": "server/pkg/event_backtest/parser.go",
              "line": 172
            }
          ]
        },
        {
          "type": "data_flow",
          "from": "tm_event_signal",
          "to": "tm_event_replay_decision",
          "label": "execution replay decisions join parsed signals for audit views",
          "evidence": [
            {
              "path": "server/internal/model/mysql/event_replay_decision_model.go",
              "line": 63
            }
          ]
        },
        {
          "type": "data_flow",
          "from": "server/internal/engine",
          "to": "web/src/features/dashboard",
          "label": "runtime engine state is persisted and polled by dashboard components",
          "evidence": [
            {
              "path": "server/internal/engine",
              "line": 1
            }
          ]
        }
      ],
      "byType": {
        "module_dependency": 5,
        "call_chain": 4,
        "upstream_downstream": 3,
        "data_flow": 4
      },
      "namedSubgraphs": {
        "stateMachines": [
          {
            "id": "event-backtest-task-state",
            "states": [
              "pending",
              "analyzing",
              "running",
              "parse_incomplete",
              "partial_failed",
              "failed",
              "done"
            ],
            "evidence": [
              {
                "path": "server/internal/consts/backtest.go",
                "line": 1
              },
              {
                "path": "server/internal/logic/event_backtest/event_signal_retry_errors_logic.go",
                "line": 31
              }
            ]
          },
          {
            "id": "batch-pause-resume-state",
            "states": [
              "pending",
              "running",
              "paused",
              "done",
              "failed"
            ],
            "evidence": [
              {
                "path": "server/api/event_backtest.api",
                "line": 1
              }
            ]
          }
        ],
        "securityBoundaries": [
          {
            "id": "jwt-protected-api",
            "boundary": "Protected routes and JWT middleware guard Trading Matrix API access",
            "evidence": [
              {
                "path": "server/api/event_backtest.api",
                "line": 1
              },
              {
                "path": "web/src/routes/index.tsx",
                "line": 1
              }
            ]
          },
          {
            "id": "admin-route-boundary",
            "boundary": "AdminRoute and User.is_admin gate admin operations",
            "evidence": [
              {
                "path": "web/src/routes/index.tsx",
                "line": 1
              },
              {
                "path": "server/internal/logic/admin",
                "line": 1
              }
            ]
          },
          {
            "id": "credential-transport-boundary",
            "boundary": "WebCrypto hybrid encryption protects AI model and exchange secret submission",
            "evidence": [
              {
                "path": "web/src/lib/crypto.ts",
                "line": 1
              }
            ]
          }
        ]
      },
      "moduleDependencies": [
        {
          "type": "module_dependency",
          "from": "identity_access",
          "to": "trader_configuration",
          "label": "JWT session gates trader/model/exchange configuration",
          "evidence": [
            {
              "path": "web/src/routes/index.tsx",
              "line": 1
            }
          ]
        },
        {
          "type": "module_dependency",
          "from": "trader_configuration",
          "to": "strategy_studio",
          "label": "strategy forms reuse AI model, exchange, source and trader concepts",
          "evidence": [
            {
              "path": "web/src/features/strategy/components/StrategyPage.tsx",
              "line": 1
            }
          ]
        },
        {
          "type": "module_dependency",
          "from": "strategy_studio",
          "to": "event_backtest_replay",
          "label": "event_trading strategies are consumed by event backtest tasks",
          "evidence": [
            {
              "path": "server/internal/logic/event_backtest/task_create_helper.go",
              "line": 1
            }
          ]
        },
        {
          "type": "module_dependency",
          "from": "event_backtest_replay",
          "to": "raceboard_candidate_pipeline",
          "label": "candidate admission can submit event backtest batches as validation evidence",
          "evidence": [
            {
              "path": "server/internal/logic/raceboard/candidate_action_logic.go",
              "line": 1
            }
          ]
        },
        {
          "type": "module_dependency",
          "from": "trader_configuration",
          "to": "live_trading_dashboard",
          "label": "configured traders feed runtime dashboard state and controls",
          "evidence": [
            {
              "path": "web/src/features/traders/api/index.ts",
              "line": 1
            }
          ]
        }
      ],
      "callChains": [
        {
          "type": "call_chain",
          "from": "web/src/features/backtest/api/index.ts",
          "to": "server/internal/logic/event_backtest",
          "label": "frontend eventBacktestAPI calls go-zero event_backtest logic",
          "evidence": [
            {
              "path": "web/src/features/backtest/api/index.ts",
              "line": 1
            }
          ]
        },
        {
          "type": "call_chain",
          "from": "server/internal/handler/routes.go",
          "to": "server/internal/logic/event_backtest",
          "label": "routes dispatch /api/event-backtest handlers into logic layer",
          "evidence": [
            {
              "path": "server/internal/handler/routes.go",
              "line": 1
            }
          ]
        },
        {
          "type": "call_chain",
          "from": "server/internal/logic/event_backtest",
          "to": "server/pkg/event_backtest",
          "label": "event-backtest logic delegates parse and replay simulation to package runtime",
          "evidence": [
            {
              "path": "server/internal/logic/event_backtest/event_signal_parse_logic.go",
              "line": 1
            }
          ]
        },
        {
          "type": "call_chain",
          "from": "server/internal/logic/debate_arena",
          "to": "server/pkg/debate",
          "label": "debate arena logic delegates multi-agent dialogue and consensus to debate package",
          "evidence": [
            {
              "path": "server/pkg/debate/manager.go",
              "line": 1
            }
          ]
        }
      ],
      "upstreamDownstream": [
        {
          "type": "upstream_downstream",
          "from": "Data Horizon source catalog",
          "to": "event_backtest_replay",
          "label": "KOL/channel evidence is selected upstream and converted into replay artifacts",
          "evidence": [
            {
              "path": "server/internal/logic/source",
              "line": 1
            }
          ]
        },
        {
          "type": "upstream_downstream",
          "from": "event_backtest_replay",
          "to": "raceboard_candidate_pipeline",
          "label": "backtest batch outcomes support candidate validation",
          "evidence": [
            {
              "path": "server/internal/types/types.go",
              "line": 1045
            }
          ]
        },
        {
          "type": "upstream_downstream",
          "from": "strategy_studio",
          "to": "live_trading_dashboard",
          "label": "strategy and trader configuration drive runtime status and execution telemetry",
          "evidence": [
            {
              "path": "web/src/features/dashboard/components/DashboardPage.tsx",
              "line": 1
            }
          ]
        }
      ],
      "dataFlows": [
        {
          "type": "data_flow",
          "from": "web/src/features/backtest/components/SourcePicker.tsx",
          "to": "server/internal/logic/source",
          "label": "source picker filters KOL/source catalog through /api/source endpoints",
          "evidence": [
            {
              "path": "web/src/features/backtest/components/SourcePicker.tsx",
              "line": 1
            }
          ]
        },
        {
          "type": "data_flow",
          "from": "server/pkg/event_backtest/parser.go",
          "to": "tm_event_signal",
          "label": "LLM extracted signals are persisted with status/outcome fields",
          "evidence": [
            {
              "path": "server/pkg/event_backtest/parser.go",
              "line": 172
            }
          ]
        },
        {
          "type": "data_flow",
          "from": "tm_event_signal",
          "to": "tm_event_replay_decision",
          "label": "execution replay decisions join parsed signals for audit views",
          "evidence": [
            {
              "path": "server/internal/model/mysql/event_replay_decision_model.go",
              "line": 63
            }
          ]
        },
        {
          "type": "data_flow",
          "from": "server/internal/engine",
          "to": "web/src/features/dashboard",
          "label": "runtime engine state is persisted and polled by dashboard components",
          "evidence": [
            {
              "path": "server/internal/engine",
              "line": 1
            }
          ]
        }
      ]
    },
    "layerRelationships": [
      {
        "from": "React routes",
        "to": "feature modules",
        "kind": "composition",
        "evidence": [
          {
            "path": "web/src/routes/index.tsx",
            "line": 1
          }
        ]
      },
      {
        "from": "feature API clients",
        "to": "go-zero REST handlers",
        "kind": "http",
        "evidence": [
          {
            "path": "web/src/features/backtest/api/index.ts",
            "line": 1
          }
        ]
      },
      {
        "from": "handlers",
        "to": "domain logic",
        "kind": "dispatch",
        "evidence": [
          {
            "path": "server/internal/handler/routes.go",
            "line": 1
          }
        ]
      },
      {
        "from": "domain logic",
        "to": "mysql models",
        "kind": "persistence",
        "evidence": [
          {
            "path": "server/internal/model/mysql",
            "line": 1
          }
        ]
      },
      {
        "from": "event backtest logic",
        "to": "event runner package",
        "kind": "runtime-call",
        "evidence": [
          {
            "path": "server/pkg/event_backtest/event_runner.go",
            "line": 74
          }
        ]
      },
      {
        "from": "debate arena logic",
        "to": "debate package",
        "kind": "runtime-call",
        "evidence": [
          {
            "path": "server/pkg/debate/manager.go",
            "line": 1
          }
        ]
      },
      {
        "from": "engine/job runtime",
        "to": "exchange and LLM adapters",
        "kind": "external-io",
        "evidence": [
          {
            "path": "server/internal/engine",
            "line": 1
          }
        ]
      }
    ]
  },
  "surfaces": {
    "entrySurface": {
      "schema": "reference-agent-wiki/entry-surface/v1",
      "groups": {
        "frontend_routes": [
          {
            "path": "auth_token",
            "component": "",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "auth_user",
            "component": "",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/",
            "component": "HomeRedirect",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/register",
            "component": "RegisterRoute",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/login",
            "component": "LoginRoute",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/traders",
            "component": "TradersRoute",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/strategy",
            "component": "StrategyRoute",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/dashboard",
            "component": "DashboardRoute",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/competition",
            "component": "CompetitionRoute",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/debate-arena",
            "component": "DebateArenaRoute",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/dev-tracker",
            "component": "DevTrackerPage",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/backtest",
            "component": "BacktestPage",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/backtest/batch/:batchId",
            "component": "BatchComparePage",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/backtest/task/:taskId",
            "component": "TaskDetailPage",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/strategy-market",
            "component": "StrategyMarketRoute",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/admin",
            "component": "AdminRoute",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/invites",
            "component": "InvitesPage",
            "source": "web/src/routes/index.tsx"
          },
          {
            "path": "/raceboard",
            "component": "RaceboardRoute",
            "source": "web/src/routes/index.tsx"
          }
        ],
        "backend_routes": [
          {
            "method": "POST",
            "path": "/api/event/receive",
            "handler": "ReceiveEventHandler",
            "auth": false
          },
          {
            "method": "POST",
            "path": "/api/event/logs",
            "handler": "EventLogsHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/admin/traders/overview",
            "handler": "admin.AdminTradersOverviewHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/admin/sync-all-balances",
            "handler": "admin.AdminSyncAllBalancesHandler",
            "auth": false
          },
          {
            "method": "POST",
            "path": "/api/admin/test-query",
            "handler": "admin.AdminTestQueryHandler",
            "auth": false
          },
          {
            "method": "POST",
            "path": "/api/ai-model/delete",
            "handler": "aiModel.AiModelDeleteHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/ai-model/get",
            "handler": "aiModel.AiModelGetHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/ai-model/list",
            "handler": "aiModel.AiModelListHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/ai-model/supported",
            "handler": "aiModel.AiModelSupportedHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/ai-model/test",
            "handler": "aiModel.AiModelTestHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/ai-model/update",
            "handler": "aiModel.AiModelUpdateHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/auth/complete-registration",
            "handler": "auth.CompleteRegistrationHandler",
            "auth": false
          },
          {
            "method": "POST",
            "path": "/api/auth/login",
            "handler": "auth.LoginHandler",
            "auth": false
          },
          {
            "method": "POST",
            "path": "/api/auth/register",
            "handler": "auth.RegisterHandler",
            "auth": false
          },
          {
            "method": "POST",
            "path": "/api/auth/verify-otp",
            "handler": "auth.VerifyOtpHandler",
            "auth": false
          },
          {
            "method": "POST",
            "path": "/api/auth/logout",
            "handler": "auth.LogoutHandler",
            "auth": true
          },
          {
            "method": "GET",
            "path": "/api/backtest/decisions",
            "handler": "backtest.BacktestDecisionsHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/backtest/delete",
            "handler": "backtest.BacktestDeleteHandler",
            "auth": true
          },
          {
            "method": "GET",
            "path": "/api/backtest/equity",
            "handler": "backtest.BacktestEquityHandler",
            "auth": true
          },
          {
            "method": "GET",
            "path": "/api/backtest/export",
            "handler": "backtest.BacktestExportHandler",
            "auth": true
          },
          {
            "method": "GET",
            "path": "/api/backtest/klines",
            "handler": "backtest.BacktestKlinesHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/backtest/label",
            "handler": "backtest.BacktestLabelHandler",
            "auth": true
          },
          {
            "method": "GET",
            "path": "/api/backtest/metrics",
            "handler": "backtest.BacktestMetricsHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/backtest/pause",
            "handler": "backtest.BacktestPauseHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/backtest/resume",
            "handler": "backtest.BacktestResumeHandler",
            "auth": true
          },
          {
            "method": "GET",
            "path": "/api/backtest/runs",
            "handler": "backtest.BacktestRunsHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/backtest/start",
            "handler": "backtest.BacktestStartHandler",
            "auth": true
          },
          {
            "method": "GET",
            "path": "/api/backtest/status",
            "handler": "backtest.BacktestStatusHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/backtest/stop",
            "handler": "backtest.BacktestStopHandler",
            "auth": true
          },
          {
            "method": "GET",
            "path": "/api/backtest/trace",
            "handler": "backtest.BacktestTraceHandler",
            "auth": true
          },
          {
            "method": "GET",
            "path": "/api/backtest/trades",
            "handler": "backtest.BacktestTradesHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/competition/equity-history-batch",
            "handler": "competition.GetEquityHistoryBatchHandler",
            "auth": false
          },
          {
            "method": "POST",
            "path": "/api/competition/list",
            "handler": "competition.GetCompetitionListHandler",
            "auth": false
          },
          {
            "method": "POST",
            "path": "/api/debate-arena/add",
            "handler": "debate.DebateAddHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/debate-arena/cancel",
            "handler": "debate.DebateCancelHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/debate-arena/delete",
            "handler": "debate.DebateDeleteHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/debate-arena/execute",
            "handler": "debate.DebateExecuteHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/debate-arena/get",
            "handler": "debate.DebateGetHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/debate-arena/list",
            "handler": "debate.DebateListHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/debate-arena/messages",
            "handler": "debate.DebateMessagesHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/debate-arena/personalities",
            "handler": "debate.DebatePersonalitiesHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/debate-arena/start",
            "handler": "debate.DebateStartHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/debate-arena/votes",
            "handler": "debate.DebateVotesHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/demo/add",
            "handler": "demo.DemoAddHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/demo/get",
            "handler": "demo.DemoGetHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/demo/list",
            "handler": "demo.DemoListHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/demo/update",
            "handler": "demo.DemoUpdateHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/compare",
            "handler": "event_backtest.EventBacktestBatchCompareHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/create",
            "handler": "event_backtest.EventBacktestBatchCreateHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/delete",
            "handler": "event_backtest.EventBacktestBatchDeleteHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/get",
            "handler": "event_backtest.EventBacktestBatchGetHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/list",
            "handler": "event_backtest.EventBacktestBatchListHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/pause",
            "handler": "event_backtest.EventBacktestBatchPauseHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/resume",
            "handler": "event_backtest.EventBacktestBatchResumeHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/kline/list",
            "handler": "event_backtest.EventKlineListHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/kol-source/list",
            "handler": "event_backtest.KolSourceListHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/profile",
            "handler": "event_backtest.EventProfileHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/replay/decision/list",
            "handler": "event_backtest.EventReplayDecisionListHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/signal/list",
            "handler": "event_backtest.EventSignalListHandler",
            "auth": true
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/signal/parse",
            "handler": "event_backtest.EventSignalParseHandler",
            "auth": true
          }
        ],
        "event_backtest_api": [
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/compare",
            "handler": "event_backtest.EventBacktestBatchCompareHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/create",
            "handler": "event_backtest.EventBacktestBatchCreateHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/delete",
            "handler": "event_backtest.EventBacktestBatchDeleteHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/get",
            "handler": "event_backtest.EventBacktestBatchGetHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/list",
            "handler": "event_backtest.EventBacktestBatchListHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/pause",
            "handler": "event_backtest.EventBacktestBatchPauseHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/batch/resume",
            "handler": "event_backtest.EventBacktestBatchResumeHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/kline/list",
            "handler": "event_backtest.EventKlineListHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/kol-source/list",
            "handler": "event_backtest.KolSourceListHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/profile",
            "handler": "event_backtest.EventProfileHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/replay/decision/list",
            "handler": "event_backtest.EventReplayDecisionListHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/signal/list",
            "handler": "event_backtest.EventSignalListHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/signal/parse",
            "handler": "event_backtest.EventSignalParseHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/signal/retry-errors",
            "handler": "event_backtest.EventSignalRetryErrorsHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/signal/update",
            "handler": "event_backtest.EventSignalUpdateHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/source/list",
            "handler": "event_backtest.EventSourceListHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/task/create",
            "handler": "event_backtest.EventBacktestTaskCreateHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/task/delete",
            "handler": "event_backtest.EventBacktestTaskDeleteHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/task/get",
            "handler": "event_backtest.EventBacktestTaskGetHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/task/label",
            "handler": "event_backtest.EventBacktestTaskLabelHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/task/list",
            "handler": "event_backtest.EventBacktestTaskListHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/task/retry",
            "handler": "event_backtest.EventBacktestTaskRetryHandler"
          },
          {
            "method": "POST",
            "path": "/api/event-backtest/trade/list",
            "handler": "event_backtest.EventTradeListHandler"
          }
        ],
        "source_integrations": [
          {
            "endpoint": "/event-backtest/batch/compare",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/batch/create",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/batch/delete",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/batch/get",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/batch/list",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/batch/pause",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/batch/resume",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/kline/list",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/kol-source/list",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/profile",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/replay/decision/list",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/signal/list",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/signal/parse",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/signal/retry-errors",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/signal/update",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/source/list",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/task/create",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/task/delete",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/task/get",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/task/label",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/task/list",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/task/retry",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event-backtest/trade/list",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/event/logs",
            "source": "web/src/features/dashboard/api/index.ts",
            "feature": "dashboard"
          },
          {
            "endpoint": "/source/by-ids",
            "source": "web/src/features/traders/api/trader.ts",
            "feature": "traders"
          },
          {
            "endpoint": "/source/by-kol",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/source/by-kol",
            "source": "web/src/features/traders/api/trader.ts",
            "feature": "traders"
          },
          {
            "endpoint": "/source/by-kols",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/source/facets",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          },
          {
            "endpoint": "/source/kol-list",
            "source": "web/src/features/backtest/api/index.ts",
            "feature": "backtest"
          }
        ],
        "agent_reading_entries": [
          {
            "file": "overview.md"
          },
          {
            "file": "event_backtest_replay.md"
          },
          {
            "file": "knowledge_pack/api_catalog.md"
          },
          {
            "file": "knowledge_pack/model_catalog.md"
          },
          {
            "file": "knowledge_pack/runtime_flows.md"
          }
        ]
      }
    }
  },
  "dataAndModels": {
    "typesIndexed": 527,
    "routesIndexed": 133,
    "frontendEndpointsIndexed": 145
  },
  "evidence": {
    "sourceAnchors": [
      "web/src/routes/index.tsx",
      "web/src/features/*",
      "server/internal/handler/routes.go",
      "server/api/*.api",
      "server/internal/logic/*",
      "server/internal/engine",
      "server/internal/job",
      "server/pkg/debate",
      "server/internal/model/mysql"
    ],
    "diagramArtifacts": [
      {
        "id": "architecture",
        "evidence": [
          {
            "path": "web/src/routes/index.tsx",
            "line": 1
          },
          {
            "path": "server/internal/handler/routes.go",
            "line": 1
          }
        ]
      },
      {
        "id": "runtime-flow",
        "evidence": [
          {
            "path": "server/internal/engine",
            "line": 1
          },
          {
            "path": "web/src/features/dashboard/components/DashboardPage.tsx",
            "line": 1
          }
        ]
      },
      {
        "id": "event-backtest-flow",
        "evidence": [
          {
            "path": "web/src/features/backtest/api/index.ts",
            "line": 1
          },
          {
            "path": "server/pkg/event_backtest/parser.go",
            "line": 172
          }
        ]
      },
      {
        "id": "event-backtest-state",
        "evidence": [
          {
            "path": "server/internal/logic/event_backtest/event_signal_retry_errors_logic.go",
            "line": 31
          },
          {
            "path": "server/internal/types/types.go",
            "line": 1045
          }
        ]
      },
      {
        "id": "model-contracts",
        "evidence": [
          {
            "path": "web/src/features/backtest/types/index.ts",
            "line": 1
          },
          {
            "path": "server/internal/types/types.go",
            "line": 782
          }
        ]
      },
      {
        "id": "transport-crypto-flow",
        "evidence": [
          {
            "path": "web/src/lib/crypto.ts",
            "line": 1
          },
          {
            "path": "server/internal/logic/ai_model",
            "line": 1
          }
        ]
      },
      {
        "id": "api-entrypoints",
        "evidence": [
          {
            "path": "server/internal/handler/routes.go",
            "line": 1
          },
          {
            "path": "server/api/event_backtest.api",
            "line": 1
          }
        ]
      },
      {
        "id": "debate-flow",
        "evidence": [
          {
            "path": "server/pkg/debate/manager.go",
            "line": 1
          },
          {
            "path": "web/src/features/debate",
            "line": 1
          }
        ]
      },
      {
        "id": "module-dependencies",
        "evidence": [
          {
            "path": "module_tree.json",
            "line": 1
          },
          {
            "path": "web/src/features",
            "line": 1
          }
        ]
      }
    ]
  },
  "personaEntrypoints": {
    "maintainer": [
      "interactive/index.html",
      "knowledge_pack/architecture_map.md",
      "knowledge_pack/api_catalog.md"
    ],
    "eventBacktestAgent": [
      "event_backtest_replay.md",
      "diagrams/event-backtest-flow.svg",
      "knowledge_pack/runtime_flows.md"
    ],
    "reviewer": [
      "knowledge_pack/evidence_report.md",
      "diagrams/index.html",
      "artifacts_manifest.json"
    ]
  },
  "projectOptimizations": {
    "eventBacktestParsing": {
      "summary": "Document parse_incomplete retry gate, LLM JSON array extraction hardening, and parse-rate versus entry-rate split.",
      "evidence": [
        "event_backtest_replay.md",
        "server/pkg/event_backtest/parser.go",
        "server/internal/logic/event_backtest/event_signal_retry_errors_logic.go"
      ]
    },
    "agentNavigation": {
      "summary": "Expose structured entry surface, API catalog, model catalog, runtime flows, and recommended read order for downstream agents."
    },
    "securityBoundary": {
      "summary": "Separate JWT/admin boundaries from credential transport encryption and Data Horizon source identity."
    },
    "runtimeSeparation": {
      "summary": "Keep Data Horizon sensing, offline replay evidence, raceboard validation, and live execution as distinct ownership surfaces."
    },
    "diagramSemantics": {
      "summary": "Normalize diagram artifacts into architecture, runtime-flow, data-flow, state-machine, model-contract, security-boundary, and entrypoint groups."
    }
  },
  "diagramArtifacts": [
    {
      "id": "architecture",
      "group": "architecture",
      "title": "Trading Matrix System Architecture",
      "file": "diagrams/architecture.svg",
      "type": "svg",
      "interpretation": "Shows the browser, React feature modules, Go REST API, domain logic, runtime engine, debate package, persistence, and external systems.",
      "evidence": [
        {
          "path": "web/src/routes/index.tsx",
          "line": 1
        },
        {
          "path": "server/internal/handler/routes.go",
          "line": 1
        }
      ]
    },
    {
      "id": "runtime-flow",
      "group": "runtime-flow",
      "title": "Live Trading Runtime Flow",
      "file": "diagrams/runtime-flow.svg",
      "type": "svg",
      "interpretation": "Shows trader startup through backend logic, engine/job runtime, exchange/LLM calls, persistence, and dashboard polling.",
      "evidence": [
        {
          "path": "server/internal/engine",
          "line": 1
        },
        {
          "path": "web/src/features/dashboard/components/DashboardPage.tsx",
          "line": 1
        }
      ]
    },
    {
      "id": "event-backtest-flow",
      "group": "data-flow",
      "title": "Event Backtest Data Flow",
      "file": "diagrams/event-backtest-flow.svg",
      "type": "svg",
      "interpretation": "Shows KOL source selection, task creation, LLM parsing, simulation/replay, metrics, batch comparison, and Raceboard feedback.",
      "evidence": [
        {
          "path": "web/src/features/backtest/api/index.ts",
          "line": 1
        },
        {
          "path": "server/pkg/event_backtest/parser.go",
          "line": 172
        }
      ]
    },
    {
      "id": "event-backtest-state",
      "group": "state-machine",
      "title": "Event Backtest State Machine",
      "file": "diagrams/event-backtest-flow.svg",
      "type": "svg",
      "interpretation": "Captures event task movement across pending, analyzing, parse_incomplete, running, done, partial_failed, and retry paths.",
      "evidence": [
        {
          "path": "server/internal/logic/event_backtest/event_signal_retry_errors_logic.go",
          "line": 31
        },
        {
          "path": "server/internal/types/types.go",
          "line": 1045
        }
      ]
    },
    {
      "id": "model-contracts",
      "group": "model-contract",
      "title": "Model And Contract Surface",
      "file": "diagrams/model-contracts.svg",
      "type": "svg",
      "interpretation": "Summarizes TypeScript contracts, Go API types, go-zero API schema, MySQL models, and event backtest tables.",
      "evidence": [
        {
          "path": "web/src/features/backtest/types/index.ts",
          "line": 1
        },
        {
          "path": "server/internal/types/types.go",
          "line": 782
        }
      ]
    },
    {
      "id": "transport-crypto-flow",
      "group": "security-boundary",
      "title": "Credential Transport Security Boundary",
      "file": "diagrams/transport-crypto-flow.svg",
      "type": "svg",
      "interpretation": "Shows browser-side WebCrypto encryption and server-side handling of AI model and exchange credentials.",
      "evidence": [
        {
          "path": "web/src/lib/crypto.ts",
          "line": 1
        },
        {
          "path": "server/internal/logic/ai_model",
          "line": 1
        }
      ]
    },
    {
      "id": "api-entrypoints",
      "group": "entrypoint",
      "title": "API Entrypoints",
      "file": "diagrams/api-entrypoints.svg",
      "type": "svg",
      "interpretation": "Groups major API prefixes and handler domains for agent navigation.",
      "evidence": [
        {
          "path": "server/internal/handler/routes.go",
          "line": 1
        },
        {
          "path": "server/api/event_backtest.api",
          "line": 1
        }
      ]
    },
    {
      "id": "debate-flow",
      "group": "runtime-flow",
      "title": "Debate Arena Flow",
      "file": "diagrams/debate-flow.svg",
      "type": "svg",
      "interpretation": "Shows debate session setup, personality/message generation, votes, consensus, and execution proposal boundary.",
      "evidence": [
        {
          "path": "server/pkg/debate/manager.go",
          "line": 1
        },
        {
          "path": "web/src/features/debate",
          "line": 1
        }
      ]
    },
    {
      "id": "module-dependencies",
      "group": "architecture",
      "title": "Module Dependencies",
      "file": "diagrams/module-dependencies.svg",
      "type": "svg",
      "interpretation": "Shows high-level module dependencies across identity, trader configuration, strategy, backtest, dashboard, raceboard, and debate.",
      "evidence": [
        {
          "path": "module_tree.json",
          "line": 1
        },
        {
          "path": "web/src/features",
          "line": 1
        }
      ]
    }
  ],
  "artifactLinks": {
    "interactive": "../interactive/index.html",
    "diagrams": "../diagrams/index.html",
    "apiCatalog": "api_catalog.md",
    "modelCatalog": "model_catalog.md",
    "runtimeFlows": "runtime_flows.md"
  },
  "coverage": {
    "modules": 9,
    "routes": 133,
    "frontendEndpoints": 145,
    "types": 527,
    "diagrams": 9
  }
}
