← Roleplay terms explained

What does chat depth mean in SillyTavern?

Updated

Chat depth is a position in the prompt counted in messages up from the newest one. At depth 0 an inserted text goes after the last message; at depth 4 it goes above the last four. SillyTavern uses depth to place author's notes, lorebook entries and character notes inside the chat history, so they stay close to the reply however long the story grows. Lower depth means stronger influence.

Try it now, free, no account neededStart a story with Ophelia MarshThe lord is dead. The maid knows every secret in the house.

How depth is counted

Take a chat with ten messages, M1 to M10, where M10 is the newest. An insertion lands here:

  • Depth 0: after M10, the very last thing the model reads before replying.
  • Depth 1: between M9 and M10.
  • Depth 4: between M6 and M7.
  • Depth 20: the chat is shorter than that, so it goes at the top of the history.

Every message counts, whoever wrote it. When M11 arrives, everything inserted at a depth slides down with it, keeping the same distance from the bottom.

An example lorebook entry at depth

Say you play a Victorian mystery with Ophelia Marsh, and she must keep a secret that should colour her replies without ever being said outright. A lorebook entry might read:

[Ophelia's locket holds a photograph of her drowned sister. She touches it when lying and never opens it in company.]

Set its position to in-chat at depth 3, with the system role. Each time the keyword "locket" comes up, the entry appears three messages from the bottom, close enough to shape the next reply and far enough that she does not recite it. At the top of the prompt, the same line would compete with the whole card and fade in a long chat.

What uses depth in SillyTavern

  • The author's note, when placed in the chat at a depth.
  • World Info and lorebook entries whose position is set to "at depth", often shown as @D.
  • The character's note in a card's advanced definitions, which travels with the card in its extension data.
  • Prompt blocks in a Chat Completion preset that you set to an in-chat position.

Each can also take a role (system, user or assistant) for Chat Completion APIs. Labels can change between versions, so look for "depth" or "@D" if a menu moved.

Insertion depth versus scan depth

Lorebooks have a second, unrelated number: scan depth. That is how many recent messages are searched for an entry's keywords. With scan depth 2, an entry only switches on if its keyword appears in the last two messages; insertion depth then decides where the switched-on entry goes. People tune one when they meant the other surprisingly often.

Choosing a depth, and common mistakes

  • Depth 0 to 1: strongest. Good for a one-off nudge, but models sometimes echo the text or answer it as if you said it.
  • Depth 2 to 4: the usual range for notes and scene state.
  • Depth 5 to 10: background facts that should stay in reach without dominating.

Common mistakes: piling several entries at the same low depth so they crowd the reply; using the assistant role at depth 0, which can make the model think it already wrote the text; forgetting that depth counts messages, not tokens, so one huge message moves everything far away; and writing long insertions where one sentence would do.

Depth and speed on UnsavedAI

UnsavedAI reuses the start of a prompt between messages, so the next reply only reads what is new, as long as that start stays the same. Lore that switches on and off near the top breaks that and makes the whole chat be read again. Putting changeable entries at a chat depth keeps the beginning stable. The context guide covers the rest of the prompt.

Questions people ask

What is the default depth for an author's note?

It is often 4 in SillyTavern, but defaults can change between versions, so check the field in yours.

Do other apps use chat depth?

Apps that read Character Card V2 and lorebook files may honour depth settings stored in them; others ignore them and place everything near the top.

Does depth count hidden or system messages?

It counts the messages that are actually sent in the prompt. If something is hidden from the prompt, it is not counted.

Characters for this story