Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.
JavaScript agent-orchestrationagentic-workflowai-agentsai-codingclaude-codecode-reviewcodebuddycodexcoding-agentscursordeveloper-toolshuman-on-the-loopllmmcpmulti-agentsdlcself-hostedsopworkflow-automationworkflow-engine
feat(local): add Hermes and DSH integrations (#158)
Chen Zhonge0ce2de54a95
diff --git a/README.md b/README.mdindex d2045d2f..d4ec28d9 100644--- a/README.md+++ b/README.md@@ -181,6 +181,8 @@ Then run `/start-devflow "<your request>"` in Claude Code.| --- | --- || Claude Code · CodeBuddy · Codex · Cursor | Classic (default) and Portable editions || Pi | Portable edition |+| DeepSeek Harness | Portable edition |+| Hermes Agent | Portable edition |See the [local guide](docs/local/usage.md) for each host's entry point and [editions](docs/local/editions.md) for the differences. Source lives in [`local/`](local/). Local runs the built-in workflows today; exporting a platform SOP for standalone local execution is planned.diff --git a/docs/local/architecture.md b/docs/local/architecture.mdindex 05ab392f..8cd04172 100644--- a/docs/local/architecture.md+++ b/docs/local/architecture.md@@ -11,8 +11,8 @@## Portable Edition`skills/` 提供独立的新 DevFlow 状态机、模板、规则、测试和 adapter,-支持 CodeBuddy、Codex、Cursor、Claude Code 与 Pi(Pi 只有声明型 adapter,-isolated 模式依赖公开扩展 `npm:pi-subagents`)。脚本只依赖 Python 3.8++支持 CodeBuddy、Codex、Cursor、Claude Code、Pi、DeepSeek Harness 和 Hermes Agent(Pi 只有声明型 adapter,+isolated 模式依赖公开扩展 `npm:pi-subagents`;DSH 使用内置 `subagent` 工具;Hermes 使用 `delegate_task`)。脚本只依赖 Python 3.8+标准库;具体 Agent 调度能力由宿主提供。`skills/manifest.json` 是跨宿主 Skill 集合清单。`skills/` 是这一层的唯一diff --git a/docs/local/compatibility.md b/docs/local/compatibility.mdindex 86c76275..5377a87f 100644--- a/docs/local/compatibility.md+++ b/docs/local/compatibility.md@@ -11,6 +11,8 @@| Cursor | `.cursor/` 完整包 | `.cursor/skills` + 两个执行器 || Claude Code | `.claude/` 完整包 | `.claude/skills` + 两个执行器 || Pi | 无(Portable only) | `.pi/skills` + `subagent` adapter(需 `npm:pi-subagents`) |+| DeepSeek Harness | 无(Portable only) | `.dsh/skills` + `subagent` adapter(DSH base 默认提供) |+| Hermes Agent | 无(Portable only) | `.hermes/skills` + `delegate_task` adapter;首次使用需 `hermes skills trust .`;可选 `hermes-plugin/` 提供 `/loopforge` 控制命令 |Classic 的 Cursor/Claude 目录是生成产物;Portable 的事实只保存在 `skills/`。两者只共享显式行为合同和测试,不共享宿主运行文件。@@ -19,7 +21,7 @@ Classic 的 Cursor/Claude 目录是生成产物;Portable 的事实只保存在1. **结构门禁**:校验 JSON/YAML、Skill frontmatter、manifest 引用和链接。2. **漂移门禁**:`build-classic-hosts.py --check` 逐字比较 Classic 生成包。-3. **安装门禁**:统一 CLI 覆盖 5 宿主 × 2 edition(pi 仅 Portable),并验证重复安装、更新、卸载、+3. **安装门禁**:统一 CLI 覆盖 7 宿主 × 2 edition(Pi、DSH 和 Hermes 仅 Portable),并验证重复安装、更新、卸载、mixed-edition 拒绝和用户文件保护。4. **流程回归**:标准库单测和 CLI E2E 验证状态机、门禁、产物与恢复协议。5. **真实宿主 canary**:发布前或宿主大版本升级后,在隔离 fixture 仓库用真实@@ -27,6 +29,10 @@ Classic 的 Cursor/Claude 目录是生成产物;Portable 的事实只保存在版本、调用轨迹、最终状态和 diff。此层需要各宿主凭据和运行环境,不应伪装成无凭据的普通单测。+Hermes 与 DSH 不绑定私有版本号:当前稳定版及后续版本必须提供清单中列出的公开能力。+能力缺失时,Hermes 不得伪造 isolated 执行器,DSH/Hermes 均须记录原因并按适配器合同降级到+`single-context`;这条能力策略就是版本边界。+前四层在普通 PR CI 中运行。第五层建议使用受保护的手动或定时流水线;任何宿主变更应先更新 manifest 的核对信息,再运行 canary。宿主 canary 失败时不能只更新快照,应先判断是字段协议变化、工具缺失、权限变化还是模型行为回归。diff --git a/docs/local/editions.md b/docs/local/editions.mdindex 8e456e0d..0dfeaf3b 100644--- a/docs/local/editions.md+++ b/docs/local/editions.md@@ -6,7 +6,7 @@ LoopForge Local 内置两套工作流,源码位于 `local/`。为避免同一| Edition | 仓库事实源 | 入口 | 维护方式 || --- | --- | --- | --- |-| Portable | `skills/` | CodeBuddy/Cursor/Claude 使用 `/devflow`,Codex 使用 `$devflow`,Pi 使用 `/skill:devflow` | 修改 canonical Skill 和 adapter manifest |+| Portable | `skills/` | CodeBuddy/Cursor/Claude/DeepSeek Harness/Hermes 使用 `/devflow`,Codex 使用 `$devflow`,Pi 使用 `/skill:devflow` | 修改 canonical Skill 和 adapter manifest || Classic(默认) | `.codebuddy/`、`.codex/`、`.cursor/`、`.claude/` | CodeBuddy/Cursor/Claude 使用 `/start-devflow`,Codex 使用 `$devflow-codex` | 以 `.codebuddy` 为参考行为;Cursor/Claude 由生成器产生 |表中路径均相对于 `local/`。安装器将对应资产安装到目标项目的宿主原生目录,@@ -27,3 +27,13 @@ loopforge skills install claudePortable 的 Pi 适配是声明型的:`skills install pi` 只安装 `.pi/skills/`,isolated(medium/large)模式还需要公开扩展 `pi install npm:pi-subagents` 提供 `subagent` 工具。++DeepSeek Harness 使用 `skills install dsh` 安装到 `.dsh/skills/`。DSH base profile 默认提供+`subagent` 工具;如果当前 profile 没有该工具,插件会记录具体原因并将 medium/large 流程降级为+`single-context`,不会伪造 isolated 执行器。++Hermes Agent 使用 `skills install hermes` 安装到项目的 `.hermes/skills/`。Hermes 首次发现项目技能时+要求显式信任仓库:在项目根目录运行 `hermes skills trust .`。medium/large 阶段使用 Hermes 的+`delegate_task` 创建独立子 Agent;当前会话缺少该工具时必须记录原因并降级为 `single-context`。+如需独立查看状态、产物和审批,可选安装 `local/hermes-plugin/`;插件只调用项目内的+`workflow_state.py`,不会覆盖 Hermes profile 配置。diff --git a/docs/local/usage.md b/docs/local/usage.mdindex b60ad726..cd894ba9 100644--- a/docs/local/usage.md+++ b/docs/local/usage.md@@ -14,6 +14,8 @@ Requires Node.js 20+ and Python 3.8+. The commands below install the default Cla| Codex | `npx -y loopforge-cli@latest install codex` | `$devflow-codex "<request>"` || Cursor | `npx -y loopforge-cli@latest install cursor` | `/start-devflow "<request>"` || Claude Code | `npx -y loopforge-cli@latest install claude` | `/start-devflow "<request>"` |+| DeepSeek Harness | `npx -y loopforge-cli@latest skills install dsh` | `/devflow "<request>"` |+| Hermes Agent | `npx -y loopforge-cli@latest skills install hermes` then `hermes skills trust .` | `/devflow "<request>"` |For example, with Claude Code:@@ -32,7 +34,7 @@ Check any installation with `npx -y loopforge-cli@latest status <agent>`. If insnpx -y loopforge-cli@latest doctor```-Pi is supported through the [Portable Edition](#portable-edition).+Pi, DeepSeek Harness and Hermes Agent are supported through the [Portable Edition](#portable-edition). DSH has an optional [plugin](../../local/dsh-plugin/README.md) for task controls, status, artifacts and approval gates. Hermes uses its project-local Agent Skills discovery and `delegate_task` tool; it does not modify `~/.hermes/config.yaml`. Hermes users can optionally install the native [Hermes plugin](../../local/hermes-plugin/README.md) for the same `/loopforge status`, `/loopforge result` and `/loopforge approve` controls.## How it works@@ -64,6 +66,8 @@ Your request| Cursor | ✓ | ✓ || Claude Code | ✓ | ✓ || Pi | — | ✓ |+| DeepSeek Harness | — | ✓ |+| Hermes Agent | — | ✓ |LoopForge enables only one edition per coding agent in each project. See [Edition selection](editions.md) for the differences and directory layout.@@ -136,6 +140,8 @@ The Classic Edition from the quick start is the right choice for most users. If| Cursor | `npx -y loopforge-cli@latest skills install cursor` | `/devflow "<request>"` || Claude Code | `npx -y loopforge-cli@latest skills install claude` | `/devflow "<request>"` || Pi | `npx -y loopforge-cli@latest skills install pi`, then `pi install npm:pi-subagents` | `/skill:devflow "<request>"` |+| DeepSeek Harness | `npx -y loopforge-cli@latest skills install dsh` | `/devflow "<request>"` |+| Hermes Agent | `npx -y loopforge-cli@latest skills install hermes`, then `hermes skills trust .` | `/devflow "<request>"` (optional plugin: `/loopforge`) |See [Edition selection](editions.md) for the complete boundaries and directory layout.@@ -147,7 +153,7 @@ For ongoing use, install the CLI globally:npm install --global loopforge-cli```-Then maintain an installation with the same agent names as above (`codebuddy`, `codex`, `cursor`, `claude`, and `pi` for the Portable Edition):+Then maintain an installation with the same agent names as above (`codebuddy`, `codex`, `cursor`, `claude`, `pi`, `dsh`, and `hermes` for the Portable Edition):```bash# Classic Editiondiff --git a/docs/local/usage.zh-CN.md b/docs/local/usage.zh-CN.mdindex f3eb0741..9aadf874 100644--- a/docs/local/usage.zh-CN.md+++ b/docs/local/usage.zh-CN.md@@ -14,6 +14,8 @@ LoopForge Local 在已有的编程助手中运行本地开发工作流,无需| Codex | `npx -y loopforge-cli@latest install codex` | `$devflow-codex "<需求>"` || Cursor | `npx -y loopforge-cli@latest install cursor` | `/start-devflow "<需求>"` || Claude Code | `npx -y loopforge-cli@latest install claude` | `/start-devflow "<需求>"` |+| DeepSeek Harness | `npx -y loopforge-cli@latest skills install dsh` | `/devflow "<需求>"` |+| Hermes Agent | `npx -y loopforge-cli@latest skills install hermes`,然后 `hermes skills trust .` | `/devflow "<需求>"` |以 Claude Code 为例:@@ -32,7 +34,7 @@ npx -y loopforge-cli@latest status claudenpx -y loopforge-cli@latest doctor```-Pi 通过 [Portable Edition](#portable-edition) 支持。+Pi、DeepSeek Harness 和 Hermes Agent 通过 [Portable Edition](#portable-edition) 支持。DSH 还可以安装[可选插件](../../local/dsh-plugin/README.md),提供任务控制、状态、产物和人工审批入口。Hermes 使用项目级 `.hermes/skills/` 和 `delegate_task`,不会修改 `~/.hermes/config.yaml`;需要独立命令时可安装[可选 Hermes 插件](../../local/hermes-plugin/README.md),提供 `/loopforge status`、`/loopforge result` 和 `/loopforge approve`。## 工作方式@@ -63,6 +65,8 @@ LoopForge 会根据任务复杂度选择路径:小改动走精简的单角色| Cursor | ✓ | ✓ || Claude Code | ✓ | ✓ || Pi | — | ✓ |+| DeepSeek Harness | — | ✓ |+| Hermes Agent | — | ✓ |同一项目中,每个编码 Agent 只能启用一种 Edition。两者的区别和目录说明见 [Edition selection](editions.md)。@@ -135,6 +139,8 @@ LoopForge 尤其适合这些任务:| Cursor | `npx -y loopforge-cli@latest skills install cursor` | `/devflow "<需求>"` || Claude Code | `npx -y loopforge-cli@latest skills install claude` | `/devflow "<需求>"` || Pi | `npx -y loopforge-cli@latest skills install pi`,然后 `pi install npm:pi-subagents` | `/skill:devflow "<需求>"` |+| DeepSeek Harness | `npx -y loopforge-cli@latest skills install dsh` | `/devflow "<需求>"` |+| Hermes Agent | `npx -y loopforge-cli@latest skills install hermes`,然后 `hermes skills trust .` | `/devflow "<需求>"`(可选插件:`/loopforge`) |完整边界和目录说明见 [Classic / Portable 说明](editions.md)。@@ -146,7 +152,7 @@ LoopForge 尤其适合这些任务:npm install --global loopforge-cli```-之后用上面的宿主名(`codebuddy`、`codex`、`cursor`、`claude`,Portable Edition 另有 `pi`)维护安装:+之后用上面的宿主名(`codebuddy`、`codex`、`cursor`、`claude`,Portable Edition 另有 `pi`、`dsh` 和 `hermes`)维护安装:```bash# Classic Editiondiff --git a/local/README.md b/local/README.mdindex 302406c2..752163e0 100644--- a/local/README.md+++ b/local/README.md@@ -1,6 +1,6 @@# LoopForge Local-LoopForge 的本地工作流组件,在 CodeBuddy、Codex、Cursor、Claude Code 或 Pi 中使用,无需启动平台。+LoopForge 的本地工作流组件,在 CodeBuddy、Codex、Cursor、Claude Code、Pi、DeepSeek Harness 或 Hermes Agent 中使用,无需启动平台。Local workflows for LoopForge, running inside an existing coding assistant without the platform server.@@ -19,7 +19,7 @@ npx -y loopforge-cli@latest install claudenpx -y loopforge-cli@latest status claude```-Start with `/start-devflow "<request>"` in Claude Code. Replace `claude` with `codebuddy`, `codex`, or `cursor` when installing for another host; the guides list each host's entry point. Pi uses the Portable edition.+Start with `/start-devflow "<request>"` in Claude Code. Replace `claude` with `codebuddy`, `codex`, or `cursor` when installing for another host; use `skills install pi`, `skills install dsh`, or `skills install hermes` for Portable hosts. DSH uses `/devflow "<request>"` after installing the Skill, and the optional DSH plugin adds `/loopforge` task controls. Hermes loads the project skill after `hermes skills trust .`; its optional native plugin adds the same `/loopforge` controls.在 Claude Code 中通过 `/start-devflow "<需求>"` 启动。其他宿主的安装命令、入口及 Portable 用法见统一文档。diff --git a/local/dsh-plugin/LICENSE b/local/dsh-plugin/LICENSEnew file mode 100644index 00000000..54a9df3a--- /dev/null+++ b/local/dsh-plugin/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 Tencent LoopForge Contributors++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/local/dsh-plugin/README.md b/local/dsh-plugin/README.mdnew file mode 100644index 00000000..0896e108--- /dev/null+++ b/local/dsh-plugin/README.md@@ -0,0 +1,51 @@+# LoopForge DSH 插件++这个插件是一个适用于 DSH 0.2.1 及后续 bundle-compatible 版本的 Host bundle,把+LoopForge Local 接入 DeepSeek Harness(DSH)Profile。它复用项目中+`.dsh/skills/devflow` 的 Portable 工作流,不复制工作流规则或产物模板。++## 本地安装++先在目标项目安装 DSH Portable Skill:++```bash+loopforge skills install dsh+```++再从 LoopForge 源码目录把 bundle 加入目标 DSH profile(`web` 也可以换成你自己的+profile 名称):++```bash+dsh plugin --profile web add -w /path/to/LoopForge/local/dsh-plugin+```++安装器会把 `@tencent/loopforge-dsh` 写入 profile 的 `dsh.profile.bundles`,并由+`cordis.patch.yml` 插入插件行;旧版 `dsh-plugin.json` 清单不会被当前 DSH Loader+读取。安装后可用下面的只读检查确认 bundle 已组合:++```bash+dsh --profile web --dump-config+dsh --profile web --dump-config-schema+```++输出应包含 `@tencent/loopforge-dsh`、`loopforge-dsh`,且 schema 的+`diagnostics` 为空。++重启 DSH 后可用:++- `/devflow <需求>`:直接按 Skill 执行完整工作流。+- `/loopforge start <需求>`:初始化一个 medium 任务并显示状态文件位置。+- `/loopforge status`:查看最近任务、当前阶段和待审批门禁。+- `/loopforge result`:查看任务状态和产物目录。+- `/loopforge approve [阶段]`:批准当前人工门禁;REQUIREMENT 会强制带用户确认。+- `loopforge_status`:供 DSH Agent 读取结构化状态。++阶段 Agent 使用 DSH 的 `subagent` 工具。没有该工具时,工作流必须按协议记录+`single-context` 降级原因,不能伪造隔离执行器。++## 卸载++```bash+dsh plugin --profile web remove loopforge-dsh+loopforge skills uninstall dsh+```diff --git a/local/dsh-plugin/cordis.patch.yml b/local/dsh-plugin/cordis.patch.ymlnew file mode 100644index 00000000..4e4a04dd--- /dev/null+++ b/local/dsh-plugin/cordis.patch.yml@@ -0,0 +1,3 @@+- insert:+ - id: loopforge-dsh+ name: '@tencent/loopforge-dsh'diff --git a/local/dsh-plugin/index.js b/local/dsh-plugin/index.jsnew file mode 100644index 00000000..eb70e45e--- /dev/null+++ b/local/dsh-plugin/index.js@@ -0,0 +1,228 @@+import { spawn } from 'node:child_process'+import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'+import { join, resolve } from 'node:path'++export const name = 'loopforge-dsh'+export const inject = ['commands', 'tools']++const SKILL_ROOT = '.dsh/skills/devflow'+const WORKFLOW = 'scripts/workflow_state.py'+const SAFE_SLUG = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u+const APPROVAL_STAGES = new Set(['REQUIREMENT', 'DESIGN', 'REVIEW', 'TEST'])+const MAX_RESULT_FILES = 40++function cwdOf(owner) {+ const agent = owner?.agent+ const session = agent?.session+ const service = agent?.ctx?.workingDirectory+ ?? agent?.ctx?.get?.('workingDirectory')+ ?? owner?.ctx?.workingDirectory+ ?? owner?.ctx?.get?.('workingDirectory')+ const candidate = typeof service?.get === 'function' && session+ ? service.get(session)+ : session?.header?.cwd+ ?? process.env.DSH_PROJECT_ROOT+ ?? process.cwd()+ return resolve(candidate)+}++function run(argv, cwd, signal) {+ return new Promise((resolvePromise, reject) => {+ if (signal?.aborted) {+ reject(signal.reason instanceof Error ? signal.reason : new Error('LoopForge command aborted'))+ return+ }+ let settled = false+ const child = spawn(argv[0], argv.slice(1), { cwd, stdio: ['ignore', 'pipe', 'pipe'] })+ let stdout = ''+ let stderr = ''+ child.stdout.on('data', chunk => { stdout += chunk })+ child.stderr.on('data', chunk => { stderr += chunk })+ const abort = () => {+ if (!child.killed) child.kill('SIGTERM')+ }+ signal?.addEventListener('abort', abort, { once: true })+ child.on('error', error => {+ if (settled) return+ settled = true+ signal?.removeEventListener('abort', abort)+ reject(error)+ })+ child.on('close', code => {+ if (settled) return+ settled = true+ signal?.removeEventListener('abort', abort)+ if (code === 0) resolvePromise(stdout.trim())+ else if (signal?.aborted) {+ reject(signal.reason instanceof Error ? signal.reason : new Error('LoopForge command aborted'))+ } else reject(new Error(stderr.trim() || `LoopForge command exited with ${code}`))+ })+ })+}++function scriptPath(cwd) {+ const path = join(cwd, SKILL_ROOT, WORKFLOW)+ if (!existsSync(path)) {+ throw new Error('LoopForge Skill is not installed in this project; run `loopforge skills install dsh` first.')+ }+ return path+}++function stateFiles(cwd) {+ const root = join(cwd, 'artifacts')+ if (!existsSync(root)) return []+ const files = []+ for (const entry of readdirSync(root)) {+ const path = join(root, entry, 'workflow-state.json')+ if (existsSync(path) && statSync(path).isFile()) files.push(path)+ }+ return files.sort((a, b) => statSync(b).mtimeMs - statSync(a).mtimeMs)+}++function readState(cwd, slug) {+ if (slug !== undefined && !SAFE_SLUG.test(slug)) {+ throw new Error('Task slug must contain only letters, digits, hyphens, and underscores.')+ }+ const paths = stateFiles(cwd)+ const path = slug ? join(cwd, 'artifacts', slug, 'workflow-state.json') : paths[0]+ if (!path || !existsSync(path)) return undefined+ return { path, state: JSON.parse(readFileSync(path, 'utf8')) }+}++function renderState(record) {+ if (!record) return 'No LoopForge task found in this project.'+ const { state, path } = record+ const completed = Object.entries(state.stages ?? {})+ .filter(([, stage]) => stage?.status === 'completed')+ .map(([stage]) => stage)+ return [+ `Task: ${state.task_slug ?? 'unknown'}`,+ `Status: ${state.status ?? 'unknown'}`,+ `Size: ${state.size_class ?? 'unknown'}`,+ `Artifacts: ${path}`,+ completed.length ? `Completed stages: ${completed.join(', ')}` : '',+ state.awaiting_approval ? `Awaiting approval: ${state.awaiting_approval}` : '',+ state.next_stage ? `Next stage: ${state.next_stage}` : '',+ ].filter(Boolean).join('\n')+}++function resultFiles(cwd, slug) {+ const root = join(cwd, 'artifacts', slug)+ if (!existsSync(root)) return []+ const files = []+ const visit = directory => {+ for (const entry of readdirSync(directory, { withFileTypes: true })) {+ const path = join(directory, entry.name)+ if (entry.isDirectory()) visit(path)+ else if (entry.isFile()) files.push(path.slice(root.length + 1))+ }+ }+ visit(root)+ return files.sort().slice(0, MAX_RESULT_FILES)+}++function parseInput(rawInput) {+ const input = rawInput.trim()+ const match = /^(start|status|approve|result|help)(?:\s+([\s\S]*))?$/u.exec(input)+ return match ? { command: match[1], value: match[2]?.trim() ?? '' } : { command: 'help', value: '' }+}++async function handle(invocation, ctx) {+ const cwd = cwdOf(invocation)+ const { command, value } = parseInput(invocation.rawInput)+ if (command === 'help') {+ return { kind: 'success', text: 'Usage: /loopforge start <request> | status [slug] | result [slug] | approve [stage] | help' }+ }+ if (command === 'status') return { kind: 'success', text: renderState(readState(cwd, value || undefined)) }+ if (command === 'result') {+ const record = readState(cwd, value || undefined)+ if (!record) return { kind: 'success', text: 'No LoopForge task found in this project.' }+ const files = resultFiles(cwd, record.state.task_slug)+ const listing = files.length+ ? `\n\nArtifact files:\n${files.map(file => `- ${file}`).join('\n')}`+ : '\n\nNo artifact files have been written yet.'+ return { kind: 'success', text: `${renderState(record)}${listing}` }+ }+ const script = scriptPath(cwd)+ if (command === 'approve') {+ const record = readState(cwd)+ if (!record) return { kind: 'error', text: 'No LoopForge task is waiting for approval.' }+ const stage = value || record.state.awaiting_approval+ if (!stage) return { kind: 'error', text: 'No approval stage is pending.' }+ if (!APPROVAL_STAGES.has(stage)) {+ return { kind: 'error', text: `Unknown approval stage: ${stage}. Use REQUIREMENT, DESIGN, REVIEW, or TEST.` }+ }+ const args = ['python3', script, 'approve', '--state', record.path, '--stage', stage]+ if (stage === 'REQUIREMENT') args.push('--user-confirmed')+ await run(args, cwd, invocation.signal)+ return { kind: 'success', text: `Approved ${stage}. Resume the DSH workflow to continue.` }+ }+ if (!value) return { kind: 'error', text: 'A request is required: /loopforge start <request>' }+ const slug = value.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '').slice(0, 48) || `dsh-${Date.now()}`+ const statePath = join(cwd, 'artifacts', slug, 'workflow-state.json')+ const hasSubagent = typeof ctx?.tools?.get === 'function'+ && ctx.tools.get('subagent', invocation.agent) !== undefined+ const args = [+ 'python3', script, 'init', '--project-root', cwd, '--slug', slug,+ '--size', 'medium', '--mode', 'auto', '--coordinator-id', 'dsh-main',+ ]+ if (hasSubagent) {+ args.push('--execution-mode', 'isolated', '--host-adapter', 'dsh')+ } else {+ args.push(+ '--execution-mode', 'single-context',+ '--fallback-reason', 'DSH subagent tool is unavailable in this session',+ )+ }+ const output = await run(args, cwd, invocation.signal)+ const execution = hasSubagent+ ? 'isolated stages via the DSH subagent tool'+ : 'single-context fallback because the DSH subagent tool is unavailable'+ return { kind: 'success', text: `LoopForge task initialized: ${slug}\nRequest: ${value}\nState: ${statePath}\n${output}\nExecution: ${execution}. Follow the devflow Skill to resume the workflow.` }+}++export function apply(ctx) {+ ctx.commands.register({+ name: 'loopforge',+ description: 'Start, inspect, and approve LoopForge Local workflows',+ input: { hint: '[start <request>|status [slug]|result [slug]|approve [stage]|help]' },+ handler: invocation => handle(invocation, ctx),+ })+ ctx.tools.register({+ name: 'loopforge_status',+ description: 'Read the current LoopForge Local workflow state and pending human approval for the current DSH project. Read-only.',+ parameters: {+ type: 'object',+ properties: {+ slug: { type: 'string', description: 'Optional task slug; omit to inspect the most recently updated task.' },+ },+ additionalProperties: false,+ },+ output: {+ schema: {+ type: 'object',+ additionalProperties: false,+ properties: {+ found: { type: 'boolean' },+ status: { type: 'string' },+ task_slug: { type: 'string' },+ awaiting_approval: { type: 'string' },+ state_path: { type: 'string' },+ },+ required: ['found'],+ },+ render: (_args, value) => [{ type: 'text', text: JSON.stringify(value) }],+ },+ execute: async (args, exec) => {+ const record = readState(cwdOf(exec), args?.slug)+ if (!record) return { found: false }+ return {+ found: true,+ status: record.state.status,+ task_slug: record.state.task_slug,+ awaiting_approval: record.state.awaiting_approval ?? '',+ state_path: record.path,+ }+ },+ })+}diff --git a/local/dsh-plugin/package.json b/local/dsh-plugin/package.jsonnew file mode 100644index 00000000..e785e40c--- /dev/null+++ b/local/dsh-plugin/package.json@@ -0,0 +1,18 @@+{+ "name": "@tencent/loopforge-dsh",+ "version": "0.1.0",+ "description": "LoopForge Local integration for DeepSeek Harness",+ "type": "module",+ "main": "./index.js",+ "exports": {+ ".": "./index.js",+ "./cordis.patch.yml": "./cordis.patch.yml"+ },+ "files": ["index.js", "cordis.patch.yml", "README.md", "LICENSE"],+ "dsh": {+ "bundle": {+ "patch": "./cordis.patch.yml"+ }+ },+ "license": "MIT"+}diff --git a/local/hermes-plugin/README.md b/local/hermes-plugin/README.mdnew file mode 100644index 00000000..7841f1ab--- /dev/null+++ b/local/hermes-plugin/README.md@@ -0,0 +1,57 @@+# LoopForge Hermes plugin++This native Hermes Agent plugin adds `/loopforge` controls for a project that+already has the LoopForge Hermes Skill installed:++```text+/loopforge start <request>+/loopforge status [slug]+/loopforge result [slug]+/loopforge approve [REQUIREMENT|DESIGN|REVIEW|TEST]+```++The plugin calls the project's `.hermes/skills/devflow/scripts/workflow_state.py`+contract. It stores state under `artifacts/<slug>/` and does not read or modify+`~/.hermes/config.yaml`, profile credentials, or the profile skill directory.++## Local installation++From a LoopForge checkout, validate the plugin first:++```bash+hermes plugins doctor ./local/hermes-plugin+```++For a local Hermes profile, copy the directory to the profile's plugin folder+and restart Hermes. The copy is intentionally explicit so an existing plugin+directory is never overwritten by LoopForge:++```bash+plugin_dir="${HERMES_HOME:-$HOME/.hermes}/plugins/loopforge"+if [ -e "$plugin_dir" ]; then+ echo "Refusing to overwrite existing Hermes plugin: $plugin_dir" >&2+ exit 1+fi+mkdir -p "$(dirname "$plugin_dir")"+cp -a ./local/hermes-plugin "$plugin_dir"+```++When this repository is published, install the same directory through Hermes'+normal Git plugin flow (`hermes plugins install <owner>/<repo>`), then enable it+with `hermes plugins enable loopforge`.++To update a published installation, use `hermes plugins update loopforge`. To+disable it without deleting files, use `hermes plugins disable loopforge`; to+remove it, disable it first and then run `hermes plugins remove loopforge`.+For a local copied installation, remove only the exact directory you copied+after disabling the plugin.++Run Hermes from the project root after installing the Skill and trust it:++```bash+loopforge skills install hermes+hermes skills trust .+hermes+```++The plugin is optional. `/devflow` remains the canonical workflow entrypoint.diff --git a/local/hermes-plugin/__init__.py b/local/hermes-plugin/__init__.pynew file mode 100644index 00000000..69c8c680--- /dev/null+++ b/local/hermes-plugin/__init__.py@@ -0,0 +1,213 @@+"""Hermes Agent command plugin for LoopForge Local.++The plugin deliberately keeps its state in the current project. It calls the+same ``workflow_state.py`` contract as the ``devflow`` Skill and never reads or+writes Hermes' profile configuration.+"""++from __future__ import annotations++import json+import os+import re+import subprocess+import sys+from pathlib import Path+from typing import List, Optional, Tuple+++_SAFE_SLUG = re.compile(r"^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$")+_APPROVAL_STAGES = {"REQUIREMENT", "DESIGN", "REVIEW", "TEST"}+_MAX_RESULT_FILES = 40+++def _project_root() -> Path:+ """Resolve the Hermes session project without touching Hermes config.++ Hermes normally starts from the active project directory. The explicit+ environment override is useful for gateway hosts that keep a different+ process working directory and makes the behavior testable.+ """++ override = os.environ.get("LOOPFORGE_PROJECT_ROOT")+ if override:+ return Path(override).resolve()+ try:+ # Hermes documents this as the public way for plugins to access the+ # invoking session's working directory. The gateway process cwd is+ # the Hermes home and is therefore not a safe fallback.+ from agent.runtime_cwd import resolve_agent_cwd++ return Path(resolve_agent_cwd()).resolve()+ except (ImportError, RuntimeError, TypeError):+ return Path(os.getcwd()).resolve()+++def _workflow_script(root: Path) -> Path:+ path = root / ".hermes" / "skills" / "devflow" / "scripts" / "workflow_state.py"+ if not path.is_file():+ raise RuntimeError(+ "LoopForge Skill is not installed in this project; run "+ "`loopforge skills install hermes` first."+ )+ return path+++def _run(root: Path, script: Path, *args: str) -> str:+ result = subprocess.run(+ [sys.executable, str(script), *args],+ cwd=str(root),+ capture_output=True,+ text=True,+ check=False,+ )+ output = (result.stdout or result.stderr).strip()+ if result.returncode:+ raise RuntimeError(output or f"workflow_state.py exited with {result.returncode}")+ return output+++def _state_files(root: Path) -> List[Path]:+ artifacts = root / "artifacts"+ if not artifacts.is_dir():+ return []+ return sorted(+ (+ path+ for path in artifacts.glob("*/workflow-state.json")+ if path.is_file()+ ),+ key=lambda path: path.stat().st_mtime_ns,+ reverse=True,+ )+++def _record(root: Path, slug: Optional[str] = None) -> Optional[Tuple[Path, dict]]:+ if slug is not None and not _SAFE_SLUG.fullmatch(slug):+ raise RuntimeError("Task slug may contain only letters, digits, dots, hyphens, and underscores.")+ path = root / "artifacts" / slug / "workflow-state.json" if slug else None+ if path is None:+ files = _state_files(root)+ path = files[0] if files else None+ if path is None or not path.is_file():+ return None+ try:+ return path, json.loads(path.read_text(encoding="utf-8"))+ except (OSError, json.JSONDecodeError) as exc:+ raise RuntimeError(f"Cannot read LoopForge state: {path}: {exc}") from exc+++def _render(record: Optional[Tuple[Path, dict]]) -> str:+ if record is None:+ return "No LoopForge task found in this project."+ path, state = record+ completed = [+ name+ for name, stage in (state.get("stages") or {}).items()+ if stage.get("status") == "completed"+ ]+ lines = [+ f"Task: {state.get('task_slug', 'unknown')}",+ f"Status: {state.get('status', 'unknown')}",+ f"Size: {state.get('size_class', 'unknown')}",+ f"State: {path}",+ ]+ if completed:+ lines.append("Completed stages: " + ", ".join(completed))+ if state.get("awaiting_approval"):+ lines.append(f"Awaiting approval: {state['awaiting_approval']}")+ if state.get("next_stage"):+ lines.append(f"Next stage: {state['next_stage']}")+ return "\n".join(lines)+++def _result_files(root: Path, slug: str) -> List[str]:+ artifact_root = root / "artifacts" / slug+ if not artifact_root.is_dir():+ return []+ return sorted(+ str(path.relative_to(artifact_root))+ for path in artifact_root.rglob("*")+ if path.is_file()+ )[:_MAX_RESULT_FILES]+++def _parse(raw: str) -> Tuple[str, str]:+ value = raw.strip()+ match = re.match(r"^(start|status|result|approve|help)(?:\s+([\s\S]*))?$", value)+ return (match.group(1), (match.group(2) or "").strip()) if match else ("help", "")+++def _handle(raw: str) -> str:+ command, value = _parse(raw)+ root = _project_root()+ if command == "help":+ return (+ "Usage: /loopforge start <request> | status [slug] | result [slug] | "+ "approve [stage] | help"+ )+ if command == "status":+ return _render(_record(root, value or None))+ record = _record(root, value or None) if command == "result" else _record(root)+ if command == "result":+ if record is None:+ return "No LoopForge task found in this project."+ _path, state = record+ files = _result_files(root, state.get("task_slug", ""))+ listing = "\n\nArtifact files:\n" + "\n".join(f"- {item}" for item in files)+ return _render(record) + (listing if files else "\n\nNo artifact files have been written yet.")+ script = _workflow_script(root)+ if command == "approve":+ if record is None:+ return "No LoopForge task is waiting for approval."+ state_path, state = record+ stage = value.upper() if value else state.get("awaiting_approval")+ if not stage:+ return "No approval stage is pending."+ if stage not in _APPROVAL_STAGES:+ return "Unknown approval stage. Use REQUIREMENT, DESIGN, REVIEW, or TEST."+ args = ["approve", "--state", str(state_path), "--stage", stage]+ if stage == "REQUIREMENT":+ args.append("--user-confirmed")+ _run(root, script, *args)+ return f"Approved {stage}. Resume the Hermes workflow to continue."+ if not value:+ return "A request is required: /loopforge start <request>"+ slug = re.sub(r"[^a-z0-9]+", "-", value.lower()).strip("-")[:48] or "hermes-task"+ state_path = root / "artifacts" / slug / "workflow-state.json"+ output = _run(+ root,+ script,+ "init",+ "--project-root",+ str(root),+ "--slug",+ slug,+ "--size",+ "medium",+ "--mode",+ "auto",+ "--execution-mode",+ "isolated",+ "--host-adapter",+ "hermes",+ "--coordinator-id",+ "hermes-main",+ )+ return (+ f"LoopForge task initialized: {slug}\nRequest: {value}\nState: {state_path}\n"+ f"{output}\nExecution mode: the Hermes adapter will use delegate_task when available "+ "and record a single-context fallback with its reason when it is not. "+ "Continue with /devflow or resume the task in Hermes."+ )+++def register(ctx) -> None:+ """Register the command on Hermes' documented PluginContext surface."""++ ctx.register_command(+ "loopforge",+ _handle,+ description="Start, inspect, and approve LoopForge Local workflows",+ args_hint="[start <request>|status [slug]|result [slug]|approve [stage]|help]",+ )diff --git a/local/hermes-plugin/plugin.yaml b/local/hermes-plugin/plugin.yamlnew file mode 100644index 00000000..d2d885e1--- /dev/null+++ b/local/hermes-plugin/plugin.yaml@@ -0,0 +1,9 @@+name: loopforge+version: 0.1.0+description: "LoopForge Local workflow controls for Hermes Agent"+author: Tencent LoopForge+kind: standalone+platforms:+ - linux+ - macos+ - windowsdiff --git a/local/package.json b/local/package.jsonindex ecaf361e..306f18d5 100644--- a/local/package.json+++ b/local/package.json@@ -1,7 +1,7 @@{"name": "loopforge-cli","version": "0.2.3",- "description": "LoopForge Local development workflows for CodeBuddy, Codex, Cursor, Claude Code and Pi (Portable)",+ "description": "LoopForge Local development workflows for CodeBuddy, Codex, Cursor, Claude Code, Pi, DeepSeek Harness and Hermes Agent","keywords": ["ai-agents","multi-agent",@@ -9,7 +9,9 @@"codex","claude-code","cursor",- "codebuddy"+ "codebuddy",+ "deepseek-harness",+ "hermes-agent"],"repository": {"type": "git",@@ -33,6 +35,8 @@".codex/",".cursor/",".claude/",+ "hermes-plugin/",+ "dsh-plugin/","README.md","LICENSE","THIRD_PARTY_NOTICES.md",diff --git a/local/skills/README.md b/local/skills/README.mdindex b269534c..e36312ab 100644--- a/local/skills/README.md+++ b/local/skills/README.md@@ -5,7 +5,7 @@- `devflow/`:任务分级、需求澄清、方案、计划、实现、审查、测试、知识沉淀和总结。- `devflow-clarify-requirements/`:需求阶段使用的澄清 Skill,由主协调 Agent 在当前会话中调用。-脚本只依赖 Python 3.8+ 标准库。当前支持 CodeBuddy、Codex、Cursor 和 Claude Code。+脚本只依赖 Python 3.8+ 标准库。当前支持 CodeBuddy、Codex、Cursor、Claude Code、Pi、DeepSeek Harness 和 Hermes Agent。## 流程@@ -34,8 +34,16 @@ loopforge skills install codebuddyloopforge skills install codexloopforge skills install cursorloopforge skills install claude+loopforge skills install hermes```+Hermes Agent 使用项目级 `.hermes/skills/`,安装后在项目根目录执行+`hermes skills trust .`,然后使用 `/devflow <软件交付需求>`。Hermes 的 medium/large+阶段通过公开的 `delegate_task` 工具创建独立子 Agent;缺少该工具时必须记录原因并降级为+`single-context`。安装器不会改动 `~/.hermes/config.yaml` 或用户 profile。需要独立的+状态、结果和审批命令时,可按 [`hermes-plugin/README.md`](../hermes-plugin/README.md)+安装可选原生插件,使用 `/loopforge status|result|approve`;`/devflow` 仍是工作流入口。+`loopforge skills status/update/uninstall <host>` 和 `loopforge doctor` 使用`.devflow/install-state.json` 保护用户文件。下面的 adapter 命令只保留为开发和故障排查入口,不再是面向使用者的主安装方式。diff --git a/local/skills/devflow/adapters/dsh/adapter.md b/local/skills/devflow/adapters/dsh/adapter.mdnew file mode 100644index 00000000..96fdf4c5--- /dev/null+++ b/local/skills/devflow/adapters/dsh/adapter.md@@ -0,0 +1,27 @@+# DeepSeek Harness 适配器++支持当前稳定版以及后续仍提供公开 `subagent` 工具的 DSH 版本;不绑定私有版本号。+没有该工具的 profile 仍可运行,但 medium/large 必须记录原因并降级为+`single-context`。++DSH 通过 `subagent` 工具创建独立阶段执行器。每个阶段必须使用新的子 Agent,+并将工具返回的子 Agent 名称作为 `executor_id` 登记到 `workflow_state.py`。++## 能力映射++1. `spawn(role, prompt) -> executor_id`:调用 `subagent`,使用完整阶段提示;返回的+ 子 Agent 名称就是 `executor_id`。+2. `wait(executor_id)`:结束当前轮次,等待 DSH 自动投递子 Agent 完成通知。+3. `close(executor_id)`:DSH 子 Agent 完成后由宿主回收,不需要额外调用。+4. `spawn_helper(role, bounded_prompt) -> executor_id`:同样使用 `subagent`,只读范围+ 由提示明确限制。++DSH 没有 LoopForge 专用的 send/close 生命周期 API。不要伪造 executor ID,也不要把+普通当前上下文工作标记为 isolated;如果当前会话没有 `subagent` 工具,必须用具体+原因降级为 `single-context` 并记录 `fallback_reason`。++## 使用入口++安装 Portable Skill 后,在 DSH 中使用 `/devflow <需求>`,或通过 LoopForge DSH 插件的+`/loopforge start <需求>` 初始化任务。任务状态和产物保存在项目的+`artifacts/<task_slug>/` 下;需要人工确认时,插件会显示待批准阶段和批准命令。diff --git a/local/skills/devflow/adapters/dsh/manifest.json b/local/skills/devflow/adapters/dsh/manifest.jsonnew file mode 100644index 00000000..692fc5c5--- /dev/null+++ b/local/skills/devflow/adapters/dsh/manifest.json@@ -0,0 +1,14 @@+{+ "version": "1.0",+ "id": "dsh",+ "compatibility": {+ "verified_on": "2026-11-09",+ "version_policy": "Current stable DSH releases exposing the subagent tool; profiles without it use the recorded single-context fallback",+ "documentation": "https://github.com/deepseek-ai/deepseek-harness"+ },+ "dispatch_tool": "subagent",+ "topology": "spawn",+ "stage_executor": "subagent",+ "research_executor": "subagent",+ "required_tools": ["subagent"]+}diff --git a/local/skills/devflow/adapters/hermes/adapter.md b/local/skills/devflow/adapters/hermes/adapter.mdnew file mode 100644index 00000000..c792d8fb--- /dev/null+++ b/local/skills/devflow/adapters/hermes/adapter.md@@ -0,0 +1,40 @@+# Hermes Agent 适配器++Hermes Agent 通过项目内的 Agent Skills 目录加载 LoopForge:安装器写入+`.hermes/skills/`,不会修改 Hermes 用户目录或 `config.yaml`。首次在该项目运行+Hermes 时,需要按宿主的信任提示执行 `hermes skills trust`,之后 `/devflow` 才会+出现在会话中。++## 版本和能力边界++适配器支持当前稳定版以及后续仍提供项目级 `.hermes/skills/`、`hermes skills trust` 和+`delegate_task` 的 Hermes Agent 版本,不绑定私有版本号。Hermes 的插件和 skill API+仍在演进;LoopForge 只依赖这三个公开能力,不读取 Hermes 私有状态文件。若当前会话没有+`delegate_task`,medium/large 工作流必须记录具体原因并降级为+`single-context`,不能把当前上下文伪造为 isolated。++## 能力映射++1. `spawn(role, prompt) -> executor_id`:调用+ `delegate_task(goal=<完整阶段提示>, context=<项目路径和交接信息>)`,将返回值中的+ `delegation_id`(或宿主提供的等价句柄)登记为 `executor_id`。+2. `wait(executor_id)`:等待 Hermes 的 delegation 完成通知;不得轮询或猜测句柄。+3. `close(executor_id)`:Hermes 会在 delegation 完成后回收子 Agent,不要求额外关闭。+4. `spawn_helper(role, bounded_prompt) -> executor_id`:同样调用+ `delegate_task`,并在提示中限定只读范围;用返回的 delegation 句柄登记 helper。++REQUIREMENT 和 SUMMARY 仍由协调者执行。每个 DESIGN、IMPLEMENT、REVIEW、TEST+阶段必须新建独立 delegation;子 Agent 只能通过完整阶段提示和允许的上游产物获得上下文。++## 安装和入口++在项目根目录执行:++```bash+loopforge skills install hermes+hermes skills trust .+```++重启或重新打开 Hermes 会话后使用 `/devflow <需求>`。任务状态和产物保存在+`artifacts/<task_slug>/`,与其他 Portable 宿主相同;卸载使用+`loopforge skills uninstall hermes`,只删除 LoopForge 自己未修改的托管文件。diff --git a/local/skills/devflow/adapters/hermes/manifest.json b/local/skills/devflow/adapters/hermes/manifest.jsonnew file mode 100644index 00000000..a74ec490--- /dev/null+++ b/local/skills/devflow/adapters/hermes/manifest.json@@ -0,0 +1,16 @@+{+ "version": "1.0",+ "id": "hermes",+ "compatibility": {+ "verified_on": "2026-11-09",+ "product": "Nous Research Hermes Agent",+ "version_policy": "Current stable Hermes releases exposing project-local skills, hermes skills trust, and delegate_task; no private-version pin",+ "capabilities": ["project-local-skills", "hermes-skills-trust", "delegate_task"],+ "documentation": "https://github.com/NousResearch/hermes-agent"+ },+ "dispatch_tool": "delegate_task",+ "topology": "spawn",+ "stage_executor": "dynamic",+ "research_executor": "dynamic",+ "required_tools": ["delegate_task"]+}diff --git a/local/skills/devflow/references/runtime-core.md b/local/skills/devflow/references/runtime-core.mdindex 75906f99..5cba1052 100644--- a/local/skills/devflow/references/runtime-core.md+++ b/local/skills/devflow/references/runtime-core.md@@ -18,6 +18,7 @@- CodeBuddy 提供 `task|team_create|send_message|team_delete|use_skill`:加载 [adapters/codebuddy/adapter.md](../adapters/codebuddy/adapter.md),使用 Team member 拓扑;不得把普通 task subagent 当成阶段执行者。- Codex 提供 `spawn_agent|send_message|wait_agent`:加载 [adapters/codex/adapter.md](../adapters/codex/adapter.md)。+- Hermes Agent 提供 `delegate_task`:加载 [adapters/hermes/adapter.md](../adapters/hermes/adapter.md),使用 delegation spawn 拓扑;只把宿主返回的 `delegation_id`(或等价句柄)登记为 executor ID。- 没有受支持的生命周期 API:先报告限制并记录 `fallback_reason`,之后才能使用 `single-context`。一个 isolated 流程只能选择一个适配器。除非适配器明确提供桥接,否则不要混用项目原生流程与本状态机。适配器只实现 `spawn/send/wait/close`,不得复制或改写核心状态、模板和规则语义。diff --git a/local/skills/devflow/scripts/workflow_state.py b/local/skills/devflow/scripts/workflow_state.pyindex 8f1cc80f..92424309 100755--- a/local/skills/devflow/scripts/workflow_state.py+++ b/local/skills/devflow/scripts/workflow_state.py@@ -1090,11 +1090,19 @@ def command_resume(args: argparse.Namespace) -> int:"executor_role": STAGE_ROLES[next_stage],"executor_type": ("coordinator" if STAGE_EXECUTION[next_stage] == "coordinator"- else expected_executor_type(data)+ else (+ "single-context"+ if data.get("execution_mode") == "single-context"+ else expected_executor_type(data)+ )),"executor_topology": ("coordinator" if STAGE_EXECUTION[next_stage] == "coordinator"- else TOPOLOGIES.get(data.get("host_adapter"))+ else (+ "single-context"+ if data.get("execution_mode") == "single-context"+ else TOPOLOGIES.get(data.get("host_adapter"))+ )),"team_name": (data.get("team_name") if STAGE_EXECUTION[next_stage] != "coordinator"@@ -1105,6 +1113,12 @@ def command_resume(args: argparse.Namespace) -> int:action.update(action="prepare", **common)elif STAGE_EXECUTION[next_stage] == "coordinator":action.update(action="start-coordinator", **common)+ elif data.get("execution_mode") == "single-context":+ action.update(+ action="start-single-context",+ message="宿主没有独立 Agent 生命周期 API;在当前上下文执行本阶段并记录降级原因",+ **common,+ )elif not stage.get("executor_id"):action.update(action="spawn-and-assign",diff --git a/local/src/devflow_cli/cli.py b/local/src/devflow_cli/cli.pyindex 574d967d..741edcac 100644--- a/local/src/devflow_cli/cli.py+++ b/local/src/devflow_cli/cli.py@@ -146,6 +146,8 @@ def main(argv=None) -> int:)if args.host == "pi" and args.edition == "portable":print("Note: Pi isolated mode also needs the public extension: pi install npm:pi-subagents")+ if args.host == "hermes" and args.edition == "portable":+ print("Note: Hermes must trust this project before loading .hermes/skills: hermes skills trust .")return 0if args.command == "skills":if args.skills_command in {"install", "update"}:@@ -168,6 +170,8 @@ def main(argv=None) -> int:)if args.host == "pi":print("Note: Pi isolated mode also needs the public extension: pi install npm:pi-subagents")+ if args.host == "hermes":+ print("Note: Hermes must trust this project before loading .hermes/skills: hermes skills trust .")return 0if args.skills_command == "status":rows = [diff --git a/local/src/devflow_cli/core.py b/local/src/devflow_cli/core.pyindex 13a3a984..8f7a08b8 100644--- a/local/src/devflow_cli/core.py+++ b/local/src/devflow_cli/core.py@@ -157,6 +157,25 @@ def materialize_portable(host: str, stage: Path) -> None:for name in manifest["skill_sets"]["portable"]:copy_skill(skills_root / name, target / name)return+ if host == "dsh":+ target = stage / ".dsh/skills"+ target.mkdir(parents=True, exist_ok=True)+ manifest = json.loads((skills_root / "manifest.json").read_text(encoding="utf-8"))+ copy_skills_manifest(skills_root, target)+ for name in manifest["skill_sets"]["portable"]:+ copy_skill(skills_root / name, target / name)+ return+ if host == "hermes":+ # Hermes discovers project skills under .hermes/skills after the user+ # explicitly trusts the repository. Keep installation project-local;+ # never mutate ~/.hermes/config.yaml or the user's profile skills.+ target = stage / ".hermes/skills"+ target.mkdir(parents=True, exist_ok=True)+ manifest = json.loads((skills_root / "manifest.json").read_text(encoding="utf-8"))+ copy_skills_manifest(skills_root, target)+ for name in manifest["skill_sets"]["portable"]:+ copy_skill(skills_root / name, target / name)+ returnraise DevFlowError(f"不支持的宿主: {host}")diff --git a/local/src/devflow_cli/editions.py b/local/src/devflow_cli/editions.pyindex bcc3ead8..2e3d2d75 100644--- a/local/src/devflow_cli/editions.py+++ b/local/src/devflow_cli/editions.py@@ -4,26 +4,30 @@ from typing import Dict, TupleDEFAULT_EDITION = "classic"-HOSTS: Tuple[str, ...] = ("codebuddy", "codex", "cursor", "claude", "pi")+HOSTS: Tuple[str, ...] = ("codebuddy", "codex", "cursor", "claude", "pi", "dsh", "hermes")HOST_LABELS = {"codebuddy": "CodeBuddy","codex": "Codex","cursor": "Cursor","claude": "Claude Code","pi": "Pi",+ "dsh": "DeepSeek Harness",+ "hermes": "Hermes Agent",}EDITION_SPECS: Dict[str, dict] = {"portable": {"description": "Agent Skills based portable workflow","source_roots": ("skills/",),- "hosts": ("codebuddy", "codex", "cursor", "claude", "pi"),+ "hosts": ("codebuddy", "codex", "cursor", "claude", "pi", "dsh", "hermes"),"entrypoints": {"codebuddy": "/devflow","codex": "$devflow","cursor": "/devflow","claude": "/devflow","pi": "/skill:devflow",+ "dsh": "/devflow",+ "hermes": "/devflow",},},"classic": {diff --git a/local/src/devflow_cli/targets/dsh.py b/local/src/devflow_cli/targets/dsh.pynew file mode 100644index 00000000..49ff78e9--- /dev/null+++ b/local/src/devflow_cli/targets/dsh.py@@ -0,0 +1,12 @@+HOST = "dsh"+++def describe() -> str:+ return "DeepSeek Harness project workflow target"+++def materialize(edition, stage) -> None:+ from devflow_cli.core import materialize_portable+ if edition != "portable":+ raise ValueError("DeepSeek Harness 只支持 Portable edition")+ materialize_portable(HOST, stage)diff --git a/local/src/devflow_cli/targets/hermes.py b/local/src/devflow_cli/targets/hermes.pynew file mode 100644index 00000000..8377bbfc--- /dev/null+++ b/local/src/devflow_cli/targets/hermes.py@@ -0,0 +1,12 @@+HOST = "hermes"+++def describe() -> str:+ return "Hermes Agent project workflow target"+++def materialize(edition, stage) -> None:+ from devflow_cli.core import materialize_portable+ if edition != "portable":+ raise ValueError("Hermes Agent 只支持 Portable edition")+ materialize_portable(HOST, stage)diff --git a/local/tests/e2e/fake_agent.py b/local/tests/e2e/fake_agent.pyindex 13946000..a24f09b4 100644--- a/local/tests/e2e/fake_agent.py+++ b/local/tests/e2e/fake_agent.py@@ -34,6 +34,8 @@ HOST_SKILL_DIRS = {"cursor": ".cursor/skills","claude": ".claude/skills","pi": ".pi/skills",+ "dsh": ".dsh/skills",+ "hermes": ".hermes/skills",}FIXTURES = Path(__file__).resolve().parent / "fixtures"EXIT_COMPLETED, EXIT_CONTRACT, EXIT_WAITING, EXIT_BLOCKED, EXIT_INTERRUPTED = 0, 2, 3, 4, 75@@ -175,11 +177,13 @@ class FakeAgent:self.log("spawned", stage=action["stage"], executor_id=executor_id,executor_type=action["executor_type"],dispatch_tool=action["dispatch_tool"])- elif kind in ("start-assigned", "start-coordinator"):+ elif kind in ("start-assigned", "start-coordinator", "start-single-context"):self.run("start", "--state", self.state_path(), "--stage", action["stage"])if self.args.crash_in == action["stage"]:self.log("crash", stage=action["stage"])return EXIT_INTERRUPTED+ if kind == "start-single-context":+ self.log("fallback", stage=action["stage"], reason=self.state().get("fallback_reason"))self.execute_stage(action["stage"])elif kind == "continue-executor":self.execute_stage(action["stage"])diff --git a/local/tests/e2e/test_e2e_workflow_modes.py b/local/tests/e2e/test_e2e_workflow_modes.pyindex e97abc65..6dec87c3 100644--- a/local/tests/e2e/test_e2e_workflow_modes.py+++ b/local/tests/e2e/test_e2e_workflow_modes.py@@ -62,6 +62,39 @@ class WorkflowModesE2E(unittest.TestCase):self.assertEqual(["REQUIREMENT"], [e["stage"] for e in events(project, "approved")])self.assert_code_fixed(project)+ def test_dsh_medium_workflow_uses_the_subagent_adapter(self):+ project = self.install("dsh")+ h.fake_agent("dsh", project, check_rc=0)+ state = h.workflow_state(project)+ self.assertEqual("completed", state["status"])+ self.assertEqual("dsh", state["host_adapter"])+ self.assertEqual("isolated", state["execution_mode"])+ self.assertTrue(events(project, "spawned"))++ def test_dsh_can_record_single_context_fallback(self):+ project = self.install("dsh")+ state_file = h.run_workflow(+ project, "init", "--project-root", project, "--slug", "dsh-fallback",+ "--size", "medium", "--mode", "auto", "--execution-mode", "single-context",+ "--fallback-reason", "subagent tool unavailable",+ ).stdout.strip()+ result = h.fake_agent("dsh", project, "--slug", "dsh-fallback", "--resume", check_rc=0)+ self.assertEqual(0, result.returncode)+ state = h.workflow_state(project, "dsh-fallback")+ self.assertEqual("single-context", state["execution_mode"])+ self.assertEqual("subagent tool unavailable", state["fallback_reason"])+ self.assertTrue(events(project, "fallback"))++ def test_hermes_medium_workflow_uses_delegate_task_adapter(self):+ project = self.install("hermes")+ h.fake_agent("hermes", project, check_rc=0)+ state = h.workflow_state(project)+ self.assertEqual("completed", state["status"])+ self.assertEqual("hermes", state["host_adapter"])+ self.assertEqual("isolated", state["execution_mode"])+ self.assertTrue(events(project, "spawned"))+ self.assertTrue((project / ".hermes/skills/devflow/adapters/hermes/manifest.json").is_file())+def test_large_task_runs_the_knowledge_stage_when_it_has_value(self):project = self.install("codex")h.fake_agent("codex", project, "--size", "large", "--knowledge", "run", check_rc=0)diff --git a/local/tests/test_hermes_plugin.py b/local/tests/test_hermes_plugin.pynew file mode 100644index 00000000..5c623b80--- /dev/null+++ b/local/tests/test_hermes_plugin.py@@ -0,0 +1,68 @@+import importlib.util+import json+import os+import sys+import tempfile+import unittest+import shutil+from pathlib import Path+++ROOT = Path(__file__).resolve().parents[1]+PLUGIN = ROOT / "hermes-plugin" / "__init__.py"+++def load_plugin():+ spec = importlib.util.spec_from_file_location("loopforge_hermes_plugin", PLUGIN)+ module = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(module)+ return module+++class HermesPluginTests(unittest.TestCase):+ def test_register_uses_public_slash_command_api(self):+ module = load_plugin()+ calls = []++ class Context:+ def register_command(self, name, handler, description="", args_hint=""):+ calls.append((name, handler, description, args_hint))++ module.register(Context())+ self.assertEqual("loopforge", calls[0][0])+ self.assertIn("LoopForge", calls[0][2])+ self.assertEqual("[start <request>|status [slug]|result [slug]|approve [stage]|help]", calls[0][3])++ def test_commands_use_project_state_and_leave_profile_unmodified(self):+ module = load_plugin()+ with tempfile.TemporaryDirectory() as temporary:+ project = Path(temporary)+ skill_root = project / ".hermes/skills/devflow"+ source = ROOT / "skills"+ shutil.copytree(source, skill_root.parent)+ profile = project / ".hermes/config.yaml"+ profile.write_text("user_setting: keep\n", encoding="utf-8")+ old_root = os.environ.get("LOOPFORGE_PROJECT_ROOT")+ os.environ["LOOPFORGE_PROJECT_ROOT"] = str(project)+ try:+ started = module._handle("start add tests")+ self.assertIn("LoopForge task initialized", started)+ status = module._handle("status")+ self.assertIn("Task: add-tests", status)+ result = module._handle("result")+ self.assertIn("- workflow-state.json", result)+ finally:+ if old_root is None:+ os.environ.pop("LOOPFORGE_PROJECT_ROOT", None)+ else:+ os.environ["LOOPFORGE_PROJECT_ROOT"] = old_root+ self.assertEqual("user_setting: keep\n", profile.read_text(encoding="utf-8"))+ state = json.loads(+ (project / "artifacts/add-tests/workflow-state.json").read_text(encoding="utf-8")+ )+ self.assertEqual("hermes", state["host_adapter"])+ self.assertEqual("isolated", state["execution_mode"])+++if __name__ == "__main__":+ unittest.main()diff --git a/local/tests/test_installer.py b/local/tests/test_installer.pyindex 5dd10c73..138daa98 100644--- a/local/tests/test_installer.py+++ b/local/tests/test_installer.py@@ -174,6 +174,28 @@ class InstallerTests(unittest.TestCase):with self.assertRaises(DevFlowError):apply_install(project, "pi", "classic")+ def test_dsh_installs_portable_skills_and_rejects_classic(self):+ with tempfile.TemporaryDirectory() as td:+ project = Path(td)+ installed, _unchanged = apply_install(project, "dsh", "portable")+ self.assertGreater(installed, 0)+ self.assertTrue((project / ".dsh/skills/devflow/SKILL.md").is_file())+ self.assertTrue((project / ".dsh/skills/manifest.json").is_file())+ self.assertTrue((project / ".dsh/skills/devflow/adapters/dsh/manifest.json").is_file())+ with self.assertRaises(DevFlowError):+ apply_install(project, "dsh", "classic")++ def test_hermes_installs_project_skills_and_rejects_classic(self):+ with tempfile.TemporaryDirectory() as td:+ project = Path(td)+ installed, _unchanged = apply_install(project, "hermes", "portable")+ self.assertGreater(installed, 0)+ self.assertTrue((project / ".hermes/skills/devflow/SKILL.md").is_file())+ self.assertTrue((project / ".hermes/skills/manifest.json").is_file())+ self.assertTrue((project / ".hermes/skills/devflow/adapters/hermes/manifest.json").is_file())+ with self.assertRaises(DevFlowError):+ apply_install(project, "hermes", "classic")+def test_editions_and_plan_make_the_split_visible_without_writing(self):output = StringIO()with redirect_stdout(output):