Ruleset Generator
Generate Edictum rulesets and workflow YAML with the current schema. Copy the prompt, paste it into your AI assistant, and stop teaching it dead fields.
You are an expert at writing Edictum rulesets and workflow files. First, ask me: 1. What tools does my agent have? (e.g., read_file, write_file, bash, query_database, send_email, deploy_service, web_fetch) 2. What behaviors should be blocked, asked, warned, or redacted? 3. What environment does the agent run in? (development, staging, production) 4. Do I need stage-based Workflow Gates or human approval pauses? 5. Do I use role-based access (principals)? Then generate YAML using the current edictum/v1 schema only. Use `kind: Ruleset`, `rules:`, `action:`, and the real workflow stage fields shown below. RULESET STRUCTURE: ```yaml apiVersion: edictum/v1 kind: Ruleset metadata: name: <slug> description: "optional" defaults: mode: enforce # or observe tools: <tool_name>: side_effect: pure|read|write|irreversible idempotent: true|false observability: otel: enabled: true endpoint: "http://localhost:4317" protocol: grpc|http service_name: my-agent stdout: true file: /path/to/events.jsonl rules: - ... ``` WORKFLOW STRUCTURE: ```yaml apiVersion: edictum/v1 kind: Workflow metadata: name: workflow-name description: "optional" version: "1.0" stages: - id: implement description: "optional" tools: [Read, Write, Bash] entry: - condition: file_read("specs/feature.md") message: "Read the spec first" checks: - command_matches: "git diff" message: "Inspect your changes" - command_not_matches: "git push.*main" message: "Never push to main" exit: - condition: exec("pnpm test", exit_code=0) message: "Tests must pass" approval: message: "Human approval required" ``` RULE TYPES: 1. Check rule (type: pre) -- evaluates BEFORE tool execution: ```yaml - id: unique-id type: pre tool: tool_name when: <selector>: <operator>: <value> then: action: block message: "supports {args.path} placeholders" tags: [optional, tags] ``` For approval: use `action: ask`, plus optional `timeout` and `timeout_action` (`block` or `allow`). 2. Check output rule (type: post) -- evaluates AFTER tool execution: ```yaml - id: unique-id type: post tool: tool_name when: output.text: <operator>: <value> then: action: warn message: "message" tags: [tags] ``` `redact` and `block` only modify output for pure/read tools. write/irreversible fall back to warn. 3. Session rule (type: session) -- cumulative limits: ```yaml - id: unique-id type: session limits: max_tool_calls: 50 max_attempts: 120 max_calls_per_tool: deploy_service: 3 then: action: block message: "message" ``` 4. Sandbox rule (type: sandbox) -- allowlist boundaries: ```yaml - id: unique-id type: sandbox tools: [read_file, write_file] within: [/workspace, /tmp] not_within: [/workspace/.git] outside: block message: "msg with {args.path}" ``` Sandbox does NOT use when/then. WORKFLOW CONDITIONS THAT EXIST: - `stage_complete("stage-id")` - `file_read("path")` - `exec("command", exit_code=N)` - `approval("stage-id")` - `command_matches("regex")` in `checks:` - `command_not_matches("regex")` in `checks:` DO NOT GENERATE: - legacy bundle kinds and top-level fields - legacy action fields - legacy before/after workflow field names - invented workflow helper functions SELECTORS: args.<key>, tool.name, environment, principal.user_id, principal.service_id, principal.org_id, principal.role, principal.ticket_ref, principal.claims.<key>, env.<VAR>, metadata.<key>, output.text (post only) OPERATORS: exists, equals, not_equals, in, not_in, contains, contains_any, starts_with, ends_with, matches, matches_any, gt, gte, lt, lte BOOLEAN COMBINATORS: all, any, not RULES: - Single-quote regex in YAML: '\b' = word boundary, "\b" = backspace - Message placeholders: {args.path}, {tool.name}, {principal.role}, etc. - Prefer sandbox rules over long deny-lists when the surface is open-ended - Include helpful messages that tell the agent what to do instead - output.text is INVALID in check rules - Rule IDs must be unique within the ruleset - Use Workflow YAML only when process order matters After generating, explain each rule briefly and explain whether a workflow file is needed.
Copy the prompt above into Claude, ChatGPT, Codex, Cursor, or another assistant. Describe your tools, your blocked behavior, and whether order matters. The assistant should return current-schema YAML instead of the dead rule schema.
What the Prompt Does
The prompt gives the assistant the live schema:
kind: Ruleset- top-level
rules: action: block | ask | warn | redact- workflow
entry,checks,exit,approval - real workflow conditions only
That stops the two common failures:
- generating legacy bundle or action YAML
- inventing legacy workflow stage fields
Rule Types At A Glance
| Type | Purpose | Key Fields |
|---|---|---|
pre | Block or ask before execution | tool, when, then.action: block|ask |
post | Inspect tool output after execution | tool, when with output.text, then.action: warn|redact|block |
session | Enforce cumulative limits | limits.max_tool_calls, limits.max_calls_per_tool |
sandbox | Allowlist boundaries (files, commands, domains) | within, allows, outside: block|ask |
Workflow | Enforce ordered process | entry, checks, exit, approval |
Examples: What You Might Ask For
Don't know where to start? Just list your tools and ask:
Here are the tools my agent has:
read_file,write_file,bash,query_database,send_email,deploy_service. Which rules should I start with? Do I also need a workflow file?
The assistant should recommend a small starting ruleset and only add a workflow when order or approvals matter.
Already know what you want? Be specific:
My agent has
read_file,write_file,bash, andweb_fetch. It should only access files in/workspaceand/tmp. It should only rungit,npm,node, andpython. Block reads of.envand credential files. Redact SSN patterns from output. Cap total tool calls at 100 per session. Requiregit diffbefore review and require approval before deployment.
That should produce:
- a ruleset for file, shell, output, and session behavior
- a workflow file for review and deploy stages
Writing Rules By Hand
If you would rather write the YAML yourself:
- YAML Reference -- full schema and field documentation
- Operators -- all 15 operators with examples
- Patterns -- common rule patterns by category
- Writing Rules Guide -- step-by-step guide
- Workflow Gates Runtime -- real workflow YAML and setup
- Testing Rules -- validate rulesets with the CLI
Last updated on