Inkstone LogoInkstone
v0.1.7 Documentation / Prompt Engine

The Prompt Engine

How Inkstone assembles prompt layers, preserves priority content, and trims safely.

04

The Prompt Engine

The most complex system you'll never have to think about.

Every time you send a message, Inkstone assembles your system prompt, character card, lorebook entries, and chat history into one coherent block that gets sent to the AI. Here's how.

Tokens

The chunks an AI processes text in. ~4 characters per token. "Roleplay" = 2 tokens. A paragraph = ~75.

Context Window

The AI's working memory. A desk with limited space. When it's full, something comes off the edge to make room.

Context Assembly Order

Every message you send, this stack gets built from top to bottom:

1
Pre-History Content
Your system prompt's opening section
2
Lorebook (Before Char)
World info injected before the character
3
Character Card
The full character — always protected
4
Lorebook (After Char)
World info injected after the character
5
Example Dialogs
First to go when space gets tight
6
Chat History
Your conversation — oldest trimmed first
7
Post-History Instructions
Character's final whisper
8
Post-History Content
MOST INFLUENTIAL position

The post-history position carries the most weight. Instructions placed there are the last thing the AI reads before responding — they have the strongest influence.

Want to understand why field placement matters? Read Understanding the Fields

That's the whole machine. Each system is designed to stay out of your way when you don't need it and be there when you do.