Repository navigation
feat(roles): add S.I.R.E.N. mermaid diagram specialist - #7
Merged
Merged
Conversation
Adds a utility role that emits Mermaid source which parses on the first attempt. The prompt encodes the parser hazards that actually cause render failures (reserved `end`, unquoted punctuation in labels, ids used as display text, the o/x edge trap, unbalanced subgraph/alt blocks) and runs a mandatory 13-point verification pass before emitting. Beyond syntax it selects the diagram type from the subject rather than the user's vocabulary, budgets node count for readability, and requires an explicit text colour alongside every classDef fill so styled diagrams stay legible in dark themes. Roles are auto-discovered from roles/**/role.md, so catalog.yaml needs only the MINOR bump for a new role (VERSIONING.md): 2.0.0-alpha.2 -> alpha.3. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds S.I.R.E.N. — Syntax Integrity and Rendering Engine for Notation, a utility role for producing Mermaid diagrams that render on the first attempt.
Why a role rather than a prompt snippet
Asking a general-purpose model for a Mermaid diagram fails in a small, stable, well-known set of ways: the reserved word
endsilently terminating a flowchart, unquoted()/:/,inside labels, node identifiers doing double duty as display text,A---oBparsing as a circle-ended edge, analtblock missing itsend. Those failures are enumerable, so they are encoded as hazards H1–H12 in the prompt and re-checked as V1–V13 in a mandatory verification pass that runs before anything is emitted.Three judgement calls the prompt makes that a bare request does not:
TYPE_SELECTORmaps 15 subject shapes to types, and prefers the modern forms (flowchartovergraph,stateDiagram-v2overstateDiagram).classDeffill must ship with an explicitcolor:. A fill without one renders dark-on-dark for anyone using a dark viewer — the most common way a "working" diagram breaks for half its readers.It also repairs: paste a broken diagram and it returns corrected source plus a fault list naming each hazard, preserving the author's intent rather than redesigning the content.
Design notes
utility,interaction: single-shot,targets: [system-prompt],governanceall-low/public — matching A.T.L.A.S., its nearest neighbour (both are stateless single-task renderers, and it's listed as a companion).catalog.yamlneeds no role entry —tools/build.pydiscovers roles from theroles/**/role.mdtree. Onlymodule.versionmoves,2.0.0-alpha.2→2.0.0-alpha.3, a MINOR bump perVERSIONING.md("new roles").Verification
python3 tools/build.py→built 24 roles;index.yamlanddist/prompts/siren.mdregenerated in the same commit, so the CI stale-artifact gate is satisfied.scripts/validate-index.sh --check-crisis→OK — all checks passed, including the README metadata-agreement check added in fix: restore role versions lost in the v2 migration, and guard the drift class #6 (the> **Version:** 1.0 | **Category:** Utilityheader agrees with the frontmatter).scripts/test-roles.sh→OK — all role smoke tests passed (4 warning(s)).sirenis clean at 21,604 chars, well under the 60,000 budget. The 4 WARNs are the pre-existing crisis-number findings forfrank,psy,vita,agora— untouched by this PR and targeted by Phase 2 config templating.valid: true,diagramType: flowchart. The role tells the model to quote every label; the example had to actually demonstrate that, so it was worth confirming rather than assuming.No existing prompt bodies changed.
Noted, not fixed here
roles/utility/atlas/README.mdstill links toprompt.mdandprompt-semanticode.mdfrom its Quick Start and Files table; both were replaced byrole.mdin the v2 migration. Out of scope for this PR, but it's the template new roles get copied from, so it's worth a follow-up.🤖 Generated with Claude Code