Skip to content
dsh.fish
Bundle

@the-heart-fickle/dsh-solo-agent

DSH plugin that injects a solo orchestrator preset with explore/editor/verify/general subagents and subagent-only minimal anchoring.

Source
TheHeartFickle
License
MIT
Updated
Updated 14 days ago

Readme

# dsh-solo-agent

DSH 插件:向用户 agent-presets 注入 `solo` preset,优化上下文占用和模型调度。

## 核心设计

- **Solo 主 agent 是纯编排者**:
  - 模型可见目录里没有 `bash` / `pwsh` / `read` / `write` / `edit` / `glob` / `grep` / `str_replace_editor`。
  - 只保留 `ask_user_question`、`todo_write`、`skill` 和 4 个前台 subagent 工具。
  - shell / fs / web 工具在 preset 层挂载供子代理使用,由 `solo-bootstrap.mjs` 对主 agent 隐藏。
- **闭环调度**:
  1. `subagent_explore` 初始化一次,产出 target tests / test command / root-cause。
  2. 最多 5 轮:`subagent_editor` 修改 → `subagent_general` 跑测试并返回原始输出 → Solo 只依据原始测试输出决策。
  3. 大改动/高风险且测试通过后,`subagent_verify` 做对抗性验证。
- **子代理 minimal 锚定**:借鉴 `anchored-standard`,只对 `delegationDepth > 0` 的子代理生效;Solo 主 agent 不受锚定。
- **压缩**:`dsh-compaction-basic` + `dsh-compaction-tool-result-pruner` + `dsh-command-compact` 全开。

## 项目结构

```
dsh-solo-agent/
├── package.json                 # bundle 插件元数据 + dsh.bundle.patch
├── dsh.plugin.json              # 插件清单,contributes.presets = ["solo"]
├── cordis.patch.yml             # 挂载 dsh-solo-agent 插件行
├── lib/
│   ├── index.js                 # apply(): 写入/更新 ~/.dsh/.agent-presets/solo
│   ├── preset-renderer.js       # 生成 agent.cordis.yml / preset.yml
│   └── roles.js                 # 角色注册表(persona + toolFilter)
├── templates/
│   ├── solo-bootstrap.mjs       # 子代理 minimal 锚定 + 主 agent 目录过滤
│   ├── compaction-epoch.mjs     # 压缩后重新锚定的 epoch 跟踪
│   └── custom-bash.mjs          # Windows 下注册 bash 工具
├── scripts/
│   └── package-registry.mjs     # 生成 registry/ 本地注册表安装包
└── test/                        # node --test 测试
```

## 角色

| toolName | 职责 | 可见工具(toolFilter.allow) | skill |
|---|---|---|---|
| `subagent_explore` | 只读研究,产出 target tests / test command / root-cause | read, read_image, glob, grep, bash, web_search, web_fetch | 无 |
| `subagent_editor` | 聚焦编辑,不自测 | read, write, edit, str_replace_editor, glob, grep, bash | 无 |
| `subagent_verify` | 对抗性验证,返回 PASS/FAIL/PARTIAL | read, read_image, glob, grep, bash, skill | 有 |
| `subagent_general` | 杂活/测试执行,返回原始输出 | read, write, edit, str_replace_editor, glob, grep, bash, web_search, web_fetch, skill | 有 |

角色注册表在 `lib/roles.js`,后续加角色只需新增一条记录。

## 开发

```sh
npm test
npm run package:registry
```

Install

dsh plugin --profile web add github:TheHeartFickle/dsh-solo-agent

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source