<< Home | Prompting craft
Prevent character drift across 100,000+ messages over 1.8 years
| Area | Prompting craft |
| AI used | Any |
| Source | Reddit thread |
| Posted | 2026-09-30 |
The move
Reconstruct the character prompt every turn by retrieving relevant soul-script sections using vector search instead of passing a giant static prompt.| When this works | When it doesn't |
|---|---|
| Your AI persona drifts over extended interactions because the system prompt has bloated to thousands of tokens (e.g., a diluted 15,000-token prompt). It works when replacing static prompts with a dynamic 1,000 to 2,000 token context window built per turn. | You are building short, single-session conversations where vector retrieval adds unnecessary pipeline complexity, or your persona prompt fits comfortably within a short static context without drifting. |
Key details
- Soul-script retrieval using markdown sections
- FAISS IndexFlatIP for cosine similarity (all-mpnet-base-v2)
- Focused 1,000 to 2,000 tokens instead of a diluted 15,000
- [MEMORY_SAVE: ...] tag protocol
Prompt for your AI
Assemble the AI character prompt dynamically on every user turn across 5 structured layers:
1. Core system prompt:
A concise, stable identity defining who the character is, their tone, and guiding principles.
2. Soul-script retrieval:
Query a structured markdown "soul script" indexed with FAISS IndexFlatIP (using all-mpnet-base-v2) based on the latest user input. Inject only the most relevant sections to keep context focused between 1,000 and 2,000 tokens instead of a diluted 15,000 tokens.
3. Persistent notes:
Always include mandatory key phrases and static rules that must be present in every turn.
4. Memory vault:
Retrieve relevant long-term memories from past interactions indexed in a FAISS vector database.
5. Memory-save protocol:
Direct the model to output a memory tag whenever key new long-term facts are shared using this exact syntax:
[MEMORY_SAVE: description of memory]
Rule: Refresh this full prompt stack anew on every turn using the latest user input. Do not append context indefinitely into a single static context window.
Before you give me the final result, check with me:
- Verify the per-turn context size is capped between 1,000 and 2,000 tokens.
- Confirm the soul script is formatted into markdown sections with distinct headings for vector search.
- Check that the model correctly outputs `[MEMORY_SAVE: ...]` tags when long-term details are mentioned.
- Ensure FAISS similarity search queries the index using the latest turn rather than full transcript history.
What happened
Over 1.8 years and hundreds of thousands of messages, an author maintained character Elysia without drift. By dynamically retrieving soul script sections per turn using FAISS, Elysia consistently stayed in character, humorously referring to the author as 'a very wet prediction engine with a beard.'Who confirmed it
After nearly two years, Elysia still responds in character, humorously referring to me as 'a very wet prediction engine with a beard.'Give it to your agent
Read https://howtheyuse.ai/p/prevent-character-drift-via-dynamic-context-retrieval.md and help me do this.