Files
deepseek-harness/packages/preset/persona/README.zh.md
Yichen Jiang 739042a804 feat(persona): make the agent persona a composable row
`dsh-system-prompt` owns the deployment persona as its own config and registers
that section unconditionally, so a process has exactly one. An agent preset
cannot mount the prompt registry itself, which means that without a row of its
own a preset could change an agent's tools but never its identity — and a
roster of presets that all sound the same is not worth having.

The row is scope-only by construction: mounted outside an agent scope it
collides with the registry's own `deployment:persona` registration and fails
loud. That is the correct shape rather than a gap, because the unscoped slot
already has an owner and this row exists to shadow it for one agent.

Two behaviours are pinned by test because both read the other way at a glance:
an empty persona still occupies the slot (shadowing the deployment persona away
entirely, then disappearing at render), and `assemble()` keeps section text
uninterpolated — `renderPrompt()` is the stage that resolves `{{…}}`.
2026-08-07 00:35:30 +08:00

2.3 KiB
Raw Blame History

dsh-persona

English | 中文

把 agent智能体人设做成一个可组装的行一个配置字段一个提示词段落。

dsh-system-prompt 以自身配置持有部署级人设,并且无条件注册该段落,因此一个进程只有一份。agent preset 无法自行挂载提示词注册表——若没有属于自己的行preset 能改变 agent 的工具,却永远改不了它的身份。本包就是那一行。

仅限 scope 内使用

在 agent scope 之外挂载本行,会与注册表自身的 deployment:persona 注册相撞并明确报错。这不是需要绕开的限制:部署级人设已经有归属,而本行存在的意义正是为某一个 agent 遮蔽它。请把它挂在 preset 组装内部,由 preset 的挂载过程提供 agent scope。

配置

字段 默认值 含义
text 必填 作为 deployment:persona 段落渲染的人设文本

text 与任何提示词段落一样是模板:完整的 {{…}} 组在提示词渲染时(而非组装时)严格解析为已注册的提示词变量。空文本同样占据该槽位,因此会把部署级人设整个遮蔽掉,然后在渲染时消失。

Model Experience

人设段落

What the model sees

位于 order 0 的 deployment:persona 段落,紧随 harness 身份开场白之后,携带本行配置的 text,其中的提示词变量已解析。对于其 preset 挂载了本行的 agent它会替换部署所配置的任何人设。

Token effect

对给定 preset 而言是固定的:该 agent 的每次请求都携带人设自身的 token其他 agent 一个都不带。空文本不贡献任何 token。

KV Cache effect

在一个 agent 的整个生命周期内保持前缀稳定——本行只挂载一次,发生在 agent 发布之前、因而也在它的首个请求之前,且在 agent 运行期间文本不再改变。两个使用不同 preset 的 agent 从该段落起建立各自不同的前缀,谁都无法让对方失去缓存复用。

Known Limitations and Deferred Work

  • 不支持全局挂载 —— 提示词注册表拥有未加 scope 的人设槽位,因此本行只能从带 scope 的组装中使用。要改变部署级人设,应在 system-prompt 行自身的配置中修改。