Problem
bbeval opt must generate structured, compliant prompts in Markdown, YAML, or SudoLang, while enforcing company guidelines (attached via --guidelines) Invalid prompts (missing {{examples}}, banned phrases, wrong format) must be rejected during optimization.
Proposed Solution
Add a multi-format Guideline Reinforcement Engine to bbeval opt that:
- Validates every candidate before scoring
- Supports Markdown, YAML, and SudoLang output
- Enforces format-specific rules via
--guidelines (YAML)
CLI Usage
bbeval opt tests.yaml base.prompt.md \
--mode direct-llm \
--guidelines constraints.yaml \
--format markdown \
--output optimized.prompt.md
constraints.yaml (Format-Agnostic + Format-Specific)
# Globalrequired_placeholders:
- "{{task}}"
- "{{guidelines}}"banned_phrases:
- "never"
- "always avoid"max_tokens: 500# Format: Markdownmarkdown:
required_headers:
- "# Task"
- "## Output"required_tools_in_frontmatter: trueno_universal_concepts: true # Ban SOLID, PascalCase, etc.# Format: YAMLyaml:
required_keys:
- persona
- workflow
- outputno_inheritance: true # Ban `extends`, `class`# Format: SudoLangsudolang:
no_class_keywords: trueprefer_natural_language: truerequired_constraints_block: truelint_rules: true # Auto-run SudoLang linter
Supported Output Formats
| Format | When to Use | Validation |
|---|
| Markdown (default) | Single workflow, clear steps | Headers, frontmatter, placeholders |
| YAML | Multi-workflow, context-aware | Keys, no class, composition |
| SudoLang | Loops, branching, state | No new, constraints, lint |
Auto-selection:bbeval opt picks simplest format that fits logic (Markdown > YAML > SudoLang).
Enforcement Flow
defvalidate_candidate(prompt_str: str, format: str) -> (bool, str):
# 1. Parse (Markdown → AST, YAML → dict, SudoLang → lint)# 2. Check global rules (tokens, phrases)# 3. Check format-specific rules# In optimizer:ifnotvalidate_candidate(candidate, format):
score=0.0# Reject early
Example: Optimized Markdown Output
---description: 'SQL schema review'mode: 'ask'tools: ['runInTerminal', 'getTerminalOutput']---# SQL Schema Reviewer
You are a senior DBA with 15 years in fintech.
## Task
Review `${selection}` for compliance with internal SQL standards.
{{guidelines}}
## Instructions1. Run `EXPLAIN` via terminal
2. Check for missing indexes
3. Suggest fixes only if critical
## Output```diff- Old+ New
SudoLang Linter Integration
# constraints.yamlsudolang:
lint: true
→ Auto-runs:
Lint { style constraints { * obey style guide; prohibit (class) } }
Problem
bbeval optmust generate structured, compliant prompts in Markdown, YAML, or SudoLang, while enforcing company guidelines (attached via--guidelines) Invalid prompts (missing{{examples}}, banned phrases, wrong format) must be rejected during optimization.Proposed Solution
Add a multi-format Guideline Reinforcement Engine to
bbeval optthat:--guidelines(YAML)CLI Usage
constraints.yaml(Format-Agnostic + Format-Specific)Supported Output Formats
class, compositionnew, constraints, lintEnforcement Flow
Example: Optimized Markdown Output
SudoLang Linter Integration
→ Auto-runs: