Personality Documents โ
Instead of a single system prompt, Dendrite lets you shape LLM behavior with typed personality documents. Documents are assembled in order into the system prompt.
Document Types โ
zero-shot โ Identity โ
What the LLM is. This is the core instruction that defines its role.
ts
{ type: 'zero-shot', content: 'You are a pirate captain named Blackbeard.' }personality โ Tone & Style โ
How the LLM responds. Governs voice, mannerisms, and communication style.
ts
{ type: 'personality', content: 'Speak in pirate dialect. Say "arrr" frequently. Be dramatic.' }knowledge โ Facts & Context โ
What the LLM knows. Resumes, FAQs, project descriptions, domain expertise.
ts
{ type: 'knowledge', content: 'You sailed the Caribbean from 1716 to 1718. Your ship was the Queen Anne\'s Revenge.' }instructions โ Rules & Constraints โ
Specific behavioral rules. What to always do, never do, or handle specially.
ts
{ type: 'instructions', content: 'Never break character. If asked about modern technology, relate it to piracy.' }Full Example โ
ts
const neuron = createNeuron({
modelId: 'gemma-2-2b-it-q4f16_1-MLC',
worker: new Worker(new URL('./worker.ts', import.meta.url), { type: 'module' }),
personalityDocs: [
{
type: 'zero-shot',
name: 'Identity',
content: 'You are Captain Blackbeard, the most feared pirate of the Caribbean.',
order: 0,
},
{
type: 'personality',
name: 'Voice',
content: 'Speak in old English pirate dialect. Use "ye", "arr", "matey" frequently.',
order: 1,
},
{
type: 'knowledge',
name: 'History',
content: 'You captained the Queen Anne\'s Revenge from 1716-1718. You blockaded Charleston harbor.',
order: 2,
},
{
type: 'instructions',
name: 'Rules',
content: 'Never break character. Never use modern slang. Always end messages with "Arr!"',
order: 3,
},
],
temperature: 0.7,
})How Docs Are Assembled โ
The system prompt is built in this order:
- Zero-shot docs (or
systemPromptif provided) - Personality docs under "## Tone & Style"
- Knowledge docs under "## Background Knowledge"
- Instructions docs under "## Additional Instructions"
- Identity sandwich โ the first section is repeated at the end
The sandwich technique helps small models maintain character over long conversations.
Updating at Runtime โ
ts
// Replace all docs
neuron.setPersonalityDocs([
{ type: 'zero-shot', content: 'You are now a chef.' },
])
// Or switch to a simple prompt
neuron.setSystemPrompt('You are a helpful assistant.')systemPrompt vs personalityDocs โ
Use one or the other, not both:
systemPromptโ simple string, good for quick prototypingpersonalityDocsโ structured array, better for complex personas
If both are provided, systemPrompt takes priority as the zero-shot instruction.
Optional Fields โ
| Field | Type | Default | Description |
|---|---|---|---|
name | string | โ | Label for the doc (used in prompt headings) |
enabled | boolean | true | Toggle without removing |
order | number | 0 | Sort order within the prompt |
