Skip to content

Commit 659d9f0

Browse files
jddunnclaude
andcommitted
feat: add mood evolution and contextual prompt adaptation examples
- Mood-Adaptive Responses: GMIMood enum, moodAdaptation config, mood-specific prompts - Contextual Prompt Adaptation: dynamic prompt injection based on user skill level, task hints, meta-prompts for self-reflection 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 4dec42f commit 659d9f0

1 file changed

Lines changed: 85 additions & 0 deletions

File tree

README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,91 @@ for await (const chunk of agent.processRequest({ message: 'Explain OAuth 2.0 bri
424424
const fullResponse = chunks.join('');
425425
```
426426

427+
### Mood-Adaptive Responses
428+
429+
```typescript
430+
import { AgentOS, GMIMood } from '@framers/agentos';
431+
432+
const agent = new AgentOS();
433+
await agent.initialize({
434+
llmProvider: { provider: 'openai', apiKey: process.env.OPENAI_API_KEY, model: 'gpt-4o' },
435+
persona: {
436+
name: 'Support Agent',
437+
moodAdaptation: {
438+
enabled: true,
439+
defaultMood: GMIMood.EMPATHETIC,
440+
allowedMoods: [GMIMood.EMPATHETIC, GMIMood.FOCUSED, GMIMood.ANALYTICAL],
441+
sensitivityFactor: 0.7,
442+
// Mood-specific prompt modifiers
443+
moodPrompts: {
444+
[GMIMood.EMPATHETIC]: 'Prioritize understanding and emotional support.',
445+
[GMIMood.FRUSTRATED]: 'Acknowledge difficulty, offer step-by-step guidance.',
446+
[GMIMood.ANALYTICAL]: 'Provide detailed technical explanations with examples.'
447+
}
448+
}
449+
}
450+
});
451+
452+
// Agent automatically adapts tone based on conversation context
453+
for await (const chunk of agent.processRequest({
454+
message: 'This is so frustrating, nothing works!'
455+
})) {
456+
// Response adapts with empathetic tone, mood shifts to EMPATHETIC
457+
}
458+
```
459+
460+
### Contextual Prompt Adaptation
461+
462+
```typescript
463+
import { AgentOS } from '@framers/agentos';
464+
465+
const agent = new AgentOS();
466+
await agent.initialize({
467+
llmProvider: llmConfig,
468+
persona: {
469+
name: 'Adaptive Tutor',
470+
// Dynamic prompt elements injected based on runtime context
471+
contextualPromptElements: [
472+
{
473+
id: 'beginner-guidance',
474+
type: 'SYSTEM_INSTRUCTION_ADDON',
475+
content: 'Explain concepts simply, avoid jargon, use analogies.',
476+
criteria: { userSkillLevel: ['novice', 'beginner'] },
477+
priority: 10
478+
},
479+
{
480+
id: 'expert-mode',
481+
type: 'SYSTEM_INSTRUCTION_ADDON',
482+
content: 'Assume deep technical knowledge, be concise, skip basics.',
483+
criteria: { userSkillLevel: ['expert', 'advanced'] },
484+
priority: 10
485+
},
486+
{
487+
id: 'debugging-context',
488+
type: 'FEW_SHOT_EXAMPLE',
489+
content: { role: 'assistant', content: 'Let\'s trace through step by step...' },
490+
criteria: { taskHint: ['debugging', 'troubleshooting'] }
491+
}
492+
],
493+
// Meta-prompts for self-reflection and planning
494+
metaPrompts: [
495+
{
496+
id: 'mid-conversation-check',
497+
trigger: 'every_n_turns',
498+
triggerConfig: { n: 5 },
499+
prompt: 'Assess: Is the user making progress? Should I adjust my approach?'
500+
}
501+
]
502+
}
503+
});
504+
505+
// Prompts automatically adapt based on user context and task
506+
await agent.updateUserContext({ skillLevel: 'expert' });
507+
for await (const chunk of agent.processRequest({ message: 'Explain monads' })) {
508+
// Uses expert-mode prompt element, skips beginner explanations
509+
}
510+
```
511+
427512
---
428513

429514
## Roadmap

0 commit comments

Comments
 (0)