Skip to content
dsh.fish
Bundle

@lynsucceed/dsh-openclaw-persona

Reuse OpenClaw persona files (SOUL/IDENTITY/USER/MEMORY/TOOLS.md) as the DSH agent persona, with a Web GUI editor — edit the .md files in the sidebar and the change takes effect on the next request.

Source
lynsucceed
stars
2 stars
License
MIT
Updated
Updated 4 days ago

Readme

# dsh-openclaw-persona

> **改 md 即改 Persona,下一条消息生效。**
> 把 OpenClaw 五件套 Persona 定义搬进 DeepSeek Harness——侧边栏直接编辑,保存即生效。

[![License][license-badge]][license] [![npm][npm-badge]][npm]

[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg
[license]: LICENSE
[npm-badge]: https://img.shields.io/npm/v/@lynsucceed/dsh-openclaw-persona?logo=npm&color=cb3837
[npm]: https://www.npmjs.com/package/@lynsucceed/dsh-openclaw-persona

---

## 🖼️ 界面预览

![Custom Persona 编辑器界面](docs/screenshot.png)

侧边栏入口,点开即编辑,标签页切换五个文件,**保存后下一条消息立即生效**。

## ✨ 核心特性

- **🖊️ 即改即生效** — 聊到一半觉得 Agent 回答风格不对?点开侧边栏改两笔,**下一条消息**就按新设定来。不用重启、不用重载配置。
- **📐 五文件分层定义** — 借鉴 [OpenClaw](https://openclaw.ai) 的成熟范式:行为准则 / 身份设定 / 用户画像 / 长期记忆 / 工具备忘,各司其职,改哪块动哪块。
- **🎛️ Web GUI 编辑器** — 标签页切换 5 个文件,Markdown 直接写,保存即写入磁盘。也可以用你喜欢的编辑器直接改文件,效果完全一样。
- **⚡ mtime 缓存,KV-cache 友好** — 文件没变就复用缓存文本,不打乱模型端 KV-cache;文件改动立刻生效,两全其美。
- **🏗️ 两级回退** — 先找项目内 `.dsh/persona/`(每个仓库一套设定),找不到再回退到全局 `~/.dsh/persona/`(默认设定)。项目覆盖全局,天经地义。
- **🔌 即插即用** — 一个命令装上,侧边栏自动出现入口;首次启动写入示例模板,**绝不覆盖你已有的编辑**。

## 🚀 一分钟上手

```bash
# 安装插件(web profile)
dsh plugin --profile web add @lynsucceed/dsh-openclaw-persona

# 重启 DSH Web
dsh web
```

重启后侧边栏会出现 **「Custom Persona」** 入口——点开就能编辑 5 个 Persona 文件。

> 也可以从 GitHub 安装:`dsh plugin --profile web add github:lynsucceed/dsh-openclaw-persona`

## 🧩 五文件体系

| 文件 | 管什么 | 组合顺序 |
|---|---|---|
| `SOUL.md` | 行为准则 — 语气、边界、价值观 | 1 |
| `IDENTITY.md` | 身份设定 — 角色定位、背景、说话方式 | 2 |
| `USER.md` | 用户画像 — 称呼、时区、相处之道 | 3 |
| `MEMORY.md` | 长期记忆 — 值得记住的信息 | 4 |
| `TOOLS.md` | 工具 / 环境备忘 — TTS 声线、设备别名等 | 5 |

五个文件按顺序拼接,替换 DSH 的 `deployment:persona` 提示段。**任何一个文件都可以留空或删除**——缺失的部分会被安静跳过,不会报错。

## 🎯 使用方式

### 在 Web GUI 里编辑(推荐)

1. 点击侧边栏 **「Custom Persona」**
2. 切换标签页,在对应的 Markdown 文件里写设定
3. 点 **「保存」**
4. 发下一条消息——Agent 已经按新设定应答了 ✨

### 直接改文件

编辑磁盘上的 `~/.dsh/persona/*.md`(全局)或 `<项目目录>/.dsh/persona/*.md`(项目级),效果完全一样。mtime 缓存会自动检测变化。

### 项目级覆盖

想给某个项目单独配一套 Persona?在项目根目录下建 `.dsh/persona/`,把要覆盖的文件放进去就行。没放的文件仍然从全局读取。

## ⚙️ 配置(可选)

默认开箱即用。如果想自定义,可以在 cordis 配置里传参:

```yaml
plugins:
  '@lynsucceed/dsh-openclaw-persona':
    dir: persona          # 目录名,默认 persona
    files:                # 文件列表 + 顺序,默认是下面这 5 个
      - SOUL.md
      - IDENTITY.md
      - USER.md
      - MEMORY.md
      - TOOLS.md
```

- **`dir`** — 在 `.dsh/` 和 `~/.dsh/` 下查找的子目录名
- **`files`** — 自定义文件名和组合顺序,想用几个用几个

## 🛠️ 开发

```bash
pnpm install     # 安装依赖(devDependencies 直接从 npm 拉,不需要本地 DSH checkout)
pnpm build       # tsc 生成类型 + tsdown 打包(host ESM + client ModuleLoader)
pnpm typecheck   # 仅类型检查
```

运行时依赖通过 `peerDependencies` 由宿主 profile 注入,打包产物里不包含 cordis / dsh-* 包。

## 📄 许可

MIT

Install

dsh plugin --profile web add github:lynsucceed/dsh-openclaw-persona

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source