autoflow-core

autoflow-core is a skill for Claude Code, Codex from lidicn/AutoFlow. It costs 55 tokens per session (1,833 once invoked), scanned A, original, MIT.

A safety-focused skill for reading, writing, changing, and checking Node-RED flows. Node-RED is a tool for connecting devices and services with visual flow diagrams.

In plain words
What is it for?
Inspecting Node-RED flows, creating or updating agent-owned flows, checking their structure, preventing accidental production edits, and verifying that a change was saved correctly.
Why use it?
It protects existing user flows by using snapshots, checks, limited write access, logs, and read-back verification before and after changes.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/lidicn/autoflow/skill
Any agent
npx skills add lidicn/AutoFlow --skill skill
Clone the repo
git clone --depth 1 https://github.com/lidicn/AutoFlow

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for autoflow-core

README.md
[![agentmods](https://agentmods.dev/badge/skills/lidicn/autoflow/skill.svg)](https://agentmods.dev/skills/lidicn/autoflow/skill)
Your own site
<a href="https://agentmods.dev/skills/lidicn/autoflow/skill"><img src="https://agentmods.dev/badge/skills/lidicn/autoflow/skill.svg" alt="Measured on agentmods" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,833 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.01833
Opus 5 $0.00028 $0.00916
Sonnet 5 $0.00011 $0.00367
Haiku 4.5 $0.00006 $0.00183

Measured 4d ago against content hash 714bc083c0de, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

autoflow-core scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/nr_client.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

core/skill/SKILL.md · 114 lines

How it starts

The opening of the file, as written. The whole thing — 114 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AutoFlow Core(核心版)

你(agent)通过本 skill 获得对 Node-RED 实例的安全编程能力:读取、编写、修改、验证 flow。 所有写入经 scripts/nr_client.py(纯标准库,无 pip 依赖),自带护栏:写前快照、 结构 lint、节点数熔断、prod 闸、操作日志、回读校验。

🚨 黄金法则(违反任何一条立即停止)

  1. af_* 前缀 = 你的所有权(代码层硬拦截)。新建 tab/flow 一律 af_<场景名> 命名。
  2. 用户手工流只读——硬拦截,不靠自觉write-flow / create_tab 对不带 af_ 前缀的 目标默认抛 NRGuardError 拒绝;确需改动用户流必须显式加 --allow-user-flow (仍会照常快照留底)。归属以线上 label 为准,伪造前缀绕不过。
  3. 写前必快照,写后必回读。用 write-flow(内置快照+回读校验),不要手工拼 PUT。
  4. prod 默认禁写。URL 含 :1880 或用户明确说是生产实例 → 需用户显式同意才可 --allow-prod
  5. 禁止整体替换。任何"把整个 flows 数组 PUT 回去"的操作都是禁区(会删掉未列出的节点)。 单 flow 更新只走 write-flow
  6. 不确定就问。实体 ID、设备语义拿不准时问用户,不要猜。

配置(~/.autoflow-core/config.json)

{"url": "http://<host>:<port>", "username": "...", "password": "..."}

优先级:环境变量 NR_URL/NR_USER/NR_PASS > 配置文件 > 函数参数。 推荐用环境变量(配置文件是明文密码文件,仅限本机、勿入版本库/勿外发)。 可选(verify 的 HA 断言用):HASS_SERVER + HASS_TOKEN 环境变量。

连接排障:若报 Client sent an HTTP request to an HTTPS server → 端点其实是 HTTPS, 把 url 改 https://;若报证书错误 → 用带有效证书的域名(如 Tailscale 的 *.ts.net), 不要用裸 IP。

标准写入流程(每次写 flow 都走这七步)

1. inventory                     # 看现状:哪些 tab、归属谁、可写性
2. get <tab-id> --compact        # 读参考 flow(省 token;学习用户节点的写法)
3. 写 JSON(见节点构建约定)        # z 必须指向真实 tab id;新 tab 用 af_ 前缀
4. write-flow <id> --file f.json --dry-run   # 预览
5. write-flow <id> --file f.json             # 快照→PUT→回读校验一体
6. inject-read <inject-node-id>  # 自愈闭环:触发+回读 context 捕获
7. 不符 → 改 → 重跑 4-6(上限 3 轮,仍失败则停下报告用户,附快照路径)

自愈闭环(inject → 回读 → apply)

被测 flow 在验证点接一个 function 节点,把结果写到 context:

global.set("af_dbg", {ok: true, state: msg.payload});  // 结构自定,但要能断言
return msg;

然后:

python scripts/nr_client.py inject-read <inject节点id> --key af_dbg --timeout 10
  • 捕获到值 → 与期望比对 → 一致即通过;不一致 → 分析原因 → 修改 → 重验。
  • 超时 None → flow 没跑到验证点(检查触发条件/连线/节点使能)。
  • 命令会先清旧值再触发,不怕读到上一轮残留。

命令速查

python scripts/nr_client.py doctor                     # 安装后自检(验收标准:全绿)
python scripts/nr_client.py inventory                  # 全 tab 只读概览
python scripts/nr_client.py get <id> --compact         # 读 flow(去坐标省 token)
python scripts/nr_client.py search <keyword>           # 全局搜节点
python scripts/nr_client.py write-flow <id> -f f.json [--dry-run]
python scripts/nr_client.py inject-read <inject-id> [--key af_dbg]
python scripts/nr_client.py lint f.json                # 离线结构校验
python scripts/nr_client.py verify <flow-id> --yes     # 端到端(含可选 HA 断言)

Read the full file on GitHub · 114 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 114 lines · 55 tokens per session scan A 714bc083c0de

Subscribe to this mod's changes

autoflow-core is a skill published in the GitHub repository lidicn/AutoFlow (1 stars, last pushed today), licensed MIT. It adds 55 tokens to every session and 1,833 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.