dsh-worldquant 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md ADDED
@@ -0,0 +1,169 @@
1
+ # dsh-worldquant
2
+
3
+ [中文](README.md) | **English**
4
+
5
+ > **WorldQuant BRAIN inside DeepSeek Harness.** One bundle mounts a BRAIN MCP server, exposes its tools as `mcp__brain__*`, and adds a preflight check and a safety-first alpha research workflow.
6
+
7
+ [![npm](https://img.shields.io/npm/v/dsh-worldquant?color=blue)](https://www.npmjs.com/package/dsh-worldquant)
8
+ [![dsh-plugin](https://img.shields.io/badge/topic-dsh--plugin-6f42c1)](https://github.com/topics/dsh-plugin)
9
+ [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
10
+
11
+ DeepSeek Harness is a strong agent runtime for long, tool-heavy research loops. WorldQuant BRAIN is a tool-heavy research platform: datasets, fields, simulation settings, submission checks, correlations, and PnL. This plugin connects the two without writing a new BRAIN client: it uses DSH's official MCP bridge and the BRAIN MCP server you already run.
12
+
13
+ Not affiliated with WorldQuant. BRAIN credentials stay on your machine; this package never sends them anywhere except to the MCP server you configure.
14
+
15
+ ## What you get
16
+
17
+ - **`mcp__brain__*` tools** — every tool your BRAIN MCP server publishes appears as a native DSH tool.
18
+ - **`brain_status`** — a local preflight that reports the MCP command and the authentication mode (`env`, `external`, or `missing`), without printing secrets or calling the API.
19
+ - **A workflow, not a toy demo** — the README and prompts below encode the loop that actually matters: explore fields → write an expression → simulate → read checks → compare correlation → only then consider submission.
20
+ - **No build step** — plain ESM JavaScript and a YAML patch. Install from git or npm.
21
+
22
+ ## Install
23
+
24
+ ```sh
25
+ dsh plugin --profile web add dsh-worldquant
26
+ ```
27
+
28
+ Or install straight from GitHub (no build step):
29
+
30
+ ```sh
31
+ dsh plugin --profile web add github:bit0620/dsh-worldquant
32
+ ```
33
+
34
+ ## Configure a BRAIN MCP server
35
+
36
+ The bundle reads four environment variables at startup:
37
+
38
+ | Variable | Default | Meaning |
39
+ | --- | --- | --- |
40
+ | `BRAIN_USERNAME` | — | BRAIN account email |
41
+ | `BRAIN_PASSWORD` | — | BRAIN password |
42
+ | `BRAIN_MCP_COMMAND` | `python` | Executable that starts the MCP server |
43
+ | `BRAIN_MCP_ARGS` | `["-m","wq_mcp"]` | JSON array of arguments |
44
+ | `BRAIN_MCP_SERVER_NAME` | `brain` | Tool namespace (`mcp__brain__*`) |
45
+
46
+ ### Option A: `wq-brain-mcp` installed
47
+
48
+ ```sh
49
+ python -m wq_mcp
50
+ ```
51
+
52
+ Set the credentials and leave the command/args at their defaults.
53
+
54
+ ### Option B: your own BRAIN bridge script
55
+
56
+ This is the setup many BRAIN users already have — a Python file that speaks MCP over stdio:
57
+
58
+ ```powershell
59
+ $env:BRAIN_MCP_ARGS='["C:\\tools\\brain-mcp.py"]'
60
+ $env:BRAIN_USERNAME='you@example.com'
61
+ $env:BRAIN_PASSWORD='...'
62
+ ```
63
+
64
+ Then restart DSH. The namespace is `mcp__brain__*` unless you change `BRAIN_MCP_SERVER_NAME`.
65
+
66
+ ### Option C: a different MCP server over stdio
67
+
68
+ ```powershell
69
+ $env:BRAIN_MCP_COMMAND='uvx'
70
+ $env:BRAIN_MCP_ARGS='["--from","wq-brain-mcp","wq-mcp"]'
71
+ ```
72
+
73
+ Streamable HTTP is not wired in this bundle; add a second `@deepseek-ai/dsh-mcp-client` row to your profile if your server uses it.
74
+
75
+ ### External-auth servers
76
+
77
+ Some local BRAIN bridges store the session/JWT themselves and do not read `BRAIN_USERNAME` / `BRAIN_PASSWORD` from the environment. In that case, set only `BRAIN_MCP_COMMAND` and `BRAIN_MCP_ARGS`, and leave the credential variables unset. `brain_status` reports `authMode: external` and `configured: true`; the MCP server owns authentication.
78
+
79
+ The defaults (`python -m wq_mcp`) are for a server that expects environment credentials. Pick the setup that matches your bridge.
80
+
81
+ ## Verify
82
+
83
+ Ask the agent:
84
+
85
+ > Call `brain_status`, then list the BRAIN tools you can see.
86
+
87
+ A healthy setup returns `configured: true` and a tool list containing `mcp__brain__*`. If the tools are absent, the MCP server failed to start; the DSH log names the `mcp-brain` row and the underlying error.
88
+
89
+ ### Verified against a live BRAIN account
90
+
91
+ On 2026-11-28, a local stdio BRAIN MCP server was launched through this bundle in a DSH headless profile. `mcp__brain__get_datasets` returned **289 datasets** for USA / TOP3000 / delay 1, including:
92
+
93
+ - `acquisition_model` — Corporate Acquisition Likelihood Model (coverage 0.9063, 15 fields)
94
+ - `ai_equity_alpha` — AI Equity Alpha Forecasts (coverage 0.9049, 1108 fields)
95
+
96
+ The run was read-only: no simulation, no submission, no alpha creation. The server authenticated itself; `brain_status` now reports that as `authMode: external`. Details: [docs/verification-2026-11-28.md](docs/verification-2026-11-28.md).
97
+
98
+ ## The research loop
99
+
100
+ ### 1. Explore before writing
101
+
102
+ > Use the BRAIN tools to list datasets in the USA/TOP3000/delay-1 universe. Rank the top five by field coverage and show the fields with the highest non-zero ratio.
103
+
104
+ The agent should call the MCP data tools, not invent field names. Require a table with dataset id, field id, coverage, and update frequency.
105
+
106
+ ### 2. Write one expression at a time
107
+
108
+ > Propose three expressions using only the fields above. For each, state the economic intuition in one sentence, the operators used, and the expected turnover range. Do not simulate yet.
109
+
110
+ Keep the proposal step separate from the simulation step. It makes bad ideas cheap to reject.
111
+
112
+ ### 3. Simulate with explicit settings
113
+
114
+ > Simulate expression A with region USA, universe TOP3000, delay 1, decay 0, neutralization INDUSTRY. Report Sharpe, fitness, turnover, margin, and every failed check. Do not submit.
115
+
116
+ The plugin does not add a submit tool of its own. If your MCP server exposes submission, ask the agent to stop before calling it.
117
+
118
+ ### 4. Compare, then decide
119
+
120
+ > Compare the new alpha's PnL with my last 20 submitted alphas. Flag any correlation above 0.7 and explain which shared exposure is likely responsible.
121
+
122
+ ### 5. Gate submission
123
+
124
+ Before any submission, require all of the following in the transcript:
125
+
126
+ - IS Sharpe and fitness above your own thresholds
127
+ - turnover inside the platform limit
128
+ - every submission check passing
129
+ - self-correlation and prod-correlation below your limits
130
+ - a written reason the alpha is not a re-skin of an existing one
131
+
132
+ If any item is missing, the correct action is **do not submit**.
133
+
134
+ ## A system prompt that works well
135
+
136
+ Add this to your `AGENTS.md` or the session prompt:
137
+
138
+ ```text
139
+ You are a BRAIN alpha research assistant.
140
+ - Use only fields returned by the BRAIN tools; never guess a field id.
141
+ - Propose expressions before simulating them.
142
+ - Report every simulation check, including failures.
143
+ - Never call a submit tool without explicit user confirmation in the same turn.
144
+ - After a simulation, compare PnL correlation against the user's existing alphas.
145
+ - Prefer one clear hypothesis per expression over a kitchen-sink formula.
146
+ ```
147
+
148
+ ## Why this is a plugin instead of a prompt
149
+
150
+ A prompt can describe a workflow; it cannot guarantee the tools exist, keep credentials out of the transcript, or make a failed MCP connection visible. The bundle owns those pieces:
151
+
152
+ - the MCP row is versioned with the plugin;
153
+ - `brain_status` diagnoses configuration without leaking secrets;
154
+ - the workflow ships with the plugin and is updated with it;
155
+ - the same package works in the Web UI, headless runs, and eval suites.
156
+
157
+ ## Roadmap
158
+
159
+ - [ ] Streamable HTTP transport option
160
+ - [ ] Batch-simulation queue with a local ledger
161
+ - [ ] Alpha diff report (expression, settings, metrics, checks)
162
+ - [ ] A `dsh-regress` eval pack for BRAIN workflows (field selection, expression repair, submission gating)
163
+ - [ ] Read-only mode that registers only research tools even if the MCP server exposes submit
164
+
165
+ Issues and PRs welcome. If your BRAIN MCP server uses a different launch shape, open an issue with the command (never the credentials) and we will document it.
166
+
167
+ ## License
168
+
169
+ MIT © 2026 Bit0620
package/README.md CHANGED
@@ -1,166 +1,168 @@
1
1
  # dsh-worldquant
2
2
 
3
- > **WorldQuant BRAIN inside DeepSeek Harness.** One bundle mounts a BRAIN MCP server, exposes its tools as `mcp__brain__*`, and adds a preflight check and a safety-first alpha research workflow.
3
+ **中文** | [English](README.en.md)
4
+
5
+ > **把 WorldQuant BRAIN 接进 DeepSeek Harness。** 一个 bundle 挂载 BRAIN MCP server,把工具暴露成 `mcp__brain__*`,并附带配置自检和安全优先的 Alpha 研究工作流。
4
6
 
5
7
  [![npm](https://img.shields.io/npm/v/dsh-worldquant?color=blue)](https://www.npmjs.com/package/dsh-worldquant)
6
8
  [![dsh-plugin](https://img.shields.io/badge/topic-dsh--plugin-6f42c1)](https://github.com/topics/dsh-plugin)
7
9
  [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
8
10
 
9
- DeepSeek Harness is a strong agent runtime for long, tool-heavy research loops. WorldQuant BRAIN is a tool-heavy research platform: datasets, fields, simulation settings, submission checks, correlations, and PnL. This plugin connects the two without writing a new BRAIN client: it uses DSH's official MCP bridge and the BRAIN MCP server you already run.
11
+ DSH 很适合长链路、工具密集的研究循环;BRAIN 正好是这样一个平台:数据集、字段、仿真设置、提交检查、相关性、PnL。这个插件不重写 BRAIN 客户端,而是复用 DSH 官方 MCP bridge,把你已经在跑的 BRAIN MCP server 接进来。
10
12
 
11
- Not affiliated with WorldQuant. BRAIN credentials stay on your machine; this package never sends them anywhere except to the MCP server you configure.
13
+ 与 WorldQuant 官方无关。BRAIN 凭据只留在本机;除了你配置的 MCP server,这个包不会把凭据发到任何地方。
12
14
 
13
- ## What you get
15
+ ## 提供什么
14
16
 
15
- - **`mcp__brain__*` tools** — every tool your BRAIN MCP server publishes appears as a native DSH tool.
16
- - **`brain_status`** — a local preflight that reports the MCP command and the authentication mode (`env`, `external`, or `missing`), without printing secrets or calling the API.
17
- - **A workflow, not a toy demo** — the README and prompts below encode the loop that actually matters: explore fields → write an expression → simulate → read checks → compare correlation → only then consider submission.
18
- - **No build step** — plain ESM JavaScript and a YAML patch. Install from git or npm.
17
+ - **`mcp__brain__*` 工具** —— BRAIN MCP server 发布的每个工具都会成为 DSH 原生工具。
18
+ - **`brain_status`** —— 本地自检:报告 MCP 命令和认证模式(`env`、`external` 或 `missing`),不打印密钥、不调用 API。
19
+ - **一个真正能跑的工作流** —— 探索字段 → 写表达式 → 仿真 → 读检查 → 比相关性 → 最后才考虑提交。
20
+ - **无需构建** —— 纯 ESM JavaScript + YAML patch,git 或 npm 都能直接装。
19
21
 
20
- ## Install
22
+ ## 安装
21
23
 
22
24
  ```sh
23
25
  dsh plugin --profile web add dsh-worldquant
24
26
  ```
25
27
 
26
- Or install straight from GitHub (no build step):
28
+ 也可以直接从 GitHub 装(无需构建):
27
29
 
28
30
  ```sh
29
31
  dsh plugin --profile web add github:bit0620/dsh-worldquant
30
32
  ```
31
33
 
32
- ## Configure a BRAIN MCP server
34
+ ## 配置 BRAIN MCP server
33
35
 
34
- The bundle reads four environment variables at startup:
36
+ bundle 启动时读取这些环境变量:
35
37
 
36
- | Variable | Default | Meaning |
38
+ | 变量 | 默认值 | 含义 |
37
39
  | --- | --- | --- |
38
- | `BRAIN_USERNAME` | — | BRAIN account email |
39
- | `BRAIN_PASSWORD` | — | BRAIN password |
40
- | `BRAIN_MCP_COMMAND` | `python` | Executable that starts the MCP server |
41
- | `BRAIN_MCP_ARGS` | `["-m","wq_mcp"]` | JSON array of arguments |
42
- | `BRAIN_MCP_SERVER_NAME` | `brain` | Tool namespace (`mcp__brain__*`) |
40
+ | `BRAIN_USERNAME` | — | BRAIN 账号邮箱 |
41
+ | `BRAIN_PASSWORD` | — | BRAIN 密码 |
42
+ | `BRAIN_MCP_COMMAND` | `python` | 启动 MCP server 的可执行文件 |
43
+ | `BRAIN_MCP_ARGS` | `["-m","wq_mcp"]` | JSON 字符串数组 |
44
+ | `BRAIN_MCP_SERVER_NAME` | `brain` | 工具命名空间(`mcp__brain__*`) |
43
45
 
44
- ### Option A: `wq-brain-mcp` installed
46
+ ### 方式 A:已安装 `wq-brain-mcp`
45
47
 
46
48
  ```sh
47
49
  python -m wq_mcp
48
50
  ```
49
51
 
50
- Set the credentials and leave the command/args at their defaults.
52
+ 配置好账号密码,命令和参数保持默认即可。
51
53
 
52
- ### Option B: your own BRAIN bridge script
54
+ ### 方式 B:你自己的 BRAIN bridge 脚本
53
55
 
54
- This is the setup many BRAIN users already have — a Python file that speaks MCP over stdio:
56
+ 很多 BRAIN 用户已经有一个通过 stdio 提供 MCP 的 Python 文件:
55
57
 
56
58
  ```powershell
57
- $env:BRAIN_MCP_ARGS='["D:\\123\\Documents\\wq\\platform_functions.py"]'
59
+ $env:BRAIN_MCP_ARGS='["C:\\tools\\brain-mcp.py"]'
58
60
  $env:BRAIN_USERNAME='you@example.com'
59
61
  $env:BRAIN_PASSWORD='...'
60
62
  ```
61
63
 
62
- Then restart DSH. The namespace is `mcp__brain__*` unless you change `BRAIN_MCP_SERVER_NAME`.
64
+ 重启 DSH。命名空间默认是 `mcp__brain__*`。
63
65
 
64
- ### Option C: a different MCP server over stdio
66
+ ### 方式 C:其他 stdio MCP server
65
67
 
66
68
  ```powershell
67
69
  $env:BRAIN_MCP_COMMAND='uvx'
68
70
  $env:BRAIN_MCP_ARGS='["--from","wq-brain-mcp","wq-mcp"]'
69
71
  ```
70
72
 
71
- Streamable HTTP is not wired in this bundle; add a second `@deepseek-ai/dsh-mcp-client` row to your profile if your server uses it.
73
+ 这个 bundle 暂不包含 Streamable HTTP;如果你的 server 用 HTTP,在 profile 里再加一行 `@deepseek-ai/dsh-mcp-client`。
72
74
 
73
- ### External-auth servers
75
+ ### 自认证 server
74
76
 
75
- Some local BRAIN bridges store the session/JWT themselves and do not read `BRAIN_USERNAME` / `BRAIN_PASSWORD` from the environment. In that case, set only `BRAIN_MCP_COMMAND` and `BRAIN_MCP_ARGS`, and leave the credential variables unset. `brain_status` reports `authMode: external` and `configured: true`; the MCP server owns authentication.
77
+ 有些本地 BRAIN bridge 自己保存 session/JWT,不读环境变量里的 `BRAIN_USERNAME` / `BRAIN_PASSWORD`。这种情况下只设置 `BRAIN_MCP_COMMAND` 和 `BRAIN_MCP_ARGS`,不要设置账号密码。`brain_status` 会报告 `authMode: external` 和 `configured: true`,认证由 MCP server 自己负责。
76
78
 
77
- The defaults (`python -m wq_mcp`) are for a server that expects environment credentials. Pick the setup that matches your bridge.
79
+ 默认的 `python -m wq_mcp` 是给“从环境变量读凭据”的 server 用的。按你的 bridge 选对应方式。
78
80
 
79
- ## Verify
81
+ ## 验证
80
82
 
81
- Ask the agent:
83
+ 对 Agent 说:
82
84
 
83
- > Call `brain_status`, then list the BRAIN tools you can see.
85
+ > 调用 `brain_status`,然后列出你能看到的 BRAIN 工具。
84
86
 
85
- A healthy setup returns `configured: true` and a tool list containing `mcp__brain__*`. If the tools are absent, the MCP server failed to start; the DSH log names the `mcp-brain` row and the underlying error.
87
+ 配置正常时返回 `configured: true`,工具列表里出现 `mcp__brain__*`。如果工具没出现,说明 MCP server 启动失败;DSH 日志会指出 `mcp-brain` 这一行和具体错误。
86
88
 
87
- ### Verified against a live BRAIN account
89
+ ### 真实 BRAIN 账号验证
88
90
 
89
- On 2026-11-28, a local stdio BRAIN MCP server was launched through this bundle in a DSH headless profile. `mcp__brain__get_datasets` returned **289 datasets** for USA / TOP3000 / delay 1, including:
91
+ 2026-11-28,在 DSH headless profile 里通过本 bundle 启动本地 stdio BRAIN MCP server。`mcp__brain__get_datasets` 返回 USA / TOP3000 / delay 1 的 **289 个数据集**,包括:
90
92
 
91
- - `acquisition_model` — Corporate Acquisition Likelihood Model (coverage 0.9063, 15 fields)
92
- - `ai_equity_alpha` — AI Equity Alpha Forecasts (coverage 0.9049, 1108 fields)
93
+ - `acquisition_model` — Corporate Acquisition Likelihood Model(coverage 0.9063,15 个字段)
94
+ - `ai_equity_alpha` — AI Equity Alpha Forecasts(coverage 0.9049,1108 个字段)
93
95
 
94
- The run was read-only: no simulation, no submission, no alpha creation. The server authenticated itself; `brain_status` now reports that as `authMode: external`. Details: [docs/verification-2026-11-28.md](docs/verification-2026-11-28.md).
96
+ 全程只读:没有仿真、没有提交、没有创建 alpha。server 自己完成认证;`brain_status` 现在会把这种情况报告为 `authMode: external`。详情见 [docs/verification-2026-11-28.md](docs/verification-2026-11-28.md)。
95
97
 
96
- ## The research loop
98
+ ## 研究循环
97
99
 
98
- ### 1. Explore before writing
100
+ ### 1. 先探索
99
101
 
100
- > Use the BRAIN tools to list datasets in the USA/TOP3000/delay-1 universe. Rank the top five by field coverage and show the fields with the highest non-zero ratio.
102
+ > 用 BRAIN 工具列出 USA/TOP3000/delay-1 的数据集,按字段覆盖率排序,给出覆盖率最高的五个字段和它们的非零比例。
101
103
 
102
- The agent should call the MCP data tools, not invent field names. Require a table with dataset id, field id, coverage, and update frequency.
104
+ 要求 Agent 调用 MCP 工具,而不是编造字段名。输出应包含 dataset id、field id、coverage、更新频率。
103
105
 
104
- ### 2. Write one expression at a time
106
+ ### 2. 一次只写一个表达式
105
107
 
106
- > Propose three expressions using only the fields above. For each, state the economic intuition in one sentence, the operators used, and the expected turnover range. Do not simulate yet.
108
+ > 只用上面的字段提出三个表达式。每个用一句话说明经济直觉、使用的算子、预期 turnover 区间。先不要仿真。
107
109
 
108
- Keep the proposal step separate from the simulation step. It makes bad ideas cheap to reject.
110
+ 把“提想法”和“跑仿真”分开,能低成本否掉坏点子。
109
111
 
110
- ### 3. Simulate with explicit settings
112
+ ### 3. 明确设置后再仿真
111
113
 
112
- > Simulate expression A with region USA, universe TOP3000, delay 1, decay 0, neutralization INDUSTRY. Report Sharpe, fitness, turnover, margin, and every failed check. Do not submit.
114
+ > 用 USA、TOP3000、delay 1、decay 0、INDUSTRY 中性化仿真表达式 A。报告 Sharpe、fitness、turnover、margin,以及每一个失败检查。不要提交。
113
115
 
114
- The plugin does not add a submit tool of its own. If your MCP server exposes submission, ask the agent to stop before calling it.
116
+ 插件本身不提供提交工具。如果你的 MCP server 有提交能力,要求 Agent 在调用前停下来。
115
117
 
116
- ### 4. Compare, then decide
118
+ ### 4. 对比后再决定
117
119
 
118
- > Compare the new alpha's PnL with my last 20 submitted alphas. Flag any correlation above 0.7 and explain which shared exposure is likely responsible.
120
+ > 把新 Alpha 的 PnL 和我最近提交的 20 个 Alpha 对比。相关性超过 0.7 的标出来,并解释可能共享了什么暴露。
119
121
 
120
- ### 5. Gate submission
122
+ ### 5. 提交前门禁
121
123
 
122
- Before any submission, require all of the following in the transcript:
124
+ 提交前要求 transcript 里同时具备:
123
125
 
124
- - IS Sharpe and fitness above your own thresholds
125
- - turnover inside the platform limit
126
- - every submission check passing
127
- - self-correlation and prod-correlation below your limits
128
- - a written reason the alpha is not a re-skin of an existing one
126
+ - IS Sharpe 和 fitness 达到你的阈值
127
+ - turnover 在平台限制内
128
+ - 所有 submission check 通过
129
+ - self-correlation 和 prod-correlation 低于你的限制
130
+ - 一段书面理由说明这不是已有 Alpha 的换皮
129
131
 
130
- If any item is missing, the correct action is **do not submit**.
132
+ 缺任何一项,正确动作都是 **不要提交**。
131
133
 
132
- ## A system prompt that works well
134
+ ## 推荐系统提示
133
135
 
134
- Add this to your `AGENTS.md` or the session prompt:
136
+ 把这段加进 `AGENTS.md` 或会话提示:
135
137
 
136
138
  ```text
137
- You are a BRAIN alpha research assistant.
138
- - Use only fields returned by the BRAIN tools; never guess a field id.
139
- - Propose expressions before simulating them.
140
- - Report every simulation check, including failures.
141
- - Never call a submit tool without explicit user confirmation in the same turn.
142
- - After a simulation, compare PnL correlation against the user's existing alphas.
143
- - Prefer one clear hypothesis per expression over a kitchen-sink formula.
139
+ 你是一名 BRAIN Alpha 研究助手。
140
+ - 只使用 BRAIN 工具返回的字段,绝不猜字段 id。
141
+ - 先提出表达式,再仿真。
142
+ - 报告每一个仿真检查,包括失败项。
143
+ - 没有用户在同一轮明确确认,绝不调用提交工具。
144
+ - 仿真后,把 PnL 和用户已有 Alpha 做相关性对比。
145
+ - 一个表达式只验证一个清晰假设,不要堆公式。
144
146
  ```
145
147
 
146
- ## Why this is a plugin instead of a prompt
148
+ ## 为什么做成插件而不是一段提示
147
149
 
148
- A prompt can describe a workflow; it cannot guarantee the tools exist, keep credentials out of the transcript, or make a failed MCP connection visible. The bundle owns those pieces:
150
+ 提示可以描述流程,但无法保证工具存在、无法避免凭据进入 transcript、也无法让 MCP 连接失败变得可见。这个 bundle 负责这些:
149
151
 
150
- - the MCP row is versioned with the plugin;
151
- - `brain_status` diagnoses configuration without leaking secrets;
152
- - the workflow ships with the plugin and is updated with it;
153
- - the same package works in the Web UI, headless runs, and eval suites.
152
+ - MCP 配置和插件一起版本化;
153
+ - `brain_status` 在不泄露密钥的前提下诊断配置;
154
+ - 工作流随插件发布、随插件更新;
155
+ - 同一个包在 Web UI、headless 和 eval suite 里都能用。
154
156
 
155
- ## Roadmap
157
+ ## 路线图
156
158
 
157
- - [ ] Streamable HTTP transport option
158
- - [ ] Batch-simulation queue with a local ledger
159
- - [ ] Alpha diff report (expression, settings, metrics, checks)
160
- - [ ] A `dsh-regress` eval pack for BRAIN workflows (field selection, expression repair, submission gating)
161
- - [ ] Read-only mode that registers only research tools even if the MCP server exposes submit
159
+ - [ ] Streamable HTTP 传输
160
+ - [ ] 批量仿真队列 + 本地账本
161
+ - [ ] Alpha diff 报告(表达式、设置、指标、检查)
162
+ - [ ] 面向 BRAIN 工作流的 `dsh-regress` eval pack(字段选择、表达式修复、提交门禁)
163
+ - [ ] 只读模式:即使 MCP server 暴露 submit,也只注册研究工具
162
164
 
163
- Issues and PRs welcome. If your BRAIN MCP server uses a different launch shape, open an issue with the command (never the credentials) and we will document it.
165
+ 欢迎 issue 和 PR。如果你的 BRAIN MCP server 启动方式不同,提交 issue 时只给命令,不要给凭据。
164
166
 
165
167
  ## License
166
168
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-worldquant",
3
- "version": "0.1.1",
4
- "description": "WorldQuant BRAIN inside DeepSeek Harness: an MCP bridge, preflight checks and a safety-first alpha research workflow.",
3
+ "version": "0.1.3",
4
+ "description": "把 WorldQuant BRAIN MCP 接入 DeepSeek Harness(中文优先):配置自检和只读优先的 Alpha 研究工作流。",
5
5
  "type": "module",
6
6
  "main": "./index.js",
7
7
  "exports": {
@@ -11,7 +11,7 @@
11
11
  "index.js",
12
12
  "cordis.patch.yml",
13
13
  "README.md",
14
- "README.zh.md",
14
+ "README.en.md",
15
15
  "LICENSE",
16
16
  "docs"
17
17
  ],
package/README.zh.md DELETED
@@ -1,167 +0,0 @@
1
- # dsh-worldquant
2
-
3
- > **把 WorldQuant BRAIN 接进 DeepSeek Harness。** 一个 bundle 挂载 BRAIN MCP server,把工具暴露成 `mcp__brain__*`,并附带配置自检和安全优先的 Alpha 研究工作流。
4
-
5
- [![npm](https://img.shields.io/npm/v/dsh-worldquant?color=blue)](https://www.npmjs.com/package/dsh-worldquant)
6
- [![dsh-plugin](https://img.shields.io/badge/topic-dsh--plugin-6f42c1)](https://github.com/topics/dsh-plugin)
7
- [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
8
-
9
- DSH 很适合长链路、工具密集的研究循环;BRAIN 正好是这样一个平台:数据集、字段、仿真设置、提交检查、相关性、PnL。这个插件不重写 BRAIN 客户端,而是复用 DSH 官方 MCP bridge,把你已经在跑的 BRAIN MCP server 接进来。
10
-
11
- 与 WorldQuant 官方无关。BRAIN 凭据只留在本机;除了你配置的 MCP server,这个包不会把凭据发到任何地方。
12
-
13
- ## 提供什么
14
-
15
- - **`mcp__brain__*` 工具** —— BRAIN MCP server 发布的每个工具都会成为 DSH 原生工具。
16
- - **`brain_status`** —— 本地自检:报告 MCP 命令和认证模式(`env`、`external` 或 `missing`),不打印密钥、不调用 API。
17
- - **一个真正能跑的工作流** —— 探索字段 → 写表达式 → 仿真 → 读检查 → 比相关性 → 最后才考虑提交。
18
- - **无需构建** —— 纯 ESM JavaScript + YAML patch,git 或 npm 都能直接装。
19
-
20
- ## 安装
21
-
22
- ```sh
23
- dsh plugin --profile web add dsh-worldquant
24
- ```
25
-
26
- 也可以直接从 GitHub 装(无需构建):
27
-
28
- ```sh
29
- dsh plugin --profile web add github:bit0620/dsh-worldquant
30
- ```
31
-
32
- ## 配置 BRAIN MCP server
33
-
34
- bundle 启动时读取这些环境变量:
35
-
36
- | 变量 | 默认值 | 含义 |
37
- | --- | --- | --- |
38
- | `BRAIN_USERNAME` | — | BRAIN 账号邮箱 |
39
- | `BRAIN_PASSWORD` | — | BRAIN 密码 |
40
- | `BRAIN_MCP_COMMAND` | `python` | 启动 MCP server 的可执行文件 |
41
- | `BRAIN_MCP_ARGS` | `["-m","wq_mcp"]` | JSON 字符串数组 |
42
- | `BRAIN_MCP_SERVER_NAME` | `brain` | 工具命名空间(`mcp__brain__*`) |
43
-
44
- ### 方式 A:已安装 `wq-brain-mcp`
45
-
46
- ```sh
47
- python -m wq_mcp
48
- ```
49
-
50
- 配置好账号密码,命令和参数保持默认即可。
51
-
52
- ### 方式 B:你自己的 BRAIN bridge 脚本
53
-
54
- 很多 BRAIN 用户已经有一个通过 stdio 提供 MCP 的 Python 文件:
55
-
56
- ```powershell
57
- $env:BRAIN_MCP_ARGS='["D:\\123\\Documents\\wq\\platform_functions.py"]'
58
- $env:BRAIN_USERNAME='you@example.com'
59
- $env:BRAIN_PASSWORD='...'
60
- ```
61
-
62
- 重启 DSH。命名空间默认是 `mcp__brain__*`。
63
-
64
- ### 方式 C:其他 stdio MCP server
65
-
66
- ```powershell
67
- $env:BRAIN_MCP_COMMAND='uvx'
68
- $env:BRAIN_MCP_ARGS='["--from","wq-brain-mcp","wq-mcp"]'
69
- ```
70
-
71
- 这个 bundle 暂不包含 Streamable HTTP;如果你的 server 用 HTTP,在 profile 里再加一行 `@deepseek-ai/dsh-mcp-client`。
72
-
73
- ### 自认证 server
74
-
75
- 有些本地 BRAIN bridge 自己保存 session/JWT,不读环境变量里的 `BRAIN_USERNAME` / `BRAIN_PASSWORD`。这种情况下只设置 `BRAIN_MCP_COMMAND` 和 `BRAIN_MCP_ARGS`,不要设置账号密码。`brain_status` 会报告 `authMode: external` 和 `configured: true`,认证由 MCP server 自己负责。
76
-
77
- 默认的 `python -m wq_mcp` 是给“从环境变量读凭据”的 server 用的。按你的 bridge 选对应方式。
78
-
79
- ## 验证
80
-
81
- 对 Agent 说:
82
-
83
- > 调用 `brain_status`,然后列出你能看到的 BRAIN 工具。
84
-
85
- 配置正常时返回 `configured: true`,工具列表里出现 `mcp__brain__*`。如果工具没出现,说明 MCP server 启动失败;DSH 日志会指出 `mcp-brain` 这一行和具体错误。
86
-
87
- ### 真实 BRAIN 账号验证
88
-
89
- 2026-11-28,在 DSH headless profile 里通过本 bundle 启动本地 stdio BRAIN MCP server。`mcp__brain__get_datasets` 返回 USA / TOP3000 / delay 1 的 **289 个数据集**,包括:
90
-
91
- - `acquisition_model` — Corporate Acquisition Likelihood Model(coverage 0.9063,15 个字段)
92
- - `ai_equity_alpha` — AI Equity Alpha Forecasts(coverage 0.9049,1108 个字段)
93
-
94
- 全程只读:没有仿真、没有提交、没有创建 alpha。server 自己完成认证;`brain_status` 现在会把这种情况报告为 `authMode: external`。详情见 [docs/verification-2026-11-28.md](docs/verification-2026-11-28.md)。
95
-
96
- ## 研究循环
97
-
98
- ### 1. 先探索
99
-
100
- > 用 BRAIN 工具列出 USA/TOP3000/delay-1 的数据集,按字段覆盖率排序,给出覆盖率最高的五个字段和它们的非零比例。
101
-
102
- 要求 Agent 调用 MCP 工具,而不是编造字段名。输出应包含 dataset id、field id、coverage、更新频率。
103
-
104
- ### 2. 一次只写一个表达式
105
-
106
- > 只用上面的字段提出三个表达式。每个用一句话说明经济直觉、使用的算子、预期 turnover 区间。先不要仿真。
107
-
108
- 把“提想法”和“跑仿真”分开,能低成本否掉坏点子。
109
-
110
- ### 3. 明确设置后再仿真
111
-
112
- > 用 USA、TOP3000、delay 1、decay 0、INDUSTRY 中性化仿真表达式 A。报告 Sharpe、fitness、turnover、margin,以及每一个失败检查。不要提交。
113
-
114
- 插件本身不提供提交工具。如果你的 MCP server 有提交能力,要求 Agent 在调用前停下来。
115
-
116
- ### 4. 对比后再决定
117
-
118
- > 把新 Alpha 的 PnL 和我最近提交的 20 个 Alpha 对比。相关性超过 0.7 的标出来,并解释可能共享了什么暴露。
119
-
120
- ### 5. 提交前门禁
121
-
122
- 提交前要求 transcript 里同时具备:
123
-
124
- - IS Sharpe 和 fitness 达到你的阈值
125
- - turnover 在平台限制内
126
- - 所有 submission check 通过
127
- - self-correlation 和 prod-correlation 低于你的限制
128
- - 一段书面理由说明这不是已有 Alpha 的换皮
129
-
130
- 缺任何一项,正确动作都是 **不要提交**。
131
-
132
- ## 推荐系统提示
133
-
134
- 把这段加进 `AGENTS.md` 或会话提示:
135
-
136
- ```text
137
- 你是一名 BRAIN Alpha 研究助手。
138
- - 只使用 BRAIN 工具返回的字段,绝不猜字段 id。
139
- - 先提出表达式,再仿真。
140
- - 报告每一个仿真检查,包括失败项。
141
- - 没有用户在同一轮明确确认,绝不调用提交工具。
142
- - 仿真后,把 PnL 和用户已有 Alpha 做相关性对比。
143
- - 一个表达式只验证一个清晰假设,不要堆公式。
144
- ```
145
-
146
- ## 为什么做成插件而不是一段提示
147
-
148
- 提示可以描述流程,但无法保证工具存在、无法避免凭据进入 transcript、也无法让 MCP 连接失败变得可见。这个 bundle 负责这些:
149
-
150
- - MCP 配置和插件一起版本化;
151
- - `brain_status` 在不泄露密钥的前提下诊断配置;
152
- - 工作流随插件发布、随插件更新;
153
- - 同一个包在 Web UI、headless 和 eval suite 里都能用。
154
-
155
- ## 路线图
156
-
157
- - [ ] Streamable HTTP 传输
158
- - [ ] 批量仿真队列 + 本地账本
159
- - [ ] Alpha diff 报告(表达式、设置、指标、检查)
160
- - [ ] 面向 BRAIN 工作流的 `dsh-regress` eval pack(字段选择、表达式修复、提交门禁)
161
- - [ ] 只读模式:即使 MCP server 暴露 submit,也只注册研究工具
162
-
163
- 欢迎 issue 和 PR。如果你的 BRAIN MCP server 启动方式不同,提交 issue 时只给命令,不要给凭据。
164
-
165
- ## License
166
-
167
- MIT © 2026 Bit0620