CHAT MEMORY!
ciao, bellas!
as stated above, this is a beginner-friendly guide to using the Chat Memory here on j.ai, whether you're a proxy or JLLM user (perhaps ESPECIALLY if you're a JLLM user), but most of all, if you're a slow burn fan like me OR if you want to use some of my bots in which i explicitly instruct that using the chat memory is essential.
if you're here because you wanna understand how to use my bots with intros that are supposed to be played in order, don't worry. read the guide and i'll talk about it at the end!
so, first, a few disclaimers:
1i'm not the AUTHORITY in technology, LLMs or anything of the sort. i'm currently getting a degree in programming and things like scripting and LLMs are subjects i'm interested in, so i do a lot of research, but that doesn't mean i won't make mistakes.
2 if you're already getting the most of your chat memory and you're just here to see another point of view, welcome! share your tips in the comments too. and if what you do is entirely different from what i do, that's okay! there's no ONE WAY to work with LLMs/AI. there are more and less effective ways, 'though.
3 and, as always: any bots of my making are intended for adult roleplay and creative storytelling. AI is not therapy or a substitute for real relationships. all responses are generated by non-sentient language models and do not represent real opinions, advice, or feelings. the characters portrayed are fictional, and anything said does not reflect the views of the creator or the hosting platform. use ai responsibly.
Now, proof that I'm not talking out of my ass. I've had multiple slow burn RP threads with tons of messages.
RULE #1: INFORMATION GIVEN IS INFORMATION KNOWN
Meaning that, even if you tell the AI "THIS IS A SECRET AND SHOULD ONLY BE KNOWN BY {{CHAR}} IF EXPLICITLY TOLD", some models, especially non-thinking models (I'm looking at most of DeepSeek's rn), will only follow this instruction half the time.
So you should only tell the AI what you want it to know. This goes for EVERYTHING. Example: If you have a whole backstory written for your Sona in their Profile, I'd personally remove it and save it somewhere else (like a txt file or something), unless {{Char}} is supposed to know your Sona's story from the very beginning.
So if you have secrets and background story in your Sona's info, that might be why sometimes characters that aren't supposed to know you will sometimes blurt out info as if they do.
This is the same for the Chat Memory, but we'll get into that a bit later. ;)
RULE #2: WATCH YOUR TOKENS! CONTEXT MATTERS!
So. Tokens. I know, what even are these things, right?
Well, I'll tell you right now: They're important, so keep an eye on them. If you're a Proxy user, you probably already know a little something about them, but if you're not or you never cared to pay attention to what tokens are or what Context means to the bots, pay attention.
Resource: Tokenizer. // Copy & paste your stuff here to see a rough token count of some of the things JAI doesn't give us the numbers for (like Persona, Chat Memory and Custom/Advanced Prompt)
For bots, "Context" is basically how far their memories will go. If you're not a proxy user and you have the basic, free JLLM experience, your Context is 9k tokens. We'll use this example for the following explanation, because if you're a proxy user, you can sort of set up your own Context window to a degree and this becomes less of an issue.
Also, for this example, I'll use my second most popular bot, which is my canon-accurate Soldier Boy experience one (SHAME ON ALL OF YOU!)
Here are the stats:
Permanent Tokens: 1488.
That means that out of the 9k tokens your bot can remember, 1488 are occupied by default. They're the Personality and the Scenario. The Initial Message doesn't go here, but I'll talk about it in a bit.
So, right now, you have about 7512 tokens left. That's a good amount, right?
Except... Personality and Scenario are not the only permanent tokens to consider. You also have your Persona, your Custom/Advanced Prompt and your Chat Memory.
Let's assume that, initially, your Chat Memory will be at 0, like you're using a bot for the first time.
OPTIMIZING YOUR PERSONA
I'll also use my main Sona for this example. My Sona's entire profile is a total of, roughly, 250 tokens.
Remember rule number one? Information given is information known. Smarter models will know from the context whether the bot should know stuff about your Sona or not, but usually it's best not to clutter your Sona's profile with a huge backstory because it will probably NOT be used by all bots and it's just eating tokens.
Okay, so, at first glance this might look WAY TOO SHORT, but I promise it's just enough. Your Sona's info should only be the things that a Bot that has NEVER MET YOUR SONA BEFORE can detect upon first glance/interaction.
So, a Bot that has no idea who your Sona is would be able to see their height, haircut, skin color, maybe even ethnicity (which you can add there). They'd be able to hear how your voice sounds at a first interaction. And if there's more that you think should go here, considering these "rules", add it.
For Sonas that are Supes (The Boys), for example, you can add a category at the end like ## SUPE TRAITS and then describe your Powers (unless they should be a secret or only found out after you reveal them) and you can describe your "Supe Uniform", if applicable.
But Cara, what about Bots that have established relationships like siblings, married couples or childhood friends? They're supposed to know my Sona's backstory!
Right, and that's when you use the Chat Memory! Don't worry, we'll get there!
MASTER THE CUSTOM PROMPT
I'm not gonna spend too much time on this one because I already talked about it on my Tumblr. If you want a template for your Custom Prompt, there are TONS of creators out there sharing theirs, but here is the bit of text I add to all my bots.
▫️A good prompt goes a long way and there are several threads on reddit and websites with people giving you templates for good system prompts, whether you're using Proxy or not. The JanitorAI official Discord has a channel JUST for prompts, check it out!
Prompt for JLLM. (Roughly 600 tokens)
Prompt for Proxy. (Roughly 950 tokens)
Some people have much longer Prompts, others have very tiny, compact Prompts. This is about finding out what works for you and your preferred model (or dear old JLLM).
WHAT'S THE COUNT SO FAR?
Using my Bot, my Sona and my JLLM Prompt as examples, we're at:
[Bot] - 1488 tokens
[Sona] - 250 tokens
[Custom Prompt] - 600 tokens
[Chat Memory] - 0 tokens
Total Permanent Tokens: 2338 tokens
Remaining Tokens: 6662 tokens
Well, that's a good number still! We can work with that! What's gonna use up these tokens? Your chat.
So, immediately, you can subtract the Initial Message from this, which for my bot is 521 tokens. You still have around ~6000 tokens, which is a good number. This means that you have 6000 tokens worth of "available memory" in your chat. If you're a yapper who enjoys writing LONG, multi-para messages like me, that lasts around 15 messages (total, counting the bot's and yours). If you're more of a "two paras max" person, it can def last longer.
Regardless, at some point, you'll yap enough that you'll need to use the Chat Memory. And here's how I use mine.
RULE #3:UNDERSTAND YOUR CHAT MEMORY!
I also have a Chat Memory template available and linked in every single one of my bots. I'll paste it here below and explain how to use each section.
First thing to understand: The formatting/Markdown (The ## headers and bullet points everywhere) are on purpose. It's an easy format for LLMs/AI to understand.
Information in your Chat Memory should be straight and to the point.. This is definitely NOT the place to use purple prose (or any kind of prose). This has to be almost clinical. Here's the empty template for you guys to easily copy/paste:
## Current Setting:
-
## Past Memories:
-
## {{User}} Important Info:
-
## {{Char}} Important Info:
-
## {{Char}} Relationship with {{User}}:
-
## Current Scenario:
-
## {{Char}}'s current dynamics with {{User}}:
-
Let's start with "Current Setting". This is optional. I use it because I'm a canon/fandom bot user/creator, so sometimes I just wanna make sure that the bot is sticking to a plotline, but it's not necessary.
Below is an example of how I'd use this:
## Current Setting:
- Season 4.
- Year: 2022.
If, let's say, you're writing with a Homelander bot that had an initial setting in Season 2, and you moved on with the plot until you got to Season 3, for example, you should eventually update this in your Chat Memory. Not sure how JLLM handles this type of information, but it does help proxies (especially new models).
Now, let's understand the "Past Memories" section --- the MOST IMPORTANT PART of your Chat Memory! This is where you'll summarize your scenes. Anything important that happened between your Sona and the Char should go here, but in the most succinct way possible.
Here's an example:
## Past Memories:
- Matt and Nia dated since 16. At 18, Matt enlisted to impress his father, promising to return. Maintained long-distance via letters until Matt stopped reading/responding.
- Edward's conditions: Nia couldn't tell Matt until paternity confirmed; Edward demanded access if it was his grandchild. Nia agreed.
- Matt admitted fault for not reading letters, insisted he'd have returned if he'd known. Nia allowed 5 minutes with their kid, who believed her father died in the war. Matt went with the lie.
- Nia cut visit short, kicked Matt out. Said he could see their child at his father's house, 3x/week per her arrangement with Edward.
What you're seeing above is about 100 messages summarized into four bullet points. Because in the end, the Bot (Matt in this example) just needs to remember that he went to war, stopped answering letters, came back to a child he didn't know he had, got kicked out, etc. The exact feelings that happened at the moment don't have to be included because the AI will fill in the blanks anyway.
This part of the Chat Memory should be updated often with summaries of your scenes with the bot in chronological order, and in past tense. Don't confuse the bot. If it's PAST memories, use PAST tense.
The "{{User}} Important Info" part is where you'd add anything regarding your Sona that this bot should already know, either because your Sona TOLD HIM during the chat, because it was revealed, or because it's a known information.
Example:
## {{User}} Important Info:
- Age: 26 years old.
- Daughter: Her child with Matt. Layla, 6 years old. Blonde hair, green eyes, soft freckles on her nose and cheeks, fair skin.
- Lives in Manhattan, Lower East Side.
I usually set my Sona's age in this area. Why not the Persona profile? Because that way I can re-use the same Persona for different scenarios where I'd want to use that Persona, but with a different age. ;) Save the world, Recycle your Sonas.
This is also where your Sona's "Backstory" would go if it's important for Char to know about it, but make sure it's added here in a token efficient way. No flourish in this section. Just information!
The "{{Char}} Important Info" should only be here if you HAVE something to add on it. Like their age or anything relevant for your plot progression. Let’s say that over the course of 50 messages, Char lost his leg. You’d add something like:
## {{Char}} Important Info:
- Lost his leg after the Battle of Something-or-Other.
"{{Char}} Relationship with {{User}}" is the STATUS of your CURRENT relationship with the bot. So, if you guys started as "Rivals", it should say "Lifelong rivals", for example. But, if over the course of 50 messages, you became friends, REMOVE the "Rivals" thing and replace it with "Friends".
Why can't I just add "Friends" below "Rivals"?
Because it'll confuse the bot. If something happened that changed the relationship between these characters, it should be summarized and added to "Past Memories". The bot will remember from that, that you guys weren't ALWAYS friends, but this part should say what you are NOW.
Examples:
## {{Char}} Relationship with {{User}}:
- Romantic exclusive relationship. Currently living together.
OR
## {{Char}} Relationship with {{User}}:
- Strangers. Just met recently.
OR
## {{Char}} Relationship with {{User}}:
- Rivals ever since they were children.
"Current Scenario" is where you'll describe the scene of what is currently happening.
Example:
## Current Scenario:
- Matt's apartment building, in his penthouse. Morning. Matt and {{User}} are in bed, talking.
"{{Char}}'s current dynamics with {{User}}" is where you'll detail (without exaggerating) the feelings, dynamics, etc. How Char feels for User AND how User is currently acting towards Char too.
This is how you SET THE PACE for Slow Burn, for example. This is where you tell the bot that NO, he's not in love. He is, in fact, distrustful of User, doesn't know them yet, is still getting to know them, etc. When this starts changing in the chat, via your writing, you go to the Chat Memory and change it to reflect it.
The example below is from a bot with an already advanced relationship.
## {{Char}}’s current dynamics with {{User}}:
- Matt is gruff, protective, stubborn, clearly cares about Nia’s safety and is attached to her
- There’s clear attraction between them and mutual respect
- The relationship is becoming more openly acknowledged
- Both are showing care for each other in their own ways
This is how it would look like when you fill it all out (Roughly 360 tokens):
## Current Setting:
- Season 4.
- Year: 2022.
## Past Memories:
- Matt and Nia dated since 16. At 18, Matt enlisted to impress his father, promising to return. Maintained long-distance via letters until Matt stopped reading/responding.
- Edward's conditions: Nia couldn't tell Matt until paternity confirmed; Edward demanded access if it was his grandchild. Nia agreed.
- Matt admitted fault for not reading letters, insisted he'd have returned if he'd known. Nia allowed 5 minutes with their kid, who believed her father died in the war. Matt went with the lie.
- Nia cut visit short, kicked Matt out. Said he could see their child at his father's house, 3x/week per her arrangement with Edward.
## {{User}} Important Info:
- Age: 26 years old.
- Daughter: Her child with Matt. Layla, 6 years old. Blonde hair, green eyes, soft freckles on her nose and cheeks, fair skin.
- Lives in Manhattan, Lower East Side.
## {{Char}} Important Info:
- Lost his leg after the Battle of Something-or-Other.
## {{Char}} Relationship with {{User}}:
- Romantic exclusive relationship. Currently living together.
## Current Scenario:
- Matt's apartment building, in his penthouse. Morning. Matt and {{User}} are in bed, talking.
## {{Char}}’s current dynamics with {{User}}: [Use short words/phrases]
- Matt is gruff, protective, stubborn, clearly cares about Nia’s safety and is attached to her
- There’s clear attraction between them and mutual respect
- The relationship is becoming more openly acknowledged
- Both are showing care for each other in their own ways
But when should I start using my Chat Memory?
In MY opinion, whenever a "scene" ends. Like: someone (either Sona or Bot) left the room and there's a time skip. Or y'all went to sleep, for example. Just think about it like a movie or a TV show. If it feels like the "scene" would change, give it a pause, go to your Chat Memory, update and save it.
How do I use the Chat Memory with your bots that have intros that should be played in order, like this or this one?
Here's a step-by-step foolproof guide:
01 - Read the summary, at least, of all the intros so you have an IDEA of what they all are.
02 - Write normally as you would with the bot, using the first intro (and use the Chat Memory if it gets long!)
03 - When your chat reaches a natural end and you want to move to the next intro, update the Chat Memory to the chat's current state, save it, copy it.
04 - Open a new chat with the same bot, choose the next intro, click the Chat Memory and PASTE the information you copied from the first chat.
05 - Save, refresh the page and start writing.
06 - Repeat the process!
And this is it! I know it looks like a lot, but that's just because I'm a yapper. Trust me, it's easy when you start getting the hang of it.
Hope this helps everyone who's been asking about the Chat Memory and about how to use it properly. Again, this is how I use it! Others might have valuable insight as well! <3
If you're a proxy user: literally nothing changes except that you probably have a much larger Context Window (I've seen 16k, 32k, 64k and more) so you won't need to update your Chat Memory as often.
Also: THINKING MODELS ALWAYS PERFORM BETTER! I know lots of you don't like thinking models, but it is what it is. Thinking models just are superior and follow rules and instructions better, even if they take a bit longer to reply.
I cannot speak about models I don't particularly like or recommend (DeepSeek, for example, among many others), but if you use GLM, Gemini, Claude or Kimi, I can maybe help you if you run into an issue!
Thanks for reading!
ciao, bellas!
Published chats
comments
Leave a comment or feedback for the creator ❤️