为 DeepSeek Harness (dsh) 增加 Morning Star 多代理协作框架:注入流程门禁、状态校验、子代理角色装饰与可视化工作流面板。
- 语言
- TypeScript
- License
- MIT
- 分支
- main
安装
$ dsh plugin --profile web add github:btspoony/mstar-harness在终端中运行以上命令,通过 dsh CLI 安装此插件。可在右上角切换 Profile。 第一次用 dsh?看这篇新手教程
对话式安装
帮我安装 DeepSeek Harness 插件 btspoony/mstar-harness:先查看仓库 https://github.com/btspoony/mstar-harness.git 确认安全性,然后执行安装命令并验证插件加载成功。
把这段指令粘贴给 DSH Web GUI 里的助手,由它代你完成安装与验证。
一句话定位
这是 Morning Star(启明星)多代理协作框架的 dsh(DeepSeek Harness)宿主插件。它把一套带状态机的工作流引擎挂到 dsh 内部:在写入 harness 状态文件、派发子代理、修改技能文档等关键节点自动校验,并在 dsh 对话窗口右侧渲染一个可视化的工作流面板。
核心能力
- 守护 harness 状态文件写入:拦截对
{HARNESS_DIR}/status.json的写入请求,按当前文档做完整性校验与残留清理检查,违规时通过 dsh 的拒绝通道返回决策 - 校验子代理派发:拦截 subagent / subagent_fork 工具调用,按工作流约束判断该派发是否合法,在"硬约束"模式下可拒绝不合规派发(含反自递归预检)
- 自动注入角色人设:监听 dsh 子代理启动事件,把对应角色的描述作为系统提示片段注入子代理上下文
- 挂载技能目录:以独立的技能提供者身份把 mstar 的
skills/镜像挂到 dsh,让 dsh 能识别并调用 mstar-* 系列技能 - 输出引擎状态目录:每次模型推理前向对话上下文追加一行
mstar-engine-status摘要(含迭代阶段、当前计划、剩余项、合规策略等) - 暴露四个工作流斜杠命令:注册
/iteration-start、/iteration-drive、/iteration-loop、/codebase-audit,无需离开 dsh 即可启动/恢复多计划迭代 - 在对话窗口右侧渲染"MStar 工作流"面板:以画布形式展示当前迭代阶段、计划看板与代理流转状态
技术实现
- 语言: TypeScript
- 关键依赖: @deepseek-ai/cordis(插件容器)、@mstar-harness/engine(共享工作流引擎)、@deepseek-ai/dsh-skill-filesystem(技能挂载通道)、schemastery(配置校验)
- 架构模式: dsh cordis 扩展插件(named export + apply 钩子),通过 fs 写入拦截、工具预执行拦截、subagent 启动事件、agent 推理前目录注入四个 dsh 官方扩展面工作,零 dsh 本体修改
- 入口文件: packages/dsh/src/index.ts(DSH 子包);根 package.json 的 main 指向 packages/opencode/src/mstar.ts(OpenCode 宿主入口,本插件不涉及)
适用场景
使用 dsh(DeepSeek Harness)的多代理项目,需要让多个代理(PM、QC、QA、开发者角色)按一致的状态机和阶段门禁协作。当前的痛点是 dsh 自带的派发工具只负责"派一个代理去干活",无法保证每个派发都符合整体计划的工作流约束;装上这个插件后,所有派发和状态写入都会被引擎先审核一遍,并把当前进度可视化出来。
前置依赖与兼容性
| 依赖 | 最低版本 | 说明 |
|---|---|---|
| DSH | 0.1.0-rc.7+ | 插件强依赖 dsh-agent / dsh-client-runtime / dsh-client-ui-conversation / dsh-client-ui-slots / dsh-client-locale / dsh-commands / dsh-fs / dsh-invariants / dsh-jobs / dsh-llm / dsh-skill / dsh-skill-filesystem / dsh-tools 等宿主包,且需 dsh-base + dsh-web-app 层在 profile 中 |
| @deepseek-ai/cordis | ^4.0.1 | dsh 的插件容器,由宿主提供 |
| Bun(仅构建期) | >=1.2.17 | 插件开发者从源码构建时使用;用户从 npm 安装已构建产物则无需 |
| 运行时 Node | 由 dsh 宿主决定 | 插件未单独声明 Node 版本 |
| dsh-llm-fallbacks | 可选 ^0.2.0 | 仅在使用 mstar 角色种子与 fallbacks 模型路由联动时需要,独立安装 |
| 平台 | 跨平台 | 服务端跑在 dsh Node 进程;浏览器侧通过 dsh web profile 加载 |
安装方式
dsh plugin --profile web add github:btspoony/mstar-harness
安装命令格式由 dsh 官方插件规范规定;上述命令会把
@mstar-harness/dsh加入 web profile 的 bundle 列表并自动重建挂载。也可使用一行式 CLI 安装:npx @mstar-harness/cli init --target dsh,会自动顺带安装dsh-llm-fallbacks。
配置项
所有字段都可省略,省略时按"硬编码默认"或"运行时探测"工作。
| 配置 | 类型 | 说明 | 默认值 |
|---|---|---|---|
harnessDir | 字符串 | 显式指定 harness 根目录。当你的项目用 .mstar/ 等会被插件自动识别的目录名时无需配置;如果用了非常规目录名(例如 .harness/),必须手动指定 | 运行时按会话工作区探测(依次尝试 .mstar/、.agents/、.plans/、plans/) |
enforcement | hard / soft | 全局强制度覆盖。hard 让派发门禁真拒绝;soft 强制只警告(哪怕迭代指引声明硬约束)。一般无需改 | 跟随迭代 compass 的元数据决定,无 compass 时一律警告 |
dispatchTools | 字符串数组 | 派发门禁要拦截的工具名清单 | ["subagent", "subagent_fork"] |
dispatchBinding | 字符串 | 当前 dsh 会话对应的 mstar 角色(如 fullstack-dev),用于反自递归预检:避免代理派发"自己" | 未配置则跳过自递归检查 |
skillRoots | 字符串数组 | 额外技能根目录,会以 dsh 技能文件系统的"项目级"被识别 | 无(只挂载插件自带的技能镜像) |
bundledSkillDir | 字符串 | 自定义"内置"技能根目录。绝对路径优先;相对路径按 dsh 启动目录解析 | 插件包自带的 harness-skills/ 镜像(包内相对路径,不受启动目录影响) |
catalogTtlMs | 数字 | 引擎状态目录的刷新间隔(毫秒) | 60000 |
roleMap | 对象 | mstar 角色名 → dsh-llm-fallbacks 角色名的映射表,目前只用于日志 | 无 |
rolePersonas | 对象 | mstar 角色名 → 自定义人设文本。子代理启动时会作为系统提示片段注入。注意:内容里不能出现成对的 {{ 与 }},否则启动时校验失败 | 走插件包自带的 harness-agents/ 镜像默认值 |
workflowGate | off / warn / ask / hard | 工作流/ralph 工具的合规门禁模式。warn 只警告;ask 首次出现新工作流走 dsh 审批;hard 直接拦截违规调用 | warn |
workflowNames | 字符串数组 | 被认为是"已知"的工作流名白名单。空/未配置 ⇒ 全部按未知处理(默认不放行) | 未配置 |
maxGoalRounds | 数字 | 目标服务的最大回合上限(自主迭代阶段的硬边界) | 256 |
常见问题
Q: 安装之后 dsh 启动变慢了吗?
A: 影响极小。引擎状态目录默认 60 秒刷新一次,热路径只是时间戳比对加 Map 查询;只有在第一次或缓存过期时才会重读 harness 文件。
Q: 派发门禁会不会"误杀"我合法的派发?
A: 默认是 warn 模式,只警告不阻止;只有当你在迭代 compass 中显式开启 Enforcement: hard、或在配置中写 enforcement: hard 时才会真正拒绝。硬模式下被拦截会附带具体原因,按提示修改即可。
Q: 反自递归预检怎么配置才生效?
A: 在你的 dsh 配置里给插件的 mstar 行加上 dispatchBinding: '<发起派发的 mstar 角色名>',例如 dispatchBinding: fullstack-dev。没配置就跳过预检,不会误报。
Q: 我看到 dsh 多了一个"MStar 工作流"标签页,怎么关掉?
A: 它来自插件包内的浏览器端 client bundle(packages/dsh/src/client/),由 dsh web profile 自动加载。如果你不需要,把 @mstar-harness/dsh 从 profile 移除后重启 dsh 即可。
Q: 我能修改插件内的角色人设或技能目录吗?
A: 可以。两种方式:编辑 dsh profile 层的 cordis.patch.yml,在 mstar 行的 config 里加 rolePersonas / bundledSkillDir 覆盖;或者修改仓库根目录的 skills/、agents/ 后跑 bun run bundle-assets 重新打包。
Q: 报错 "persona contains {{...}}" 怎么办?
A: dsh 系统提示渲染器对 {{ 与 }} 做严格变量插值,你在 rolePersonas 写的文本里若出现成对的大括号就会被拒。把双大括号改成单大括号、或换个写法即可;孤立的 {{(没有配对的 }})是安全的。
Q: 跟 dsh 升级冲突吗?
A: 不会。插件不修改 dsh 本体,dsh 升级后只需 bun run build && dsh plugin --profile web add . 重新挂一次(或重新 add 远端版本)。如果升级的是 dsh 0.1.0-rc.7 之前版本,则可能需要先升级 dsh。
上手难度
进阶 — 需要理解 mstar 的状态机概念({HARNESS_DIR}/status.json、iteration compass、QC/QA gate),普通 dsh 用户多数情况下装上即用,但要让"硬约束"真正生效就需要读懂 compass 元数据。
已知问题与限制
- 状态文件写入拦截是"内容盲"的:fs 写入事件只携带目标路径与代理,不带新内容,所以"把好文档改坏"的那一次写入无法被拦;修复方式是手动改回正确格式,或删除 status.json 让 harness 重建
- 反自递归预检依赖
dispatchBinding配置:未配置时直接跳过,多角色派发方需要为每种角色分别部署配置 - 技能内置镜像在构建时同步:如果你是从源码安装但没跑
bun run bundle-assets,则没有内置技能也没有内置命令,但不会报错 {{与}}的内容不能写在rolePersonas中,否则插件挂载阶段就会被 schemastery 校验拒绝- 对
workflow/ralph工具调用做门禁时,未配置workflowNames等同于"全部未知",所以第一次跑新工作流会被标记 - 内容盲技能 lint 也有同款盲区:fs 写入事件不带内容,所以"首次创建的内容不合规"或"好文档被覆盖"无法拦截
lintSkillWrite的硬拦截错误类已实现但当前 dsh 还没有"带内容"的技能写入钩子,所以只能以"repair escape"形式给出告警- 角色→模型的自动路由功能未交付:当前插件只注入人设,不会改写子代理的模型选择;该能力依赖上游接口
- design-md 命名匹配是全局 basename 匹配(任意目录下的
DESIGN.md都会触发设计系统校验),可能对不相关项目产生噪音告警
Morning Star is an Agent Plugin for harness engineering workflows: a TypeScript Harness Workflow Engine (@mstar-harness/engine) enforces deterministic workflow gates, while mstar-* judgment skills drive multi-agent code delivery.
- Deterministic gates, enforced by a TS engine — path/status/lease/dispatch/sdd/iteration/lint gates run in
@mstar-harness/engine, not as prompt suggestions - Judgment stays in
mstar-*skills — skills remain the single source of truth (SSOT) for roles, gates, and workflow judgment - One engine across hosts — the same engine + skills power dsh (DeepSeek Harness), omp, OpenCode, Cursor, Kimi Code, ZCode, and Codex
- Agent Plugin packaging — one-command install; portable across any Agent Plugins v1.0.0 client
- Recommended host (best → usable): dsh = omp ≥ OpenCode ≥ Cursor > Kimi = ZCode > Codex
What ships
| Component | What it is |
|---|---|
| Harness Workflow Engine | @mstar-harness/engine — TS enforcement of deterministic workflow gates |
| mstar CLI | @mstar-harness/cli — installer bootstrap + mstar workflow verbs |
mstar-* skills | Role, gate, and workflow judgment (single source of truth) |
| Host adapters | dsh, omp, OpenCode, Cursor, Kimi Code, ZCode, Codex |
Release notes: CHANGELOG.md / CHANGELOG_CN.md.
Install
| Host | Command |
|---|---|
| dsh (DeepSeek Harness) | npx @mstar-harness/cli init --target dsh(one CLI command that runs two independent dsh plugin --profile web add installs:@mstar-harness/dsh + dsh-llm-fallbacks; --no-fallbacks skips the latter)or dsh plugin --profile web add @mstar-harness/dsh+ dsh plugin --profile web add dsh-llm-fallbacks |
| omp | npx @mstar-harness/cli init --target omp(links ~/.mstar/harness)or omp plugin install github:btspoony/mstar-harness |
| OpenCode | npx @mstar-harness/cli init --target opencode |
| Cursor | npx @mstar-harness/cli init --target cursor |
| Kimi | Kimi TUI: /plugins install https://github.com/btspoony/mstar-harness→ /plugins reload |
| ZCode | npx @mstar-harness/cli init --target zcodethen install morning-star-harness in ZCode → Settings → Plugin Management |
| Codex | npx @mstar-harness/cli init --target codexthen codex plugin add morning-star-harness --marketplace personal |
| Generic (Agent Plugins v1) | point any Agent Plugins v1.0.0 conformant client at this repo root ( plugin.json + skills/ are the portable package) |
Engine gate checks (optional)
npm i -g @mstar-harness/cli
Puts the mstar-harness binary (short alias mstar) on PATH, so the engine-check commands the skills cite (mstar status validate, mstar dispatch validate, mstar iteration gate, …) actually run.
Without a global install the harness still works and those checks stay advisory. Set enforcement: hard in an iteration compass to make dispatch preflights fail-fast.
Caution:
mstaris a short alias and a shared bin namespace — an unrelated third-party npm package namedmstarclaims the same command name. The alias exists only where@mstar-harness/cliis installed: barenpx mstar …without the package resolves via the registry to that other tool, and globally co-installing both packages silently overwrites themstarshim (last install wins). The canonical invocation name staysmstar-harness— use the long name on any conflict.
Verify
npx @mstar-harness/cli doctor --target <opencode\|cursor\|codex\|zcode\|omp\|dsh>.
The repo ships a portable Agent Plugins v1.0.0 manifest (plugin.json) at its root; skills/ is the Agent Skills component — verify it with npx @mstar-harness/cli plugin validate.
Manual install / path layout: INSTALL.md. CLI flags: docs/cli.md.
Use
Three entry shapes: without iteration (single plan / hotfix), with iteration (multi-plan Phase 1–5), or codebase audit (discover what to do).
General (without iteration)
Enter PM, then run the per-plan cycle: Prepare → Execute → QC → QA gate → Done.
| Host | Enter PM |
|---|---|
| dsh (DeepSeek Harness) | pm skill (via the mstar skill provider; no auto-load) |
| omp | /skill:pm each session (no auto-load) |
| OpenCode | agent.project-manager (agents/project-manager.md) |
| Cursor | /pm |
| Kimi | session auto-loads pm; or /skill:pm |
| ZCode | /morning-star-harness:pm each session (no auto-load) |
| Codex | /pm |
Iteration
| Command | When |
|---|---|
/iteration-start [direction] [pause] | Start a new iteration: Phase 1 (interactive grill-me), then auto-continue Phase 2→5.direction — optional hint (still interactive).pause — stop after Phase 1; resume with /iteration-drive. |
/iteration-drive | Resume Phase 2→5 on an already-locked iteration. |
/iteration-loop [direction] [scale] | Full Phase 1→5 autonomous (no grill-me).direction — optional free text.scale — S / M / L / XL (default M). |
Codebase audit
| Command | When |
|---|---|
/codebase-audit [keywords] | Read-only survey → prioritized, self-contained plans in {PLAN_DIR}/audit-<date>/.Never edits source. Output feeds /iteration-start Research or normal Prepare → Execute.Effort: quick / deep (default standard).Scope: category focus ( security, perf, tests, …); branch (current-branch changes only); next / roadmap (direction candidates only); simplify (DEBT-focused deep pass).SSOT → mstar-audit. |
Command loading
| Host | How commands load |
|---|---|
| dsh (DeepSeek Harness) | /iteration-start · /iteration-drive · /iteration-loop · /codebase-audit (bundled harness-commands/ via ctx.commands) |
| omp | /iteration-start · /iteration-drive · /iteration-loop · /codebase-audit (filename commands from plugin commands/) |
| OpenCode / Cursor | Bundled from commands/ (OpenCode: plugin harness-commands/) |
| Kimi / ZCode | /morning-star-harness:iteration-start · :codebase-audit (etc.) via plugin manifest |
| Codex project | .agents/skills/<name>/SKILL.md (CLI symlinks from commands/) |
| Codex global | Project-scoped commands not installed — use --scope project |
Phase 2 defaults: per-plan worktree + lease, Findings cleanup: zero-residual. Override only with explicit Worktree mode: waived / Findings cleanup: allow-residual. SSOT → mstar-iteration, mstar-branch-worktree, mstar-plan-artifacts.
Project knowledge bootstrap: mstar-compound-refresh → references/project-knowledge-bootstrap.md.
Harness Workflow
flowchart TD
A["PM: entry and intent clarification"] --> B{"PM: spec and context ready"}
B -->|No| C["PM: clarify and refine requirements"]
C --> B
B -->|Yes| D["PM: initialize/load HARNESS_DIR and PLAN_DIR"]
D --> E{"Iteration scope needed"}
E -->|Deep / first iteration| F["iteration-start: grill-me → compass → review → lock"]
E -->|Fast autonomous loop| F2["iteration-loop: Phase 1→5 continuous"]
F --> G["PM: lock compass and create integration branch"]
F2 --> G
G --> H["Phase 2→5: execute → close → PR → merge-ready"]
E -->|No| I["PM: select active plan from status.json"]
H --> I
I --> J{"Any plan not Done"}
J -->|Yes| K["PM: dispatch one plan on a feature branch"]
K --> L["Dev roles: implement and report"]
L --> M["PM: update plan and status.json"]
M --> N["QC trio: review gate"]
N --> O{"QC decision"}
O -->|Request Changes| K
O -->|Approve| P{"QA gate"}
P -->|mandatory| P1["qa-engineer: acceptance verification"]
P -->|pm-acceptance| P2["PM: acceptance checklist"]
P1 --> Q{"Residual findings remain"}
P2 --> Q
Q -->|Yes| R["PM/QA: register or accept residuals in status.json"]
R --> S["PM: mark plan Done and merge to integration branch"]
Q -->|No| S
S --> T["PM: sync compass plan status"]
T --> J
J -->|No| U["iteration-close: close entry checklist"]
U --> V["PM: compound round and knowledge index"]
V --> W["PM: update roadmap and compass completed frontmatter"]
W --> X["PM: close exit checklist and commit"]
X --> Y["Phase 4: create PR"]
Y --> Z["Phase 5: merge-ready loop until CI green and reviews resolved"]
Without iteration: same per-plan gates, no iteration-start / iteration-close wrapper.
Roles and skills
| Agent ID | Responsibility |
|---|---|
project-manager | Routing, assignment, phase progression |
product-manager | Requirements, product planning, research |
architect | Architecture and technical contracts |
fullstack-dev / fullstack-dev-2 | Backend-led implement / second parallel track |
frontend-dev | UI, interaction, frontend performance |
qa-engineer | Acceptance when QA gate: mandatory |
code-reviewer | SDD per-task review; codebase audit (audit category) |
qc-specialist / -2 / -3 | QC trio |
ops-engineer | Deploy, monitoring, infrastructure |
writing-specialist | Docs, fiction, copy, scripts |
prompt-engineer | Prompt / skill / rule work |
Load mstar-harness-core first, then topic skills on demand (mstar-roles).
| Skill | Purpose |
|---|---|
mstar-harness-core | Entry, state machine, Task category, skill index |
mstar-phase-gates | Prepare/Execute, clarify, hotfix |
mstar-iteration | Phase 1–5 iteration lifecycle |
mstar-dispatch-gates | Dispatch, Delegation, anti-recursion |
mstar-sdd | Subagent-driven development |
mstar-branch-worktree | Branches, worktrees, QC/QA checkout |
mstar-plan-conventions | {HARNESS_DIR} discovery / init |
mstar-plan-artifacts | Plans, status.json, residuals, Findings cleanup |
mstar-design-md | DESIGN.md gate for UI plans |
mstar-review-qc | PM QC tri orchestration |
mstar-coding-behavior | RCA, test-first, review feedback, evidence |
mstar-compound / mstar-compound-refresh | Knowledge crystallize / maintain |
mstar-strategy | STRATEGY.md alignment |
mstar-skill-authoring | General skill authoring (SkillsBench gate) |
mstar-audit | Read-only codebase audit → prioritized improvement plans |
mstar-roles | Role prompts + load lists |
mstar-host | Host adapters (dsh / omp / OpenCode / Cursor / Kimi / ZCode / Codex) |
pm | /pm / /skill:pm / host PM entry |
Consumer plans default to .mstar/. Process artifacts (plans/, iterations/, status.json, sdd/, …) are gitignored; tracked results: {HARNESS_DIR}/AGENTS.md, knowledge/, specs/. Specs resolve .mstar/specs/ → docs/specs/ → repo-root specs/. Details → mstar-plan-conventions.
Maintainers: AGENTS.md.
License
MIT. See LICENSE.
收录徽章
[](https://deepseek-plugin.org/plugins/btspoony/mstar-harness)把这段 markdown 粘贴到你的 GitHub README,链接回本插件详情页。徽章只声明已被本站收录,不代表安全认证。