agentleFS
full-aigc-pluginsfull-aigc-plugins/blender-design-plugin/skills/blender-harness/SKILL.md

blender-harness

Skill4 starsChanged 21 days agoApache-2.0View on GitHub

Launch a managed Blender harness session and dispatch structured JSON commands through harness_cli.py. Covers session bootstrap, the closed request envelope (protocolVersion/sessionId/requestId/transactionId/command/arguments/expectedSceneRevision), receipt verification, error codes, capability maturity levels and background jobs. Use this skill for ANY task that needs to create, modify, inspect or export Blender content.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

Blender Harness 调用规范

本技能定义驱动 Blender 的唯一执行通道(WorkBuddy 团队与单插件用户通用)。它是平台无关的:启动器 + JSON 命令行客户端 + 运行在 Blender 内的结构化命令注册表。所有命令契约、回执 schema 与验收阈值以本插件随附的 blender-production 技能参考文档为准。

1. 定位插件目录

本技能位于 <插件根>/skills/blender-harness/SKILL.md。插件根目录(含 scripts/、schemas/、config/)即执行入口所在:

<插件根>/scripts/launch_harness.py     # 启动托管会话
<插件根>/scripts/harness_cli.py        # 向会话派发命令

在 shell 中用 pwd/ls 确认实际路径后再执行;不要凭记忆猜路径。

2. 启动会话(每个生产任务一次)

mkdir -p <输出根目录>            # 所有产物必须落在该授权目录内
python3 <插件根>/scripts/launch_harness.py \
    --session-id <唯一会话ID> \
    --output-root <输出根目录的绝对路径> \
    --execution-mode auto_with_budget
  • Blender 可执行文件自动发现(PATH 或 /Applications/Blender.app/Contents/MacOS/Blender);装在别处时传 --blender <路径>。
  • 启动成功后打印 descriptor(含 address、token、descriptorPath)。记下 descriptorPath——后续所有命令都要用它。
  • 会话结束后按 descriptor 里的说明关闭;不要留孤儿 Blender 进程。

3. 派发命令

把请求写成 JSON 文件再发送(闭合契约,多余字段直接报 INVALID_REQUEST):

{
  "protocolVersion": "codex-blender/v1",
  "sessionId": "<与会话一致>",
  "requestId": "<本次请求唯一ID>",
  "transactionId": "<事务ID>",
  "command": "mesh.inspect",
  "arguments": {}
}
python3 <插件根>/scripts/harness_cli.py \
    --descriptor <descriptorPath> --request <请求.json>

修改类命令必须走事务(读命令不需要)

凭空编造 transactionId 会得到 TRANSACTION_NOT_FOUND。正确序列:

  1. transaction.begin(arguments 必须为空对象)→ 返回 snapshotId 与当前 sceneRevision。
  2. 修改命令(如 object.create_mesh):带同一 transactionId,并带 expectedSceneRevision = begin 返回的 revision;每次成功修改后 revision 递增,下一条命令要跟上。
  3. transaction.commit(arguments 为空对象)→ 提交事务,快照进入已批准状态。
  4. export.file:arguments.snapshotId 必须逐字等于 commit 批准的 snapshotId,否则报 MILESTONE_NOT_APPROVED。

规则:

  • requestId 每次唯一;读命令(*.inspect、capability.*、查询类)不需要事务,也不需要 revision。
  • 响应是 JSON:status 为 succeeded 时核对 result 与 changedObjects;failed 时读 error.code 与 error.message。

4. 常用错误码

错误码含义下一步
INVALID_ARGUMENT参数闭合校验失败对照技能参考里的参数表修正,不要换 undocumented 参数
TRANSACTION_NOT_FOUND事务不存在(未 begin 或已 commit/rollback)先 transaction.begin 再发修改命令
STALE_SCENE_REVISIONexpectedSceneRevision 过期(可重试)用响应里的当前 revision 重发
MILESTONE_NOT_APPROVED导出的 snapshotId 未在当前 revision 提交走完整事务:begin → 修改 → commit → export
OUTPUT_NOT_AUTHORIZED目标路径不在授权输出根内改用会话的 output-root 下的路径
DISK_RESERVE_EXCEEDED磁盘保留策略超限清理空间或换盘;不要绕过
ROTATION_MODE_MISMATCH姿态通道与骨骼 rotation_mode 不符换匹配通道或先设 rotation_mode
MEDIA_INVALID产物媒体探测不过(编码/帧率)按报错的实际值修正输出设置
CAPABILITY_UNAVAILABLE命令在当前运行模式不可用capability.describe 查前置条件
AUTHORIZATION_REQUIRED门禁命令缺授权声明走 session.authorize;用户拒绝就如实上报

5. 能力目录与成熟度

开工前先查,不要假设:

{"command": "capability.list", "arguments": {"domain": "mesh"}}
{"command": "capability.describe", "arguments": {"id": "export.file"}}

成熟度分层:L1 可查询(产物不可交付)、L3 可生产(有 runtime/visual/delivery 证据)、L4 可恢复生产。交付任务只允许 L3+ 命令产出。

6. 后台任务(长渲染/烘焙)

{"command": "job.submit", "arguments": {"jobId": "render_001", "kind": "RENDER_ANIMATION_FRAMES", "parameters": {...}}}
{"command": "job.status",  "arguments": {"jobId": "render_001"}}
{"command": "job.list",    "arguments": {"state": "running"}}

最大并发 2;第三个任务 FIFO 排队;磁盘保留 max(卷容量20%, 20GB),超限时不落快照、不启进程。取消用 job.cancel。

7. 纪律

  1. 回执是唯一事实——"应该成功了"不算数。
  2. 每个验收断言都要能失败;测量值(计数/误差/哈希/探测)必须进汇报。
  3. 门禁(gated/foreground)被拒就如实上报,不重试绕过。
  4. 产物路径永远在授权输出根内;导出走 export.* 命令而不是直接写 Blender 设置。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.