STAGE_S4_FLOWCHART

A workflow rule set for exporting flowcharts from approved product requirements and prototypes. It checks that required backlog and design files exist before the flowchart stage begins.

In plain words
What is it for?
Use it when running the AIDocx S4 flowchart stage. It helps validate backlog files, read prototype page nodes, apply module boundaries, and generate the resulting flowchart or failure report.
Why use it?
It prevents flowcharts from being created from incomplete or misunderstood project material. Missing required files produce a failure report and stop the stage.

Cursor rule for Cursor

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 rules/silenceinsect/aidocxworkflow/stage_s4_flowchart
Clone the repo
git clone --depth 1 https://github.com/SilenceInsect/AIDocxWorkFlow

Made for: Cursor.

Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 6,074 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.00021 $0.06074
Opus 5 $0.00010 $0.03037
Sonnet 5 $0.00004 $0.01215
Haiku 4.5 $0.00002 $0.00607

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

Security

Grade A, and why

STAGE_S4_FLOWCHART 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 2d ago.

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.

.cursor/rules/STAGE_S4_FLOWCHART.mdc · 417 lines

How it starts

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

AIDocxWorkFlow S4 — 流程图导出

独立阶段:可以单独调用。上游材料(S2 backlog + S3 prototype)审查合格后开始,失败写失败报告。

⚠️ 模块定义见 .cursor/MODULES.md(项目级唯一真相源)。 本文件不重写 8 模块表。


阶段入口

触发方式/aidocx-s4-flowchart 或粘贴 S2 backlog + S3 prototype

前置材料(必须全部满足)

材料 来源 审查要求 缺失时
S2 backlog.md workflow_assets/<req_name>/<version>/「S2 需求拆解」/backlog.md 存在且含 Epic/Story fail_report_S4.md 停止
S2 backlog.json 同上目录 summary.epic_count ≥ 1 + 每 Epic ≥ 1 Story + epic.module 从 8 模块取值 fail_report_S4.md 停止
S1.5 exit_permission.json workflow_assets/<req_name>/<version>/「S1 需求评审」/exit_permission.json can_proceed_to_s2 == true(防御性核查) 警告,不阻断
S3 prototype.md(必须读取 workflow_assets/<req_name>/<version>/「S3 原型导出」/prototype.md 存在则消费 PAGE-XXX 节点 警告,不阻断

材料缺失时:生成失败报告,停止 S4。


§1.4 LLM 必读材料(阶段前置)

生成流程图前,必须先读取以下全部材料。禁止凭印象直接生成。

# 材料 路径 读取原因
1 8 模块总表 .cursor/MODULES.md(§1 总表) Epic 的模块前缀决定该 Epic 的主测试域
2 模块边界区分 .cursor/MODULES.md(§4 各模块 O_boundary.md) 异常决策树的叶子节点归属模块;防止把 BIZ 异常归成 UI
3 S2 backlog workflow_assets/<req_name>/<version>/「S2 需求拆解」/backlog.md Story/OBJ 是流程图生成的核心输入
4 S3 prototype workflow_assets/<req_name>/<version>/「S3 原型导出」/prototype.md 页面原型是流程节点的来源;S4 是 S5 EXCEPTION 类型 TP 的核心输入

核心任务(4 类产出,缺一不可)

每个 Epic 生成:

  1. Mermaid 业务流程图(Flowchart)— 主流程
  2. Mermaid 时序图(Sequence Diagram)— 关键系统调用链路
  3. 异常/错误决策树(Flowchart / 文本)— 异常路径 + 回滚
  4. 风险点清单(表格 + s4_reference 唯一 ID)— S7 100% 覆盖率硬约束来源

4 类可机检 ID

S7 审查员 B 强依赖 S4 的可机检 ID——风险点 100% 覆盖率、异常树叶子节点覆盖率。

编号格式 含义 命名规范 示例
R-{NNN} 风险点 ID(全局顺序) 3 位 0 填充,按 Epic 顺序 + 风险发现顺序 R-001 / R-018
R-{EpicID}-{NN} 风险点按 Epic 局部 ID Epic ID + 2 位 0 填充 R-BIZ-PURCHASE-01
S4-{EpicID}-{seq}.{N} 异常树叶子节点 Epic ID + 异常分支顺序 S4-BIZ-PURCHASE-1.3.2
S4-{EpicID}-F{N} 流程图分支节点 Epic ID + 流程节点顺序 S4-BIZ-PURCHASE-F03

Read the full file on GitHub · 417 lines

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. 2d ago First seen · 417 lines · 21 tokens per session scan A b2a660936a7e

Subscribe to this mod's changes

STAGE_S4_FLOWCHART is a cursor rule published in the GitHub repository SilenceInsect/AIDocxWorkFlow (2 stars, last pushed 1mo ago), licensed MIT. It adds 21 tokens to every session and 6,074 once invoked, about $0.0001 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.