TL;DR
- Rubii default styles: Seven default styles are on for every Moment, giving dialogue, code blocks, collapsible panels, tables and more a new look with no setup; authors can turn each one off.
- Style tags: Pair a marker you name (like <status>) with an HTML template. The model writes only the marker and the content, players see the full card, and the model no longer needs to write <plot>.
- Global CSS: Write your own styles for chat messages, for every message or only user or character messages. It overrides the default styles directly and doesn't affect other pages.
- Regex: Rules match text in a reply and replace what's displayed, such as turning “Affection: 72” into a progress bar or dropping a note line. Copying, editing and the model still use the original text.
- Tokens and Ruby: The model no longer rewrites the whole HTML every turn; with Memory Boost on, 100 rounds save about 44% of the Ruby!
- One-click migration: Swap the HTML in old Moments for style tags in one click, and compare the opening line before and after migration before you save.
- Better HTML in the APP: Styles & regex need Rubii APP 2.4.2 or later. The new APP supports more HTML elements and CSS, so chat cards and Moment intros look nearly the same as on Web.
Preface
Until now there was one way to make a reply look good: write the HTML and CSS yourself, put that code into the setting and the opening line, and have the model reproduce it in every single reply. Style code is not content, yet it took up most of the tokens in every output. The more the model spent reciting tags and styles, the less room was left for the story and for memory. Beauty and memory became a trade-off.
Styles & regex separates the two. The look is defined once, by the author, on the Moment; the model writes only short markers and content, and the player still sees the full effect. The source text, copying, editing and the context sent to the model no longer carry style code, so the tokens go to the story itself.
Styles & regex is in the Moment editor on Web and Rubii APP (2.4.2 or later). It only changes how replies look; copying, editing and the model still use the original text.
Try it below.
Styles & regex
Edit freely; nothing here is saved to your Moments.
From now on, the model will no longer be asked to write <plot>. Existing Moments keep working, and the format is the author's to define.

The tangle of old markup passes through a pair of braces and comes out as one tidy card.
Styles
From zero-setup default styles to fully custom style tags and global CSS.
Rubii default styles: better looking with zero setup
Open any Moment and the seven Rubii default styles are already at work: code blocks become side notes, quoted dialogue takes on color, collapsible panels get a consistent heading bar, and quotes, tables, dividers and inline code each receive a restrained style. They apply to every Moment, including older ones whose authors never opened Styles & regex.
Authors can untick any of them in the fourth tab, Default styles. To change how one looks, write the same selector in global CSS to override it.
What the model writes
The rain had stopped. She tucked the umbrella into her bag as the platform lights came on one by one.
She looked up: “You're earlier than I expected.”
```
Time: 19:42
Weather: after rain
Affection: 68
```
<details><summary>Status</summary>
Location: Station. Mood: Hopeful.
</details>
> Station announcement: the last train departs in ten minutes.
---
| Item | Qty |
| --- | --- |
| Ticket | 1 |
| Hot coffee | 2 |
She handed over the `ticket`.Flip each switch to compare with and without
Side noteOn
Code blocks appear as notes with a thin lavender line on the left instead of a white box. Status bars and system panels use this most.
Color dialogueOn
Dialogue inside “ ”, " ", 「 」 or 『 』 appears in gradient text.
Collapsible headingOn
Collapsible panel headings get a light lavender background and start collapsed.
Quote sidelineOn
Block quotes show a thin line on the left with lighter text.
Clear tableOn
Tables get a tinted header row and alternating row shading, and scroll sideways when too wide.
Scene dividerOn
Horizontal rules become a low-contrast line with room above and below.
Inline highlightOn
Inline code gets a light lavender background, handy for items, places or system hints.
What the player sees
Seven switches for the seven default styles. Turn one off and that element goes back to how it looked before.
What happens when I untick one?
That element goes back to how it looked before; the other six are unaffected. Your choice is saved with the Moment and works on both Web and APP.
Style tags: one word for the model, one card for the player
A style tag is a pair of markers you name yourself, such as <status> and </status>. You fill in the tag name and one HTML template, with a $1 marking where the content goes. The model writes only short markers and content; the player sees the finished card.
Tag names may use any language, are case-sensitive and cannot be a built-in HTML name (such as div or span). Tags nest: put a <status-title> inside <status> and the second tag decides how the title looks.
Tell the model in the Moment setting when to write these markers; Rubii doesn't add that for you. The best demonstration is an example with real values in the opening line. In the demo below, flip a switch off to see exactly what the model wrote.
What the model writes
The rain had stopped. She tucked the umbrella into her bag as the platform lights came on one by one.
<inner>If he hasn't come, I'll pretend I was only passing by.</inner>
"You're earlier than I expected."
<status><status-title>Mira</status-title>
Location: Station
Mood: Hopeful
Affection: 68
</status>
<choice>Follow her and ask where she is going</choice>
<choice>Pretend not to notice</choice>Flip each switch to compare with and without
Status cardOn
Two tags: <status> becomes a card and <status-title> the title inside it.
What this switch adds
Style tagstatus
<section class="status-card">
<div class="status-body">$1</div>
</section>Style tagstatus-title
<span class="status-title">$1</span>Global CSS
.status-card {
margin: 12px 0;
padding: 12px 14px;
border: 1px solid rgba(192, 160, 255, 0.35);
border-radius: 12px;
background: rgba(192, 160, 255, 0.08);
}
.status-body {
white-space: pre-wrap;
}
.status-title {
color: #c0a0ff;
font-weight: 700;
}Inner monologueOn
Text inside <inner> turns muted and italic, with a dotted line on the left.
What this switch adds
Style taginner
<div class="inner">$1</div>Global CSS
.inner {
margin: 8px 0;
padding-left: 12px;
border-left: 2px dotted rgba(192, 160, 255, 0.5);
color: rgba(255, 255, 255, 0.55);
font-style: italic;
}Choice pillsOn
Each <choice> becomes a pill, like a branch you could pick.
What this switch adds
Style tagchoice
<span class="choice">$1</span>Global CSS
.choice {
display: inline-block;
margin: 4px 6px 0 0;
padding: 4px 12px;
border: 1px solid rgba(0, 235, 255, 0.5);
border-radius: 999px;
color: #9fe9ff;
}What the player sees
Switch one off to see what the model wrote; switch it on and the same text becomes a card, a monologue and pills.
- In Style tags, add status and status-title and paste the two templates above; paste the styles into Global CSS.
- Rewrite the opening line as the example above and tap Preview to check it.
- In the Moment setting, tell the model to end each reply with a status bar wrapped in <status>, the name wrapped in <status-title>, and no HTML.
- Save, then read a real reply in chat. If the model strays, adjust the wording of the setting rather than the template.
Can I give <plot> a template too?
Yes. Older replies still contain <plot>; add a style tag named plot with a template of your own and that narration wears the frame.
Global CSS: chat content only
Global CSS applies only to messages in the chat, never to other pages or other Moments. A rule without a prefix applies to every message; start the selector with .rubii-message-user to style only user messages, or with .rubii-message-character for character messages only. Scripts, external resources and fixed positioning are removed.
It comes after the seven default styles. To recolor collapsible headings, write one summary rule; no !important, and no need to untick anything first. The status card in the previous chapter uses exactly this tab.
What the model writes
The rain had stopped. She tucked the umbrella into her bag as the platform lights came on one by one.
She looked up: “You're earlier than I expected.”
```
Time: 19:42
Weather: after rain
Affection: 68
```
<details><summary>Status</summary>
Location: Station. Mood: Hopeful.
</details>
> Station announcement: the last train departs in ten minutes.
---
| Item | Qty |
| --- | --- |
| Ticket | 1 |
| Hot coffee | 2 |
She handed over the `ticket`.Flip each switch to compare with and without
Recolor the collapsible headingOff
Recolors the collapsible heading and adds a border around the panel.
What this switch adds
Global CSS
summary {
background: rgba(0, 235, 255, 0.1);
color: #9fe9ff;
}
details {
padding: 4px 12px 8px;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 10px;
}Terminal-style noteOff
The code block's side line and text turn cyan on a darker background.
What this switch adds
Global CSS
pre {
border-left: 2px solid #00ebff;
background: rgba(0, 235, 255, 0.06);
color: #bff7ff;
}Cyan quotes and table headsOff
The quote sideline and the table header shading switch to cyan.
What this switch adds
Global CSS
blockquote {
border-left: 2px solid #00ebff;
color: #bff7ff;
}
th {
background: rgba(0, 235, 255, 0.08);
color: #ffffff;
}What the player sees
Three pieces of global CSS act on the same message, with no !important needed.
Is CSS the same on Web and APP?
Both use the same configuration and the same default styles. Colors, spacing, borders, radii and linear gradients look the same on both, while complex layout, animation and web fonts may look simpler on the APP. Check both before publishing.
Regex
Change how replies look without changing the replies.
Regex: change how text is displayed
Each rule has a name, Apply to, Matches in, an expression and a replacement. Apply to is all messages, user messages or character messages. Write the expression as /pattern/flags, with flags g, i, m, s or u. In the replacement, $1 stands for what the first bracket group matched and $& for the whole match; HTML and your own style tags work too.
Matches in decides what the pattern sees. Raw content (with HTML tags) is the reply exactly as written, Markdown, code and HTML included; these rules run first, in list order, before style tags expand, so they can replace markers and whole structures. Displayed text (no HTML tags) is only the words shown on screen, after style tags and Markdown; these rules never touch tags, attributes, CSS or code, which makes them the choice for styling dialogue or putting "…" in a bubble.
A raw-content pattern really sees the HTML: "(.+?)" also finds the quotes of class="…" and of a card's CSS, and replacing those breaks the card. A displayed-text match stays inside one run of text (in “Hi <b>there</b>” it can't take the whole phrase), and its replacement sits inside the paragraph, so use inline elements such as <span>.
Reordering changes the result. An empty replacement hides whatever it matches. If a rule is too slow or its replacement too long, that message shows as plain original text.
What the model writes
(She slides the cup across the table.) "Drink it while it's warm."
Affection: 72
[Note] Next turn, you could ask about her past.Flip each switch to compare with and without
Drop the note lineOn
Matches a whole hint line and replaces it with nothing, so it no longer shows.
What this switch adds
Regex 1Drop the note line
- Expression
/^\[Note\].*$/gm- Replacement
- (empty)
- Matches in
- Raw content (with HTML tags)
Actions in parenthesesOn
Wraps actions in (…) in the style tag action, shown in muted italics.
What this switch adds
Style tagaction
<span class="action">$1</span>Global CSS
.action {
color: rgba(255, 255, 255, 0.6);
font-style: italic;
}Regex 1Actions in parentheses
- Expression
/\([^()\n]{1,60}\)/g- Replacement
<action>$&</action>- Matches in
- Raw content (with HTML tags)
Affection barOn
Finds the affection number and shows a bar of matching length.
What this switch adds
Global CSS
.bar {
display: inline-block;
width: 120px;
height: 8px;
overflow: hidden;
border-radius: 4px;
background: rgba(255, 255, 255, 0.12);
vertical-align: middle;
}
.bar-fill {
display: block;
height: 100%;
border-radius: 4px;
background: linear-gradient(90deg, #c0a0ff, #00ebff);
}Regex 1Affection bar
- Expression
/Affection[::]\s*(\d{1,3})/g- Replacement
Affection: <span class="bar"><span class="bar-fill" style="width:$1%"></span></span> $1- Matches in
- Raw content (with HTML tags)
What the player sees
The three rules are independent. Turn them all off and you see exactly what the model wrote; the dialogue color always comes from the default styles.
Migration
Replace the HTML in older Moments with style tags.
What it saves: tokens and Ruby over 100 rounds
Before, the model had to rewrite a whole block of HTML every round for the card to show. With style tags, the model writes only the tags and the content, and the Moment's templates fill in the card. Here is the same reply written both ways; it looks the same.
Before: written every round444 tokens
Mira hands you a hot coffee, her fingertips still cool from the rainy night.
"The last train is twenty minutes late. Warm your hands first."
She sits at the other end of the bench, leans the wet umbrella against her knee and watches the lit sign down the platform.
<div style="background:linear-gradient(135deg,#2a2140 0%,#16161f 100%);border:1px solid #b89cff;border-radius:14px;padding:14px 16px;margin-top:10px;color:#ece8f6;font-size:14px;line-height:1.7;box-shadow:0 6px 18px rgba(120,90,200,0.25)">
<div style="color:#c9b2ff;font-weight:bold;font-size:15px;letter-spacing:1px;border-bottom:1px dashed rgba(201,178,255,0.4);padding-bottom:6px;margin-bottom:8px">🚉 Mira · Status</div>
<div style="display:flex;gap:8px;margin:4px 0"><span style="color:#b89cff;font-weight:bold;min-width:72px">📍 Location</span><span style="color:#ffffff">Platform 2</span></div>
<div style="display:flex;gap:8px;margin:4px 0"><span style="color:#b89cff;font-weight:bold;min-width:72px">🕰 Time</span><span style="color:#ffffff">21:40</span></div>
<div style="display:flex;gap:8px;margin:4px 0"><span style="color:#b89cff;font-weight:bold;min-width:72px">💭 Mood</span><span style="color:#ffffff">Hopeful, a little nervous</span></div>
<div style="display:flex;gap:8px;margin:4px 0"><span style="color:#b89cff;font-weight:bold;min-width:72px">💗 Affection</span><span style="color:#ffffff">68 / 100</span></div>
</div>Shown in chat
Now: all the model writes117 tokens
Mira hands you a hot coffee, her fingertips still cool from the rainy night.
"The last train is twenty minutes late. Warm your hands first."
She sits at the other end of the bench, leans the wet umbrella against her knee and watches the lit sign down the platform.
<Status>
<StatusTitle>🚉 Mira · Status</StatusTitle>
<Location>Platform 2</Location>
<Clock>21:40</Clock>
<Mood>Hopeful, a little nervous</Mood>
<Affection>68 / 100</Affection>
</Status>Shown in chat
The same reply, two ways: 444 tokens before, 117 tokens now, and it displays exactly the same.
327 fewer tokens per reply may not sound like much, but a reply stays in the context and is read again in every later round. Over 100 rounds, the difference looks like this:
| Before | Now | Saved | |
|---|---|---|---|
| Tokens the model writes | 44,400 | 11,700 | 32,700 |
| Tokens the model reads (default memory) | 2,006,213 | 1,787,123 | 219,090 |
| Tokens the model reads (Memory Boost) | 3,977,459 | 2,036,900 | 1,940,559 |
| Ruby saved (Memory Boost on) | 1,473.6 | 822.4 | 651.2 (−44%) |
With Memory Boost on, the same 100 rounds cost 822.4 Ruby instead of 1,473.6, saving 651.2 Ruby (about 44%).
Migrate an older Moment, in one click or by hand
Older Moments often carry large blocks of HTML in the setting and opening line, which the model rewrites every round. Replacing that HTML with style tags saves those tokens.
The easiest way is one-click migration: open the one-click migration page to see which of your characters can be migrated. The character setting and your public Moments with that character are converted together, and you can compare the openings before saving. To do it yourself, follow the steps below.
Open the one-click migration page
- In Styles & regex, add the style tags and global CSS you need.
- Replace instructions like “output the full HTML every turn” with short ones such as “wrap the status bar in <status>”, and turn the opening line into an example with real values.
- Before changing the character setting, remember that other Moments with this character change too.
- Preview the revised opening line, save the Moment, and read a real reply in chat. Check both Web and APP before publishing.
What happens to existing messages?
Style tags are stored on the Moment: change a style and past messages update right away. If you delete or rename a tag, old messages show that part as plain text again; nothing is lost. To rename, keep the old tag and add a new one.

The tidied styles travel as a few cards; the tangled old cables stay on the platform.
Before you publish
- Web and APP 2.4.2 or later only
- Style tags, global CSS, regex and the Rubii default styles show only on Web and in Rubii APP 2.4.2 or later. Players on an older APP version won't see these effects until they update. The App Store release may be delayed by review.
- The APP and Web look nearly the same
- We've improved how the APP renders HTML. In Rubii APP 2.4.2 or later, chat cards and Moment intros look the same as on Web in the vast majority of cases.
- Styles & regex render only on the client
- We've put a lot of work into protecting the character setting and the Moment setting (see “One prompt shouldn't be enough to steal a character”), but Styles & regex have to be sent to the client to be rendered. We don't show them directly in the interface, but like any web page's styles, they are still on the client, and players with networking know-how can capture them.
- Styles are creative work too
- Every style takes its author real effort. If you like one, you're welcome to learn the thinking behind it and build a design of your own; please don't copy someone else's styles and regex outright.
- It's new: tell us what goes wrong
- Styles & regex have only just launched, so you may run into problems, including but not limited to lag in chat, styles going missing or showing as the original text, Web and APP looking different, regex not applying or replacing the wrong text, and a migrated Moment looking different from before. If something goes wrong, tell us through Feedback; a link to the Moment and screenshots help us fix it faster.

