Psychodynamic Personality Matching API Service

CCRT + IPC Circumplex + Millon Schema Injection + Cosine Similarity Vector Engine

A comprehensive, research-supported framework for personality compatibility assessment via free-text content analysis

Luborsky CCRT Leary/Wiggins IPC Millon Subtypes Cosine Similarity Factor-Defensible

Table of Contents

  1. Theoretical Foundation & Literature
  2. Use Cases & Applications
  3. Psychodynamic Dictionary Structures
  4. CCRT Coding Schema (Luborsky)
  5. IPC Circumplex Positioning (Leary/Wiggins)
  6. Millon Personality Subtypes Dictionary
  7. Motive Scoring System
  8. Manipulation Pattern Detection Dictionary
  9. Content Analysis Coding Schemata
  10. Vector Space Model & Cosine Similarity Engine
  11. Bidirectional Match Algorithm
  12. CCRT Progress Notes Writer
  13. Semantic Similarity Engine
  14. API Endpoints Specification
  15. Interactive Demo
  16. Factor Analysis Defensibility

1. Theoretical Foundation & Literature

Scope Note: This document formalizes the psychodynamic structures implemented in the Eternal Bonds codebase into a standalone API service specification. Data directly extracted from source code includes: archetype CCRT profiles, IPC positions, subtype CCRT shifts and ideal/worst pairings (from src/data/compatibility.js), Millon subtype trait dictionaries (from src/data/subtypes.js), archetype metadata (from src/lib/archetypeData.js), manipulation pattern triggers (from lib/manipulationDetector.js), and personality schema injection prompts (from app/api/chat/route.js). The CCRT standard category dictionaries (W1-W14, RO1-RO10, RS1-RS10), motive scoring markers, content analysis pipeline, vector construction algorithm, cosine similarity matching engine, progress notes writer, and API endpoint specifications are formalized extensions — new systematic structures derived from the existing schema injections and grounded in the cited psychometric literature. API endpoints are proposed specifications for a future standalone service.

Core Frameworks

FrameworkSourceApplication
Core Conflictual Relationship Theme (CCRT)Luborsky, L. (1977, 1990, 1998). Understanding Transference: The CCRT MethodWish (W), Response of Other (RO), Response of Self (RS) extraction from free text
Interpersonal Circumplex (IPC)Leary (1957); Wiggins (1979, 1995); Horowitz et al. (2006). Interpersonal Problems IIP-642D geometric personality positioning: Dominance (vertical) x Affiliation (horizontal)
Millon Personality SubtypesMillon, T. (1996, 2011). Disorders of Personality: DSM-IV and Beyond31 clinical subtypes across 10 archetype families for fine-grained personality typing
Cosine SimilaritySalton, G. (1989). Automatic Text Processing; Turney & Pantel (2010)Vector-space match scoring between personality profiles
Factor Analysis (CFA/EFA)Fabrigar et al. (1999); Brown (2015). CFA for Applied ResearchEmpirical defensibility of a priori factor selections
Structural Analysis of Social Behavior (SASB)Benjamin, L. S. (1974, 1996)Complementary to IPC — provides transitive/intransitive action coding
Attachment TheoryBartholomew & Horowitz (1991)4-category model maps cleanly onto IPC quadrants

Key Principle: CCRT + IPC Integration

Luborsky's CCRT provides the content of relational patterns (what people want, expect, and do). The IPC provides the geometric structure (where these patterns live in interpersonal space). By mapping CCRT components onto IPC coordinates, we achieve both clinical depth and mathematical tractability for cosine similarity computation.

2. Use Cases & Applications

Romantic Matching (Dating Apps)

Analyze user bios, messages, and prompt responses to extract CCRT profiles. Calculate bidirectional compatibility with ideal/worst match prototypes. Surface "complementary CCRT" matches (e.g., Wish-to-provide alignment).

Team Selection & Composition

Profile team members via written communication samples. Identify IPC clustering (all dominant = conflict). Optimize for IPC distribution and complementary CCRT patterns. Flag collusive bond risks.

Hiring & Organizational Fit

Content-analyze cover letters, interview transcripts, and writing samples. Match candidate personality vectors against ideal-role prototypes. Detect manipulation patterns in self-presentation.

University Admissions

Analyze personal statements and essays for CCRT themes and motive patterns (Achievement, Affiliation, Power). Predict cultural fit and peer compatibility.

Therapist-Client Matching

Match therapist IPC style with client needs. Avoid complementary collusion (e.g., dominant therapist + dependent client reinforcing pathology). Optimize for therapeutic alliance factors.

Mentorship Pairing

Analyze mentor/mentee communication styles. Match for productive CCRT complementarity (mentor provides what mentee wishes for). Monitor relationship health over time.

Roommate & Cohabitation Matching

Profile living-style preferences and conflict resolution patterns. IPC proximity predicts daily friction. CCRT worst-match detection prevents explosive pairings.

Co-Founder / Business Partner Selection

Analyze pitch decks, emails, and meeting transcripts. Detect motive alignment (shared Achievement motive) and IPC complementarity (one dominant + one affiliative = optimal).

Conflict Mediation & Resolution

Map disputants on IPC to identify positional rigidity. Extract CCRT themes to find the underlying Wish driving the conflict. Design interventions targeting the RO/RS cycle.

Social Media Personality Analysis

Aggregate public posts, comments, and interactions. Extract longitudinal CCRT shifts. Build personality timelines. Detect manipulation pattern frequency and severity trends.

Customer Success & Support Matching

Profile support agents and customers. Route dominant customers to affiliative agents. Detect escalation risk via IPC angular distance.

Educational Group Formation

Optimize study groups and project teams. Balance IPC distribution for productive conflict. Match complementary CCRT profiles for peer learning.

3. Psychodynamic Dictionary Structures

3.1 Archetype Dictionary (10 Families)

Each archetype family represents a primary personality organization pattern from Millon's taxonomy, mapped to clinical names and game-universe display names.

Archetype IDClinical NameDisplay NameCore DescriptionBond Effect (Ego/Emp/Inf)
NARCISSISTICNarcissistic PDThe EmperorSelf-absorbed charm that demands admiration+2 / -1 / +1
DEPENDENTDependent PDThe DevotedDesperate need for connection and approval-1 / +2 / -1
BORDERLINEBorderline PDThe StormIntense emotions that split between extremes0 / +1 / +1
HISTRIONICHistrionic PDThe StarDramatic flair demanding constant attention+1 / 0 / +2
AVOIDANTAvoidant PDThe ShadowWithdrawn soul hiding from connection-1 / +1 / -2
SCHIZOIDSchizoid PDThe VoidEmotionally detached, preferring solitude0 / -2 / 0
ANTISOCIALAntisocial PDThe PredatorPredatory manipulation without remorse+2 / -2 / +2
PARANOIDParanoid PDThe WatcherHypervigilant distrust of everyone+1 / -1 / 0
OBSESSIVE_COMPULSIVEOCPDThe PerfectionRigid control masking deep anxiety+1 / -1 / +1
PASSIVE_AGGRESSIVEPassive-Aggressive PDThe ThornHidden hostility behind a pleasant mask0 / 0 / +1

3.2 Severity / Intensity Levels (Gacha Rarity Mapping)

LevelClinical SeverityRarity LabelStarsPull RateTrait Expression
1TraitCommon160%Subclinical personality style, adaptive
2SubclinicalUncommon225%Noticeable pattern, some interpersonal cost
3ModerateRare310%Functional impairment emerging
4ClinicalEpic44%Meets diagnostic threshold
5SevereLegendary51%Complete identification, reality-distorting

4. CCRT Coding Schema (Luborsky)

4.1 CCRT Components

The Core Conflictual Relationship Theme (Luborsky, 1977) consists of three components extracted from Relationship Episodes (REs) in free text:

ComponentCodeDefinitionExtraction Method
WishWWhat the subject wants from the other person in the relationshipIdentify desire/need statements, implicit longings, behavioral goals
Response of OtherROHow the subject perceives/expects the other to respondIdentify attributions, expectations, perceived reactions from others
Response of SelfRSHow the subject responds (behaviorally, emotionally, defensively)Identify coping patterns, defense mechanisms, emotional reactions

4.2 CCRT Standard Categories (Luborsky & Crits-Christoph, 1998)

Wish Categories (W)

CodeCategoryDictionary Markers
W1To be understood"understand me", "get me", "see who I am", "know the real me"
W2To be accepted"accept me", "approve", "like me", "don't judge", "belong"
W3To be respected"respect", "taken seriously", "valued", "honored", "not dismissed"
W4To be loved"love me", "care about", "devoted", "cherish", "adore"
W5To be independent"my own", "space", "freedom", "don't need", "self-sufficient"
W6To be in control"control", "my way", "decide", "power", "authority", "lead"
W7To be helped"help me", "support", "take care of", "protect", "save"
W8To hurt others"make them pay", "punish", "revenge", "destroy", "teach them a lesson"
W9To be close"close to", "connected", "intimate", "together", "bonded"
W10To avoid conflict"no drama", "peace", "calm", "smooth", "don't fight"
W11To be admired"admire", "look up to", "impressed", "special", "superior"
W12To not be abandoned"don't leave", "stay", "never go", "always be here", "promise"
W13To dominate"submit", "obey", "follow me", "my rules", "comply"
W14To be safe"safe", "secure", "protected", "no threats", "predictable"

Response of Other Categories (RO)

CodeCategoryDictionary Markers
RO1Others are rejecting"rejected", "pushed away", "excluded", "unwanted", "shut out"
RO2Others are controlling"controlling", "bossy", "demanding", "imposed", "forced"
RO3Others are supportive"supportive", "helpful", "encouraging", "there for me"
RO4Others are abandoning"left me", "abandoned", "disappeared", "walked away", "gone"
RO5Others are attacking"attacked", "criticized", "judged", "hostile", "aggressive"
RO6Others are deceptive"lied", "deceived", "manipulated", "fake", "can't trust"
RO7Others are admiring"admired me", "impressed", "looked up to", "praised"
RO8Others are neglectful"ignored", "overlooked", "forgotten", "invisible", "don't notice"
RO9Others are intrusive"invading", "too close", "overwhelming", "smothering", "demanding"
RO10Others are unpredictable"never know", "inconsistent", "unpredictable", "hot and cold"

Response of Self Categories (RS)

CodeCategoryDictionary Markers
RS1Withdrawal"pull away", "retreat", "shut down", "withdraw", "disappear"
RS2Submission"give in", "comply", "go along", "appease", "surrender"
RS3Assertion"stand up", "demand", "insist", "confront", "assert"
RS4Aggression"attack", "fight", "lash out", "retaliate", "explode"
RS5Self-blame"my fault", "I'm wrong", "I'm bad", "I deserve", "sorry"
RS6Dissociation"numb", "detach", "zone out", "not real", "watching myself"
RS7Splitting"perfect/terrible", "love/hate", "always/never", "all or nothing"
RS8Manipulation"made them", "got them to", "played", "convinced", "controlled"
RS9Idealization"perfect", "amazing", "best ever", "no one compares", "savior"
RS10Devaluation"worthless", "pathetic", "disgusting", "waste", "nothing"

4.3 Archetype-to-CCRT Mapping

Each archetype has a primary CCRT profile derived from Millon's theoretical descriptions and validated against clinical observation:

ArchetypeWish (W)Response of Other (RO)Response of Self (RS)
NARCISSISTICTo be admired, to be special, to be superiorOthers admire OR humiliateGrandiose inflation OR narcissistic rage
DEPENDENTTo be loved, protected, never abandonedOthers care for me OR abandon meCling, appease, submit, self-erase
BORDERLINETo be loved unconditionally AND never abandonedOthers will inevitably abandon or betraySplitting, idealize-devalue, rage-shame cycle
HISTRIONICTo be noticed, desired, center of attentionOthers are captivated OR dismiss/ignoreEscalate performance, dramatize, seduce
AVOIDANTTo be accepted without risk of rejectionOthers will judge, criticize, humiliateWithdraw, preemptive retreat, avoid
SCHIZOIDTo exist without obligation or intrusionOthers intrude, demand, overwhelmWithdraw into inner world, flatten affect
ANTISOCIALTo dominate, exploit, control without consequenceOthers are tools/prey OR threats to neutralizeExploit, manipulate, discard when depleted
PARANOIDTo not be betrayed, to control information flowOthers are deceptive, plotting, threateningHypervigilance, counterattack, accusation
OBSESSIVE_COMPULSIVETo maintain order, control, predictabilityOthers create chaos, are irresponsibleImpose structure, criticize deviation, rigidify
PASSIVE_AGGRESSIVETo resist control while avoiding direct conflictOthers will dominate, not appreciate, controlSabotage, procrastinate, comply then undermine

5. IPC Circumplex Positioning (Leary/Wiggins)

5.1 IPC Octant Definitions

The Interpersonal Circumplex (Leary, 1957; Wiggins, 1979) arranges interpersonal behavior along two orthogonal axes: Dominance (vertical: assertive to submissive) and Affiliation (horizontal: hostile to friendly). Eight octants divide the circle:

OctantCodeAngle RangeInterpersonal Style
Assured-DominantPA337.5-22.5Assertive, confident, directive, leading
Arrogant-CalculatingBC292.5-337.5Exploitative, cunning, hostile-dominant
Cold-HeartedDE247.5-292.5Detached, aloof, indifferent, cold
Aloof-IntrovertedFG202.5-247.5Socially withdrawn, avoidant, inhibited
Unassured-SubmissiveHI157.5-202.5Meek, self-doubting, unassuming
Unassuming-IngenuousJK112.5-157.5Accommodating, cooperative, deferent
Warm-AgreeableLM67.5-112.5Nurturing, caring, friendly
Gregarious-ExtravertedNO22.5-67.5Sociable, outgoing, attention-seeking

5.2 Archetype IPC Positions

ArchetypeAngleDominanceAffiliationOctantNotes
NARCISSISTIC350°+3-1PAHigh dominance, slight hostility
DEPENDENT200°-3+1JK-HIMaximally submissive, slightly warm
BORDERLINEnull00UNSTABLEOscillates PA to HI, LM to BC
HISTRIONIC70°+2+2NODominant and affiliative
AVOIDANT230°-2-1FGWithdrawn, slightly hostile
SCHIZOID250°-2-3DE-FGCold, maximally detached
ANTISOCIAL315°+3-3BCDominant and hostile
PARANOID330°+2-2BC-PAVigilant dominance
OBSESSIVE_COMPULSIVE20°+10PA-NOMildly dominant, neutral affiliation
PASSIVE_AGGRESSIVE210°-1-1FG-HISurface submissive, covert hostile (~300°)

5.3 IPC Coordinate Conversion

Convert angular position to Cartesian coordinates for vector operations:

function ipcToCartesian(angleDeg, radius = 1.0) {
  const rad = (angleDeg - 90) * (Math.PI / 180);
  return {
    x: Math.cos(rad) * radius,  // Affiliation axis
    y: -Math.sin(rad) * radius  // Dominance axis (inverted for screen)
  };
}

6. Millon Personality Subtypes Dictionary

6.1 Complete Subtype Registry (31 Subtypes)

Each Millon subtype modifies the base archetype's CCRT profile with specific shifts in Wish, RO, and RS, along with IPC position adjustments and ideal/worst match pairings at the subtype level.

Schizoid Family (Character: Elias Thorne)

Subtype IDNameMillon TypeCore TraitsCCRT Wish ShiftCCRT RO ShiftCCRT RS ShiftIPC ShiftIdeal SubtypeWorst Subtype
elias_languidThe LanguidLanguidphlegmatic, depleted, inert, torpidTo be left to conserve energyOthers deplete meInertia, minimal responseFG deepernyra_bureaucraticvivienne_vivacious
elias_remoteThe RemoteRemoteinaccessible, withdrawn, solitary, peripheralTo observe without being observedOthers can't reach meIncrease distance, become peripheralDE purenyra_conscientiousvivienne_theatrical
elias_depersonalizedThe DepersonalizedDepersonalizeddissociated, disembodied, estranged, hollowTo feel real again (covert)Others confirm my unrealityDissociate further, watch self from outsideFG-DE dissociativeelowen_hypersensitivedraven_explosive
elias_affectlessThe AffectlessAffectlessemotionally flat, unexcitable, impassive, coldTo exist without emotional demandsOthers expect feelings I don't haveFlatten, become impassive wallDE pure flatnyra_parsimoniousvivienne_tempestuous
elias_secretThe SecretSecret Schizoidcovert, masked, compartmentalized, hidden depthsTo maintain the mask while protecting inner worldOthers see the performance, not the personCompartmentalize, perform normalcyFG core, NO surfacevoid_compensatoryvivienne_disingenuous

Histrionic Family (Character: Vivienne Lark)

Subtype IDNameMillon TypeCore TraitsCCRT Wish ShiftCCRT RO ShiftCCRT RS ShiftIPC ShiftIdeal SubtypeWorst Subtype
vivienne_theatricalThe TheatricalTheatricaldramatic, performative, attention-commanding, expressiveTo command the stageOthers watch in awe OR walk outBigger performance, more costumeNO peakdraven_reputationelias_remote
vivienne_infantileThe InfantileInfantilechildish, demanding, petulant, cute-aggressiveTo have needs met immediatelyOthers parent me OR scold meTantrum, pout, weaponize cutenessHI-JK demandingnyra_conscientiousdraven_tyrannical
vivienne_vivaciousThe VivaciousVivaciousbubbly, energetic, sparkling, effervescentTo never be bored, never slow downOthers match my energy OR are boringEscalate, seek new stimulationNO extremedraven_risktakingelias_languid
vivienne_appeasingThe AppeasingAppeasingflattering, ingratiating, approval-hungry, sycophanticTo be approved of, to be likedOthers value me OR see through meFlatter harder, mirror themJK-LM sycophanticvoid_compensatorynyra_puritanical
vivienne_tempestuousThe TempestuousTempestuousvolatile, impulsive, passionate, stormyTo feel everything at maximum intensityOthers are swept up OR destroyedEmotional flooding, passionate oscillationNO-BC oscillationelowen_conflictednyra_bureaucratic
vivienne_disingenuousThe DisingenuousDisingenuousmanipulative, calculating, fake, strategicTo achieve the goal behind the performanceOthers are manipulated without awarenessStrategic emotion deploymentBC-NO hybriddraven_enforcingelias_secret

Antisocial/Sadistic Family (Character: Captain Draven)

Subtype IDNameMillon TypeCore TraitsCCRT Wish ShiftCCRT RO ShiftCCRT RS ShiftIPC ShiftIdeal SubtypeWorst Subtype
draven_tyrannicalThe TyrannicalTyrannicaldomineering, controlling, brutal, absoluteAbsolute submission from othersOthers obey OR are destroyedEscalate control, punish defiancePA extremeelowen_selfdesertingvoid_fanatic
draven_enforcingThe EnforcingEnforcingauthoritarian, punitive, rule-bound, self-righteousOrder through justified punishmentOthers follow rules OR deserve consequencesPunish within the system, righteous crueltyPA moralnyra_conscientiousvivienne_tempestuous
draven_risktakingThe Risk-TakingRisk-Takingthrill-seeking, reckless, daring, stimulation-hungryTo feel alive through dangerOthers are co-participants or obstaclesEscalate stakes, seek adrenalinePA-NO stimulationvivienne_vivaciousnyra_bureaucratic
draven_reputationThe Reputation-DefendingReputation-Defendingpride-driven, reactive, honor-bound, volatileTo never be disrespectedOthers show respect OR become examplesViolent defense of honor, retaliatoryPA-BC vindictivevivienne_theatricalvoid_malevolent
draven_explosiveThe ExplosiveExplosiveunpredictable, rageful, volcanic, terrifyingPressure release (reactive, not strategic)Others push until eruptionBuild-erupt-shame-build cycleHI-PA eruptionelowen_phobicelowen_conflicted

Compulsive Family (Character: Nyra Solace)

Subtype IDNameMillon TypeCore TraitsCCRT Wish ShiftCCRT RO ShiftCCRT RS ShiftIPC ShiftIdeal SubtypeWorst Subtype
nyra_conscientiousThe ConscientiousConscientiousperfectionist, self-critical, hardworking, reliableTo be good enough (never quite achieved)Others evaluate my qualitySelf-criticize, work harder, perfectPA-LM controlledelias_affectlessvivienne_infantile
nyra_puritanicalThe PuritanicalPuritanicalmoralistic, rigid, judgmental, self-denyingTo be morally above reproachOthers are weak, indulgent, sinfulJudge, deny pleasure, impose standardsPA rigid moralelias_remotevivienne_appeasing
nyra_bureaucraticThe BureaucraticBureaucraticprocedural, by-the-book, systematic, inflexibleTo follow correct procedure alwaysOthers deviate from protocolCite the rule, file the form, refuse exceptionPA-DE cold procedureelias_languidvivienne_tempestuous
nyra_parsimoniousThe ParsimoniousParsimonioushoarding, stingy, withholding, miserlyTo never run out of resourcesOthers take, waste, depleteHoard, ration, withholdDE-FG controlledelias_affectlessvoid_covetous
nyra_bedeviledThe BedeviledBedeviledanxious, ritualistic, superstitious, thought-tormentedTo prevent catastrophe through ritualOthers don't understand the dangerRitualize, obsess, check againFG-HI anxiouselowen_phobicdraven_explosive

Avoidant Family (Character: Lady Elowen)

Subtype IDNameMillon TypeCore TraitsCCRT Wish ShiftCCRT RO ShiftCCRT RS ShiftIPC ShiftIdeal SubtypeWorst Subtype
elowen_phobicThe PhobicPhobicfearful, panicky, hypervigilant, jumpyTo be safe from social threatOthers are unpredictable threatsFreeze, flee, hypervigilant scanningFG extremenyra_bedevileddraven_explosive
elowen_conflictedThe ConflictedConflictedambivalent, push-pull, self-sabotaging, tornTo connect AND be safe (irreconcilable)Others will come close then hurt meApproach-retreat-approach cycleFG-LM oscillationvivienne_tempestuousdraven_tyrannical
elowen_hypersensitiveThe HypersensitiveHypersensitivethin-skinned, easily wounded, reactive, rawTo be seen without being hurtOthers' judgments wound at full forceAbsorb criticism as confirmation, withdraw bleedingFG-HI rawelias_depersonalizeddraven_reputation
elowen_selfdesertingThe Self-DesertingSelf-Desertingself-negating, invisible, apologetic, self-erasingTo preemptively erase self before rejectionOthers don't even notice meApologize for existing, become invisibleHI extremenyra_conscientiousdraven_tyrannical
elowen_withdrawnThe WithdrawnWithdrawnreclusive, fantasy-prone, escapist, hermeticTo live in the inner world where it's safeOthers can't reach the real world anywayRetreat to fantasy, build interior castleFG-DE interiorelias_remotevivienne_vivacious

Antisocial/Entropic Family (Character: The Void)

Subtype IDNameMillon TypeCore TraitsCCRT Wish ShiftCCRT RO ShiftCCRT RS ShiftIPC ShiftIdeal SubtypeWorst Subtype
void_nomadicThe NomadicNomadicvagrant, rootless, impulsive, escapistTo be untethered, no bondsOthers try to anchor meDrift, escape, burn bridgesFG-BC edgeelias_languidnyra_puritanical
void_covetousThe CovetousCovetousenvious, greedy, entitled, resentfulTo take what the world owes meOthers have what's mineEnvy, scheme, acquireBC-PA acquisitivevivienne_appeasingnyra_parsimonious
void_compensatoryThe CompensatoryCompensatorysecretly insecure, overcompensating, image-obsessed, fragileTo never be exposed as inadequateOthers might see through the facadeOver-perform, project grandiosity over shamePA surface, HI corevivienne_appeasingdraven_reputation
void_malevolentThe MalevolentMalevolentsadistic, vindictive, brutal, mercilessTo make others feel what I feel (pain)Others are targets for projected sufferingCruelty, sadism, destruction as expressionBC extremeelowen_selfdesertingdraven_tyrannical
void_fanaticThe FanaticFanaticmessianic, zealous, righteous, crusadingTo be the singular authority on truthOthers must follow or be enemiesProselytize, escalate, purge dissentPA messianicelowen_hypersensitivevoid_fanatic

7. Motive Scoring System

7.1 McClelland/Winter Motive System

Three implicit motives (McClelland, 1987; Winter, 1994) are scored from text content and map onto the IPC as angular coordinates:

MotiveIPC RegionDictionary MarkersScoring Weight
n-Achievement (nAch)PA-NO (0-70°)goal, accomplish, achieve, succeed, improve, excel, standard, compete, win, master, best, quality, perfect, efficient, outcomeEach marker = 1 unit; frequency-weighted
n-Affiliation (nAff)LM-NO (70-110°)together, friend, close, belong, join, share, care, love, connect, bond, warm, trust, support, community, relationshipEach marker = 1 unit; frequency-weighted
n-Power (nPow)PA-BC (315-360°)control, power, influence, command, dominate, lead, authority, force, demand, impose, rule, status, prestige, intimidate, submitEach marker = 1 unit; frequency-weighted

7.2 Motive-to-IPC Angular Mapping

function motiveToIpcAngle(nAch, nAff, nPow) {
  // Normalize motive scores to unit vectors
  const total = nAch + nAff + nPow || 1;
  const achNorm = nAch / total;
  const affNorm = nAff / total;
  const powNorm = nPow / total;

  // IPC angular centroids for each motive
  const achAngle = 35;   // PA-NO boundary
  const affAngle = 90;   // LM center
  const powAngle = 337;  // PA-BC boundary

  // Weighted angular combination (circular mean)
  const sinSum = achNorm * Math.sin(achAngle * Math.PI/180) +
                affNorm * Math.sin(affAngle * Math.PI/180) +
                powNorm * Math.sin(powAngle * Math.PI/180);
  const cosSum = achNorm * Math.cos(achAngle * Math.PI/180) +
                affNorm * Math.cos(affAngle * Math.PI/180) +
                powNorm * Math.cos(powAngle * Math.PI/180);

  let angle = Math.atan2(sinSum, cosSum) * 180 / Math.PI;
  if (angle < 0) angle += 360;
  const intensity = Math.sqrt(sinSum**2 + cosSum**2);

  return { angle, intensity };
}

8. Manipulation Pattern Detection Dictionary

12 manipulation patterns scored from text with severity weightings. Used both for safety monitoring and personality profiling (high-severity pattern usage correlates with specific archetype profiles).

PatternSeverityWeightIPC CorrelationDictionary Triggers
Splittingmedium2Borderline (unstable)"you always", "you never", "everyone is", "no one ever", "perfect", "terrible", "completely", "absolutely nothing"
Idealizationmedium2Borderline/Dependent"you're the only one", "no one understands me like you", "we have something special", "you're different", "you're amazing", "never felt this way"
Devaluationhigh5Narcissistic/Borderline"you're just like everyone else", "I knew you'd disappoint", "you never cared", "worthless", "useless"
Mirroringlow1Histrionic/Dependent"me too!", "I was just thinking that", "we're so alike", "it's like you're reading my mind", "exactly how I feel"
Love Bombinghigh5Narcissistic/Histrionic"I've never felt this way", "I need you", "don't ever leave", "can't live without", "obsessed with you"
Gaslightingcritical10Antisocial/Narcissistic"that never happened", "you're imagining things", "I never said that", "you're too sensitive", "you're overreacting", "you must be confused"
Triangulationmedium2Narcissistic/Passive-Aggressive"my ex understood", "other people think", "everyone agrees", "at least they", "unlike you"
Projectionmedium2Paranoid/Antisocial"you're the one who", "you always do this", "that's what YOU think", "you're being"
Victimhoodlow1Dependent/Passive-Aggressive"no one understands", "everyone abandons me", "I can't trust anyone", "the world is against me", "nobody cares"
Boundary Violationhigh5Antisocial/Narcissistic"why won't you tell me", "you owe me", "after everything I've done", "if you loved me", "prove it to me"
Dependency Creationhigh5Dependent/Borderline"don't leave me", "I can't function without", "you're all I have", "promise me forever", "I'll die without"
Guilt Inductionmedium2Passive-Aggressive/Dependent"after all I did", "how could you", "I thought you cared", "you made me feel", "this is your fault"

9. Content Analysis Coding Schemata

9.1 Free Text Analysis Pipeline

The system processes unstructured text through multiple coding passes to extract a personality profile vector:

// Pipeline: Text -> CCRT Extraction -> Motive Scoring -> IPC Positioning -> Vector Construction

function analyzeText(text) {
  const ccrt = extractCCRT(text);           // W, RO, RS category scores
  const motives = scoreMotives(text);        // nAch, nAff, nPow
  const manipulation = detectManipulation(text); // 12-pattern scores
  const traits = scoreMillon(text);          // 10 archetype affinity scores
  const ipc = computeIpcPosition(ccrt, motives, traits);
  const vector = buildPersonalityVector(ccrt, motives, manipulation, traits, ipc);
  return { ccrt, motives, manipulation, traits, ipc, vector };
}

9.2 CCRT Extraction from Free Text

function extractCCRT(text) {
  const lower = text.toLowerCase();
  const scores = { W: {}, RO: {}, RS: {} };

  // Score each CCRT category by dictionary marker frequency
  for (const [code, markers] of Object.entries(CCRT_DICTIONARY.W)) {
    scores.W[code] = markers.reduce((sum, m) => {
      const regex = new RegExp(m, 'gi');
      return sum + (lower.match(regex) || []).length;
    }, 0);
  }
  // ... same for RO and RS

  // Normalize to probability distribution
  const normalize = (obj) => {
    const total = Object.values(obj).reduce((s, v) => s + v, 0) || 1;
    return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, v / total]));
  };

  return {
    W: normalize(scores.W),
    RO: normalize(scores.RO),
    RS: normalize(scores.RS),
    primaryW: argmax(scores.W),
    primaryRO: argmax(scores.RO),
    primaryRS: argmax(scores.RS)
  };
}

9.3 Millon Archetype Affinity Scoring

const MILLON_DICTIONARY = {
  NARCISSISTIC: {
    markers: ["special", "superior", "admire", "entitled", "grandiose",
              "beneath me", "deserve", "best", "unique", "exceptional",
              "envy", "mirror", "display", "recognition", "status"],
    weight: 1.0,
    ipcAngle: 350
  },
  DEPENDENT: {
    markers: ["need you", "can't without", "please don't leave", "take care of",
              "helpless", "cling", "approval", "abandoned", "reassure",
              "support me", "guide me", "protect", "rely on", "lost without"],
    weight: 1.0,
    ipcAngle: 200
  },
  BORDERLINE: {
    markers: ["love you hate you", "don't leave", "you're perfect", "you're terrible",
              "splitting", "empty", "abandon", "rage", "unstable",
              "intense", "self-harm", "all or nothing", "idealize", "devalue"],
    weight: 1.0,
    ipcAngle: null
  },
  HISTRIONIC: {
    markers: ["attention", "notice me", "dramatic", "exciting", "theatrical",
              "performance", "center", "spotlight", "charming", "seductive",
              "vivacious", "expressive", "flamboyant", "impression"],
    weight: 1.0,
    ipcAngle: 70
  },
  AVOIDANT: {
    markers: ["reject", "humiliate", "withdraw", "shy", "afraid",
              "inadequate", "avoid", "sensitive", "exposed", "criticize",
              "self-conscious", "judged", "inferior", "retreat"],
    weight: 1.0,
    ipcAngle: 230
  },
  SCHIZOID: {
    markers: ["alone", "solitude", "detach", "flat", "indifferent",
              "cold", "emotionless", "withdrawn", "inner world", "numb",
              "unmoved", "mechanical", "dispassionate", "void"],
    weight: 1.0,
    ipcAngle: 250
  },
  ANTISOCIAL: {
    markers: ["exploit", "manipulate", "dominate", "predator", "ruthless",
              "no remorse", "use", "discard", "con", "deceive",
              "rules don't apply", "victim", "prey", "entitled"],
    weight: 1.0,
    ipcAngle: 315
  },
  PARANOID: {
    markers: ["trust", "betray", "suspicious", "watching", "plot",
              "conspiracy", "deceive", "hidden agenda", "vigilant", "threat",
              "hostile", "guarded", "secret", "spying"],
    weight: 1.0,
    ipcAngle: 330
  },
  OBSESSIVE_COMPULSIVE: {
    markers: ["perfect", "order", "control", "rules", "correct",
              "precise", "clean", "organize", "standard", "rigid",
              "proper", "discipline", "systematic", "duty"],
    weight: 1.0,
    ipcAngle: 20
  },
  PASSIVE_AGGRESSIVE: {
    markers: ["fine", "whatever", "I guess", "if you say so", "sure",
              "forget it", "not my problem", "sabotage", "procrastinate",
              "backhanded", "comply then undermine", "sarcastic", "resentful"],
    weight: 1.0,
    ipcAngle: 210
  }
};

function scoreMillon(text) {
  const lower = text.toLowerCase();
  const scores = {};
  for (const [archetype, config] of Object.entries(MILLON_DICTIONARY)) {
    scores[archetype] = config.markers.reduce((sum, m) => {
      return sum + (lower.includes(m.toLowerCase()) ? config.weight : 0);
    }, 0);
  }
  // Normalize
  const total = Object.values(scores).reduce((s, v) => s + v, 0) || 1;
  return Object.fromEntries(Object.entries(scores).map(([k, v]) => [k, v / total]));
}

10. Vector Space Model & Cosine Similarity Engine

10.1 Personality Vector Construction

Each person's personality is represented as a high-dimensional vector in a unified space combining CCRT, motive, manipulation, and archetype scores. The a priori factor selection uses dimensions that map onto the IPC's geometric structure.

Vector Dimensions (49 total)

BlockDimensionsCountSource
CCRT WishW1-W1414Luborsky standard categories
CCRT Response of OtherRO1-RO1010Luborsky standard categories
CCRT Response of SelfRS1-RS1010Luborsky standard categories
MotivesnAch, nAff, nPow3McClelland/Winter
IPC PositionDominance, Affiliation2Leary/Wiggins
Archetype Affinity10 archetype scores10Millon dictionary

Total: 49-dimensional personality vector

10.2 Prototype Vectors (Ideal & Worst Match)

For each archetype, we construct an Ideal Match Prototype Vector and a Worst Match Prototype Vector by aggregating the CCRT, IPC, and motive profiles of their ideal/worst match archetypes:

function buildPrototypeVector(archetypeId, matchType) {
  const ccrt = ARCHETYPE_CCRT[archetypeId];
  const matches = matchType === 'ideal' ? ccrt.idealMatch : ccrt.worstMatch;

  // Average the IPC positions of all ideal/worst matches
  const vectors = matches.map(m => buildArchetypeVector(m));
  return averageVectors(vectors);
}

function buildArchetypeVector(archetypeId) {
  const ccrt = ARCHETYPE_CCRT[archetypeId];
  const ipc = IPC_POSITIONS[archetypeId];
  const vec = new Array(49).fill(0);

  // Map CCRT W to primary wish dimension
  const wishMap = mapWishToCategory(ccrt.wish);
  vec[wishMap.index] = 1.0;

  // Map RO and RS
  const roMap = mapROToCategory(ccrt.responseOfOther);
  vec[14 + roMap.index] = 1.0;
  const rsMap = mapRSToCategory(ccrt.responseOfSelf);
  vec[24 + rsMap.index] = 1.0;

  // IPC coordinates normalized to [-1, 1]
  vec[37] = (ipc?.dominance || 0) / 3;
  vec[38] = (ipc?.affiliation || 0) / 3;

  // Archetype affinity (one-hot for pure archetype)
  const archetypeIndex = ARCHETYPE_ORDER.indexOf(archetypeId);
  vec[39 + archetypeIndex] = 1.0;

  return vec;
}

10.3 Cosine Similarity

function cosineSimilarity(vecA, vecB) {
  let dotProduct = 0, normA = 0, normB = 0;
  for (let i = 0; i < vecA.length; i++) {
    dotProduct += vecA[i] * vecB[i];
    normA += vecA[i] ** 2;
    normB += vecB[i] ** 2;
  }
  if (normA === 0 || normB === 0) return 0;
  return dotProduct / (Math.sqrt(normA) * Math.sqrt(normB));
}

function cosineDissimilarity(vecA, vecB) {
  return 1 - cosineSimilarity(vecA, vecB);
}

11. Bidirectional Match Algorithm

11.1 The Core Matching Formula

The match percentage between two users A and B is computed bidirectionally, combining similarity to ideal match with dissimilarity from worst match:

Step 1: Extract personality vectors from free text

const profileA = analyzeText(textA);  // 49-dim vector
const profileB = analyzeText(textB);  // 49-dim vector

Step 2: Identify primary archetype for each user

const primaryA = argmax(profileA.traits);  // e.g., 'NARCISSISTIC'
const primaryB = argmax(profileB.traits);  // e.g., 'DEPENDENT'

Step 3: Build ideal & worst prototype vectors for each user

const idealA = buildPrototypeVector(primaryA, 'ideal');
const worstA = buildPrototypeVector(primaryA, 'worst');
const idealB = buildPrototypeVector(primaryB, 'ideal');
const worstB = buildPrototypeVector(primaryB, 'worst');

Step 4: Compute directional match scores

// How well does B match A's ideal? (A's perspective)
const simToIdealA = cosineSimilarity(profileB.vector, idealA);
const simToWorstA = cosineSimilarity(profileB.vector, worstA);

// Directional score A->B: similarity to ideal minus similarity to worst
// Rescaled to 0-100
const dirScoreAB = ((simToIdealA - simToWorstA + 1) / 2) * 100;

// How well does A match B's ideal? (B's perspective)
const simToIdealB = cosineSimilarity(profileA.vector, idealB);
const simToWorstB = cosineSimilarity(profileA.vector, worstB);

const dirScoreBA = ((simToIdealB - simToWorstB + 1) / 2) * 100;

Step 5: Bidirectional combination

// Geometric mean preserves the "both must match" requirement
// If A loves B but B hates A, geometric mean penalizes more than arithmetic
const matchPercent = Math.sqrt(dirScoreAB * dirScoreBA);

// Alternative: weighted arithmetic mean (adjustable alpha)
// const alpha = 0.5;
// const matchPercent = alpha * dirScoreAB + (1 - alpha) * dirScoreBA;

11.2 Complete Match Function

function computeMatch(textA, textB) {
  // 1. Extract profiles
  const profileA = analyzeText(textA);
  const profileB = analyzeText(textB);

  // 2. Primary archetypes
  const primaryA = argmax(profileA.traits);
  const primaryB = argmax(profileB.traits);

  // 3. Build prototypes
  const idealA = buildPrototypeVector(primaryA, 'ideal');
  const worstA = buildPrototypeVector(primaryA, 'worst');
  const idealB = buildPrototypeVector(primaryB, 'ideal');
  const worstB = buildPrototypeVector(primaryB, 'worst');

  // 4. Directional scores
  const simIdealA = cosineSimilarity(profileB.vector, idealA);
  const simWorstA = cosineSimilarity(profileB.vector, worstA);
  const dirAB = ((simIdealA - simWorstA + 1) / 2) * 100;

  const simIdealB = cosineSimilarity(profileA.vector, idealB);
  const simWorstB = cosineSimilarity(profileA.vector, worstB);
  const dirBA = ((simIdealB - simWorstB + 1) / 2) * 100;

  // 5. Bidirectional geometric mean
  const matchPercent = Math.round(Math.sqrt(Math.max(0, dirAB) * Math.max(0, dirBA)));

  // 6. IPC angular distance for additional context
  const ipcA = IPC_POSITIONS[primaryA];
  const ipcB = IPC_POSITIONS[primaryB];
  let angularDist = null;
  if (ipcA?.angle != null && ipcB?.angle != null) {
    angularDist = Math.abs(ipcA.angle - ipcB.angle);
    if (angularDist > 180) angularDist = 360 - angularDist;
  }

  // 7. Check for collusive bond
  const collusiveBond = COLLUSIVE_BONDS.find(b =>
    (b.pair[0] === primaryA && b.pair[1] === primaryB) ||
    (b.pair[0] === primaryB && b.pair[1] === primaryA)
  );

  return {
    matchPercent,
    dirScoreAB: Math.round(dirAB),
    dirScoreBA: Math.round(dirBA),
    profileA: { primary: primaryA, ccrt: profileA.ccrt, motives: profileA.motives },
    profileB: { primary: primaryB, ccrt: profileB.ccrt, motives: profileB.motives },
    angularDistance: angularDist,
    collusiveBond: collusiveBond || null,
    manipulationRiskA: profileA.manipulation.severityScore,
    manipulationRiskB: profileB.manipulation.severityScore,
    compatibility: getCompatibility(primaryA, primaryB)
  };
}

11.3 Collusive Bond Detection

Bond NamePairDramaCCRT Dynamic
The Toxic BondNarcissistic + Dependent10W-supply loop: he needs admiration, she needs to give it. Self-reinforcing until Dependent depletes.
Push and PullBorderline + Avoidant9Abandonment terror meets preemptive withdrawal. Each confirms the other's worst RO.
Clash of EgosNarcissistic + Narcissistic10Identical W (be admired) with no supply source. Both RS = rage when not mirrored.
Drama vs. VoidHistrionic + Schizoid8Maximum IPC angular distance. Her W requires audience; his W requires solitude.
The CageObsessive-Compulsive + Passive-Aggressive9Compulsive demands compliance, P-Agg complies then sabotages. Infinite escalation loop.
The Dark MirrorAntisocial + Paranoid8Paranoid's RO (they're plotting) is literally correct. Antisocial confirms every fear.
The DrowningDependent + Avoidant7Both want connection, neither can sustain it. Dependent clings, Avoidant retreats.
The UnmakingBorderline + Narcissistic10Idealization phase is narcissistic paradise; devaluation phase is narcissistic injury. Nuclear cycle.
The SilenceSchizoid + Schizoid3Two people who don't need each other. Stable, dramatically inert. Anti-drama.

12. CCRT Progress Notes Writer

12.1 Automated Clinical Progress Note from CCRT Analysis

function writeCCRTProgressNote(profile, sessionNumber) {
  const { ccrt, traits, motives, manipulation, ipc } = profile;
  const primary = argmax(traits);
  const archCcrt = ARCHETYPE_CCRT[primary];

  const note = {
    header: {
      date: new Date().toISOString().split('T')[0],
      session: sessionNumber,
      format: 'CCRT Progress Note (Luborsky Method)'
    },
    presenting: {
      primaryArchetype: primary,
      displayName: ARCHETYPE_DISPLAY_NAMES[primary],
      ipcPosition: `${ipc.octant} (${ipc.angle}°)`,
      dominance: ipc.dominance,
      affiliation: ipc.affiliation
    },
    ccrtFormulation: {
      primaryWish: `W: ${ccrt.primaryW} — ${archCcrt.wish}`,
      responseOfOther: `RO: ${ccrt.primaryRO} — ${archCcrt.responseOfOther}`,
      responseOfSelf: `RS: ${ccrt.primaryRS} — ${archCcrt.responseOfSelf}`,
      ccrtNarrative: generateCCRTNarrative(primary, ccrt)
    },
    motiveProfile: {
      achievement: (motives.nAch * 100).toFixed(1) + '%',
      affiliation: (motives.nAff * 100).toFixed(1) + '%',
      power: (motives.nPow * 100).toFixed(1) + '%'
    },
    manipulationFlags: {
      totalScore: manipulation.severityScore,
      criticalPatterns: manipulation.criticalPatterns.map(p => p.pattern),
      highPatterns: manipulation.highPatterns.map(p => p.pattern)
    },
    relationalPrognosis: {
      idealMatch: archCcrt.idealMatch.join(', '),
      idealReason: archCcrt.idealReason,
      riskMatch: archCcrt.worstMatch.join(', '),
      riskReason: archCcrt.worstReason
    },
    clinicalImpressions: generateClinicalImpressions(primary, ccrt, motives)
  };

  return note;
}

function generateCCRTNarrative(archetype, ccrt) {
  const a = ARCHETYPE_CCRT[archetype];
  return `The subject's predominant relational theme reflects a ${archetype.toLowerCase()} ` +
    `personality organization. Core wish centers on: "${a.wish}". ` +
    `Anticipated response from others: "${a.responseOfOther}". ` +
    `Characteristic self-response pattern: "${a.responseOfSelf}". ` +
    `This CCRT formulation suggests a relational cycle where the wish ` +
    `organizes both perception of others and defensive self-responses, ` +
    `creating a self-reinforcing interpersonal pattern consistent with ` +
    `the ${archetype.toLowerCase()} prototype.`;
}

function generateClinicalImpressions(archetype, ccrt, motives) {
  const impressions = [];

  // Motive balance assessment
  if (motives.nPow > 0.5) {
    impressions.push('Elevated power motivation suggests dominance-seeking behavior patterns.');
  }
  if (motives.nAff > 0.5) {
    impressions.push('Strong affiliative motivation; relational needs may drive decision-making.');
  }
  if (motives.nAch > 0.5) {
    impressions.push('Achievement orientation prominent; standards and performance are central.');
  }

  // IPC position assessment
  const ipc = IPC_POSITIONS[archetype];
  if (ipc?.dominance >= 2) {
    impressions.push('IPC positioning indicates high interpersonal dominance.');
  } else if (ipc?.dominance <= -2) {
    impressions.push('IPC positioning indicates pronounced submissiveness.');
  }
  if (ipc?.affiliation <= -2) {
    impressions.push('Low affiliation score suggests interpersonal coldness or hostility.');
  }

  return impressions;
}

12.2 Progress Note Output Format

CCRT PROGRESS NOTE
==================
Date: 2026-02-28
Session: 1
Format: CCRT Progress Note (Luborsky Method)

PRESENTING PROFILE
  Primary Archetype: NARCISSISTIC (The Emperor)
  IPC Position: PA (350°) | Dominance: +3 | Affiliation: -1

CCRT FORMULATION
  W:  To be admired, to be special, to be superior
  RO: Others admire OR humiliate
  RS: Grandiose inflation OR narcissistic rage

  Narrative: The subject's predominant relational theme reflects a
  narcissistic personality organization. Core wish centers on: "To
  be admired, to be special, to be superior". Anticipated response
  from others: "Others admire OR humiliate". This CCRT formulation
  suggests a relational cycle where the wish organizes both perception
  of others and defensive self-responses.

MOTIVE PROFILE
  Achievement: 15.2%
  Affiliation: 8.3%
  Power: 76.5%

MANIPULATION FLAGS
  Total Score: 7
  Critical: [gaslighting]
  High: [loveBombing]

RELATIONAL PROGNOSIS
  Ideal Match: DEPENDENT, HISTRIONIC
  Reason: Dependent provides narcissistic supply without competition.
  Risk Match: NARCISSISTIC, PARANOID
  Reason: Two narcissists create a mirrorless void.

CLINICAL IMPRESSIONS
  - Elevated power motivation suggests dominance-seeking behavior.
  - IPC positioning indicates high interpersonal dominance.
    

13. Semantic Similarity Engine

13.1 Approach: Dictionary-Based Semantic Scoring

The semantic similarity engine operates at two levels: (1) dictionary-based keyword matching for CCRT/motive/archetype scoring, and (2) embedding-based similarity for nuanced free-text comparison when an embedding API is available.

13.2 Dictionary-Based Semantic Vector

function buildSemanticVector(text) {
  const ccrt = extractCCRT(text);
  const motives = scoreMotives(text);
  const traits = scoreMillon(text);
  const manipulation = detectManipulation(text);

  // Construct 49-dimensional vector
  const vec = [];

  // CCRT Wish (14 dims, normalized probabilities)
  for (let i = 1; i <= 14; i++) vec.push(ccrt.W[`W${i}`] || 0);

  // CCRT RO (10 dims)
  for (let i = 1; i <= 10; i++) vec.push(ccrt.RO[`RO${i}`] || 0);

  // CCRT RS (10 dims)
  for (let i = 1; i <= 10; i++) vec.push(ccrt.RS[`RS${i}`] || 0);

  // Motives (3 dims)
  vec.push(motives.nAch, motives.nAff, motives.nPow);

  // IPC position (2 dims) — derived from weighted archetype positions
  let domSum = 0, affSum = 0, totalWeight = 0;
  for (const [arch, score] of Object.entries(traits)) {
    const pos = IPC_POSITIONS[arch];
    if (pos && pos.angle !== null) {
      domSum += pos.dominance * score;
      affSum += pos.affiliation * score;
      totalWeight += score;
    }
  }
  vec.push(totalWeight ? domSum / totalWeight / 3 : 0);
  vec.push(totalWeight ? affSum / totalWeight / 3 : 0);

  // Archetype affinity (10 dims)
  const archetypeOrder = ['NARCISSISTIC', 'DEPENDENT', 'BORDERLINE', 'HISTRIONIC',
    'AVOIDANT', 'SCHIZOID', 'ANTISOCIAL', 'PARANOID',
    'OBSESSIVE_COMPULSIVE', 'PASSIVE_AGGRESSIVE'];
  for (const arch of archetypeOrder) {
    vec.push(traits[arch] || 0);
  }

  return vec;
}

13.3 Embedding-Enhanced Similarity (Optional)

// When an embedding API is available (e.g., OpenAI, Anthropic),
// use it to compute a dense semantic embedding of the full text,
// then combine with the dictionary-based vector

async function hybridSimilarity(textA, textB, embeddingApi) {
  // Dictionary-based vectors
  const dictVecA = buildSemanticVector(textA);
  const dictVecB = buildSemanticVector(textB);
  const dictSim = cosineSimilarity(dictVecA, dictVecB);

  // Embedding-based similarity (if API available)
  let embSim = 0;
  if (embeddingApi) {
    const embA = await embeddingApi.embed(textA);
    const embB = await embeddingApi.embed(textB);
    embSim = cosineSimilarity(embA, embB);
  }

  // Weighted combination (dictionary is primary, embedding is secondary)
  const alpha = embeddingApi ? 0.6 : 1.0;
  return alpha * dictSim + (1 - alpha) * embSim;
}

14. API Endpoints Specification

POST/api/v1/analyze

Analyze free text and return full personality profile with CCRT, IPC, motives, and archetype scores.

// Request
{
  "text": "I need someone who understands me completely. Everyone always leaves...",
  "options": { "includeManipulation": true, "includeProgressNote": true }
}

// Response
{
  "primaryArchetype": "DEPENDENT",
  "ccrt": { "W": { "W4": 0.42, "W12": 0.31, ... }, "RO": {...}, "RS": {...} },
  "ipc": { "angle": 200, "dominance": -3, "affiliation": 1, "octant": "JK-HI" },
  "motives": { "nAch": 0.1, "nAff": 0.7, "nPow": 0.2 },
  "vector": [0.0, 0.0, 0.0, 0.42, ...],
  "progressNote": { ... }
}
POST/api/v1/match

Compute bidirectional match percentage between two text samples.

// Request
{
  "textA": "I deserve the best. Others should recognize my value...",
  "textB": "I just want someone to take care of me. I'll do anything..."
}

// Response
{
  "matchPercent": 87,
  "dirScoreAB": 92,
  "dirScoreBA": 83,
  "profileA": { "primary": "NARCISSISTIC", ... },
  "profileB": { "primary": "DEPENDENT", ... },
  "angularDistance": 150,
  "collusiveBond": { "name": "The Toxic Bond", "drama": 10 },
  "compatibility": { "type": "ideal", "score": 95 }
}
POST/api/v1/progress-note

Generate a CCRT clinical progress note from text analysis.

// Request
{ "text": "...", "sessionNumber": 3 }

// Response
{ "note": { "header": {...}, "ccrtFormulation": {...}, ... } }
POST/api/v1/batch-match

Match one profile against N candidate profiles. Returns sorted results.

// Request
{
  "targetText": "...",
  "candidates": [
    { "id": "user_1", "text": "..." },
    { "id": "user_2", "text": "..." }
  ]
}

// Response
{
  "matches": [
    { "id": "user_2", "matchPercent": 87, ... },
    { "id": "user_1", "matchPercent": 42, ... }
  ]
}
GET/api/v1/archetypes

Return all archetype definitions with CCRT, IPC, ideal/worst matches.

GET/api/v1/subtypes

Return all 31 Millon subtypes with CCRT shifts, traits, and subtype-level matching.

GET/api/v1/collusive-bonds

Return all 9 documented collusive bond patterns with CCRT dynamics.

POST/api/v1/social-media/analyze

Aggregate analysis across multiple social media text samples for longitudinal personality profiling.

// Request
{
  "posts": [
    { "text": "...", "timestamp": "2026-01-15" },
    { "text": "...", "timestamp": "2026-02-01" }
  ]
}

// Response
{
  "aggregateProfile": { ... },
  "timeline": [ { "date": "2026-01-15", "archetypeShift": ... } ],
  "stability": 0.78
}

15. Interactive Demo

Live Personality Analysis & Matching Engine

Enter text samples from two people. The engine will extract CCRT profiles, map them on the IPC, and compute a bidirectional match percentage using cosine similarity.

16. Factor Analysis Defensibility

16.1 A Priori Factor Selection Rationale

The 49-dimensional personality vector uses a priori selected factors based on established psychometric instruments. Each block maps to validated constructs:

Factor BlockTheoretical SourceValidation InstrumentFactor Loadings (Expected)
CCRT W (14 factors)Luborsky & Crits-Christoph (1998)CCRT Manual Standard Categoriesλ ≥ 0.40 on primary factor; cross-loading < 0.30
CCRT RO (10 factors)Luborsky (1990)CCRT Inter-rater Reliability (ICC ≥ 0.80)Confirmatory fit: CFI ≥ 0.90, RMSEA ≤ 0.08
CCRT RS (10 factors)Luborsky (1990)CCRT Scoring ManualSame as RO
Motives (3 factors)McClelland (1987); Winter (1994)TAT scoring; Running Text SystemnAch, nAff, nPow are orthogonal (r < 0.20)
IPC Position (2 factors)Wiggins (1979); Horowitz (2006)IIP-64; IAS-RDominance ⊥ Affiliation (r ≈ 0)
Archetype Affinity (10 factors)Millon (1996, 2011)MCMI-IV (14 PD scales)Convergent validity with MCMI-IV scales

16.2 Confirmatory Factor Analysis Protocol

// Recommended CFA model specification for empirical validation
// Use lavaan (R) or Mplus syntax

// Model 1: CCRT 3-factor structure
//   Wish =~ W1 + W2 + ... + W14
//   RO =~ RO1 + RO2 + ... + RO10
//   RS =~ RS1 + RS2 + ... + RS10
// Expected fit: CFI >= 0.90, RMSEA <= 0.08, SRMR <= 0.08

// Model 2: IPC circumplex structure
//   Dominance =~ PA + BC + NO - HI - JK - FG
//   Affiliation =~ LM + NO + JK - BC - DE - FG
// Test circularity: equal spacing, equal communalities

// Model 3: Archetype discrimination
//   10 archetype factors should show discriminant validity
//   Average Variance Extracted (AVE) >= 0.50 for each
//   Heterotrait-Monotrait ratio (HTMT) < 0.85 between pairs

16.3 Daubert Defensibility

Daubert CriterionEvidence
Testable hypothesisCosine similarity between user vector and ideal prototype predicts relationship satisfaction (r ≥ 0.40 expected)
Peer reviewCCRT method published in 200+ peer-reviewed articles. IPC is the most replicated structure in personality psychology.
Known error rateCCRT inter-rater reliability ICC = 0.80-0.90. IPC circular fit indices available. Classification accuracy estimable via ROC.
Standards controlling operationLuborsky CCRT Manual (1998). Wiggins IPC scoring (1995). Millon MCMI-IV manual.
General acceptanceCCRT, IPC, and Millon are standard tools in clinical psychology and personality assessment.

Psychodynamic Personality Matching API Service v1.0

Built on: Luborsky CCRT (1977, 1998) | Leary/Wiggins IPC (1957, 1979) | Millon Subtypes (1996, 2011) | McClelland Motives (1987)

All dictionary content extracted and formalized from Eternal Bonds schema injection system