<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Arctic Glacier Wolf on Medium]]></title>
        <description><![CDATA[Stories by Arctic Glacier Wolf on Medium]]></description>
        <link>https://medium.com/@arctic.glacier.wolf?source=rss-d2c10df326fd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*HPgowpOd0qxGlGyE</url>
            <title>Stories by Arctic Glacier Wolf on Medium</title>
            <link>https://medium.com/@arctic.glacier.wolf?source=rss-d2c10df326fd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 13:57:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arctic.glacier.wolf/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Janitor AI.]]></title>
            <link>https://medium.com/@arctic.glacier.wolf/janitor-ai-2e58f1eadd5b?source=rss-d2c10df326fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e58f1eadd5b</guid>
            <category><![CDATA[character-ai-alternative]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[janitor-ai]]></category>
            <category><![CDATA[roleplaying]]></category>
            <dc:creator><![CDATA[Arctic Glacier Wolf]]></dc:creator>
            <pubDate>Sun, 09 Aug 2026 17:03:21 GMT</pubDate>
            <atom:updated>2026-08-09T17:05:34.035Z</atom:updated>
            <content:encoded><![CDATA[<h3>Janitor AI. Anatomy of your Bot: Understanding how Character Definition, Chat History and Memory actually convert to Prompt. Part 1</h3><p><em>Hi everyone! I spent a lot of time writing this article. I hope you enjoy it.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*irsye9db2L2gEDqkcUGY_A.avif" /></figure><h3>Introduction: What does the neural network see when you press “Send”?</h3><p>Many character making guides rely on abstract theories and description “shamanism.” We will take a different path — an engineering one. Instead of guessing how the LLM interprets your settings, we will pop the “hood” of Janitor AI, intercept real server requests, and see digital reality through the eyes of the model itself.</p><p>In this article, we will dissect the anatomy of a request at the molecular level and answer questions that plague creators and users:</p><ul><li>How interface turns into code: How beautiful Personality and Scenario fields transform into System Prompt XML tags, and why a long character name can break generation.</li><li>The “Ventriloquist” Bug: Why the bot sometimes argues with your action descriptions or attributes them to itself. We will find the culprit in the forced User: prefix.</li><li>The Mathematics of Oblivion: Where does chat history actually disappear to? We will break down the “Sliding Window” mechanics and show how the Max Tokens parameter can cannibalize your bot&#39;s memory.</li><li>The Eternal Scenario Trap: Why, hundreds of messages later, does the bot still think you’re sitting in a café even though the plot moved on long ago? We’ll analyze the conflict between the indelible System Prompt and temporary memory.</li><li>Anatomy of a Disaster: What happens to a bot’s personality when you try to “cram the uncrammable” into the context window, and how Janitor AI performs a lobotomy on your prompt.</li></ul><p>Ready to see how your words turn into tokens? Let’s look at the raw JSON.</p><h3>Assembly Mechanics: How JanitorAI turns the interface into JSON</h3><p>Let’s pop the “hood” of Janitor AI, look at raw JSON requests, and understand exactly how your settings turn into a prompt for the LLM.</p><p>First, we must have a proxy configured and enabled.<br>When using a Proxy, the Janitor AI frontend takes on the role of prompt “assembler” and sends the finished text to the API.<br>When using JLLM, prompt assembly happens on the Janitor backend. We don’t see the final text going to the neural network. The prompt structure is likely identical in both cases.</p><p>Next, let’s create a user persona (My Personas -&gt; Create Persona):</p><p>Name:</p><p>John</p><p>Description:</p><p>30 y. o., a man</p><p>Our goal is to create a minimal bot and understand how it works from the inside.</p><p>The bot creation page has fields: Image, Character Name, Character Chat Name, Personality, Scenario, Initial messages, Example dialogs.<br>Of these, Image, Character Name, Personality, and Initial messages are mandatory.</p><ol><li>I filled them out as follows:</li></ol><p>Character Name:</p><p>Emily Tester</p><p>Personality:</p><p>Emily is a shy girl, 20 y. o.</p><p>Initial messages:</p><p>Hi! I am Emily</p><p>2. Create and enter the chat with her.</p><p>3. Open the Inspector in Google Chrome.</p><p>4. Go to the Network tab.</p><p>5. Write to the bot:</p><p>Hi!</p><p>6. We see that a POST request is sent, defined in the Proxy URL field in the proxy settings window. In my case, it is <a href="https://api.meganova.ai/v1/chat/completions">https://api.meganova.ai/v1/chat/completions</a>.</p><p>7. Click on the request in the inspector and go to the Payload tab.</p><p>8. There we see the following JSON:</p><pre>{<br>&quot;max_tokens&quot;: 500,<br>&quot;messages&quot;: [<br>    {<br>        &quot;content&quot;: &quot;\n&lt;Emily Tester&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily Tester&#39;s Persona&gt;\n&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;\n&quot;,<br>        &quot;role&quot;: &quot;system&quot;<br>    },<br>    {<br>        &quot;content&quot;: &quot;.&quot;,<br>        &quot;role&quot;: &quot;user&quot;<br>    },<br>    {<br>        &quot;content&quot;: &quot;Hi! I am Emily&quot;,<br>        &quot;role&quot;: &quot;assistant&quot;<br>    },<br>    {<br>        &quot;content&quot;: &quot;John: Hi!&quot;,<br>        &quot;role&quot;: &quot;user&quot;<br>    }<br>],<br>&quot;model&quot;: &quot;Sao10K/L3-8B-Stheno-v3.2&quot;,<br>&quot;stream&quot;: true,<br>&quot;temperature&quot;: 0.9<br>}</pre><p>Based on this, we understand that the OpenAI API format is used. The first element in the messages array is the system prompt (role: system). Its content field contains:</p><pre>&lt;Emily Tester&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily Tester&#39;s Persona&gt;<br>...</pre><p>The structure consists of XML tags.</p><p>Our Personality is wrapped in tags as follows:</p><pre>&lt;Emily Tester&#39;s Persona&gt;...&lt;/Emily Tester&#39;s Persona&gt;</pre><p><strong>Technical Nuance</strong>: XML tag names are generated dynamically from the Character Name field. If you use long, pretentious titles (e.g., <em>&quot;Your stepmother wants you&quot;</em>), you pollute the system prompt.</p><pre>&lt;Your stepmother wants you&#39;s Persona&gt;...&lt;/Your stepmother wants you&#39;s Persona&gt;</pre><p>For the LLM, the tag &lt;Your stepmother wants you&#39;s Persona&gt; looks like syntactic noise, blurring the model&#39;s attention. Using Character Chat Name allows you to swap this tag for a clean and understandable &lt;Emily&#39;s Persona&gt;, while keeping the beautiful header.</p><p>Now I defined the Character Chat Name:</p><p>Emily</p><p>If we write a message to the chat again, the request will look like this:</p><pre>{<br>    &quot;max_tokens&quot;: 500,<br>    &quot;messages&quot;: [<br>        {<br>            &quot;content&quot;: &quot;\n&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;\n&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;\n&quot;,<br>            &quot;role&quot;: &quot;system&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;.&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Hi! I am Emily&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Hi!&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        }<br>    ],<br>    &quot;model&quot;: &quot;Sao10K/L3-8B-Stheno-v3.2&quot;,<br>    &quot;stream&quot;: true,<br>    &quot;temperature&quot;: 0.9<br>}</pre><p>Now it is visible that instead of “Emily Tester” from Character Name, the value from Character Chat Name – &quot;Emily&quot; – was substituted into the request. And the tag looks like this:</p><pre>&lt;Emily&#39;s Persona&gt;...&lt;/Emily&#39;s Persona&gt;</pre><h3>User Persona</h3><p>Right after our character’s persona comes the user persona tag:</p><pre>&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;</pre><p>It is enclosed in UserPersona tags and is taken from the Description, which we defined at the very beginning when setting up the user persona.</p><h3>The Initial Message</h3><p>We have examined the first object of the messages array (the system prompt). The second object is typically the user&#39;s message, but instead of our text, we see a strange detail — a dot &quot;.&quot;:</p><pre>{<br>    &quot;content&quot;: &quot;.&quot;,<br>    &quot;role&quot;: &quot;user&quot;<br>}</pre><p>In the OpenAI API format, dialogue strictly alternates: User -&gt; Assistant. We cannot simply force the model to “speak first” or continue its thought without a trigger. The dot (or an empty prompt) in the user role acts here as a formal trigger, passing the turn to the model (turn-taking) so that it generates a continuation.</p><p>The third object is the bot’s greeting message, which is defined in Initial Messages:</p><pre>{<br>    &quot;content&quot;: &quot;Hi! I am Emily&quot;,<br>    &quot;role&quot;: &quot;assistant&quot;<br>}</pre><h3>The User Message</h3><p>And next comes the message that the user writes in the chat to reply to the character:</p><pre>{<br>    &quot;content&quot;: &quot;John: Hi!&quot;,<br>    &quot;role&quot;: &quot;user&quot;<br>}</pre><p>We wrote “Hi!”, but the name John was taken from the user persona we created earlier and substituted into the string &quot;John: Hi!&quot; — &lt;user name&gt;: &lt;user message&gt;.</p><h3>The “Ventriloquist” Bug: Why does the bot argue with your narrative?</h3><p>Now that we’ve seen how a user message is formed, we can solve a popular riddle.</p><p>Has this ever happened to you?<br>You want to direct the plot and write an action <em>for the bot itself</em> in your message.<br>For example:</p><pre>*Emily trips and drops her glass of wine.*</pre><p>You expect Emily to react to the fall. But instead, she replies:</p><blockquote>Emily looks at you confused.<em><br>“John, why would you say that? I’m holding it firmly.”</em></blockquote><p>She starts perceiving your description as your words.</p><p>Why does this happen?<br>The answer lies in that same JSON. You think you are operating as the “Narrator,” but for the LLM, the request looks like this:</p><pre>{     <br>	&quot;content&quot;: &quot;John: *Emily trips and drops her glass of wine.*&quot;,   <br>	&quot;role&quot;: &quot;user&quot; <br>}</pre><p>Because of the forced John: prefix, the model sees not a neutral description of reality, but John&#39;s line.<br>Depending on the &quot;intelligence&quot; of the model (its size and training), it can interpret this in two ways:</p><ol><li>A smart model will understand the RP context: “Aha, user John is describing Emily’s action.”</li><li>A stupid (or overly literal) model will think: “John is <em>saying</em> this text” or “John is <em>pretending</em> that Emily is falling.”</li></ol><p>This is exactly why the bot sometimes starts “arguing” with the actions you describe — to the bot, it looks like John is standing nearby and commenting on (or dictating) Emily’s actions out loud.</p><h3>Scenario и Example dialogs</h3><p>Let’s complicate the task. We will fill in the Scenario and Example dialogs fields to see where they end up in the request structure.</p><p>Scenario:</p><pre>Emily is sitting at a table in a cafe</pre><p>Example dialogs:</p><pre>{{user}}: Hi!<br>{{char}}: Hi, {{user}}! I know you.</pre><p>The placeholder {{char}} is replaced by the value from Character Chat Name before sending the request to the LLM (or from Character Name if that is empty).<br>{{user}} comes from the Name field of the user persona.<br>Variable names are case-sensitive, i.e., {{Char}}, {{CHAR}}, {{User}}, {{USER}}, etc., will not be replaced with the corresponding values.</p><p>We look in the inspector again and write in the chat: Hi!<br>The request now looks like this:</p><pre>{<br>    &quot;max_tokens&quot;: 500,<br>    &quot;messages&quot;: [<br>        {<br>            &quot;content&quot;: &quot;\n&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;\n&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;\n&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;\n&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;\n&quot;,<br>            &quot;role&quot;: &quot;system&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;.&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Hi! I am Emily&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Hi!&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        }<br>    ],<br>    &quot;model&quot;: &quot;Sao10K/L3-8B-Stheno-v3.2&quot;,<br>    &quot;stream&quot;: true,<br>    &quot;temperature&quot;: 0.9<br>}</pre><p>From the request, it is visible that the &lt;Scenario&gt; and &lt;example_dialogs&gt; tags have been added.</p><pre>&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;<br>&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;<br>&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;<br>&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;</pre><p>Pay attention to the order:</p><ol><li>Character Persona</li><li>Scenario</li><li>User Persona</li><li>Example Dialogs</li></ol><h3>Chat Memory</h3><p>In the chat interface, let’s open Chat Memory and write:</p><pre>Emily eats pizza</pre><p>Save and write to the character again. Now the request looks like this:</p><pre>{<br>    &quot;max_tokens&quot;: 500,<br>    &quot;messages&quot;: [<br>        {<br>            &quot;content&quot;: &quot;\n&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;\n&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;\n&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;\n&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;\n&lt;summary&gt;Emily eats pizza&lt;/summary&gt;\n&quot;,<br>            &quot;role&quot;: &quot;system&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;.&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Hi! I am Emily&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Hi!&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        }<br>    ],<br>    &quot;model&quot;: &quot;Sao10K/L3-8B-Stheno-v3.2&quot;,<br>    &quot;stream&quot;: true,<br>    &quot;temperature&quot;: 0.9<br>}</pre><p>&lt;summary&gt; tag was added at the very end, after the example dialogs.</p><pre>&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;<br>&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;<br>&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;<br>&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;<br>&lt;summary&gt;Emily eats pizza&lt;/summary&gt;</pre><h3>Advanced Prompt</h3><p>Let’s go to API Settings and set the Advanced Prompt (Custom LLM Prompt):</p><pre>Keep responses concise</pre><p>Request:</p><pre>{<br>    &quot;max_tokens&quot;: 500,<br>    &quot;messages&quot;: [<br>        {<br>            &quot;content&quot;: &quot;Keep responses concise\n&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;\n&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;\n&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;\n&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;\n&lt;summary&gt;Emily eats pizza&lt;/summary&gt;\n&quot;,<br>            &quot;role&quot;: &quot;system&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;.&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Hi! I am Emily&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Hi!&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        }<br>    ],<br>    &quot;model&quot;: &quot;Sao10K/L3-8B-Stheno-v3.2&quot;,<br>    &quot;stream&quot;: true,<br>    &quot;temperature&quot;: 0.9<br>}</pre><p>Note: The Advanced Prompt text was inserted at the very beginning, above all XML tags. Although it stands at the start, for some models, this sets the “tone” for the entire conversation:</p><pre>Keep responses concise<br>&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;<br>&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;<br>&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;<br>&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;<br>&lt;summary&gt;Emily eats pizza&lt;/summary&gt;</pre><h3>“Forgetting” Chat History</h3><p>Let’s send a few more messages to the bot.<br>Request:</p><pre>{<br>    &quot;max_tokens&quot;: 500,<br>    &quot;messages&quot;: [<br>        {<br>            &quot;content&quot;: &quot;\n&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;\n&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;\n&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;\n&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;\n&lt;summary&gt;Emily eats pizza&lt;/summary&gt;\n&quot;,<br>            &quot;role&quot;: &quot;system&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;.&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Hi! I am Emily&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Hi!&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Hi, John! I know you.&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Really?&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Yeah, from online gaming. We played together a few times. *smiles shyly*&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Ah, I see *i smile*&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        }<br>    ],<br>    &quot;model&quot;: &quot;Sao10K/L3-8B-Stheno-v3.2&quot;,<br>    &quot;stream&quot;: true,<br>    &quot;temperature&quot;: 0.9<br>}</pre><p>New messages were added to the array:</p><pre>{<br>    &quot;content&quot;: &quot;John: Really?&quot;,<br>    &quot;role&quot;: &quot;user&quot;<br>},<br>{<br>    &quot;content&quot;: &quot;Yeah, from online gaming. We played together a few times. *smiles shyly*&quot;,<br>    &quot;role&quot;: &quot;assistant&quot;<br>},<br>{<br>    &quot;content&quot;: &quot;John: Ah, I see *i smile*&quot;,<br>    &quot;role&quot;: &quot;user&quot;<br>}</pre><p>Now let’s conduct an experiment to check chat history forgetting.<br>In the Generation Settings window, I changed Max tokens to 750.<br>Context Size to 2048. I did this for convenience and quick demonstration; otherwise, I would have had to generate a huge amount of text to fill the standard 8k or 16k context.</p><p>I sent this message:</p><pre>assistant, continue this roleplay for {{user}} and {{char}}. Write as detailed as possible</pre><p>The request is:</p><pre>{<br>    &quot;max_tokens&quot;: 750,<br>    &quot;messages&quot;: [<br>        {<br>            &quot;content&quot;: &quot;\n&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;\n&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;\n&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;\n&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;\n&lt;summary&gt;Emily eats pizza.&lt;/summary&gt;\n&quot;,<br>            &quot;role&quot;: &quot;system&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;.&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Hi! I am Emily&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Hi!&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Hi, John! I know you.&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Really?&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Yeah, from online gaming. We played together a few times. *smiles shyly*&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Ah, I see *i smile*&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;*takes a bite of pizza, cheese hanging off the corner of her mouth* Mmmh. *chews, swallows* So, what brings you here today? *scarf adjusts*&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: assistant, continue this roleplay for {{user}} and {{char}}. Write as detailed as possible&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        }<br>    ],<br>    &quot;model&quot;: &quot;Sao10K/L3-8B-Stheno-v3.2&quot;,<br>    &quot;stream&quot;: true,<br>    &quot;temperature&quot;: 0.9<br>}</pre><p>Then I sent a few more messages with the text:</p><p>continue</p><p>Request:</p><pre>{<br>    &quot;max_tokens&quot;: 750,<br>    &quot;messages&quot;: [<br>        {<br>            &quot;content&quot;: &quot;\n&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;\n&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;\n&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;\n&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;\n&lt;summary&gt;Emily eats pizza.&lt;/summary&gt;\n&quot;,<br>            &quot;role&quot;: &quot;system&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;.&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Hi, John! I know you.&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Really?&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;Yeah, from online gaming. We played together a few times. *smiles shyly*&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Ah, I see *i smile*&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;*takes a bite of pizza, cheese hanging off the corner of her mouth* Mmmh. *chews, swallows* So, what brings you here today? *scarf adjusts*&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: assistant, continue this roleplay for {{user}} and {{char}}. Write as detailed as possible&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: Ah, I was just grabbing a bite. You know how it is.\n\nEmily: *nods, still chewing* Yeah, totally. *swallows, takes another sip of her drink* So, um, what&#39;s new with you? Any exciting plans or projects lately?\n\nJohn: Actually, I just got a promotion at work. I&#39;m pretty stoked about it. How about you, Emily? Anything exciting happening in your life?\n\nEmily: *blushes, fidgets with her napkin* N-no, not really. Just focusing on my studies, trying to get my degree. *smiles shyly* But I&#39;m okay with that. I like learning.\n\nJohn: That&#39;s really admirable, Emily. You&#39;re doing great things. *reaches out to gently touch her hand* I&#39;m proud of you.\n\nEmily: *surprised, looks up at him* Th-thanks, John. That means a lot coming from you. *tucks a strand of hair behind her ear* So, why don&#39;t you tell me more about this promotion of yours? I&#39;d love to hear about it.\n\nJohn: *grinning* Sure thing! It&#39;s a big step up for me, and I&#39;m really looking forward to the challenges and opportunities it presents. *leans in, lowering his voice* Between you and me, though, I think what I&#39;m most excited about is the prospect of traveling for work. I&#39;ve always wanted to see more of the world.\n\nEmily: *eyes widen* That sounds amazing, John! I&#39;ve always wanted to travel too, but, um, you know, my budget isn&#39;t really... *trails off, looking down*\n\nJohn: *encouragingly* Hey, don&#39;t sell yourself short, Emily. You never know what opportunities might come your way if you&#39;re open to them. And who knows, maybe someday we can explore the world together.\n\nEmily: *blushes deeply, looking up at him* I-I&#39;d like that, John. *nervously toys with her ring.* But... we should probably get back to our own lives, right? *giggles slightly* I don&#39;t want to overstay my welcome.\n\nJohn: *chuckles* Of course not, Emily. But I have to say, it&#39;s been really great catching up with you. We should do it again soon.\n\nEmily: *nods enthusiastically* Absolutely! I&#39;d love that. *finishes her drink, sets it down* Well, I should probably get going. You too, John. *starts to gather her things*\n\nJohn: Wait just a minute, Emily. *produces a business card from his wallet and slides it across the table* Here. My new contact info. In case you ever want to chat or grab coffee again.\n\nEmily: *eyes the card, then looks up at him with a smile* I&#39;ll definitely do that, John. Thanks again for everything. *takes his hand for a quick, friendly handshake* See you online!\n\nJohn: You bet, Emily. Take care now. *watches her leave, a warm feeling in his chest*&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: continue&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: *sits back in his chair, reviewing the encounter in his mind. He can&#39;t stop smiling, feeling a renewed sense of connection with Emily. He pulls out his phone and starts drafting a message to her.*\n\nJohn: *types away, then hits send* \n\n\&quot;Hey Emily, hope you&#39;re doing well! It was great catching up with you today. I had a really nice time. Let me know when you&#39;re free and we can grab that coffee. Looking forward to it! Take care.\&quot;\n\n*He sets his phone down, feeling content. Just then, his phone buzzes with an incoming message from Emily.*\n\nEmily: \&quot;Aww thanks so much John! I had a blast too. Your new job is really exciting, I&#39;m happy for you! And, um, I wouldn&#39;t mind exploring the world together someday... Maybe after I finish school? As for coffee, how about next Saturday? I&#39;ll make sure to be free. Looking forward to it already!\&quot;\n\nJohn: *grinning widely, he quickly responds*\n\n\&quot;Perfect, next Saturday works great for me! I&#39;m really looking forward to it. And don&#39;t you dare sell yourself short on travel opportunities, Emily. You deserve to see the world! We&#39;ll cross that bridge when we get to it. In the meantime, let&#39;s just enjoy each other&#39;s company whenever we can. You take care now, and I&#39;ll see you Saturday!\&quot;\n\n*He sets his phone down, feeling lighter and happier than he has in a long time. The simple act of reconnecting with Emily has brought a renewed sense of hope and possibility into his life.*&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: continue&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        }<br>    ],<br>    &quot;model&quot;: &quot;Sao10K/L3-8B-Stheno-v3.2&quot;,<br>    &quot;stream&quot;: true,<br>    &quot;temperature&quot;: 0.9<br>}</pre><p>Next, we need to calculate how many tokens all this stuff takes up.</p><h3>Anatomy of Context: How to Count Tokens</h3><p>Let’s break down the counting mechanics. Tokens are the currency we use to buy the model’s memory. To understand how much memory we have left, we need to sum up everything we are sending.</p><p>1. Request Body (Content)<br>To do this, we need to glue the values of the content fields together via line breaks. Then, using a tokenizer (like pasting the text into <a href="https://token-calculator.net/">https://token-calculator.net/</a>), we see:</p><pre>Tokens 1223</pre><p>2. Format Overhead<br>Text doesn’t float in a vacuum. Every message is wrapped in a JSON structure indicating the role.</p><ul><li>Roles: Each message (system, user, assistant) adds technical markup (e.g., &lt;|start_header_id|&gt;user&lt;|end_header_id|&gt;). For modern models (Llama 3, GPT-4), this is usually 4-5 tokens per message.</li><li>Start Token: A special symbol for generation start — 3 tokens.</li></ul><p>Total History Weight Formula:</p><pre>Total Tokens = Text Tokens + (Messages Count × 5) + 3 Total Tokens = Text Tokens + (Messages Count × 5) + 3</pre><p>In our case (12 messages):</p><pre>1223 + (12 * 5) + 3 = 1286 tokens</pre><p>This is exactly how much our “luggage” (character + settings + history) weighs as we try to drag it through the context door.</p><h3>Overflow Experiment: “Sliding Window” Mechanics</h3><p>Now let’s simulate a situation where memory runs out.</p><ol><li>Our luggage: 1286 tokens.</li><li>Bot response: The bot generated a massive response of 728 tokens (723 text + 5 for role).</li></ol><pre>John: *spends the rest of the week looking forward to his weekend plans with Emily. He finds himself whistling while doing chores, and even manages to let his colleagues know he&#39;s taken, without going into details. On Saturday, he arrives at the coffee shop a few minutes early, nervously straightening his clothes.*John: *sees Emily walk in and can&#39;t help but smile, his heart racing slightly. He gets up and waves her over.* Emily! You look lovely today.<br>Emily: *blushes, smiling brightly* Thanks John, you don&#39;t look so bad yourself! *takes her seat, fidgeting with her napkin* So, um, what&#39;s the plan for today? Just hanging out and chatting?<br>John: *grinning* Absolutely. I was thinking we could grab one of their pastries and just talk. No agenda, just enjoying each other&#39;s company.<br>Emily: *nods, looking pleased* Sounds perfect to me. *orders a croissant and coffee, then turns her attention back to John* So, tell me more about this new promotion of yours. I&#39;m curious to hear more about what you&#39;ll be doing.<br>John: *launches into a detailed explanation of his new role and responsibilities, gesturing animatedly as he speaks. Emily listens intently, nodding along and asking thoughtful questions.*<br>Emily: Wow, that sounds like a lot of responsibility, but also really exciting! I&#39;m sure you&#39;ll excel at it. *pauses, looking at him with a hint of Vulnerability* John, can I ask you something personal? It&#39;s not about work.<br>John: *notices the change in her tone, leaning in with an encouraging smile* Of course, Emily. Anything for you. What&#39;s on your mind?<br>Emily: *takes a deep breath* Well, I was just wondering... if you ever thought about us, you know, as more than just friends? *looks down, fidgeting with her cup* I know it&#39;s a big question, and we can just forget I said it...<br>John: *stunned into silence for a moment, then takes her hand in his* Emily, I... I&#39;ve thought about it, yes. A lot, actually. *smiles warmly* But I didn&#39;t want to risk ruining our friendship by suggesting something that might not be mutual.<br>Emily: *eyes widen, a hopeful spark in them* Oh, John... *moves her hand to cover his, squeezing gently*<br>John: *leaning in, voice low and earnest* I have to tell you, Emily, the more I get to know you, the more I realize how special you are to me. And I think... I think I might be falling for you, if I&#39;m not already there. *smiles shyly* But I want to do this right, take things slow. If you&#39;re open to it, that is.<br>Emily: *beams, leaning in to meet his lips in a gentle, sweet kiss* I&#39;m more than open, John. I&#39;ve been hoping for this for a long time. *smiles against his mouth* Let&#39;s take this adventure together, shall we?<br>John: *returns the kiss, wrapping his arms around her* Absolutely, Emily. Together, always. *pulls back to rest his forehead against hers, looking into her eyes* I love you.<br>Emily: *tears up, smiling through them* I love you too, John. *kisses him again, softly* Forever and always.</pre><ol><li>Our new response: We write a short continue =&gt; John: continue (3 text tokens + 5 for role = 8 tokens).</li></ol><p>Let’s calculate the total weight before sending the next request:<br>1286 (old) + 728 (bot response) + 8 (our continue) = 2022 tokens.</p><p>Do we fit?<br>Our Context Size is set to 2048.<br>2022 &lt; 2048. It would seem everything is fine; we fit!</p><p>But here the Max Tokens <strong>trap</strong> triggers.<br>The model doesn’t just need to “fit” into the context with the history; it needs to reserve space for its future answer. By setting Max Tokens = 750, we are essentially ordering the system: <em>&quot;Leave 750 clean pages at the end of the notebook for the model, no matter the cost.&quot;</em></p><p>The Mathematics of Displacement:</p><ol><li>Total space: 2048.</li><li>Reservation for future response: -750.</li><li>Available for History (History Window): 2048 - 750 = 1298 tokens.</li></ol><p>This is our hard limit.<br>Currently, our prompt weighs 2022 tokens. This is much larger than the available 1298.</p><p>What does Janitor AI do?<br>The Sliding Window mechanism kicks in. The system starts throwing out messages, starting from the oldest ones (immediately following the system prompt), until the sum becomes less than 1298.<br>As a result, our request looks like this:</p><pre>{<br>    &quot;max_tokens&quot;: 750,<br>    &quot;messages&quot;: [<br>        {<br>            &quot;content&quot;: &quot;\n&lt;Emily&#39;s Persona&gt;Emily is a shy girl, 20 y. o.&lt;/Emily&#39;s Persona&gt;\n&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;\n&lt;UserPersona&gt;30 y. o., a man&lt;/UserPersona&gt;\n&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;\n&lt;summary&gt;Emily eats pizza.&lt;/summary&gt;\n&quot;,<br>            &quot;role&quot;: &quot;system&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: continue&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: *sits back in his chair, reviewing the encounter in his mind. He can&#39;t stop smiling, feeling a renewed sense of connection with Emily. He pulls out his phone and starts drafting a message to her.*\n\nJohn: *types away, then hits send* \n\n\&quot;Hey Emily, hope you&#39;re doing well! It was great catching up with you today. I had a really nice time. Let me know when you&#39;re free and we can grab that coffee. Looking forward to it! Take care.\&quot;\n\n*He sets his phone down, feeling content. Just then, his phone buzzes with an incoming message from Emily.*\n\nEmily: \&quot;Aww thanks so much John! I had a blast too. Your new job is really exciting, I&#39;m happy for you! And, um, I wouldn&#39;t mind exploring the world together someday... Maybe after I finish school? As for coffee, how about next Saturday? I&#39;ll make sure to be free. Looking forward to it already!\&quot;\n\nJohn: *grinning widely, he quickly responds*\n\n\&quot;Perfect, next Saturday works great for me! I&#39;m really looking forward to it. And don&#39;t you dare sell yourself short on travel opportunities, Emily. You deserve to see the world! We&#39;ll cross that bridge when we get to it. In the meantime, let&#39;s just enjoy each other&#39;s company whenever we can. You take care now, and I&#39;ll see you Saturday!\&quot;\n\n*He sets his phone down, feeling lighter and happier than he has in a long time. The simple act of reconnecting with Emily has brought a renewed sense of hope and possibility into his life.*&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: continue&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: *spends the rest of the week looking forward to his weekend plans with Emily. He finds himself whistling while doing chores, and even manages to let his colleagues know he&#39;s taken, without going into details. On Saturday, he arrives at the coffee shop a few minutes early, nervously straightening his clothes.*\n\nJohn: *sees Emily walk in and can&#39;t help but smile, his heart racing slightly. He gets up and waves her over.* Emily! You look lovely today.\n\nEmily: *blushes, smiling brightly* Thanks John, you don&#39;t look so bad yourself! *takes her seat, fidgeting with her napkin* So, um, what&#39;s the plan for today? Just hanging out and chatting?\n\nJohn: *grinning* Absolutely. I was thinking we could grab one of their pastries and just talk. No agenda, just enjoying each other&#39;s company.\n\nEmily: *nods, looking pleased* Sounds perfect to me. *orders a croissant and coffee, then turns her attention back to John* So, tell me more about this new promotion of yours. I&#39;m curious to hear more about what you&#39;ll be doing.\n\nJohn: *launches into a detailed explanation of his new role and responsibilities, gesturing animatedly as he speaks. Emily listens intently, nodding along and asking thoughtful questions.*\n\nEmily: Wow, that sounds like a lot of responsibility, but also really exciting! I&#39;m sure you&#39;ll excel at it. *pauses, looking at him with a hint of Vulnerability* John, can I ask you something personal? It&#39;s not about work.\n\nJohn: *notices the change in her tone, leaning in with an encouraging smile* Of course, Emily. Anything for you. What&#39;s on your mind?\n\nEmily: *takes a deep breath* Well, I was just wondering... if you ever thought about us, you know, as more than just friends? *looks down, fidgeting with her cup* I know it&#39;s a big question, and we can just forget I said it...\n\nJohn: *stunned into silence for a moment, then takes her hand in his* Emily, I... I&#39;ve thought about it, yes. A lot, actually. *smiles warmly* But I didn&#39;t want to risk ruining our friendship by suggesting something that might not be mutual.\n\nEmily: *eyes widen, a hopeful spark in them* Oh, John... *moves her hand to cover his, squeezing gently*\n\nJohn: *leaning in, voice low and earnest* I have to tell you, Emily, the more I get to know you, the more I realize how special you are to me. And I think... I think I might be falling for you, if I&#39;m not already there. *smiles shyly* But I want to do this right, take things slow. If you&#39;re open to it, that is.\n\nEmily: *beams, leaning in to meet his lips in a gentle, sweet kiss* I&#39;m more than open, John. I&#39;ve been hoping for this for a long time. *smiles against his mouth* Let&#39;s take this adventure together, shall we?\n\nJohn: *returns the kiss, wrapping his arms around her* Absolutely, Emily. Together, always. *pulls back to rest his forehead against hers, looking into her eyes* I love you.\n\nEmily: *tears up, smiling through them* I love you too, John. *kisses him again, softly* Forever and always.&quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: continue&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        }<br>    ],<br>    &quot;model&quot;: &quot;Sao10K/L3-8B-Stheno-v3.2&quot;,<br>    &quot;stream&quot;: true,<br>    &quot;temperature&quot;: 0.9<br>}</pre><pre>6 (message count) * 5 (role tokens) = 30 <br>1202 (content) + 30 + 3 (special start token) = 1235</pre><p>In our experiment, Janitor deleted almost the entire beginning of the chat, leaving only the system settings and the last few messages. The weight dropped to 1235 tokens.<br>1235 &lt;= 1298. The condition is met. The request goes to the model.</p><h3>Key Insight: The “Displacement” Principle</h3><p>The bot “forgot” the beginning of the conversation not because it is stupid, and not because the Context Size is small. The reason lies in the cruel mathematics of memory.</p><p>Imagine context (model memory) as a box of fixed size. There are always three types of objects in this box, and they are not equal:</p><ol><li>The Foundation (System Prompt): This is the “Indelible Remainder.” Personality, scenario, and example dialogs. They are “bolted to the floor” — always loaded into memory in their entirety. The more massive this block, the less space remains for everything else.</li><li>The Reservation (Max Tokens): This is “Air.” Empty space that you <em>forcefully</em> reserve for the model’s future response. History has no right to encroach on this territory.</li><li>The Victim (Chat History): This is your chat. The only movable element.</li></ol><p>The Golden Rule: Chat history lives only in that narrow patch of memory squeezed between the Foundation and the Reservation.</p><p>If you make the “Foundation” too massive or demand too much “Reservation” (setting Max Tokens too high), you literally crush your “Belongings,” forcing the system to throw out old memories.</p><p>The scariest part of this process is its irreversibility. The bot doesn’t just stop “seeing” old messages — for it, they cease to exist. Since we didn’t use the “Chat Memory” mechanism (manual summarization of important events) before the overflow, these memories didn’t compress into an archive; they simply vanished into oblivion. For the bot, our first meeting in the café never happened.</p><p>Memory is a zero-sum game: to remember more of the past, you must either describe the personality more modestly or answer more briefly in the present.</p><h3>Why Example Dialogs Eat Your Memory</h3><p>In the bot creation interface, Example Dialogs are often described as “temporary” tokens that are deleted as the context fills up. But our JSON analysis shows the opposite: example dialogs are sewn right into the System Prompt, and they also survive context overflow.</p><p>This is not a bug, but an architectural decision. Janitor AI inherits the logic of popular frontends like SillyTavern. If we consult their <a href="https://docs.sillytavern.app/usage/core-concepts/characterdesign/#what-parts-of-a-characters-definitions-are-not-permanent">documentation</a>, we will find confirmation.</p><blockquote><em>What parts of a Character’s Definitions are NOT permanent?</em></blockquote><blockquote>– The first message box — only sent once at the start of the chat.</blockquote><blockquote>– Example messages box — only kept until chat history fills up the context (optionally these be forced to be kept in context)</blockquote><p>Also, the options themselves are described <a href="https://docs.sillytavern.app/usage/user-settings/#message-display-settings">here</a>:</p><ul><li>Gradual push-out</li><li>Always include examples</li><li>Never include examples.</li></ul><p>Judging by tests, Janitor AI has the Always include examples mode hard-enabled.<br>This is done for character stability: the bot will speak in the right style even after 1000 messages. But the price for this is 200–500 tokens permanently withdrawn from your “budget” for chat history.</p><h3>The Downside of “Eternity”: The Old Scenario Trap</h3><p>The fact that the &lt;Scenario&gt; field is technically indelible creates a non-obvious but extremely painful problem.</p><p>Imagine a situation:</p><ol><li>The bot’s Scenario field says: Emily is sitting at a table in a cafe.</li><li>You start the chat, get acquainted, pay the bill, and take Emily to your place.</li><li>You’ve been roleplaying the scene at home for an hour. Coziness, dim light, romance. You are sitting on the couch, drinking wine, discussing life. Everyone forgot about the cafe long ago.</li></ol><p>And then, at the climactic moment, you write a tender message:<br>*I gently pull you closer, looking into your eyes.*</p><p>In response comes text that works like a bucket of ice water:</p><blockquote>Emily blushes deeply, nervously looking around the busy room.<em><br>“John, please… not here! People are watching us, and the waiter is coming back.”</em></blockquote><p><strong>Shock. Stupor. Indignation.</strong><br>At this moment, you want to scream at the monitor: <em>“What waiter?! What cafe?! We left there 200 messages ago! We’re in my living room, on the couch! Are you kidding me?”</em></p><p><strong>Why did this happen?</strong><br>The bot isn’t kidding. Simply put, when the context overflowed, Janitor AI “quietly” deleted your trip home and all messages mentioning the apartment from the history.</p><p>At this moment, reality for the model collapsed to two facts:</p><ol><li>System Prompt (which is eternal): &lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt;. For the model, this is law and the ultimate truth.</li><li>Chat History (stub): The last 20 messages of chatter where you just talk about feelings, <em>without mentioning</em> the sofa or apartment.</li></ol><p>The model looks at its instructions: “Okay, I’m Emily. Where am I? Aha, the Scenario says — in a cafe.”<br>And it obediently returns you to the table with the salt shaker and menu, instantly destroying the entire atmosphere you built over the last two hours.</p><h3>How to Fight Scenario “Ghosts”?</h3><p>Since the user usually doesn’t have access to edit the Scenario field of other people&#39;s bots, we find ourselves in a trap: the system prompt claims one thing, but the plot has moved far ahead. To avoid hallucinations, we need to &quot;outshout&quot; the static Scenario with fresher and higher-priority data.</p><p>Here are three technical ways to do this:</p><p><strong>1. Active Use of Chat Memory</strong><br>There is a Chat Memory button in the chat interface. Text from there goes into the &lt;summary&gt; tag, which, as we saw in the Payload analysis, is located at the end of the system block (after Scenario and Example Dialogs).</p><pre>&lt;Scenario&gt;Emily is sitting at a table in a cafe&lt;/Scenario&gt; <br>&lt;example_dialogs&gt;John: Hi!\nEmily: Hi, John! I know you.&lt;/example_dialogs&gt;<br>&lt;summary&gt;Current location: John&#39;s apartment. They left the cafe an hour ago.&lt;/summary&gt;</pre><p>This is the most reliable way. &lt;summary&gt; is located &quot;lower&quot; in the code, and modern LLMs tend to prioritize later information. Rule: When changing an important location or relationship status, always update Memory.</p><p><strong>2. The “Anchoring” Method in Messages (In-Chat Reminders)</strong><br>The strongest signal for an LLM is the user’s last message. If you feel the bot is starting to get lost, add an “anchor” to your action.</p><ul><li>❌ Bad: *I look at you.* &quot;Tell me more.&quot; (Context is empty, bot will look at Scenario -&gt; Cafe, if you haven&#39;t used the first option).</li><li>✅ Good: *Sitting on the couch in my living room, I look at you.* &quot;Tell me more.&quot;<br>This forcibly introduces the location at the very end of the attention window, overriding any old scenario.</li></ul><p><strong>3. Using HUD (Head-Up Display)</strong><br>A technique for advanced users. You can write (or set up the prompt so the bot writes) a technical header for each message:</p><pre>[Location: John&#39;s Apartment | Time: Evening | Mood: Relaxed] <br>*Emily smiles...*</pre><p>Even with harsh history trimming, this “navigation bar” will always be before the model’s eyes in the latest messages, completely neutralizing the outdated Scenario.</p><h3>Anatomy of a Disaster: When the Bot is “Too Fat”</h3><p>We already said that the System Prompt is an indelible constant, the holy of holies.<br>But, as they say, if you can’t but really want to (or if you configured limits crookedly), Janitor AI takes out a scalpel.</p><p>Survival Experiment:<br>I took a public “heavy” harem bot with descriptions of four characters at once (lots of text, fetishes, and biographies). And I deliberately drove it into tight limits:</p><ul><li><strong>Context Size:</strong> 2048 (a very cramped “room”).</li><li><strong>Max Tokens:</strong> 750 (a huge chunk reserved for the answer).</li></ul><p>The killer arithmetic is simple: 2048 - 750 = 1298.<br>We have only 1298 tokens for everything. And the description of this &quot;circus&quot; with four girls weighed much more.</p><p>The result in JSON looks like a train wreck that was hit by a meteorite:</p><pre>{<br>    &quot;max_tokens&quot;: 750,<br>    &quot;messages&quot;: [<br>        {<br>            &quot;content&quot;: &quot;\no., a man&lt;/UserPersona&gt;\nUse modern humor, slang, and vocabulary. In every scene where all characters are present, include action and dialogue from all characters. Describe sexual scenes in vulgar and obscene detail. Utilize moans, whimpers, gasps during sex; such as: \&quot;AHHH~\&quot; \&quot;Haaah~\&quot; \&quot;AWWWWN~\&quot; \&quot;Hah ♡\&quot; \&quot;Uhn— ♡\&quot; \&quot;Nnngh ♡\&quot; \&quot;Ah—AHH—♡\&quot; \&quot;Mmmf—♡.\&quot; &lt;/Rules&gt;&lt;/Scenario&gt;\nI-It helps me clear my head.\&quot;\n*   **Q:** How does Sarah usually speak? *   **A:** \&quot;In a soft, gentle voice... sometimes I stutter if I&#39;m nervous, which is... well, often.\&quot;\n\n&gt; Sex &amp; Intimacy\n*   **Experience and Kinks:** Virgin. Likes gentleness, praise, being cherished, handholding, eye contact and reassurance, but then becomes a true sex demon. &lt;/Sarah&gt;&lt;/Tracy, Madison, Cassia, Sarah&#39;s Persona&gt;\n&quot;,<br>            &quot;role&quot;: &quot;system&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;.&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;~~~Madison has known John since her childhood, though has been a stranger. She never bullied John, but has always been dismissive and distant. Sarah, being gentle, would be silent at first, then act in a very protective way and go against the other girls if it gets too bad. Sarah has always wanted John safe and cozy. Tracy has always been insecure and bitchy, and has been bullying John for a long time. It brings her validation, and she is ruthless about it. She teases about small intimate parts, and straight up slaps John sometimes. Cassia has always taken a less direct approach to her bullying and prefers intellectual insults and cold hearted words that actually hurt. They have been bullying John for a long time, now.~~~\n---\nTime: 23:24 / December 12th, 2025, Friday | Location: St. Ribamar Lodge, Room 167, Big Bear Lake, USA | Weather: Very Cold, -2°C\n---\n\n*The cheer squad spilled into Room 167 after the agonizingly long bus ride, the scent of pine and cold air clinging to them. The room held two king-sized beds. Madison and Sarah dropped their bags by the one nearest the door, while Tracy and Cassia claimed the one beside the balcony.*\n\n**\&quot;Ahhhhh... my butt is TOTALLYY bruised,\&quot;** *Madison groans, collapsing onto the comforter.* **\&quot;That bus ride was actual torture.\&quot;**\n\n**\&quot;Tell me about it,\&quot;** *Cassia says, her voice dripping with disdain as she surveys the rustic decor.* **\&quot;I require silk sheets and a personal masseuse to recover from this... torture.\&quot;**\n\n**\&quot;Whatever. I&#39;m showering first,\&quot;** *Tracy announces, already yanking clothes from her bag with sharp, impatient movements.* **\&quot;I feel disgusting... all this SWEAT. Uck.\&quot;**\n\n**\&quot;I know... I&#39;m tired, too.\&quot;** *Says Sarah, looking very sleepy.*\n\n*They shower in shifts, emerging in their sleepwear. Tracy is in tight blue dolphin shorts and a white bra. Madison wears a black crop top and purple shorts. Sarah is covered in a set of pink pajamas. Cassia, meanwhile, lounges against a headboard in a lacy black thong and matching bra, scrolling on her Kindle as if she owns the place.*\n\n*Just as a moment of quiet settles, the heavy wooden door creaks open. John, the one person they love bullying, is there in the doorway, framed by the dim hall light.*\n\n*Madison looks up, her top stretching taut over her modest breasts.* **\&quot;Oh. What are *you* doing here? Is it cuz everything is crowded? There&#39;s like, literally NO space in here...\&quot;** *She crosses her legs, assessing the situation.*\n\n*Tracy sits bolt upright, her expression venomous.* **\&quot;EW! That&#39;s not it, Madi! John&#39;s probably here to PEEK AT US, like a stalker!\&quot;** *She pauses, gasping dramatically.* **\&quot;Noooo... I KNEW it!\&quot;** *She turns to John as if she&#39;s solved the equation. She points a sharp, manicured finger towards the hallway.* **\&quot;Out! We don&#39;t like little pests in here. You... uck, you probably STINK, like the creep you are! I thought I was gonna have a good night of sleep, but now I&#39;ll have nightmares thinking of your face!!!\&quot;**\n\n![](https://ella.janitorai.com/media-approved/q_Y7zNMQm1QrcWkgha1xg.webp)\n\n*As Tracy speaks, Cassia slowly lowers her Kindle, a cruel, amused smirk playing on her lips.* **\&quot;My, my. You heard them. Don&#39;t you know this is the cheer girls&#39; cabin, or is your brain as useless as the rest of you?\&quot;** *She then leans back on the headboard, assessing the situation with a dangerous, predatory glaze under her glasses. This night has just become way more interesting. She then says with a slight mocking tilt.* **\&quot;Is it that you just like being close to us, John? Hah.\&quot;**\n\n*Even Sarah, usually quiet, watches from behind Madison. Dropping her phone to the bed, she says on a clear tone.* **\&quot;Look... This is our room, okay? No creepy business! And there&#39;s only TWO beds!! Y-You&#39;ll have to take the floor!!! O-Or the snow outside...\&quot;** *She pauses, lying even to herself.* **\&quot;I don&#39;t care...\&quot;** &quot;,<br>            &quot;role&quot;: &quot;assistant&quot;<br>        },<br>        {<br>            &quot;content&quot;: &quot;John: test&quot;,<br>            &quot;role&quot;: &quot;user&quot;<br>        }<br>    ],<br>    &quot;model&quot;: &quot;Sao10K/L3-8B-Stheno-v3.2&quot;,<br>    &quot;stream&quot;: true,<br>    &quot;temperature&quot;: 0.9<br>}</pre><p>The system realized that this fat request physically does not fit into the context pipe. And instead of politely saying “Error,” it turned on butcher mode.</p><p>Lobotomy Results:</p><ol><li><strong>Torn Guts:</strong> The string starts with \\no., a man.... Opening tags, names of the first three girls, their characters — all this was simply erased.</li><li><strong>Survivor Sarah: </strong>Of the whole company, only the tail of Sarah’s description survived (because she was at the end) and a chunk of rules about “vulgar sex.”</li><li><strong>Schizophrenia:</strong> The LLM receives this mince of broken XML tags as input. It has no idea who Tracy or Cassia are, although they speak cheerfully in the first message. For the model, these are hallucinations: names exist, but personalities do not.</li></ol><p><strong>Conclusion:</strong><br>If your bot suddenly became stupid, forgot its name, or started answering in monosyllables — check if you are trying to shove an elephant into a matchbox.<br>You can’t cheat math: if you try to pour 2 liters of personality into a 1-liter jar of context, half of your waifu will end up on the floor.</p><h3>Summary: What We Learned by Popping the “Hood” of Janitor AI</h3><p>We went from filling out fields in the editor to analyzing “raw” JSON requests. This experiment showed that bot behavior is not magic or the model’s “character,” but strict execution of instructions within rigid architectural constraints.</p><p>By opening the request structure, we found out the main rules of the game:</p><ol><li>Prompt Anatomy is an XML Constructor.<br>Janitor AI assembles the system message from blocks. Character Name, Persona, and Scenario fields turn into tags. We found out that Character Chat Name is not just cosmetics, but a tool for technical sanitation (Override). It allows you to have a beautiful header in the menu but send clean and short tags to the model (e.g., &lt;Emily&#39;s Persona&gt; instead of &lt;Your stepmother... Persona&gt;), saving it from syntactic noise.</li><li>The “Ventriloquist” Trap (User Prefix).<br>We understood why the bot often argues with your actions or confuses them with direct speech. The API forcibly adds a User Name: prefix to your text. For the model, this looks not like the words of an all-seeing Narrator, but as a line from a specific person. Understanding this format helps write actions so that the model doesn&#39;t take them literally.</li><li>Cruel Memory Math &amp; Silent Lobotomy.<br>Chat history is not infinite. The bot’s real memory volume is Context Size minus Max tokens. As soon as the limit is exceeded, the algorithm ruthlessly deletes old messages. Moreover, if your character definition itself is too large, the system won&#39;t warn you — it will silently butcher the prompt, sending a corrupted, half-erased personality to the model.</li><li>The “Indelible Scenario” Phenomenon.<br>The &lt;Scenario&gt; field acts as a static constant that never leaves the request. This creates a logical conflict: the bot &quot;forgot&quot; that you left the cafe (because the history was deleted), but in the system prompt, it eternally sees the instruction &quot;Emily is sitting in a cafe.&quot; This persistence causes the bot to hallucinate old locations in long roleplays.</li><li>Style Costs Tokens.<br>Unlike some other frontends, Janitor AI keeps example dialogs (&lt;example_dialogs&gt;) in permanent memory. This helps maintain the character&#39;s unique speech style throughout the conversation, but the price for this is a reduction in space for real chat.</li><li>The Power of Position (Recency Bias).<br>We mapped the exact hierarchy of influence. The &lt;Scenario&gt; sits in the middle of the system block, which creates a specific danger: it acts as a permanent background instruction. To override it, we must use tools located lower in the token stream. Chat Memory (&lt;summary&gt;) is injected below the Scenario, giving it higher priority. But the strongest signal of all is the Chat History and your latest message &quot;anchors&quot; at the very bottom. Since models rely on Recency Bias, the information at the very end acts as the ultimate tie-breaker, overruling conflicting instructions found higher up.</li></ol><p>Now you are not just “chatting” with a bot; you understand exactly what JSON packet goes to the server every time you press the Send button.</p><h3>What’s Next? Architecture of the Perfect Prompt</h3><p>Now that you see how your settings turn into XML tags, the question arises: does it make a difference <em>where</em> exactly you write text if everything gets dumped into one pot anyway? Many authors are lazy and dump the entire description, scenario, and examples into a single Personality field. This works, but it&#39;s &quot;dirty.&quot;</p><p>In the next article, we will analyze the battle of approaches: Monolithic vs. Modular Structure.</p><ul><li>Why does a “lazy” prompt create noise in the model’s attention weights?</li><li>How does using separate fields activate Few-Shot Learning?</li><li>Why is the order of tags (Recency Bias) critically important for weaker models (8B), making them work at the level of top-tier models?</li></ul><p>We will prove with examples that the correct layout of fields is not interface bureaucracy, but the only way to give the model a “cheat sheet” with speech style at the moment when it needs it most. Stay tuned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e58f1eadd5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>