add grammars/sovereign_prompt.gbnf
Browse files
grammars/sovereign_prompt.gbnf
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GBNF grammar for sovereign XML system prompts
|
| 2 |
+
# Use with llama.cpp: --grammar-file sovereign_prompt.gbnf
|
| 3 |
+
# Forces 100% valid XML on first attempt — zero correction iterations
|
| 4 |
+
|
| 5 |
+
root ::= system-prompt
|
| 6 |
+
|
| 7 |
+
system-prompt ::= "<system_prompt>" ws identity ws logic-gates ws execution-flow ws "</system_prompt>"
|
| 8 |
+
|
| 9 |
+
identity ::= "<identity>" ws text ws "</identity>"
|
| 10 |
+
|
| 11 |
+
logic-gates ::= "<logic_gates>" ws gate* ws "</logic_gates>"
|
| 12 |
+
|
| 13 |
+
gate ::= "<gate>" ws
|
| 14 |
+
"<name>" text "</name>" ws
|
| 15 |
+
"<condition>" text "</condition>" ws
|
| 16 |
+
"<action>" text "</action>" ws
|
| 17 |
+
"</gate>" ws
|
| 18 |
+
|
| 19 |
+
execution-flow ::= "<execution_flow>" ws step* ws "</execution_flow>"
|
| 20 |
+
|
| 21 |
+
step ::= "<step>" ws
|
| 22 |
+
"<order>" [0-9]+ "</order>" ws
|
| 23 |
+
"<instruction>" text "</instruction>" ws
|
| 24 |
+
"</step>" ws
|
| 25 |
+
|
| 26 |
+
text ::= [^<>]+
|
| 27 |
+
ws ::= [ \t\n\r]*
|