dsh-vibe-math 0.1.0 → 0.2.0
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.md +60 -0
- package/agent.cordis.yml +198 -0
- package/package.json +5 -3
- package/preset.yml +2 -0
- package/vibe-math.js +31 -3
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# Vibe Mathematics — 多代理数学问题求解与验证框架
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-vibe-math)
|
|
3
4
|
[](https://opensource.org/licenses/MIT)
|
|
4
5
|
[](https://github.com/ChongCyrus/Vibe-Mathematics)
|
|
5
6
|
|
|
@@ -41,6 +42,65 @@
|
|
|
41
42
|
|
|
42
43
|
---
|
|
43
44
|
|
|
45
|
+
## 🧩 架构图
|
|
46
|
+
|
|
47
|
+
> 静态 PNG 预览 + 可编辑 Mermaid 图源(GitHub 原生渲染);完整流程说明见 [docs/架构图.md](docs/架构图.md)。
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
```mermaid
|
|
52
|
+
flowchart TB
|
|
53
|
+
subgraph L1["👤 交互层"]
|
|
54
|
+
U["😀 用户(自然语言)"]
|
|
55
|
+
M["🤖 主代理(助手 + 汇报者)<br/>翻译需求 · 汇报进度 · 问答配置<br/>不求解 · 不调度"]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
subgraph L2["⚙️ 调度层(插件代码)"]
|
|
59
|
+
SCHED["调度器 Scheduler<br/>唯一文件写者<br/>读 qs.csv · 派发子代理 · 推进状态机"]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
subgraph L3["🧠 子代理层(continuable 持久会话)"]
|
|
63
|
+
BRAIN["🧭 Brainstorm<br/>拆解多个求解方向"]
|
|
64
|
+
SOLV["✍️ Solver × N<br/>逐方向多轮迭代"]
|
|
65
|
+
DERI["🔀 Derive<br/>死路时派生新方向"]
|
|
66
|
+
VERI["🔬 Verifier × ≥3<br/>独立审查 → 辩论 → 裁决"]
|
|
67
|
+
DECI["⚖️ Decider<br/>判定是否解决"]
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
subgraph L4["💾 数据层 · VibeMath/Projects/<项目>/"]
|
|
71
|
+
QS["📋 qs.csv"]
|
|
72
|
+
PEND["📥 Pending_Verification/"]
|
|
73
|
+
UNDR["📂 Under_Verification/"]
|
|
74
|
+
TVAL["✅ Temp_Validated/"]
|
|
75
|
+
KNOW["📚 Verified/ 可信知识库"]
|
|
76
|
+
STATE["🗄️ Progress_Logs/ · VibeMath_State/"]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
U -->|"求解 XX / 查进度 / 干预"| M
|
|
80
|
+
M -->|"vibe_math_* 工具"| SCHED
|
|
81
|
+
|
|
82
|
+
SCHED -->|"① 派发"| BRAIN
|
|
83
|
+
BRAIN -->|"多个大相径庭的方向"| SCHED
|
|
84
|
+
SCHED -->|"② 每方向一个"| SOLV
|
|
85
|
+
SOLV -->|"结构化结果 JSON"| SCHED
|
|
86
|
+
SOLV -.->|"迭代至卡死"| DERI
|
|
87
|
+
DERI -->|"派生 1~3 个新方向"| SCHED
|
|
88
|
+
SCHED -->|"③ 写盘"| PEND
|
|
89
|
+
SCHED -->|"④ 拆解为最小验证单元"| UNDR
|
|
90
|
+
SCHED -->|"⑤ 派发 ≥3 个"| VERI
|
|
91
|
+
VERI -->|"裁决 JSON"| SCHED
|
|
92
|
+
SCHED -->|"⑥ 通过"| TVAL
|
|
93
|
+
SCHED -->|"⑦ 晋升"| KNOW
|
|
94
|
+
SCHED -->|"⑧ 派发"| DECI
|
|
95
|
+
DECI -->|"⑨ 已解决 → 回写"| QS
|
|
96
|
+
SCHED <-->|"读取问题"| QS
|
|
97
|
+
SCHED <-->|"状态落盘 / 断点恢复"| STATE
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**一句话流水线**:`qs.csv` → Brainstorm 拆方向 → 每方向一个 Solver 多轮迭代(卡死则 Derive 派生新方向)→ 输出拆成最小验证单元 → ≥3 个 Verifier 独立审查 → 辩论 → 裁决 → 通过晋升 `Verified/` → Decider 回写 `qs.csv`;全程状态落盘 `VibeMath_State/`,`resume` 断点续跑,`manual` 模式在派发/裁决/晋升处挂起人工决策。
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
44
104
|
## 📁 目录结构
|
|
45
105
|
|
|
46
106
|
框架数据落在会话工作区的 `VibeMath/` 下,每个项目一套完整布局:
|
package/agent.cordis.yml
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# The `vibe-math` agent preset: the full coding agent (`standard`), plus the
|
|
2
|
+
# multi-agent mathematical problem-solving & verification framework.
|
|
3
|
+
#
|
|
4
|
+
# The vibe-math plugin row consumes the HOST subagents/agents/fs/tools services
|
|
5
|
+
# and publishes nothing, so it needs no isolate realm (like tool-fs / tool-web).
|
|
6
|
+
|
|
7
|
+
# ── identity ────────────────────────────────────────────────────────────────
|
|
8
|
+
|
|
9
|
+
- id: persona
|
|
10
|
+
name: '@deepseek-ai/dsh-persona'
|
|
11
|
+
config:
|
|
12
|
+
text: |-
|
|
13
|
+
You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
|
|
14
|
+
|
|
15
|
+
## Vibe Math toolkit (available in this preset)
|
|
16
|
+
|
|
17
|
+
This session includes the "Vibe Math" multi-agent mathematical problem-solving and
|
|
18
|
+
verification framework. It is driven by a background scheduler (code), NOT by the model:
|
|
19
|
+
you only issue the control tools below and read status; the scheduler then automatically
|
|
20
|
+
runs brainstorm → solver iteration → multi-verifier debate → promotion to Verified →
|
|
21
|
+
triage back to the problem list (priority 2 > 3 > 1, concurrency-gated).
|
|
22
|
+
|
|
23
|
+
- vibe_math_add_problem {id, description, priority} — add a problem to qs.csv.
|
|
24
|
+
- vibe_math_start / vibe_math_resume — start / resume the scheduler (resume = continue after a checkpoint or restart).
|
|
25
|
+
- vibe_math_status / vibe_math_report — read scheduler status / full progress report (report also writes Progress_Logs/report.json).
|
|
26
|
+
- vibe_math_pause / vibe_math_abort — pause / abort (abort interrupts all children).
|
|
27
|
+
- vibe_math_set_mode {mode: manual|auto} — switch manual / auto control.
|
|
28
|
+
- vibe_math_set_params {...} — tune any parameter (see vibe_math_setup for the full schema).
|
|
29
|
+
- vibe_math_setup — return the parameter schema (name, type, current, default, description, options, suggestion) for guided configuration.
|
|
30
|
+
- vibe_math_save_settings — write current params to <project>/vibe_math_setting.json (JSON-with-comments) as new defaults.
|
|
31
|
+
- vibe_math_new_project / vibe_math_set_project / vibe_math_list_projects — manage per-project folders.
|
|
32
|
+
- vibe_math_list_decisions / vibe_math_decide {id, action: approve|reject|override, verdict?} — resolve manual decisions.
|
|
33
|
+
- vibe_math_list_agents / vibe_math_message_agent / vibe_math_interrupt_agent — inspect / steer / interrupt subagents.
|
|
34
|
+
|
|
35
|
+
A /vibe slash command mirrors these: /vibe start|resume|pause|abort|status|report|mode <auto|manual>|setup|save|add <id> <description>|project [list|new <name>|<name>]|decisions|agents.
|
|
36
|
+
|
|
37
|
+
Configurable subagent permissions (via vibe_math_set_params or the settings file): solverToolAllow/solverToolDeny and verifierToolAllow/verifierToolDeny restrict which tools a child sees (hard toolFilter); solverMaxToolCalls/verifierMaxToolCalls cap external tool calls per round (soft). Each child is also told it may read Verified/ and, for solvers, Progress_Logs/{qid}_progress.csv.
|
|
38
|
+
|
|
39
|
+
Interactive configuration: when the user wants to configure or adjust Vibe Math parameters, call vibe_math_setup to get the schema (each item has description, options, and a suggestion), then use ask_user_question to ask the user for the choices, apply them with vibe_math_set_params, and finally ask whether to persist them to vibe_math_setting.json via vibe_math_save_settings.
|
|
40
|
+
|
|
41
|
+
When the user asks to solve or verify a math problem with Vibe Math: add the problem (or ask for it first), then vibe_math_start, then report vibe_math_status. In manual mode, poll vibe_math_list_decisions and resolve each with vibe_math_decide. Data lives under {{cwd}}/VibeMath/Projects/<project>/ and survives restarts via vibe_math_resume.
|
|
42
|
+
|
|
43
|
+
- id: agent-instructions
|
|
44
|
+
name: '@deepseek-ai/dsh-agent-instructions'
|
|
45
|
+
config:
|
|
46
|
+
maxBytes: 65536
|
|
47
|
+
|
|
48
|
+
# ── shell ───────────────────────────────────────────────────────────────────
|
|
49
|
+
|
|
50
|
+
- id: tool-bash
|
|
51
|
+
name: '@deepseek-ai/dsh-tool-bash'
|
|
52
|
+
disabled: !!js process.platform === 'win32'
|
|
53
|
+
|
|
54
|
+
- id: tool-pwsh
|
|
55
|
+
name: '@deepseek-ai/dsh-tool-pwsh'
|
|
56
|
+
disabled: !!js process.platform !== 'win32'
|
|
57
|
+
|
|
58
|
+
# ── filesystem ──────────────────────────────────────────────────────────────
|
|
59
|
+
|
|
60
|
+
- id: tool-fs
|
|
61
|
+
name: '@deepseek-ai/dsh-tool-fs'
|
|
62
|
+
|
|
63
|
+
- id: tool-fs-search
|
|
64
|
+
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
65
|
+
config:
|
|
66
|
+
sampleOverCapGlobResults: false
|
|
67
|
+
|
|
68
|
+
# ── background jobs ────────────────────────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
- id: tool-jobs
|
|
71
|
+
name: '@deepseek-ai/dsh-tool-jobs'
|
|
72
|
+
|
|
73
|
+
# ── skills ──────────────────────────────────────────────────────────────────
|
|
74
|
+
|
|
75
|
+
- id: skill-filesystem
|
|
76
|
+
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
77
|
+
|
|
78
|
+
- id: tool-skill
|
|
79
|
+
name: '@deepseek-ai/dsh-tool-skill'
|
|
80
|
+
|
|
81
|
+
# ── goals ───────────────────────────────────────────────────────────────────
|
|
82
|
+
|
|
83
|
+
- id: tool-goal
|
|
84
|
+
name: '@deepseek-ai/dsh-tool-goal'
|
|
85
|
+
|
|
86
|
+
# ── plan mode ───────────────────────────────────────────────────────────────
|
|
87
|
+
|
|
88
|
+
- id: planning
|
|
89
|
+
name: cordis:group
|
|
90
|
+
group: true
|
|
91
|
+
isolate:
|
|
92
|
+
planMode: true
|
|
93
|
+
config:
|
|
94
|
+
- id: plan-mode
|
|
95
|
+
name: '@deepseek-ai/dsh-plan-mode'
|
|
96
|
+
config:
|
|
97
|
+
section: |
|
|
98
|
+
You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
|
|
99
|
+
|
|
100
|
+
Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
|
|
101
|
+
|
|
102
|
+
The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
|
|
103
|
+
|
|
104
|
+
Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
|
|
105
|
+
|
|
106
|
+
Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
|
|
107
|
+
|
|
108
|
+
When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
|
|
109
|
+
|
|
110
|
+
# ── compaction ──────────────────────────────────────────────────────────────
|
|
111
|
+
|
|
112
|
+
- id: compaction
|
|
113
|
+
name: cordis:group
|
|
114
|
+
group: true
|
|
115
|
+
isolate:
|
|
116
|
+
compaction: true
|
|
117
|
+
toolResultPruner: true
|
|
118
|
+
config:
|
|
119
|
+
- id: compaction-basic
|
|
120
|
+
name: '@deepseek-ai/dsh-compaction-basic'
|
|
121
|
+
|
|
122
|
+
- id: command-compact
|
|
123
|
+
name: '@deepseek-ai/dsh-command-compact'
|
|
124
|
+
|
|
125
|
+
- id: tool-result-pruner
|
|
126
|
+
name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
|
127
|
+
config:
|
|
128
|
+
thresholdChars: 8192
|
|
129
|
+
headChars: 4096
|
|
130
|
+
tailChars: 1024
|
|
131
|
+
|
|
132
|
+
# ── delegation and workflows ────────────────────────────────────────────────
|
|
133
|
+
|
|
134
|
+
- id: delegation
|
|
135
|
+
name: cordis:group
|
|
136
|
+
group: true
|
|
137
|
+
isolate:
|
|
138
|
+
workflowEngine: true
|
|
139
|
+
config:
|
|
140
|
+
- id: tool-subagent-control
|
|
141
|
+
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
142
|
+
|
|
143
|
+
- id: tool-subagent-list-agents
|
|
144
|
+
name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
|
|
145
|
+
|
|
146
|
+
- id: tool-subagent
|
|
147
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
148
|
+
config:
|
|
149
|
+
provider: spawn
|
|
150
|
+
toolName: subagent
|
|
151
|
+
backgroundMode: continuable
|
|
152
|
+
|
|
153
|
+
- id: tool-subagent-fork
|
|
154
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
155
|
+
config:
|
|
156
|
+
provider: fork
|
|
157
|
+
toolName: subagent_fork
|
|
158
|
+
backgroundMode: continuable
|
|
159
|
+
|
|
160
|
+
- id: workflow-worker-thread
|
|
161
|
+
name: '@deepseek-ai/dsh-workflow-worker-thread'
|
|
162
|
+
config:
|
|
163
|
+
provider: spawn
|
|
164
|
+
|
|
165
|
+
- id: tool-workflow
|
|
166
|
+
name: '@deepseek-ai/dsh-tool-workflow'
|
|
167
|
+
|
|
168
|
+
- id: tool-ralph
|
|
169
|
+
name: '@deepseek-ai/dsh-tool-ralph'
|
|
170
|
+
config:
|
|
171
|
+
subagentProvider: spawn
|
|
172
|
+
maxRounds: 64
|
|
173
|
+
|
|
174
|
+
# ── remaining model-facing rows ─────────────────────────────────────────────
|
|
175
|
+
|
|
176
|
+
- id: tool-ask-user
|
|
177
|
+
name: '@deepseek-ai/dsh-tool-ask-user'
|
|
178
|
+
|
|
179
|
+
- id: tool-todo
|
|
180
|
+
name: '@deepseek-ai/dsh-tool-todo'
|
|
181
|
+
config:
|
|
182
|
+
allowParallelInProgress: true
|
|
183
|
+
|
|
184
|
+
- id: tool-web
|
|
185
|
+
name: '@deepseek-ai/dsh-tool-web'
|
|
186
|
+
config:
|
|
187
|
+
fetch: false
|
|
188
|
+
searchTimeoutMs: 60000
|
|
189
|
+
|
|
190
|
+
# ── Vibe Math ───────────────────────────────────────────────────────────────
|
|
191
|
+
|
|
192
|
+
# The multi-agent math solver + verification framework: a preset-local plugin
|
|
193
|
+
# (./vibe-math.js) that registers 16 model tools (vibe_math_*), a /vibe slash
|
|
194
|
+
# command, and a background scheduler. It consumes the HOST
|
|
195
|
+
# subagents/agents/fs/tools/commands services and provides nothing, so it sits
|
|
196
|
+
# loose (no isolate realm).
|
|
197
|
+
- id: vibe-math
|
|
198
|
+
name: './vibe-math.js'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-vibe-math",
|
|
3
|
-
"description": "Multi-agent mathematical problem-solving & verification framework for DeepSeek Harness: breadth-first brainstorm, iterative solving, multi-verifier cross-validation with debate, and a Verified knowledge base — with checkpoint resume and mid-run human intervention.",
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "Multi-agent mathematical problem-solving & verification framework for DeepSeek Harness: breadth-first brainstorm, iterative solving, multi-verifier cross-validation with debate, and a Verified knowledge base — with checkpoint resume and mid-run human intervention. Installs as a bundle AND auto-installs its agent preset.",
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "vibe-math.js",
|
|
7
7
|
"exports": {
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"vibe-math.js",
|
|
13
|
-
"cordis.patch.yml"
|
|
13
|
+
"cordis.patch.yml",
|
|
14
|
+
"agent.cordis.yml",
|
|
15
|
+
"preset.yml"
|
|
14
16
|
],
|
|
15
17
|
"license": "MIT",
|
|
16
18
|
"keywords": [
|
package/preset.yml
ADDED
package/vibe-math.js
CHANGED
|
@@ -1,19 +1,47 @@
|
|
|
1
1
|
// Vibe Math — permanent host plugin: multi-agent mathematical problem solving &
|
|
2
2
|
// verification framework ("广度探索 → 深度迭代 → 交叉验证 → 知识沉淀").
|
|
3
3
|
//
|
|
4
|
-
// Preset-local plugin
|
|
5
|
-
// TypeScript sources
|
|
6
|
-
// background scheduler; provides NO service,
|
|
4
|
+
// Preset-local plugin. Only node: builtins are imported (the harness's own
|
|
5
|
+
// TypeScript sources are not reachable via ESM resolution). Registers 20 model
|
|
6
|
+
// tools, /vibe slash commands, and a background scheduler; provides NO service,
|
|
7
|
+
// so it sits loose in the preset.
|
|
7
8
|
//
|
|
8
9
|
// Projects: each math project lives in its own folder under
|
|
9
10
|
// <workspace>/VibeMath/Projects/<project>/ with its own qs/Verified/... layout.
|
|
10
11
|
// The current project is recorded in <workspace>/VibeMath/current.json.
|
|
11
12
|
// Default parameters can be overridden by an (optionally commented) JSON file:
|
|
12
13
|
// <project>/vibe_math_setting.json (fallback <workspace>/VibeMath/vibe_math_setting.json).
|
|
14
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
15
|
+
import { homedir } from 'node:os'
|
|
16
|
+
import { dirname, join } from 'node:path'
|
|
17
|
+
import { fileURLToPath } from 'node:url'
|
|
18
|
+
|
|
19
|
+
// Ensure the agent-preset form is installed under the DSH preset root, so a
|
|
20
|
+
// market/bundle install also surfaces "Vibe Math" in the agent-preset picker.
|
|
21
|
+
// No-op when the preset already exists or when running inside the preset itself.
|
|
22
|
+
function ensurePresetInstalled(logger) {
|
|
23
|
+
try {
|
|
24
|
+
const dshHome = process.env.DSH_HOME || join(homedir(), '.dsh')
|
|
25
|
+
const presetDir = join(dshHome, '.agent-presets', 'vibe-math')
|
|
26
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
27
|
+
const files = ['agent.cordis.yml', 'preset.yml', 'vibe-math.js']
|
|
28
|
+
if (files.every((f) => existsSync(join(presetDir, f)))) return false
|
|
29
|
+
if (!files.every((f) => existsSync(join(here, f)))) return false
|
|
30
|
+
mkdirSync(presetDir, { recursive: true })
|
|
31
|
+
for (const f of files) writeFileSync(join(presetDir, f), readFileSync(join(here, f)))
|
|
32
|
+
logger?.info?.('[vibe-math] agent preset installed to %s (visible in the preset picker for new sessions)', presetDir)
|
|
33
|
+
return true
|
|
34
|
+
} catch (err) {
|
|
35
|
+
logger?.warn?.('[vibe-math] could not install agent preset: %s', String(err?.message ?? err))
|
|
36
|
+
return false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
13
40
|
export const name = 'vibe-math'
|
|
14
41
|
export const inject = ['subagents', 'agents', 'fs', 'tools', 'commands']
|
|
15
42
|
|
|
16
43
|
export function apply(ctx) {
|
|
44
|
+
ensurePresetInstalled(ctx.logger)
|
|
17
45
|
const subagents = ctx.subagents
|
|
18
46
|
const agents = ctx.agents
|
|
19
47
|
const fs = ctx.fs
|