Knods
Overview
Handle two Knods modes:
- 1. Interactive canvas chat via the polling gateway
- Headless flow execution via the REST API
Use the polling bridge for Knods Iris/chat payloads. Use the headless API when the task is to discover a flow, inspect inputs, run it, wait, cancel, or fetch outputs programmatically.
Mode Selection
- - Use polling gateway mode when input arrives as a Knods chat envelope with
messageId, message, and history, and the response must stream back with optional [KNODS_ACTION]...[/KNODS_ACTION]. - Use headless API mode when the user wants to:
- list flows
- search flows by name/description
- inspect a flow's input schema
- start a run
- poll until completion
- cancel a run
- retrieve outputs programmatically
Workflow
A. Polling Gateway Flow
- 1. Parse incoming payload fields.
- - Treat
message as the primary request. - Use
history for continuity. - On first turn in a conversation, expect prepended context in
message describing node types and action rules. Always prefer the node catalog from this context over the defaults below. - Use
messageId to map all response chunks to the correct message.
- 2. Choose whether to emit a canvas action block.
- - Use
addNode for single-node additions. - Use
addFlow for multi-node workflows or any request requiring edges. - If the user only asks a question, respond with normal text and no action block.
- 3. Build strict action JSON.
- - Wrap each action exactly as:
-
[KNODS_ACTION]{"action":"addNode","nodeType":"FluxImage"}[/KNODS_ACTION]
-
[KNODS_ACTION]{"action":"addFlow","nodes":[...],"edges":[...]}[/KNODS_ACTION]
- - Use
"nodeType" (not "type") in node objects. Do NOT include position or data fields — Knods handles layout automatically. - For
addFlow, ensure every edge source and target references an existing node id. - Always end flows with an
Output node. - Never connect two generator nodes directly; route through
Output. - Use stable node IDs (for example
n1, n2, n3) so follow-up edits are easy. - Avoid unknown keys in action JSON.
- 4. Stream response back to Knods.
- - Send assistant text as delta chunks to
/respond for the same messageId. - Send
{"messageId":"...","done":true} when complete. - Keep first chunk quick to avoid timeout perception.
B. Headless API Flow
- 1. Discover candidate flows.
-
python3 {baseDir}/scripts/knods_headless.py list
- or INLINECODE28
- 2. Inspect the selected flow.
-
python3 {baseDir}/scripts/knods_headless.py get --flow-id "<flowId>"
- - Read
inputs and preserve every nodeId exactly.
- 3. Start a run.
- - Build
inputs as JSON array with nodeId, content, and type. - Run:
- INLINECODE36
- 4. Poll until terminal state.
-
python3 {baseDir}/scripts/knods_headless.py wait --run-id "<runId>"
- INLINECODE38
- 5. Handle result.
- - On
completed, read INLINECODE40 - On
failed, surface error.message and error.nodeId if present - On timeout, optionally cancel the run
Output Rules
- - Return normal assistant text; do not wrap the full reply in a custom envelope.
- Include
[KNODS_ACTION]...[/KNODS_ACTION] inline only when a canvas mutation is intended. - Do not mention internal polling URLs/tokens in user-facing text.
- Keep action JSON valid and compact.
Node Catalog
IMPORTANT: Every generator node listed below has a built-in prompt textarea. Do NOT add a DocumentPanel before a single generator — just connect the generator directly to an Output. Only use DocumentPanel when one shared prompt feeds multiple generators in parallel.
When the first message includes a node catalog context, always use that list over these defaults. The context catalog is always more up-to-date.
Text Generators (output: text)
All text generators accept text + image input and have a built-in prompt textarea.
- -
ChatGPT — OpenAI models. Best all-rounder. - INLINECODE46 — Anthropic models. Great for reasoning and creative writing.
Image Generators (output: image)
All image generators have a built-in prompt textarea and accept optional image input for image-to-image editing.
- -
GPTImage — OpenAI. Best at following complex instructions and text rendering. - INLINECODE48 — FLUX by Black Forest Labs. Industry-leading quality for portraits and artistic styles. Fast.
- INLINECODE49 — Google Gemini. Great for photorealistic images and concept art.
- INLINECODE50 — Lightning-fast (<2 seconds). Best for rapid prototyping.
- INLINECODE51 — Alibaba Qwen. Strong at anime, illustrations, and Asian-inspired aesthetics.
- INLINECODE52 — ByteDance. Dreamy, surreal compositions. Good at text rendering in images.
- INLINECODE53 — xAI. Text-to-image and image editing.
Video Generators (output: video)
All video generators below have a built-in prompt textarea and support both text-to-video and image-to-video (connect an ImagePanel for image-to-video).
- -
Veo3FalAI — Google Veo 3.1. Cinematic video up to 8s with native audio. Best overall quality. - INLINECODE55 — OpenAI Sora 2. Realistic motion and physics, up to 12s.
- INLINECODE56 — Kling 2.6 Surreal Engine. Cinematic with audio, up to 10s.
- INLINECODE57 — Kling 3.0. Latest generation, Standard/Pro quality, up to 10s.
- INLINECODE58 — Wan 2.6. Multi-shot videos, 720p/1080p, up to 15s.
- INLINECODE59 — LTX-2 Pro. High-fidelity cinematic with synchronized audio.
- INLINECODE60 — xAI. Video with native audio.
Special Video Node
- -
WanAnimateVideo — Character animation. REQUIRES two inputs: a VIDEO (motion reference) + an IMAGE (character to animate). Does NOT have a text prompt. Only use when user wants to animate a character image using motion from another video.
Input/Container Nodes
- -
ImagePanel — Upload or paste an image. Output: image. Use when user wants to provide a reference image or a starting frame for image-to-video. - INLINECODE63 — Editable text container. Output: text. Use ONLY when one shared prompt feeds multiple generators in parallel.
- INLINECODE64 — Displays generated results (text, image, video). REQUIRED at the end of every flow.
Flow Design Rules
- 1. Every generator has a built-in prompt textarea. Never prepend a DocumentPanel to a single generator.
- Use DocumentPanel only for one shared prompt feeding multiple generators in parallel.
- Use ImagePanel when user wants to provide a reference image, a starting frame for video, or an image input for WanAnimateVideo.
- Always end flows with an Output node.
- Never connect two generators directly. Route through an Output node if chaining.
- Flows go left to right: inputs → generators → Output.
- Use EXACT PascalCase node names from the catalog. Do NOT invent node names.
- WanAnimateVideo is the only node that requires a video input. Only suggest it when the user specifically wants to animate a character image using motion from a video.
- Add
initialData only when user intent clearly implies parameters. - Build the smallest flow that satisfies the request.
Flow Examples
Single image generator (most common):
CODEBLOCK0
Image from reference photo:
CODEBLOCK1
One prompt feeding two image generators:
CODEBLOCK2
Text-to-video:
CODEBLOCK3
Image-to-video (animate a still image):
CODEBLOCK4
Character animation from video motion (WanAnimateVideo needs both video + image):
CODEBLOCK5
Text generation:
CODEBLOCK6
Gateway Behavior Constraints
- - Poll interval target: about 1-2 seconds.
- Message claim timeout: about 2 minutes.
- Always preserve
messageId across all chunk posts for a turn. - Gateway auth uses
gw_... token via query parameter token; never require Supabase JWT in this flow.
Runtime Operations
When running a persistent poller service/process:
- - Support either configuration style:
-
KNODS_BASE_URL already includes
/updates?token=...
- or
KNODS_BASE_URL points to connection base and token is supplied separately (
KNODS_GATEWAY_TOKEN)
- - Derive
/respond from the same connection root as /updates. - Log handled
messageId values and transport errors for debugging.
For headless API operations:
- - Prefer
KNODS_API_BASE_URL + INLINECODE77 - INLINECODE78 should look like INLINECODE79
- INLINECODE80 must have
knods:read and INLINECODE82 - If the API base URL is omitted, the packaged client can derive it from the same host as INLINECODE83
Packaged Runtime (required)
This skill ships the runtime bridge and installer:
- - INLINECODE84
- INLINECODE85
- INLINECODE86
Install/deploy from the skill folder:
CODEBLOCK7
The installer deploys:
- - INLINECODE87
- INLINECODE88
Then runs:
- - INLINECODE89
- INLINECODE90
Environment Variables
Set these in ~/.openclaw/.env:
- - Required for polling gateway mode:
-
KNODS_BASE_URL
- - Required when
KNODS_BASE_URL does not already include ?token=...:
-
KNODS_GATEWAY_TOKEN
- - Required for headless API mode:
-
KNODS_API_KEY
- - Preferred for headless API mode:
-
KNODS_API_BASE_URL
-
OPENCLAW_AGENT_ID (default:
iris)
-
OPENCLAW_BIN (default:
openclaw on
PATH)
Service Operations
-
systemctl --user status knods-iris-bridge.service
-
systemctl --user restart knods-iris-bridge.service
- INLINECODE105
Config Change Lifecycle (required)
After changing gateway URL/token env values, restart the running bridge process so it reloads config.
-
systemctl --user restart <knods-bridge-service>
- stop old process
- start poller again with updated env
Do not assume env changes are picked up live without restart.
Reference
- - Read
references/protocol.md for canonical polling endpoints, payload schemas, and action examples. - Read
references/headless-api.md for the direct run/list/poll/cancel flow execution API.
Knods
概述
处理 Knods 的两种模式:
- 1. 通过轮询网关进行交互式画布聊天
- 通过 REST API 执行无界面流程
使用轮询桥接器处理 Knods Iris/聊天负载。当任务需要以编程方式发现流程、检查输入、运行、等待、取消或获取输出时,使用无界面 API。
模式选择
- - 当输入以包含 messageId、message 和 history 的 Knods 聊天信封形式到达,且响应必须通过可选的 [KNODSACTION]...[/KNODSACTION] 流式返回时,使用轮询网关模式。
- 当用户想要执行以下操作时,使用无界面 API 模式:
- 列出流程
- 按名称/描述搜索流程
- 检查流程的输入模式
- 启动运行
- 轮询直至完成
- 取消运行
- 以编程方式检索输出
工作流程
A. 轮询网关流程
- 1. 解析传入负载字段。
- 将 message 视为主请求。
- 使用 history 保持连续性。
- 在对话的第一轮中,期望 message 中包含描述节点类型和操作规则的上下文前缀。
始终优先使用此上下文中的节点目录,而非下面的默认值。
- 使用 messageId 将所有响应块映射到正确的消息。
- 2. 选择是否发出画布操作块。
- 对于单节点添加,使用 addNode。
- 对于多节点工作流或任何需要边的请求,使用 addFlow。
- 如果用户仅提问,则返回普通文本,不包含操作块。
- 3. 构建严格的操作 JSON。
- 每个操作精确包裹为:
- [KNODS
ACTION]{action:addNode,nodeType:FluxImage}[/KNODSACTION]
- [KNODS
ACTION]{action:addFlow,nodes:[...],edges:[...]}[/KNODSACTION]
- 在节点对象中使用 nodeType(而非 type)。不要包含 position 或 data 字段——Knods 会自动处理布局。
- 对于 addFlow,确保每条边的 source 和 target 引用现有的节点 ID。
- 始终以 Output 节点结束流程。
- 切勿直接连接两个生成器节点;通过 Output 路由。
- 使用稳定的节点 ID(例如 n1、n2、n3),以便后续编辑。
- 避免在操作 JSON 中使用未知键。
- 4. 将响应流式返回给 Knods。
- 将助手文本作为增量块发送到 /respond,使用相同的 messageId。
- 完成后发送 {messageId:...,done:true}。
- 保持第一个块快速发送,以避免超时感知。
B. 无界面 API 流程
- 1. 发现候选流程。
- 运行:
- python3 {baseDir}/scripts/knods_headless.py list
- 或 python3 {baseDir}/scripts/knods_headless.py resolve --query
- 2. 检查选定的流程。
- 运行:
- python3 {baseDir}/scripts/knods_headless.py get --flow-id
- 读取 inputs 并精确保留每个 nodeId。
- 3. 启动运行。
- 将 inputs 构建为包含 nodeId、content 和 type 的 JSON 数组。
- 运行:
- python3 {baseDir}/scripts/knods_headless.py run --flow-id --inputs-json [...]
- 4. 轮询直至终端状态。
- 优先使用:
- python3 {baseDir}/scripts/knods_headless.py wait --run-id
- 或使用:
- python3 {baseDir}/scripts/knods_headless.py run-wait --flow-id --inputs-json [...]
- 5. 处理结果。
- 在 completed 时,读取 outputs
- 在 failed 时,显示 error.message 和 error.nodeId(如果存在)
- 超时时,可选择取消运行
输出规则
- - 返回正常的助手文本;不要将完整回复包裹在自定义信封中。
- 仅在需要画布变更时内联包含 [KNODSACTION]...[/KNODSACTION]。
- 不要在面向用户的文本中提及内部轮询 URL/令牌。
- 保持操作 JSON 有效且紧凑。
节点目录
重要提示: 下面列出的每个生成器节点都有内置的提示文本框。不要在单个生成器前添加 DocumentPanel——只需将生成器直接连接到 Output。仅当单个共享提示并行馈送到多个生成器时,才使用 DocumentPanel。
当第一条消息包含节点目录上下文时,始终使用该列表而非这些默认值。上下文目录始终是最新的。
文本生成器(输出:文本)
所有文本生成器都接受文本+图像输入,并具有内置的提示文本框。
- - ChatGPT — OpenAI 模型。最佳全能型。
- Claude — Anthropic 模型。擅长推理和创意写作。
图像生成器(输出:图像)
所有图像生成器都有内置的提示文本框,并接受可选的图像输入用于图像到图像的编辑。
- - GPTImage — OpenAI。最擅长遵循复杂指令和文本渲染。
- FluxImage — Black Forest Labs 的 FLUX。在肖像和艺术风格方面具有行业领先的质量。速度快。
- ImagePrompt — Google Gemini。非常适合逼真图像和概念艺术。
- ZImageTurbo — 闪电般快速(<2 秒)。最适合快速原型制作。
- QwenImage — 阿里巴巴 Qwen。在动漫、插图和亚洲风格美学方面表现出色。
- Seedream — 字节跳动。梦幻、超现实的构图。擅长图像中的文本渲染。
- GrokImage — xAI。文本到图像和图像编辑。
视频生成器(输出:视频)
以下所有视频生成器都有内置的提示文本框,并支持文本到视频和图像到视频(连接 ImagePanel 用于图像到视频)。
- - Veo3FalAI — Google Veo 3.1。长达 8 秒的电影级视频,带原生音频。最佳整体质量。
- Sora2Video — OpenAI Sora 2。逼真的运动和物理效果,最长 12 秒。
- Kling26Video — Kling 2.6 超现实引擎。带音频的电影级效果,最长 10 秒。
- KlingO3Video — Kling 3.0。最新一代,标准/专业质量,最长 10 秒。
- Wan26Video — Wan 2.6。多镜头视频,720p/1080p,最长 15 秒。
- LTXVideo — LTX-2 Pro。高保真电影级效果,带同步音频。
- GrokVideo — xAI。带原生音频的视频。
特殊视频节点
- - WanAnimateVideo — 角色动画。需要两个输入:一个视频(动作参考)+ 一个图像(要动画的角色)。没有文本提示。仅当用户想要使用另一个视频的动作来动画角色图像时使用。
输入/容器节点
- - ImagePanel — 上传或粘贴图像。输出:图像。当用户想要提供参考图像或图像到视频的起始帧时使用。
- DocumentPanel — 可编辑的文本容器。输出:文本。仅当单个共享提示并行馈送到多个生成器时使用。
- Output — 显示生成的结果(文本、图像、视频)。每个流程结束时必需。
流程设计规则
- 1. 每个生成器都有内置的提示文本框。 切勿在单个生成器前添加 DocumentPanel。
- 仅当单个共享提示并行馈送到多个生成器时,才使用 DocumentPanel。
- 当用户想要提供参考图像、视频的起始帧或 WanAnimateVideo 的图像输入时,使用 ImagePanel。
- 始终以 Output 节点结束流程。
- 切勿直接连接两个生成器。 如果需要链接,通过 Output 节点路由。
- 流程从左到右: 输入 → 生成器 → Output。
- 使用目录中确切的帕斯卡命名法节点名称。 不要发明节点名称。
- WanAnimateVideo 是唯一需要视频输入的节点。仅当用户特别想要使用视频中的动作来动画角色图像时才建议使用。
- 仅当用户意图明确暗示参数时,才添加 initialData。
- 构建满足请求