Skip to main content

Building Adapters

This guide explains how to build your own adapter for sxth-mind.

What is an Adapter?

An adapter defines domain-specific behavior for your application. It tells the Mind:
  • What identity types exist (e.g., sales rep styles, learning types)
  • What journey stages look like (e.g., prospecting → closing)
  • How to detect the current stage from state
  • What nudges to send when patterns emerge
  • How to build system prompts with domain context
The Mind handles everything else: state management, persistence, LLM calls.

Minimal Adapter

Here’s the simplest possible adapter:
That’s it. This adapter works, though it doesn’t do much domain-specific customization.

Full Adapter Example

Here’s a more complete example for a customer support domain:

Key Methods to Override

Required

Journey Stages

Stages define the user’s progression. Each stage should have:

Stage Detection

The detect_journey_stage() method determines which stage a user is in. You can use:
  • Explicit context: Check project_mind.get_context_field("stage")
  • Interaction count: project_mind.interaction_count
  • Momentum: project_mind.momentum_score
  • Days since activity: project_mind.days_since_activity
  • Progress data: project_mind.get_progress_field("key")
  • User patterns: user_mind.patterns

Identity Types

Identity types help personalize responses. Define traits that matter for your domain:
The Mind stores the user’s identity type in user_mind.identity_type and additional data in user_mind.identity_data.

Pattern Detection

Override update_after_interaction() to detect domain-specific patterns:

Nudge Templates

Nudges are proactive messages. Define templates with placeholders:

Testing Your Adapter

Using Your Adapter

Best Practices

Begin with basic stages, add complexity as needed. You can always add more identity types and stages later.
Make sure transitions happen when expected. Write unit tests for detect_journey_stage().
Tell the AI exactly how to behave at each stage. Vague guidance leads to inconsistent responses.
Only detect patterns you’ll actually use. Every pattern adds complexity.
Don’t spam; nudge when there’s real value. Users will mute aggressive nudges.