Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
"Templates that understand what you mean, not just what you wrote."
What Is It?
Empathic Templates are MOOLLM's approach to template instantiation: templates that leverage LLM comprehension to understand semantic intent, not just perform mechanical string substitution.
Traditional templates: {{name}} → replace with literal value
Empathic templates: {{name}} → understand what name means in context, generate appropriate content
The Difference
Traditional Templates (Handlebars, Jinja, etc.)
Hello {{name}}!
Your order {{order_id}} has shipped.
Items: {{items}}
Total: ${{total}}
Problem: If items is a list, you need explicit loop syntax. If total should be formatted, you need filters. The template is dumb.
Empathic Templates
# The template understands contextgreeting:"{{appropriate_greeting}}"order_summary:"{{summarize_order_naturally}}"items:"{{list_items_with_quantities}}"total:"{{format_currency(total)}}"
The LLM doesn't just substitute — it interprets:
{{appropriate_greeting}} becomes "Good morning, Sarah!" or "Hey there!" based on context
{{summarize_order_naturally}} becomes prose, not data dump
The LLM doesn't just fill slots — it creates coherent content:
# Grumbald the Insufferable
A stooped figure wrapped in robes that were probably purple
once, before centuries of potion stains and cat hair took
their toll. His beard reaches his knees and contains at
least three quills, a small bird's nest, and what might be
a sandwich from the Third Age.
## Personality
Grumbald has perfected the art of making everyone feel
slightly stupid. He answers questions with questions,
sighs dramatically at simple requests, and has been
known to turn people into newts for using incorrect
grammar. Deep down, he cares — but he'd rather be
turned into a newt himself than admit it.
## Catchphrase> "I've forgotten more magic than you'll ever know.> Literally. Where did I put my staff?"
Template Syntax
Basic Slots
{{variable}} # Simple substitution (still works)
{{expression}} # Empathic expression (interpreted)
{{#if condition}} # Conditional (condition is interpreted)
{{#each items}} # Iteration (smart about structure)
{{>partial}} # Include another template
Empathic Slots (The Magic)
{{describe_X}} # Generate description based on context
{{summarize_Y}} # Create summary of data
{{generate_Z}} # Create new content fitting context
{{appropriate_W}} # Choose fitting value from possibilities
{{format_V}} # Intelligent formatting
Expressions with Empathic Interpretation
{{#if character.is_hungry}}
{{describe_hunger_behavior}}
{{/if}}
{{#if player.reputation > 50}}# The guard recognizes you
{{guard_friendly_greeting}}
{{else}}
# The guard is suspicious
{{guard_suspicious_challenge}}
{{/if}}
# Generate SQL for the reportquery:|
{{empathic_sql: "get all users who ordered in the last month"}}
# Generate the emailemail:|
Dear {{user.name}},
{{summarize_monthly_orders_naturally}}
Total spent: {{format_currency(monthly_total)}}
# CHARACTER.yml.tmpl — Character sheet template# # Required context:# - character_name: string# - species: string # - setting: string (e.g., "medieval fantasy")## Optional context:# - personality_hints: list of traits# - backstory_seeds: key events to include# - tone: "serious" | "humorous" | "dark" (default: "neutral")id: {{generate_unique_id}}
name:"{{character_name}}"# ... rest of template
LLM can sniff first 50 lines to understand what the template needs before reading the full file.
Comment Intelligence
The LLM distinguishes between meta-comments (instructions for generation) and concrete comments (meant for output):
Meta-Comments (Stripped)
# TEMPLATE: This section describes the character's appearance# INSTRUCTION: Use vivid sensory details# NOTE: Keep under 100 words# TODO: Add more variety to hair colorsdescription:|
{{describe_appearance}}
These are instructions TO the LLM. They guide generation but don't appear in output.
Concrete Comments (Preserved)
# This character was created using the incarnation protocol.# See skills/incarnation/SKILL.md for details.description:|
{{describe_appearance}}
# Sims traits determine interaction success ratessims_traits:
{{generate_traits}}
These are comments FOR the output file. They explain the generated content to future readers.
How the LLM Knows
Indicator
Type
Action
# TEMPLATE:, # INSTRUCTION:, # NOTE:
Meta
Strip
# TODO:, # FIXME: in template context
Meta
Strip
# This explains..., # See also...
Concrete
Preserve
Comments inside {{...}} blocks
Meta
Strip
Comments explaining generated values
Concrete
Preserve
ALL CAPS directive style
Meta
Strip
Lowercase explanatory style
Concrete
Preserve
Example: Mixed Comments
Template:
# TEMPLATE: Character soul file# INSTRUCTION: Generate YAML Jazz style comments# This character was incarnated via the full autonomy protocol.id: {{generate_id}}
name:"{{character_name}}"# INSTRUCTION: Describe based on species and personalitydescription:|
{{describe_appearance}}
# Personality traits affect all interactions# Higher values = stronger tendencysims_traits:nice: {{nice_value}} # 0-10, affects social success# INSTRUCTION: Infer from descriptionplayful: {{infer_playful}}
Generated Output:
# This character was incarnated via the full autonomy protocol.id:palm-001name:"Palm"description:|
A small capuchin monkey with knowing eyes and surprisingly
dexterous fingers. Palm moves with the confidence of someone
who has already seen how this story ends.
# Personality traits affect all interactions# Higher values = stronger tendencysims_traits:nice:7# 0-10, affects social successplayful:9
What happened:
# TEMPLATE: and # INSTRUCTION: lines → stripped
# This character was incarnated... → preserved
# Personality traits affect... → preserved
# 0-10, affects social success → preserved
# INSTRUCTION: Infer from description → stripped
The Principle
Meta-comments teach the generator. Concrete comments teach the reader.
The LLM understands this distinction because it understands intent. Directive language instructs; explanatory language documents.
Relationship to Self-Style Inheritance
Templates are prototypes. Instantiation creates instances:
buff_name:"Sugar Rush"buff_type:positivetrigger_condition:"eating candy or sweet treats"setting:"whimsical candy land"
Generated:
buff:id:sugar-rushname:"Sugar Rush"type:positivedescription:|
Your eyes widen, your heart races, and suddenly
EVERYTHING IS AMAZING. Colors are brighter, sounds
are sweeter, and you're pretty sure you could
outrun a unicorn.
mechanics:duration:10minuteseffect:"+20% speed, +10% charisma, -10% focus"trigger:"consuming_sweet_treat"flavor_text:|
*The sugar hits your bloodstream like a
candy-coated lightning bolt. WHEEEEE!*
Templates as Schemas (CRITICAL!)
Templates are not just for instantiation — they ARE THE SCHEMA. The same .tmpl file serves as:
Human documentation — What fields exist, what they mean
Machine schema — Required vs optional, types, constraints
# ADVENTURE.yml.tmpl — Adventure State Schema# # REQUIRED fields (must be provided):# - adventure.name: string# - player.character: path# - navigation.starting_room: path## OPTIONAL fields (can be omitted, inherited, or use defaults):# - parameters.*: all have sensible defaults# - party.members: defaults to [player.character]# - evidence.*: starts empty## COMPUTED fields (LLM generates):# - adventure.started: timestamp# - selection.targets: starts []
Smart Instantiation: The Drop Pattern
Traditional: Fill every slot, even if the value is default.
Empathic: DROP optional sections entirely if:
The value equals the prototype default
The context doesn't need it
An abstract description is sufficient
# Template has:parameters:time:advancement:normal# Defaultgit:auto_commit:false# Defaultauto_push:false# Defaultdebug:enabled:false# Default# ...50 more lines of debug config...# Smart instantiation DROPS the whole section:# (No parameters block = use all defaults)# Unless something differs:parameters:debug:enabled:true# Only what changed!
Schema Markers in Templates
Use special comments to mark field requirements:
# REQUIRED: Must be provided during instantiationadventure:name:"{{adventure_name}}"# REQUIREDobjective:"{{quest_objective}}"# REQUIREDstatus:active# OPTIONAL: has default# OPTIONAL: Can be omitted entirelyevidence:# OPTIONAL: sectionclues: [] # OPTIONAL: default []items: [] # OPTIONAL: default []# COMPUTED: Generated by LLM or systemstatistics:# COMPUTED: sectionrooms_explored:0# COMPUTED: auto-incrementturns_elapsed:0# COMPUTED: auto-increment# INHERITED: Comes from prototypeparameters:# INHERITED: from simulation skill# Only override what differs from skills/simulation/defaults.yml
Field Requirement Markers
Marker
Meaning
Instantiation Behavior
# REQUIRED
Must be filled
Error if missing
# OPTIONAL
Can be omitted
Drop if default or empty
# OPTIONAL: default X
Has default value
Drop if equals X
# COMPUTED
System generates
Never fill from context
# INHERITED
From prototype
Drop if unchanged
# ABSTRACT
Natural language OK
Keep as prose placeholder
Abstract Fields: Natural Language as Value
Sometimes the "value" is just a description of intent:
# Template:room:atmosphere:"{{atmosphere}}"# ABSTRACT: describe the feeling# Instantiation with abstract value (valid!):room:atmosphere:|
A sense of ancient mystery. Dust motes float in shafts of light
from high windows. Something important happened here, long ago.
# The LLM can work with this! It doesn't need structured data.
Prototype Inheritance
Templates inherit from prototypes. Only override what differs:
# skills/room/ROOM.yml.tmpl is the PROTOTYPE# examples/adventure-4/maze/ROOM.yml is an INSTANCE# The instance OMITS fields that match the prototype:room:name:"Maze Entrance"# DIFFERENT: specific name# purpose: omitted # INHERITED: from prototype# working_set: omitted # INHERITED: from prototypeexits:north:corridor-1/# DIFFERENT: specific exitseast:dead-end/atmosphere:"Confusion and possibility"# DIFFERENT: specific vibe
Code Generation from Templates
Templates inform Python and JavaScript class generation:
// engine.js — GENERATED FROM templatesclassAdventure {
// REQUIRED
name; // string, must be set
objective; // string, must be set// OPTIONAL with defaults
status = "active";
parameters = null; // null = use global defaults// COMPUTED (read-only, managed by engine)getstarted() { returnthis._started; }
getturns_elapsed() { returnthis._turns; }
constructor(data) {
// Validate REQUIREDif (!data.name) thrownewError("Adventure requires name");
if (!data.objective) thrownewError("Adventure requires objective");
// Apply provided valuesObject.assign(this, data);
// Preserve unknown fieldsthis._extra = {};
for (const [k, v] ofObject.entries(data)) {
if (!this.constructor.KNOWN_FIELDS.includes(k)) {
this._extra[k] = v;
}
}
}
}
LLM Compilation Events
When the template contains expressions, emit events for the LLM to compile:
# Template with expressions:guard:allows_entry:"{{empathic_expression: player has the key OR player is known to guard}}"greeting:"{{generate: appropriate greeting based on player reputation}}"actions:-trigger:"{{when: player attempts to pass without permission}}"action:"{{do: block and challenge}}"score:"{{calculate: based on guard alertness and player stealth}}"
The adventure.py linter emits events:
# Events for LLM compilation:-event:COMPILE_EXPRESSIONfield:"guard.allows_entry"source:"player has the key OR player is known to guard"target_language:javascriptexpected_type:booleanoutput_field:"guard.allows_entry_js"# Where to write the compiled expression# Naming convention: {field}_js for JavaScript, {field}_py for Python# The corresponding runtime classes know to eval these fields-event:COMPILE_GENERATIONfield:"guard.greeting"instruction:"appropriate greeting based on player reputation"target_format:stringcontext_needed: [player.reputation, guard.personality]
-event:COMPILE_SCOREfield:"guard.actions[0].score"instruction:"based on guard alertness and player stealth"target_format:"number 0-100"inputs: [guard.alertness, player.stealth]
The LLM responds with compiled expressions, written to the _js or _py suffixed fields:
# After LLM compilation, the YAML now contains:guard:allows_entry:"player has the key OR player is known to guard"allows_entry_js:|
(ctx) => ctx.player.inventory.includes('key') ||
ctx.guard.knownPlayers.includes(ctx.player.id)
allows_entry_py:|
lambda ctx: 'key' in ctx.player.inventory or
ctx.player.id in ctx.guard.known_players
greeting:"appropriate greeting based on player reputation"greeting_js:|
(ctx) => {
if (ctx.player.reputation > 80) return "Welcome back, friend!";
if (ctx.player.reputation > 50) return "You may pass.";
return "Halt! State your business.";
}
Output Field Naming Convention
Field
Output Field (JS)
Output Field (Py)
allows_entry
allows_entry_js
allows_entry_py
score
score_js
score_py
guard.condition
guard.condition_js
guard.condition_py
The runtime classes know to look for these suffixed fields: