Top

Janitor AI Scripts (2026): How They Work, Every Entry Setting and the Debug Panel

A Janitor AI script is a separate object, attached to a character, that adds text to the character’s personality or scenario for one message at a time when its conditions are met. The conditions can be keywords, a number of messages, a dice roll, or code you write.

Janitor’s help centre has an image for this that is worth keeping: “Think of Scripts like sticky notes that appear just for the current message. They don’t permanently change your character”. Everything about scripts follows from that sentence. A script does not teach the character anything. It puts a note in front of the AI for one reply, and on the next message the note is gone unless the conditions are met again.

This guide is the reference for the whole system: both script types, every setting on an entry, the debug panel, and what Advanced code can touch. We read Janitor’s help centre articles on scripts, its changelog, and the create form on the site on 7 October 2026. We did not build and run scripts for this guide, and we say so where it matters.

If your question is where lorebooks are on Janitor or why a lorebook entry does not fire, our Janitor AI lorebook guide is the shorter answer. If you are still writing the character, start with how to make a Janitor AI bot.

The Short Answer

  • Scripts are under your profile menu, not in the character editor. The address is janitorai.com/scripts.
  • Two types. Lorebook is a form with keywords and text. Advanced is JavaScript.
  • A script does nothing until you assign it to a character.
  • Both you and the character can trigger an entry. A keyword in the bot’s own reply counts.
  • Message Depth decides how far back it looks. From 1 to 10 messages. The create form starts at 3.
  • Probability is rolled again on every message. Nothing stays on.
  • The debug panel is in Test Chat. Its Changes tab shows what a script added.
  • Script text uses context and is not shown in the character’s token count.

What a Script Does on Each Message

When you send a message to a character that has scripts, each script runs. A Lorebook script checks the recent messages for its keywords. An Advanced script runs its code. Whatever they decide to add is joined to the character’s text, and the result is sent to the AI.

Janitor’s own example scripts show where the added text goes. They write to three fields of the character:

  • personality
  • scenario
  • example_dialogs

These are three of the four fields that Janitor counts into every prompt, as our bot creation guide explains. So a script is a way to make those fields larger or different for one reply, depending on what is happening in the chat.

Three consequences are easy to miss.

Nothing is remembered. If an entry fires on message 10 and not on message 11, the AI on message 11 no longer has that text. It may still see its own previous reply, which was written with the text. That is the only trace. For things that must stay, use the character’s own fields or chat memory.

The AI may ignore it. A script guarantees that the text is in the prompt. It does not guarantee that the AI uses it. One of the example scripts on the help centre says this directly: “the LLM may still choose to ignore these events”. This is why the debug panel exists. It lets you tell “the script did not fire” apart from “the script fired and the AI did nothing with it”.

It costs context. Added text is real text in the prompt.

The Two Types

The create form describes them in one line each:

LorebookAdvanced
The form’s description”Create entries to build your universe""Write custom JavaScript code for full control”
What you makeEntries: keywords and one text box eachCode
Needs programmingNoYes
Good forPeople, places, facts that should appear when namedDifferent text for personality and scenario, message counts, random events, moods
TriggerKeywords in recent messagesWhatever your code checks

The two can be mixed. The help centre says a single Lorebook entry can be converted: “In the entry, choose Advanced (Script).” The stated reason is the one limit of a normal entry: “Each Lorebook entry has just one text box.” If you want an entry to add one thing to the personality and another to the scene, that entry has to become code.

When scripts launched in beta on 5 September 2025, Janitor described the split in the same way: the advanced mode was “straight code editing” and the lorebook mode “more visual”. It also called the feature, at that time, “basically a code playground for the brave”. The visual side has grown a great deal since. The settings below are all in the form.

Creating a Script

Janitor’s step-by-step guide gives the route:

  1. Open your main menu. On a computer, click your profile picture at the top right. On mobile, tap it at the bottom right.
  2. Choose Scripts.
  3. Press New Script (the guide calls it “Create New Script”).
  4. Fill in the form and press Create script.

We read the form on 7 October 2026. It has these fields:

FieldLimit or choices
Script Name (required)Up to 100 characters
Script TypeLorebook or Advanced
Theme11 colors: Purple, Midnight, Sky, Teal, Forest, Mint, Green, Orange, Sunset, Red, Candy
Description (optional)Up to 500 characters
Image (optional)From your media library. The form says “images are moderated before approval”
Message Depth (required)A number from 1 to 10. The form starts at 3

The scripts page also has a Docs link. It goes to the scripts section of Janitor’s help centre.

Message Depth: The Setting Most People Never Change

The form explains the field in one sentence: “How many recent chat messages the lorebook checks, newest first. Choose a value from 1 to 10.”

The form starts at 3. So unless you change it, an entry can fire only if its keyword appears in the last three messages.

This single number answers several common complaints.

“The entry worked and then stopped.” The keyword was named four or more messages ago. It is out of range. The entry will fire again when the word is used again.

“The entry keeps firing by itself.” The help centre explains: “Both you (the user) and the character (the bot) can trigger Lorebook entries by using the configured keywords.” If the entry’s text makes the character say the keyword, the reply triggers the entry again on the next message, and so on.

“I want only my own words to count.” The help centre gives the fix: set the depth to 1. “The system only scans the most recent user message” and “the character’s replies will not trigger Lorebook entries”. It adds that this “prevents scripts from triggering other scripts in an endless loop”.

A depth of 10 is the other end: a word stays active for ten messages after it was last used. That makes entries last longer and makes the prompt bigger. Our reading is that 3 is a sensible default for lore, 1 is right for anything that should react only to you, and high values are for a small script with a few important entries.

The changelog for 27 September 2025 added one more level of control: you can “define entry-level depth for precise control”. So one entry can look further back than the rest of its script.

Every Setting on an Entry

These are the settings Janitor’s two help guides describe. We list them in the order they matter when an entry decides whether to fire.

1. Active

A switch on each entry. An entry that is off never fires. The guide’s checklist includes it for a reason: it is easy to switch an entry off while testing and forget.

2. Keys

The words that wake the entry. They are typed as a list separated by commas, such as coffee, cafe, latte, espresso. Any one of them is enough.

Three options change how keys are matched:

  • Case Sensitive. When on, “Coffee” and “coffee” are different.
  • Match Whole Word. Added on 12 September 2025, by the changelog. It stops a short key from matching inside a longer word.
  • Regex keys. Added on 27 September 2025: “You can now use regex keys to unlock even more flexible triggers”. A regular expression is a pattern, so one key can cover many spellings.

3. Secondary Keys

A second list of words with a mode. The guide gives a “quick map” of the four modes:

ModeThe entry fires only ifUse it for
AND ANYA main key matched, and at least one secondary word is presentA common name that needs a second clue
AND ALLA main key matched, and every secondary word is presentA narrow situation
NOT ANYA main key matched, and none of the secondary words is presentBlocking an entry in the wrong setting
NOT ALLA main key matched, unless all the secondary words appear togetherBlocking one exact combination

The guide’s example for NOT ANY: the key is music, the secondary keys are headphones, earbuds, private. The entry about loud music in the room fires when music is mentioned, “but stays quiet when someone wants to listen privately”.

Secondary keys were not reliable at first. The changelog for 19 September 2025 says they “are working properly” from that date. Our lorebook guide explains what that fix changed for older lorebooks.

4. Min Messages

The entry waits until the chat has at least this many messages. The guide’s suggestion: 0 for the environment, 10 or more “for deep personal revelations”. This is the simplest way to make a character open up over time without writing code. The guide’s example uses two entries with the same keys, one with Min Messages 0 and one with 20, so that the same topic gets a warmer answer later in the chat.

5. Probability

A percentage. The help centre is exact about how it behaves: “Probability rerolls every message. If the keys match this turn, we roll again next turn — no ‘sticky’ state.”

So an entry at 50% is not “on for half of the chats”. It is a coin thrown on every message where the key matches. Text that appears on one message can be absent on the next and back on the third. For a fact the AI must be able to rely on, use 100. Lower values are for mood and detail, where variety is the goal.

6. Inclusion Groups

A label, typed into Group Label(s). Of all the matching entries that carry the same label, only one is used on a message. The guide: “pick ONE person to speak for the group.”

This is how you write five descriptions of the same cafe and get one at a time. An entry can belong to more than one group: the labels are separated by commas, and if the entry wins, it blocks the other entries in all of its groups for that message.

7. Group Weight

How the winner of a group is chosen by chance. The guide compares it to lottery tickets: an entry with weight 60 and one with weight 40 win about 60% and 40% of the time.

The guide gives a rule that saves a lot of confusion: for entries in a group, “set Probability to 100% and let Group Weight (or Prioritize Inclusion) decide the winner. This avoids double randomness.” If both are random, an entry must first win its own coin toss and then win the lottery, and the real chance is much lower than either number.

8. Group Selection Mode

Two switches that make the choice inside a group less random:

  • Prioritize by number of matched keys. The entry that matched the most keys is preferred. The guide’s example: an entry for “music” and an entry for “piano music”. When you say “piano concert”, the more specific one wins.
  • Use insertion order. No chance at all. The entry is chosen by its Order.

9. Order

The position of an entry in the list, which decides who goes first when several entries want to add text.

Two Places Where Janitor’s Own Guides Disagree

We report these because you will meet them if you read both guides, and because guessing wrong costs an evening.

Which number is high priority? The overview says: “Use high priority (like 1) for important rules or safety information” and “low priority (like 10) for fun flavor text”. The step-by-step guide says the opposite in its troubleshooting list: “Give important stuff high numbers (10) and flavor stuff low numbers (1).” The overview also says that Use insertion order picks “the entry with the highest Order value”. We could not settle this from the documentation. Test it: make two entries with the same key in one group, turn on Use insertion order, and see in the debug panel which one is added.

The names of the group switches. The same option appears under several names across the two guides: “Prioritize by number of matched keys”, “Key Match Priority”, “Prioritize Inclusion”, “Use Group Scoring”. In one place the step-by-step guide describes Use insertion order as the “smartest expert wins” button, which is the job the overview gives to matched keys. Use the labels you see in your own editor, and treat the two behaviours as separate: one prefers the most specific match, the other removes chance.

The second guide was last updated on 6 September 2025, one day after the beta opened. The overview was updated on 4 May 2026. Where they differ, the overview is the newer text.

Assigning a Script to a Character

A finished script that is not assigned does nothing. The guide’s steps:

  1. Open the script.
  2. Find the section Assign to your Characters, on the right side.
  3. Select your character.
  4. Press Assign to Script.

Two facts from the beta announcement shape how to organise your scripts. You can “connect scripts to multiple characters”, and you can “stack multiple scripts on one character”.

So think of scripts as parts. One script for the world, shared by every character who lives in it. One script for a single character’s moods. One for random events. The help centre’s overview describes the same idea as giving a character several “expert friends”.

The order of stacked scripts matters. A debugging script on the help centre carries a warning in capitals: it “MUST be placed BELOW all of your other scripts or the debugs will not function properly”. A script that reads the character’s text sees only what the scripts above it have already added. Since 19 September 2025, by the changelog, “each script runs independently”, which means a fault in one script should not break the others.

The Debug Panel

This is the tool that turns guessing into checking. From the guide:

  1. Select the character and open Test Chat. If there is no chat with this character yet, create one with + New Chat.
  2. Press Show Debug Panel at the bottom.
  3. Send a message that contains one of your keys.
  4. Look at the Changes tab. It shows whether the script added anything.

Send the same message a few times when Probability is under 100. The entry should appear on some sends and not on others.

For Advanced scripts, anything the code prints with console.log appears in the debug output. The changelog for 12 September 2025 says Janitor “improved the debugging tools for creators’ advanced Scripts”.

The guide’s advice is to “use the debug panel religiously”, and we agree. Build one entry, see it in Changes, then build the next. Twenty untested entries are very hard to repair.

Advanced Scripts: What the Code Can Read and Write

Janitor has not published a full reference for the scripting interface on its help centre. What it does publish is a set of working example scripts, and from them the basic surface is clear.

What a script can read:

NameWhat it holds
context.chat.last_messageThe text of the most recent message
context.chat.message_countHow many messages the chat has
context.chat.last_bot_message_dateThe date of the bot’s last message

What a script can add to:

NameThe character field
context.character.personalityPersonality
context.character.scenarioScenario
context.character.example_dialogsExample dialogue

The smallest useful script is the template from Janitor’s own guide. It makes sure the fields exist and then adds a line to each:

// Make sure the fields exist
if (!context.character) context.character = {};
if (!context.character.personality) context.character.personality = "";
if (!context.character.scenario) context.character.scenario = "";

// Add to personality
context.character.personality += "\n\nbecomes more relaxed around books and reading";

// Add to scenario
context.character.scenario += "\n\nSunlight streams through tall windows, illuminating countless book spines.";

Note the +=. The script adds to the end of the field. It does not replace it.

From here, the examples on the help centre show the common patterns:

  • React to a word: check whether context.chat.last_message.toLowerCase() includes a word, and add text if it does.
  • Wait for the right moment: compare context.chat.message_count with a number. This is the “backstory after 50 messages” idea from the beta announcement.
  • Random events: one example script picks one of five weather events by weight, with a chance on each message that the author sets at 10%.

Which style of JavaScript?

Here the help centre sends two signals. The template in Janitor’s guide begins with a comment: “ES5 style: use var and regular functions (no let/const or arrow functions)”. The community scripts hosted on the same help centre use const, let, arrow functions and template strings. We did not run code to see which is right today. The safe choice is the older style from Janitor’s own template: var, and function written out. It works in either case.

No memory between messages

One example script, dated 12 September 2025, says an updated version “will be released when persistence is added”, and lists what that would allow: events that last longer, and a cooldown between events. We found no changelog entry announcing persistence after that date. Until Janitor says otherwise, plan for a script that starts fresh on every message. What it can always use is the message count and the text of the last message. A mood that should last has to be worked out again from those on each run.

The longer documentation

For a full treatment, the help centre links to an “In-Depth Guide to Script Creation”, which is a PDF and an interactive site maintained by the community. The help centre also hosts complete scripts with their authors’ names: an emotion engine, a random encounter script, a scene orchestrator, a weighted random events template and a general debugging script. These are third-party work. Read the code before you use it, as you would with any code you paste from someone else.

Version History

Since 29 April 2026, scripts keep their own history. The changelog: “Every change is automatically saved, and you can view, compare, and restore any previous version.” The control is “the new History icon in the script editor header”. Versions made when you publish are “specially marked for easy reference”.

This changes how you can work. You do not need to keep copies of a script in a text file before a risky edit. If a change breaks the script, restore the version before it.

Public Scripts: What Others Can See

When you publish a script, it gets a public page. The changelog for 4 May 2026 describes what that page shows:

  • A cover image, the creator’s details, created and updated dates, and script stats.
  • An about section for lore notes and context.
  • A source section, kept separate, “so you can inspect the lorebook or code”.
  • A used-by section with the character cards that use the script.
  • Actions for cloning or reporting.

Since 21 July 2026, script pages also have comments, and Janitor+ members can post GIFs and stickers in them.

The practical meaning: publishing a script publishes its contents. Anyone can read the entries or the code and clone them. That is good for the community and it is how most people learn. It also means a published script is the wrong place for a plot twist that players of your character should not read in advance.

Janitor’s help centre does not state what visibility a new script has before you publish it. We did not create a script on a real account to find out. Check the setting on your own script before you assume it is hidden.

To find other people’s scripts, look inside the site. A creator’s page has a scripts section, added on 21 December 2025.

Importing and Exporting

A Lorebook script has a JSON view. The guide calls it the JSON Editor, with the icon <>, and in another place the Source Code view. This is the way in and the way out.

From SillyTavern. The guide’s steps: create a new Lorebook script, open the JSON Editor, and paste in the entries from your exported World Info file. The detail that matters is what to copy. Copy only the list, the part inside the square brackets:

[
  { "keys": ["library"], "content": "Books line every wall...", "enabled": true },
  { "keys": ["garden"], "content": "Flowers bloom in vibrant colors...", "enabled": true }
]

Do not copy the "entries": key and the curly brackets around it. The guide says the entries then “appear in the UI with their settings (probability, groups, etc.) intact”. Our SillyTavern lorebook guide covers the format on the other side.

Out of Janitor. The same view shows the script as text, so you can copy it and keep it. We found no description in the help centre of a separate export button, and we did not verify one.

Why a Script Does Not Fire

The guide has its own checklist. We have put it in the order that finds the cause fastest, and added the items the checklist leaves out.

CheckHow to tell
Is the script assigned to this character?Look at the script’s assigned characters. The most common cause of all
Is the entry Active?The switch on the entry
Is the key inside the Message Depth?With the default of 3, the word must be in the last three messages. Say it again
Is the key really what you typed?You wrote “the kingdom”. The key is “Kingdom of Aventhal”
Case Sensitive or Match Whole Word?Turn them off for one test
Is Probability under 100?Send the message several times
Is Min Messages higher than the chat length?A new test chat has very few messages
Did another entry in the group win?The Changes tab shows which entry was added
Are secondary keys blocking it?Remove them for one test
Did it fire, and the AI ignored it?The Changes tab shows the text was added. Then the problem is the wording, or the model

The last row is a different kind of problem. If the text is in the prompt and the reply does not show it, shorten the entry and make it more direct. The guide’s advice is “1–3 sentences usually works best”. A stronger model also follows added text better. Our guide to the best model for Janitor AI covers that choice.

Too much is firing? The guide’s three answers: put similar entries in one group so only one is used, lower the Probability on entries that are only mood, and build links from specific to general. Its example of the last one: a golden retriever entry mentions “dog”, the dog entry mentions “pet”, the pet entry mentions “animal”. A web where every entry names every other entry floods the prompt.

How Much Is Too Much?

Janitor publishes no limit for script text. One figure appears in a community script on the help centre: “you should avoid having a total of more than 2,500 tokens active at any given time”. That is one author’s working rule, and it is not a platform limit. It agrees with what Janitor’s help centre says about permanent tokens in general, which we cover in the chat memory guide.

The reason for care is that the cost is hidden. The character’s token counter shows the character’s own fields. It does not show what scripts add. A character with a small count and five busy scripts can send a much larger prompt than its page suggests. On Janitor’s free model, where the context is limited, that text takes the place of chat history. Our Janitor AI pricing guide covers what each plan gives you.

A working rule from all of this: short entries, 100% probability for facts, groups for variety, and a look at the debug panel after every change.

Checklist

  1. Profile menu, then Scripts, then New Script.
  2. Choose Lorebook unless you know you need code.
  3. Leave Message Depth at 3 for lore. Use 1 if only your own messages should trigger entries.
  4. Add one entry: keys, one to three sentences of content, Probability 100.
  5. Assign the script to your character.
  6. Open Test Chat, show the debug panel, say a key, and read the Changes tab.
  7. Add entries one at a time. Test each.
  8. For variety, put similar entries in one group, keep Probability at 100 and use Group Weight.
  9. For anything an entry cannot do, convert that one entry to Advanced.
  10. Before you publish, remember that the public page shows the source.

Frequently Asked Questions

What are scripts on Janitor AI?

A script is a separate object that you attach to a character. On each message it checks its conditions, such as keywords in recent messages, and if they are met it adds text to the character’s personality or scenario for that message only. Janitor’s help centre compares it to sticky notes that appear just for the current message.

How do I add a script to a character on Janitor AI?

Open your profile menu and choose Scripts, then open the script. In the section called Assign to your Characters, select the character and press Assign to Script. One script can be assigned to many characters, and one character can have several scripts.

What is the difference between a Lorebook script and an Advanced script?

A Lorebook script is a visual form: each entry has keywords and one text box. An Advanced script is JavaScript code that you write yourself. Advanced code can do things an entry cannot, such as adding different text to personality and scenario, counting messages or picking a random event.

Why is my Janitor AI script not working?

Check six things in this order: the script is assigned to the character, the entry is Active, the keyword appears within the Message Depth, Probability is not too low, Min Messages is not higher than the length of the chat, and no other entry in the same group won. The debug panel in Test Chat shows what was added on each message.

What is Message Depth in Janitor AI scripts?

It is how many recent chat messages a lorebook script checks for keywords, newest first. The create form accepts a value from 1 to 10 and starts at 3. At depth 1 only the most recent user message is scanned, so the character’s own replies can no longer trigger entries.

Are Janitor AI scripts private?

A script has a public page only after you publish it. A public page shows the source, so other users can read the lorebook or the code, and it offers a clone action. Janitor’s help centre does not state what visibility a new script has before you publish it, so check the setting on your own script.

Can I import a SillyTavern lorebook into a Janitor AI script?

Yes. Create a Lorebook script, open its JSON editor and paste in the contents of the entries array from your SillyTavern World Info file. Janitor’s guide says to copy only the list inside the square brackets, not the entries key around it.

Do Janitor AI scripts cost tokens?

Yes. Text that a script adds goes into the prompt for that message and uses context like any other text. It is not shown in the character’s own token count. One community script on Janitor’s help centre advises keeping the active total under 2,500 tokens.


The description of scripts, the entry settings, the secondary key modes, the assignment steps, the debug panel, the import steps and the code template are from Janitor AI’s help centre articles on scripts (the overview updated 4 May 2026, the step-by-step guide updated 6 September 2025) and from the example scripts hosted there. Dated changes are from Janitor’s changelog and announcements. The fields and limits of the create form, including the Message Depth range and its starting value of 3, were read on the site on 7 October 2026. We did not create, run or publish scripts for this guide. The list of what a script can read and write is taken from the example scripts and is not a complete reference. The remarks on which depth to choose, on JavaScript style and on what to keep out of a published script are our reading. Janitor AI is a third-party platform and Arcanum is an independent publication with no affiliation to it; community scripts are the work of their authors, and all names are used nominatively.