插件目录 / Developer / dsh-spec-loop
dsh-spec-loop
已验证 · 实测可装 tianji-qingtian
功能简介
规格驱动开发闭环(OpenSpec兼容):/spec命令族驱动生成规格→批准→实现→验收→归档
可用 — 实测通过,早期项目
规格驱动开发闭环(OpenSpec兼容):/spec命令族驱动生成规格→批准→实现→验收→归档 实测能干净安装、正常启动。早期项目,但功能可用。
「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。
README
dsh-spec-loop
Spec-driven development loop for DeepSeek Harness (dsh): a /spec command family drives propose → approve → implement → verify → archive, with change directories compatible with the OpenSpec layout under <workspace>/openspec/.
The harness is in developer preview and iterates quickly — expect compatibility-breaking changes.
中文说明见 README.zh.md。
Features
/speccommand family —init·new <goal>·status·list·show <id>·approve <id>·implement <id>·verify <id> [--deep]·archive <id>·validate [id]·edit <id>. Commands orchestrate and touch the filesystem only; proposal and implementation content is generated by the agent's main model throughagent.steerwith the full tool set.- Clarification on
/spec new— up to three built-in choice questions (scope / constraints / acceptance), in the language of the goal; answered through the harness question UI. Subagent sessions and missing UI providers fall back to proceeding without clarification. - OpenSpec-compatible layout —
openspec/project.md,openspec/specs/<capability>/spec.md,openspec/changes/<change-id>/{proposal.md,tasks.md,design.md,verify.md,specs/<cap>/spec.md}, archived tochanges/archive/YYYY-MM-DD-<id>/. Spec deltas use## ADDED|MODIFIED|REMOVED Requirementswith#### Scenario:per requirement. - Built-in validator — the plugin ships the same core rules as the OpenSpec CLI (sections, requirements, scenarios, change-id shape) and runs them automatically after proposal generation: on failure it steers a correction request back to the agent (bounded retries).
approverefuses changes that do not validate;archiverefuses missing changes. - Approval gate —
implementrefuses changes whose state is notapproved(or later in the implementation chain). The gate reads the same durable projection the panel renders, so display state and behavior state can never disagree. - Per-scenario verification —
verifyjudges every Requirement/Scenario against the workspace with a bounded judge call (flash by default, main model with--deep), runs```bashverification commands declared inproposal.md, and writesverify.mdwith a ✅/❌ table plus the raw judge output. - Durable state machine —
proposed → approved → implemented → verified → archived(any stage caneditback toproposed) is a session projection folded from standard events (command/run/command/donepairs + the agent's machine-readable markers), so the change card, stage, and gate survive restarts. No custom event types are appended to the log. - Change card in the composer dock — a full-width row above the input card (
conversation.input.dock) shows the current change-id, stage, task progressx/y, and the next command to run. Task progress reads the standardtodosprojection (the implement prompt mirrorstasks.mdintotodo_write) — zero RPC. UI strings are localized through the harnesslocaleservice (zh/en).
Install
Prerequisites
The dsh CLI must be on your PATH. If you only ever ran the harness through npx, dsh is not installed and you will get zsh: command not found: dsh — install it globally first:
npm install -g @deepseek-ai/dsh
pnpm add -g @deepseek-ai/dsh also works if your pnpm global bin dir is on PATH (otherwise pnpm asks you to run pnpm setup first). Alternatively skip the global install and prefix the commands below with npx @deepseek-ai/dsh ….
Add the bundle
# 1. add the bundle to your web profile (pnpm-backed; the built lib/ artifacts
# are committed in this repo, so no build script runs at install time).
# Prefer a release tag (#v0.1.2); #main tracks the latest commit.
dsh plugin --profile web add "github:tianji-qingtian/dsh-spec-loop#v0.1.2"
# 2. restart the harness with that profile — `add` only edits the profile
# files; a running instance does not hot-load the new bundle
dsh --profile web
After the restart the 📐 Spec card appears above the composer in the Web UI and the /spec command is registered once the host half loads. Verify under Settings → Plugins that dsh-spec-loop is listed.
Usage
/spec init # create openspec/project.md + directory layout
/spec new 用户登录功能 # clarify → agent writes proposal/tasks/deltas → auto-validate
/spec status # read-only card: current change-id, stage, x/y progress
/spec list # active changes (x/y tasks) + capability specs
/spec show add-user-login # read a proposal (plus design.md when present)
/spec approve add-user-login # approve → implementation gate opens
/spec implement add-user-login # agent implements tasks.md in order, ticks checkboxes
/spec verify add-user-login # per-scenario judge (flash); --deep for the main model
/spec verify add-user-login --deep
/spec archive add-user-login # merge deltas into specs/, move to changes/archive/
/spec validate [id] # OpenSpec format check (auto-run after /spec new)
/spec edit add-user-login # revise a proposal, back to proposed
The change card above the input shows the current change-id, stage, and x/y progress, plus the next command to run.
How it works
| Piece | Mechanism |
|---|---|
| Commands | commands.register — one /spec command with a subcommand router. Handlers orchestrate and touch the filesystem (ctx.fs); generation is steered to the agent (agent.steer with a plugin-sourced UserMessage). |
| State machine | A session projection (specLoop) folds standard events: command/run+command/done pairs transition on success only, and the agent's reply markers (SPEC_CHANGE_ID: <id>, SPEC_IMPLEMENTED) complete the async stages. implement gates on the same projection. |
| Task progress | The implement prompt mirrors tasks.md into the todo_write tool; the panel reads the shipped todos projection. |
| Verification | Handler-side bounded judge call (ctx.llm.stream, reasoningEffort: 'off', flash by default); ```bash blocks from proposal.md run first via ctx.shell and their output is included in the judge prompt. |
| Archive merge | Deltas are merged requirement-by-requirement into specs/<cap>/spec.md (ADDED append, MODIFIED replace, REMOVED drop), then the change dir moves with one mv (ctx.shell). |
| UI | conversation.input.dock slot entry; reads useProjection('specLoop') + useProjection('todos'); locale service for zh/en strings. |
Compatibility notes
- No custom session event types. Out-of-repo plugins cannot register new
SessionEventMapmembers safely (the persistence read path refuses unknown non-ignorable types), so every state transition rides standard events. This keeps session logs readable even if the plugin is later removed. ctx.fshas no move/delete, so archive usesctx.shell(mkdir && mv) for the physical move; the workspace sandbox allows it becauseopenspec/lives inside the workspace.- Approval state is per-session, folded from that session's command log — approving in one session does not approve in another.
Development
pnpm install
pnpm build # tsdown: lib/index.js (host) + lib/client.js (client bundle)
pnpm test # three suites: mock-runtime unit tests, real-filesystem smoke,
# and a real-composition integration test (cordis + real
# fs/commands/session-projection/llm services)
Requirements baseline: REQUIREMENTS.md.
License
MIT
安装
装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:
dsh plugin add dshbase-catalog 然后对 agent 说「帮我装 dsh-spec-loop」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。
该插件是 GitHub 源码(未发 npm)——直接从仓库装:
Web profile:
dsh plugin --profile web add github:tianji-qingtian/dsh-spec-loop Headless(CLI)profile:
dsh plugin --profile headless add github:tianji-qingtian/dsh-spec-loop 实测报告
验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。
使用场景
扩展 agent 的编码能力面——给它一个新工具、工作流或集成,让它接手以前做不了的开发任务。
适合谁
想让 dsh 在真实代码库上像队友一样干活的开发者——能改、能跑、能验证,而不只是回答问题。
二次开发建议
工具/命令面就是缝:暴露更多 SDK 能力、加更聪明的上下文接线,或收紧改代码与验证之间的循环。