Persona Spawn
Use this skill to ensure the local persona library exists, assemble a deterministic persona prompt, and spawn a subagent without letting workspace persona files override the requested persona.
Files
Keep personas in the current workspace:
CODEBLOCK0
INLINECODE0 is the shared org-context config. Put docs there that every persona spawn should inherit, such as Kru foundation rules, brand standards, or execution rules.
Read references/api-endpoints.md only when importing or validating marketplace data.
Read references/soul-guide.md only when authoring a new custom persona.
First use
Before resolving personas, ensure the local library exists:
CODEBLOCK1
If the workspace has no local persona library yet, this bootstraps bundled starter personas and creates personas/config.json.
Shared org context config
Create or edit:
CODEBLOCK2
Rules:
- - Accept
context_files as either an array or a comma-separated string. - Resolve relative paths from
personas/config.json. - Use shared context for durable org rules, not persona-specific flavor.
Workflow
1. Respect local policy first
Before spawning, follow the current workspace policy.
If local AGENTS.md or system rules require asking before spawning subagents, ask first.
Do not use this skill to bypass local governance.
2. Ensure local personas exist
Run:
CODEBLOCK3
Then read <workspace>/personas/index.json.
3. Resolve the persona
Read:
- - INLINECODE8
- INLINECODE9
- INLINECODE10
If the persona is not installed locally, import it first with the bundled importer.
4. Build the persona prompt deterministically
Use the bundled builder:
CODEBLOCK4
This assembles the prompt in this order:
- 1. Override directive
- Org context files from INLINECODE11
- Persona SOUL.md
- Persona IDENTITY.md
- Task
The override directive tells the spawned agent to ignore conflicting workspace-injected SOUL.md / IDENTITY.md for persona and tone, while still obeying higher-priority system, developer, safety, and governance instructions.
5. Spawn the subagent
Use the normal OpenClaw subagent path with the assembled prompt.
Preferred shape:
CODEBLOCK5
Model guidance:
- - Use the caller's default model unless the user requests another one.
- Use a fast model for writing, brainstorming, or stylistic tasks.
- Use a stronger model for analysis, security review, or planning.
6. Return the result
The subagent reports back automatically.
- - If the user asked for the persona's voice, preserve it.
- Otherwise summarize in your own voice and mention which persona was used.
Import personas
Import one
CODEBLOCK6
Import all
CODEBLOCK7
Batch without rebuilding every time
CODEBLOCK8
Rebuild the local index manually
After adding, removing, or editing personas:
CODEBLOCK9
Guardrails
- - Do not change your own persona in-place. Spawn another agent instead.
- Do not spawn for trivial one-liners.
- Do not mix multiple personas in one subagent.
- Do not add tone instructions that conflict with the persona.
- Prefer local personas after import.
- Prefer
context_files for shared org doctrine and execution standards. - If import fails, report the failure cleanly and suggest nearby installed personas when possible.
Persona Spawn
使用此技能确保本地角色库存在,组装确定性角色提示,并生成子代理,同时防止工作区角色文件覆盖请求的角色。
文件
将角色保存在当前工作区:
text
/personas/
├── config.json
├── index.json
├── the-mandalorian/
│ ├── SOUL.md
│ ├── IDENTITY.md
│ └── persona.json
└── /
├── SOUL.md
├── IDENTITY.md
└── persona.json
personas/config.json 是共享的组织上下文配置。在此处放置每个角色生成时应继承的文档,例如 Kru 基础规则、品牌标准或执行规则。
仅在导入或验证市场数据时读取 references/api-endpoints.md。
仅在编写新的自定义角色时读取 references/soul-guide.md。
首次使用
在解析角色之前,确保本地库存在:
bash
python3 dir>/scripts/ensure-personas.py dir>
如果工作区尚未拥有本地角色库,此操作将引导内置的入门角色并创建 personas/config.json。
共享组织上下文配置
创建或编辑:
json
{
context_files: [
../_System/Motoko-Kru-Foundation.md,
../Resources/Coding-Subagent-Contract.md
]
}
规则:
- - 接受 context_files 为数组或逗号分隔的字符串。
- 从 personas/config.json 解析相对路径。
- 使用共享上下文处理持久的组织规则,而非特定角色的风格。
工作流程
1. 首先遵守本地策略
在生成之前,遵循当前工作区策略。
如果本地 AGENTS.md 或系统规则要求在生成子代理前询问,请先询问。
不要使用此技能绕过本地治理。
2. 确保本地角色存在
运行:
bash
python3 dir>/scripts/ensure-personas.py dir>
然后读取 /personas/index.json。
3. 解析角色
读取:
- - /personas//SOUL.md
- /personas//IDENTITY.md
- /personas//persona.json
如果角色未在本地安装,请先使用捆绑的导入器进行导入。
4. 确定性构建角色提示
使用捆绑的构建器:
bash
python3 /scripts/build-persona-prompt.py \
\
\
--task-file
此操作按以下顺序组装提示:
- 1. 覆盖指令
- 来自 personas/config.json 的组织上下文文件
- 角色 SOUL.md
- 角色 IDENTITY.md
- 任务
覆盖指令告诉生成的代理忽略工作区注入的冲突 SOUL.md / IDENTITY.md 中的角色和语气,同时仍然遵守更高优先级的系统、开发者、安全和治理指令。
5. 生成子代理
使用组装好的提示通过正常的 OpenClaw 子代理路径进行。
推荐格式:
json
{
task: ,
runtime: subagent,
mode: run,
label: persona:,
runTimeoutSeconds: 300,
cleanup: delete
}
模型指导:
- - 除非用户要求其他模型,否则使用调用者的默认模型。
- 对于写作、头脑风暴或风格化任务,使用快速模型。
- 对于分析、安全审查或规划,使用更强模型。
6. 返回结果
子代理自动报告结果。
- - 如果用户要求角色的语气,请保留它。
- 否则,用自己的语气总结并提及使用了哪个角色。
导入角色
导入单个角色
bash
bash /scripts/import-persona.sh /personas
导入所有角色
bash
bash /scripts/import-persona.sh --all /personas
批量导入而不每次都重建
bash
bash /scripts/import-persona.sh --no-index /personas
python3 /scripts/rebuild-index.py /personas
手动重建本地索引
在添加、删除或编辑角色后:
bash
python3 /scripts/rebuild-index.py /personas
护栏
- - 不要就地更改自己的角色。改为生成另一个代理。
- 不要为琐碎的单行任务生成代理。
- 不要在一个子代理中混合多个角色。
- 不要添加与角色冲突的语气指令。
- 导入后优先使用本地角色。
- 优先使用 context_files 处理共享组织原则和执行标准。
- 如果导入失败,清晰报告失败,并在可能时建议附近已安装的角色。