
In the world of custom AI roleplay, the quality of your interaction depends entirely on how effectively your character card is structured. If you feed an AI model a rambling, unstructured block of text, it will often struggle to parse traits, leading to broken immersion, forgotten details, and inconsistent dialogue.
To build sharp, highly responsive personas, experienced creators rely on structured pseudo-code frameworks. The most famous and enduring among these is the W++ format.
In this W++ format character card tutorial, you will learn how the syntax works, why modern Large Language Models (LLMs) interpret it so effectively, and how to write clean, token-efficient character cards for frontends like SillyTavern and Agnai.
What is W++ Format?
Developed during the early era of open-source AI roleplay, W++ (sometimes called Wplusplus) is a pseudo-code formatting style that organizes character traits using brackets, attribute keys, and string concatenation symbols.
Instead of writing a novelistic paragraph like “Elena is a 24-year-old sarcastic mage who wears a leather coat,” W++ translates those attributes into modular pseudo-code arrays:
[character("Elena")
{
Age("24")
Gender("Female")
Role("Mage")
Personality("Sarcastic" + "Witty" + "Pragmatic" + "Loyal")
Clothes("Leather coat" + "Dark jeans" + "Enchanted pendant")
}]
Why AI Models Excel with W++ Syntax
- Code Pre-training Synergy: Modern LLMs (such as Llama 3, Qwen, and Mistral splits) are trained heavily on millions of code repositories (C++, Java, Python, JSON). Because W++ mimics code syntax, the model’s neural network categorizes these traits with extreme precision.
- Zero Ambiguity: Trait categories are explicitly separated. The AI never gets confused about whether a descriptor applies to the character’s clothing, mindset, or physical body.
Core Syntax Rules of W++
Mastering W++ requires following a few fundamental structural rules to keep your card error-free:
- Outer Container Enclosure: Always enclose the entire character definition inside square brackets
[...]and curly braces{...}to signal a unified data object to the model. - Category Method Declarations: Use explicit trait declarations like
Personality(),Appearance(),Mind(),Likes(), andDislikes(). - Plus Sign Concatenation (
+): Connect multi-word descriptors or distinct traits inside a category using+operators. This tells the LLM that these attributes coexist simultaneously. - Quotation Wrappers (
""): Wrap individual traits in double quotes to prevent the parser from merging separate words into a single confusing string.

Complete Template: Writing Your First W++ Character Card
Here is a ready-to-use template you can copy, edit, and paste directly into SillyTavern’s Character Description box:
[character("Elena")
{
Species("Human")
Age("24")
Mind("Sharp" + "Sarcastic" + "Observant")
Personality("Playful" + "Stubborn" + "Teasing" + "Deeply loyal")
Body("Petite" + "Hazel eyes" + "Dark brown wavy hair")
Clothes("Over-sized knitted sweater" + "Silver ring" + "Casual jeans")
Likes("Hot tea" + "Rainy afternoons" + "Teasing {{user}}")
Dislikes("Arrogant people" + "Crowded spaces" + "Early mornings")
Speech("Uses witty banter" + "Casually playful tone" + "Expressive")
}]
3 Essential Optimization Tips
To make sure your card runs smoothly without wasting your context token budget:
- Keep Traits Concise: Avoid writing full sentences inside a W++ bracket (e.g., write
Personality("Jealous")instead ofPersonality("She gets very jealous when you talk to others")). Concise keywords leave more space in the context window for chat history. - Combine with Example Dialogue (Ali:Chat): While W++ defines static attributes, adding 2–3 short lines of Example Dialogue (
<START>blocks) beneath your W++ code gives the model a concrete example of speech cadence and dialogue formatting. - Use System Macros: Utilize SillyTavern’s dynamic macros like
{{char}}and{{user}}inside your W++ attributes so the card adapts seamlessly regardless of username changes.
The Verdict
Following this W++ format character card tutorial provides the structural foundation needed to craft dynamic, highly coherent virtual companions. By converting loose descriptions into clear, code-like attribute arrays, you eliminate AI confusion, enforce stable personality traits, and create an exceptionally engaging roleplay environment.