flowd-rules-author
Skill1 starsChanged 8 months agoMITView on GitHub
Authors flowd rule YAML files for `.flowd/rules/` (project) or `~/.flowd/rules/` (global), encoding the engine's `ProposedAction` blind spots, the `deny` vs `warn` decision, glob `scope` vs regex `match`, and a four-part description template. Use when creating or editing flowd rules, when the user mentions flowd, rules engine, rules_check, rules_list, ProposedAction, or asks to gate or warn against tool calls or file edits in a flowd-managed repo.
In this repository33 other files it gives its agents.
- argocdSkill
- c-cpp-compilersSkill
- coding-guidelinesSkill
- devops-iac-engineerSkill
- dag-flowdSkill
- frontend-designSkill
- ghSkill
- grafana-dashboardsSkill
- helmSkill
- kustomizeSkill
- legalizerSkill
- lua-projectsSkill
- markdown-documentationSkill
- mermaid-diagramsSkill
- meta-cognition-parallelSkill
- podmasterSkill
- practical-haskellSkill
- rcaSkill
- researcherSkill
- security-auditSkill
- solidity-securitySkill
- svg-genSkill
- tdd-red-green-refactorSkill
- tmux-masterySkill
- tokenomics-designSkill
- ultimate-dbSkill
- ultimate-nixosSkill
- ultimate-rustSkill
- ultimate-web3Skill
- web3-frontendSkill
- web3-testingSkill
- web3-whitepaperSkill
- ziglangSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 32
Use deny only when the gate (scope glob plus match regex) can be evaluated purely from {tool, file_path} and a true match means the action …
- Very specific: line 34
Use warn when the rule depends on content the engine cannot see -- command arguments, diff body, intent.
- Distinctive: line 83
Every rule description follows this four-part structure:
- Very specific: line 94
Prefer one rule per file, named after the rule id.
- Distinctive: line 136
After writing or editing a rule:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
flowd Rules Author
What the engine actually sees
The flowd rules engine evaluates a ProposedAction carrying only three fields:
tool: String // e.g. "Bash", "Edit", "Write"
file_path: Option<String> // target path of the action
project: Option<String> // current project contextIt does not see command arguments, edit bodies, diff contents, or source text. Schema lives in crates/flowd-core/src/rules.rs.
A rule has five fields:
id: # stable identifier, unique across loaded rules
scope: # glob over file path or project name
level: # warn | deny
description: # multi-line guidance shown to the agent
match: # regex matched against tool name OR file_pathdeny vs warn -- the decision rule
Use deny only when the gate (scope glob plus match regex) can be evaluated purely from {tool, file_path} and a true match means the action itself is wrong.
Use warn when the rule depends on content the engine cannot see -- command arguments, diff body, intent. The agent honors warnings by reading them via rules_list or rules_check.
| Constraint | Engine can enforce? | Level |
| "Don't edit this Cargo.toml" | Yes (file_path) | deny |
"Don't run cargo build" | No (args invisible) | warn |
"Don't add println! to mcp/src" | No (diff invisible) | warn |
| "Don't run any shell tool in test dirs" | Yes (tool + scope) | deny |
Promoting an advisory rule to deny blocks legitimate edits across the whole scope.
scope vs match
scope is a glob; match is a regex. They look similar in YAML and use different engines.
scope: "**"matches every action. Use for tool-name-only rules.scope: "crates/flowd-core/**"matches by file path.scope: "my-project"matches by project name (no globbing).match: "^(Bash|...)$"matches the tool name.match: "crates/flowd-mcp/src/.*\\.rs$"matches the file path.
Either scope or match may carry the path constraint; pick one and keep the other broad. Mixing both narrows the rule unintentionally.
Canonical tool-name regexes
Copy verbatim. Shell-class tools across Claude Code, Cursor, and generic MCP wire:
^(Bash|shell|shell_exec|run_command|run_terminal_cmd)$Edit-class plus shell-class:
^(Bash|Write|Edit|MultiEdit|shell|shell_exec|run_command|run_terminal_cmd)$Global vs project placement
| Rule references... | Place under |
| Specific paths in this repo | .flowd/rules/ |
| Engineering principles, language conventions | ~/.flowd/rules/ |
| Tool or CLI invocations regardless of project | ~/.flowd/rules/ |
Project rules augment globals. Uniqueness is enforced by id, so prefix repo-local ids with the repo name when collision is plausible.
Description template
Every rule description follows this four-part structure:
- What and why -- one or two sentences of intent.
- The footgun -- the future mistake this rule prevents (often "a future agent will look at X and try to fix it").
- Engine caveat -- when the rule is advisory, state the limitation so the next author does not promote it to
deny. - Cross-reference -- README section, sibling rule id, or source file path.
Skip step 3 when the rule is enforceable (deny on observable file_path).
File layout
Prefer one rule per file, named after the rule id. Both single-rule and list layouts are accepted by crates/flowd-core/src/rules/loader.rs. Use the list layout only for tightly-coupled rule families sharing intent (for example multiple cargo-* rules grouped in cargo-discipline.yaml).
Worked examples
Enforceable deny
id: forward-only-migrations
scope: "crates/flowd-storage/src/**"
level: deny
description: |
Schema migrations are forward-only by project policy and live as inline
`const MIGRATION_NNN: &str` constants in
`crates/flowd-storage/src/migrations.rs` (not as .sql files).
Editing or reordering an existing MIGRATION_NNN constant is a breaking
change for every installed user -- append a new, higher-numbered constant
and add it to the MIGRATIONS slice instead.
match: "crates/flowd-storage/src/migrations\\.rs$"Advisory warn
id: mcp-wire-discipline
scope: "crates/flowd-mcp/src/**"
level: warn
description: |
Stdout is reserved for JSON-RPC 2.0 frames when flowd runs as an MCP stdio
subprocess. Diagnostics MUST go to stderr -- use `eprintln!`, `tracing::*`,
or write to `std::io::stderr()`. A single stray `println!`, `print!`, or
`dbg!` corrupts the wire and breaks every connected MCP client silently.
Note: the rules engine cannot read source contents (a ProposedAction carries
only { tool, file_path, project }), so this rule is an advisory triggered on
any edit under crates/flowd-mcp/src/. The agent is responsible for honoring
the constraint in the diff itself.
match: "crates/flowd-mcp/src/.*\\.rs$"Validation
After writing or editing a rule:
Parse and compile check:
cargo test -p flowd-core --lib rules::Confirm the daemon loaded it for the intended scope:
flowd rules list -p <project-name> flowd rules list -f <repo-relative-path>Bare
flowd rules listevaluates against an empty scope and returns no matches even when rules are loaded.
Anti-patterns
level: denyon a rule whosematchonly constrains the tool name with nofile_pathpredicate. Blocks the entire toolclass across the scope.- File name differs from the
id. Breaks grep-by-id. - Rule body embedded in
matchinstead ofdescription.matchis a regex, not prose. - Globally scoped rules referencing repo-specific paths. They fire in unrelated projects.
- Adding
level: denyto advisory rules because "the comment said it was a mistake". If the engine cannot observe the violation,denyblocks legitimate work.
Reference
- Schema:
crates/flowd-core/src/rules.rs(Rule,RuleLevel,ProposedAction). - Loader:
crates/flowd-core/src/rules/loader.rs(single vs list layout, recursive YAML discovery, no symlink follow). - Evaluator:
crates/flowd-core/src/rules/evaluator.rs(glob compilation, regex compilation, lookup). - README sections: "Use the agent" (MCP tool table) and "Recommendations" (rule placement guidance).
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
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.

