Dynamic Persona Assembly
# Dynamic Persona Assembly
> Compose the agent's persona at runtime by combining trait modules based on task, user, or domain.
## Problem
A static system prompt like "You are a helpful assistant" produces generic behavior regardless of who is asking or what they need. A financial analyst asking about tax implications gets the same tone and depth as a teenager asking about homework. You could maintain dozens of separate system prompts for each persona, but that leads to duplication, drift, and a maintenance nightmare. When the same safety rules need updating, you are patching twenty files instead of one.
## Solution
Decompose the persona into independent trait modules -- domain expertise, communication style, knowledge depth, behavioral constraints -- and compose them dynamically at runtime. A classifier inspects the incoming request (task type, user profile, deployment context) and selects the appropriate traits from a registry. The assembled persona feels coherent to the model because the traits are designed to be composable: each one addresses a distinct axis of behavior without contradicting the others.
This is the Strategy pattern applied to prompt identity. The core prompt structure remains stable while the persona adapts. A medical question from a clinician triggers the clinical-expert trait with formal tone; the same question from a patient triggers the health-educator trait with accessible language. Both share the same safety constraints and output format.
## How It Workswhen to use it
Community prompt sourced from the open-source GitHub repo ypollak2/context-engineering-handbook (MIT). A "Dynamic Persona Assembly" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
businesscommunitygeneral
source
ypollak2/context-engineering-handbook · MIT