| name | prompt-orchestration-markup |
| title | Prompt Orchestration Markup Language (POML) |
| version | 0.0.2 |
| engine | skillxiv-v0.0.2-claude-opus-4.6 |
| license | MIT |
| url | https://arxiv.org/abs/2508.13948 |
| keywords | ["prompt-engineering","markup-language","structured-prompts","templating","developer-tools"] |
| description | Use component-based markup with CSS-like styling to structure complex prompts, integrate diverse data types, and separate content from formatting for maintainable, version-control-friendly LLM applications. |
Prompt Orchestration Markup Language (POML)
Core Concept
Modern LLM applications require increasingly complex prompts with roles, instructions, examples, and diverse data (documents, tables, images). Traditional string concatenation is fragile, format-sensitive, and hard to version control.
POML provides structured markup for composing prompts declaratively, with CSS-like styling to separate content from formatting. This makes prompts maintainable, reusable, and compatible with standard developer tools.
Architecture Overview
- Component-Based Structure: Define roles, tasks, examples as reusable components
- CSS-Like Styling: Separate content formatting from structure
- Data Integration: First-class support for documents, tables, images
- Templating System: Dynamic prompts with variables and conditionals
- Developer Tooling: IDE support, version control, SDKs
- Format Normalization: Reduces sensitivity to whitespace and formatting
Implementation Steps
1. Define POML Schema and Parser
import xml.etree.ElementTree as ET
from typing import Dict, List, Any
class POMLComponent:
"""Base component in POML"""
def __init__(self, component_type: str, attributes: Dict[str, str] = None):
self.type = component_type
self.attributes = attributes or {}
self.children = []
def add_child(self, child):
self.children.append(child)
def to_text(self, styling_rules: Dict[str, Dict] = None) -> str:
"""Convert component to text using styling rules"""
raise NotImplementedError
class POMLParser:
"""Parse POML markup"""
def __init__(self):
self.styling_rules = {}
def parse(self, poml_string: str) -> POMLComponent:
"""Parse POML XML string"""
root = ET.fromstring(poml_string)
._parse_element(root)
() -> POMLComponent:
component = POMLComponent(
element.tag,
(element.attrib)
)
child_elem element:
component.add_child(._parse_element(child_elem))
element.text element.text.strip():
component.text = element.text.strip()
component
2. Create POML Component Types
class RoleComponent(POMLComponent):
"""POML <role> component"""
def __init__(self, role_name: str, description: str = ""):
super().__init__("role", {"name": role_name})
self.description = description
def to_text(self, styling: Dict = None) -> str:
style = (styling or {}).get('role', {})
prefix = style.get('prefix', 'Role: ')
return f"{prefix}{self.attributes['name']}\n{self.description}\n"
class InstructionComponent(POMLComponent):
"""POML <instructions> component"""
def __init__(self, instructions: List[str]):
super().__init__("instructions")
self.instructions = instructions
def to_text(self, styling: Dict = None) -> str:
style = (styling or {}).get('instructions', {})
format_type = style.get(, )
format_type == :
.join( i, inst (.instructions))
format_type == :
.join( inst .instructions)
:
.join(.instructions)
():
():
().__init__()
. = input_text
.output = output_text
() -> :
style = (styling {}).get(, {})
input_label = style.get(, )
output_label = style.get(, )
():
():
().__init__(, {: data_type})
.content = content
() -> :
data_type = .attributes[]
data_type == :
._format_table(.content)
data_type == :
.content
data_type == :
:
.content
() -> :
rows = [row.split() row content.strip().split()]
col_widths = [((row[i]) row rows) i ((rows[]))]
formatted = []
i, row (rows):
padded = [cell.ljust(col_widths[j]) j, cell (row)]
formatted.append(.join(padded))
i == :
formatted.append( * (formatted[]))
.join(formatted)
3. Define CSS-Like Styling System
class POMLStylesheet:
"""CSS-like styling for POML components"""
def __init__(self):
self.rules = {}
def add_rule(self, component_type: str, properties: Dict[str, str]):
"""Add styling rule for component type"""
self.rules[component_type] = properties
def parse_from_string(self, css_like_string: str):
"""Parse CSS-like string"""
import re
pattern = r'(\w+)\s*\{([^}]+)\}'
for match in re.finditer(pattern, css_like_string):
component = match.group(1)
properties_str = match.group(2)
properties = {}
for prop in properties_str.split(';'):
if ':' in prop:
key, value = prop.split(':')
properties[key.strip()] = value.strip()
self.rules[component] = properties
def get_styling(self) -> Dict:
"""Get styling dict for components"""
.rules
style_str =
stylesheet = POMLStylesheet()
stylesheet.parse_from_string(style_str)
4. Build Templating System
from string import Template
class POMLTemplate:
"""Templating system for dynamic POML"""
def __init__(self, poml_string: str):
self.template = Template(poml_string)
def render(self, **variables) -> str:
"""Render template with variables"""
return self.template.substitute(variables)
def safe_render(self, **variables) -> str:
"""Render with defaults for missing variables"""
return self.template.safe_substitute(variables)
template_str = """
<prompt>
<role name="$role_name">$role_description</role>
<task>$task_description</task>
<examples>
#for example in $examples
<example input="$example.input" output="$example.output"/>
#end
</examples>
</prompt>
"""
template = POMLTemplate(template_str)
5. Create POML Builder API
class POMLBuilder:
"""Fluent API for building POML"""
def __init__(self):
self.components = []
self.stylesheet = POMLStylesheet()
def add_role(self, name: str, description: str = ""):
"""Add role component"""
self.components.append(RoleComponent(name, description))
return self
def add_instructions(self, instructions: List[str], format_type: str = "numbered"):
"""Add instructions component"""
comp = InstructionComponent(instructions)
self.stylesheet.add_rule("instructions", {"format": format_type})
self.components.append(comp)
return self
def add_example(self, input_text: str, output_text: str):
"""Add example component"""
self.components.append(ExampleComponent(input_text, output_text))
return self
def add_data(self, data_type: str, content: str):
.components.append(DataComponent(data_type, content))
() -> :
styling = .stylesheet.get_styling()
result =
comp .components:
result += comp.to_text(styling) +
result
builder = POMLBuilder()
prompt = (builder
.add_role(, )
.add_instructions([
,
,
], format_type=)
.add_example(
input_text=,
output_text=
)
.build())
6. Developer Tools Integration
class POMLProject:
"""Manage POML files and components"""
def __init__(self, project_dir: str):
self.project_dir = project_dir
self.prompts = {}
def load_prompt(self, name: str) -> str:
"""Load POML prompt from file"""
import os
filepath = os.path.join(self.project_dir, f"{name}.poml")
with open(filepath, 'r') as f:
poml_content = f.read()
return poml_content
def save_prompt(self, name: str, poml_content: str):
"""Save POML prompt to file"""
import os
filepath = os.path.join(self.project_dir, f"{name}.poml")
os.makedirs(self.project_dir, exist_ok=True)
with open(filepath, 'w') as f:
f.write(poml_content)
def render_prompt(self, name: str, **variables) -> str:
"""Load, render, and return prompt"""
poml_content = .load_prompt(name)
parser = POMLParser()
component = parser.parse(poml_content)
template = POMLTemplate(poml_content)
rendered = template.safe_render(**variables)
rendered
project = POMLProject()
project.save_prompt(, )
Practical Guidance
- Component Granularity: Break prompts into role, task, examples, data
- Styling Consistency: Use stylesheets to enforce formatting across prompts
- Version Control: POML files are text-based, git-friendly
- Reusability: Build component libraries for common patterns
- Testing: Test prompt variations using templating
Reference
POML (2508.13948): https://arxiv.org/abs/2508.13948
Structure complex prompts using component-based markup with CSS-like styling, improving maintainability, version control, and reducing format sensitivity across LLM applications.