Knods
Overview
Handle Knods chat turns that request new flows or edits on a visual canvas. Parse Knods polling payload messages, generate assistant text, and include [KNODS_ACTION]...[/KNODS_ACTION] blocks when the canvas should change.
Workflow
- Parse incoming payload fields.
- Treat
messageas the primary request. - Use
historyfor continuity. - On first turn in a conversation, expect prepended context in
messagedescribing node types and action rules. - Use
messageIdto map all response chunks to the correct message.
- Choose whether to emit a canvas action block.
- Use
addNodefor single-node additions. - Use
addFlowfor multi-node workflows or any request requiring edges. - If the user only asks a question, respond with normal text and no action block.
- Build strict action JSON.
- Wrap each action exactly as:
[KNODS_ACTION]{"action":"addNode",...}[/KNODS_ACTION][KNODS_ACTION]{"action":"addFlow",...}[/KNODS_ACTION]
- For
addFlow, ensure every edgesourceandtargetreferences an existing node id. - Always end flows with an
Outputnode. - Never connect two generator nodes directly; route through
Outputor through appropriate input/output structure. - Use stable node IDs (for example
input_1,image_1,output_1) so follow-up edits are easy. - Avoid unknown keys in action JSON.
- Stream response back to Knods.
- Send assistant text as delta chunks to
/respondfor the samemessageId. - Send
{"messageId":"...","done":true}when complete. - Keep first chunk quick to avoid timeout perception.
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.
Flow Design Heuristics
- Build the smallest flow that satisfies the request.
- Prefer node types listed in the first-message context when provided.
- Default catalog (when context is absent):
ChatGPT,Claude,Gemini,GPTImage,FluxImage,FalAIImage,Veo31Video,WanAnimate,TextInput,ImagePanel,Dictation,Output. - Add
initialDataonly when user intent clearly implies parameters. - If one generator must feed another, route through
Output. - When node catalog is unknown, make a best-effort choice and clearly state assumptions.
Gateway Behavior Constraints
- Poll interval target: about 1-2 seconds.
- Message claim timeout: about 2 minutes.
- Always preserve
messageIdacross all chunk posts for a turn. - Gateway auth uses
gw_...token via query parametertoken; never require Supabase JWT in this flow.
Runtime Operations
When running a persistent poller service/process:
- Support either configuration style:
KNODS_BASE_URLalready includes/updates?token=...- or
KNODS_BASE_URLpoints to connection base and token is supplied separately (KNODS_GATEWAY_TOKEN)
- Derive
/respondfrom the same connection root as/updates. - Log handled
messageIdvalues and transport errors for debugging.
Packaged Runtime (required)
This skill ships the runtime bridge and installer:
scripts/knods_iris_bridge.pyscripts/install_local.sh
Install/deploy from the skill folder:
bash /home/rolf/.openclaw/skills/knods/scripts/install_local.sh
The installer deploys:
~/.openclaw/scripts/knods_iris_bridge.py~/.config/systemd/user/knods-iris-bridge.service
Then runs:
systemctl --user daemon-reloadsystemctl --user enable --now knods-iris-bridge.service
Environment Variables
Set these in ~/.openclaw/.env:
- Required:
KNODS_BASE_URL
- Required when
KNODS_BASE_URLdoes not already include?token=...:KNODS_GATEWAY_TOKEN
- Optional:
OPENCLAW_AGENT_ID(default:iris)OPENCLAW_BIN(default:openclawonPATH)
Service Operations
- Status:
systemctl --user status knods-iris-bridge.service
- Restart:
systemctl --user restart knods-iris-bridge.service
- Logs:
journalctl --user -u knods-iris-bridge.service -f
Config Change Lifecycle (required)
After changing gateway URL/token env values, restart the running bridge process so it reloads config.
- Generic service form:
systemctl --user restart <knods-bridge-service>
- Generic process form:
- 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.