Skip to main content

Archetype System

The Archetype System wraps the existing Collective Best Practices (CBP) injection engine with Jungian archetype filtering. Every pattern injected into your session is classified into one of four archetypes and scored based on your current context, ensuring the most relevant patterns rise to the top.
Archetype classification is fully deterministic — no LLM calls are made. Context fields (outcome, observation type, consecutive failures) are mapped directly to archetype weights using a fixed algorithm.

The Four Archetypes

Label: Shadow WarningThe Shadow represents the hidden or unconscious negative side — things that can go wrong if you are not careful.Pattern Types:
  • anti_pattern — Common mistakes to avoid
  • security_warning — Security vulnerabilities and risks
  • gotcha — Surprising behaviors that catch developers off-guard
When Dominant: Error/failure contexts. When a tool call fails, Shadow patterns are boosted (1.2x multiplier) to surface warnings about what went wrong.Example: “NEVER run git push --force to main without checking CI status first — caused production data loss for 3 teams.”

How Weight Calculation Works

Archetype weights are determined by a fixed algorithm that examines context fields. No machine learning or LLM is involved.

Weight Selection Rules

All weights are shown after normalization (each row sums to 1.0):
In error/failure contexts, Shadow receives a 1.2x boost and Sage receives a 1.1x boost before normalization. The pre-normalization values are Shadow=0.48, Sage=0.44, Hero=0.10, Trickster=0.10 (sum=1.12), which normalize to the values shown above.

Scoring Formula

Each pattern receives a composite score:
  • archetypeWeight: From the context-based weight table above (0.0-1.0)
  • confidence: The pattern’s CBP confidence score (0.0-1.0)
  • similarity: Vector similarity between the query and the pattern (0.0-1.0)
Patterns are sorted by this composite score in descending order, then capped at 2 patterns per archetype and a global maximum (default: 5 total).

Input Context

The archetype router accepts these optional context fields:

API Reference

Response:

SDK Usage

MCP Tool

The pluggedin_memory_search_with_context MCP tool provides the same archetype-aware search:

Backward Compatibility

The archetype system is fully backward compatible:
  • Existing injection API: Unchanged. If ARCHETYPE_ENABLED=false, the standard injection engine is used and all patterns are labeled as sage by default.
  • Existing patterns: All previously stored patterns continue to work. They are classified into archetypes at query time based on their patternType field.
  • Existing MCP tools: pluggedin_cbp_query and pluggedin_cbp_feedback are unaffected.

Configuration

Next Steps

Synchronicity Detection

How patterns are discovered from temporal events

Dream Processing

How related memories are consolidated