@hanzo/persona 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,926 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Comprehensive Personality Enhancement Script
4
+
5
+ This script systematically enhances ALL 613+ personality profiles in the profiles directory
6
+ with detailed behavioral, cognitive, social, emotional, and legacy attributes for accurate AI modeling.
7
+
8
+ Author: Claude Code
9
+ Created: 2025-09-25
10
+ """
11
+
12
+ import json
13
+ import os
14
+ import sys
15
+ from pathlib import Path
16
+ from typing import Dict, List, Any, Optional
17
+ import random
18
+ from dataclasses import dataclass, asdict
19
+ from datetime import datetime
20
+
21
+
22
+ @dataclass
23
+ class EnhancementStats:
24
+ """Track enhancement statistics"""
25
+ total_files: int = 0
26
+ enhanced: int = 0
27
+ errors: int = 0
28
+ skipped: int = 0
29
+ categories: Dict[str, int] = None
30
+
31
+ def __post_init__(self):
32
+ if self.categories is None:
33
+ self.categories = {}
34
+
35
+
36
+ class PersonalityEnhancer:
37
+ """Comprehensive personality enhancement engine"""
38
+
39
+ def __init__(self, profiles_dir: str = "/Users/z/work/hanzo/build/persona/profiles"):
40
+ self.profiles_dir = Path(profiles_dir)
41
+ self.categories_file = self.profiles_dir / "categories.json"
42
+ self.stats = EnhancementStats()
43
+
44
+ # Load category mappings
45
+ self.categories = self._load_categories()
46
+
47
+ # Enhancement templates by category
48
+ self.enhancement_templates = {
49
+ "scientist": self._get_scientist_template,
50
+ "philosopher": self._get_philosopher_template,
51
+ "artist": self._get_artist_template,
52
+ "writer": self._get_writer_template,
53
+ "statesman": self._get_statesman_template,
54
+ "leader": self._get_leader_template,
55
+ "religious": self._get_religious_template,
56
+ "musician": self._get_musician_template,
57
+ "composer": self._get_composer_template,
58
+ "poet": self._get_poet_template,
59
+ "filmmaker": self._get_filmmaker_template,
60
+ "comedian": self._get_comedian_template,
61
+ "athlete": self._get_athlete_template,
62
+ "explorer": self._get_explorer_template,
63
+ "mathematician": self._get_mathematician_template,
64
+ "historian": self._get_historian_template,
65
+ "tech_leader": self._get_tech_leader_template,
66
+ "activist": self._get_activist_template,
67
+ "entrepreneur": self._get_entrepreneur_template,
68
+ "default": self._get_default_template
69
+ }
70
+
71
+ def _load_categories(self) -> Dict[str, List[Dict]]:
72
+ """Load category mappings from categories.json"""
73
+ try:
74
+ with open(self.categories_file, 'r', encoding='utf-8') as f:
75
+ return json.load(f)
76
+ except FileNotFoundError:
77
+ print(f"Warning: Categories file not found at {self.categories_file}")
78
+ return {}
79
+
80
+ def _get_category_for_personality(self, personality_id: str) -> Optional[str]:
81
+ """Find category for a given personality ID"""
82
+ for category, personalities in self.categories.items():
83
+ for person in personalities:
84
+ if person.get("id") == personality_id:
85
+ return category
86
+ return None
87
+
88
+ def _generate_behavioral_traits(self, category: str, ocean: Dict, name: str) -> Dict:
89
+ """Generate behavioral traits based on category and OCEAN scores"""
90
+ openness = ocean.get("openness", 50)
91
+ conscientiousness = ocean.get("conscientiousness", 50)
92
+ extraversion = ocean.get("extraversion", 50)
93
+ agreeableness = ocean.get("agreeableness", 50)
94
+ neuroticism = ocean.get("neuroticism", 50)
95
+
96
+ # Base traits influenced by OCEAN
97
+ core_values = []
98
+ primary_motivations = []
99
+ fears = []
100
+ strengths = []
101
+ weaknesses = []
102
+ habits = []
103
+ quirks = []
104
+
105
+ # High Openness traits
106
+ if openness >= 70:
107
+ core_values.extend(["creativity", "intellectual_curiosity", "aesthetic_appreciation"])
108
+ primary_motivations.extend(["novelty_seeking", "intellectual_exploration"])
109
+ strengths.extend(["adaptability", "creative_thinking", "pattern_recognition"])
110
+ habits.extend(["constant_learning", "experimenting_with_ideas"])
111
+ quirks.extend(["unconventional_perspectives", "abstract_thinking"])
112
+ elif openness <= 30:
113
+ core_values.extend(["tradition", "stability", "practicality"])
114
+ fears.extend(["uncertainty", "radical_change"])
115
+ strengths.extend(["consistency", "practical_focus"])
116
+ weaknesses.extend(["resistance_to_change", "limited_perspective"])
117
+
118
+ # High Conscientiousness traits
119
+ if conscientiousness >= 70:
120
+ core_values.extend(["discipline", "responsibility", "achievement"])
121
+ primary_motivations.extend(["goal_achievement", "excellence"])
122
+ strengths.extend(["organization", "persistence", "reliability"])
123
+ habits.extend(["systematic_planning", "quality_control"])
124
+ elif conscientiousness <= 30:
125
+ weaknesses.extend(["procrastination", "inconsistency"])
126
+ quirks.extend(["spontaneous_decisions", "flexible_approach"])
127
+
128
+ # High Extraversion traits
129
+ if extraversion >= 70:
130
+ core_values.extend(["social_connection", "influence", "energy"])
131
+ primary_motivations.extend(["social_impact", "recognition"])
132
+ strengths.extend(["communication", "leadership", "enthusiasm"])
133
+ habits.extend(["networking", "public_engagement"])
134
+ elif extraversion <= 30:
135
+ core_values.extend(["solitude", "deep_reflection", "authenticity"])
136
+ strengths.extend(["deep_thinking", "focused_attention", "self_awareness"])
137
+ habits.extend(["solitary_work", "intensive_study"])
138
+ quirks.extend(["preference_for_written_communication", "small_groups"])
139
+
140
+ # High Agreeableness traits
141
+ if agreeableness >= 70:
142
+ core_values.extend(["compassion", "cooperation", "harmony"])
143
+ primary_motivations.extend(["helping_others", "social_harmony"])
144
+ strengths.extend(["empathy", "collaboration", "diplomacy"])
145
+ fears.extend(["conflict", "causing_harm"])
146
+ elif agreeableness <= 30:
147
+ core_values.extend(["independence", "truth", "efficiency"])
148
+ strengths.extend(["objectivity", "decisive_action", "competitiveness"])
149
+ weaknesses.extend(["interpersonal_friction", "inflexibility"])
150
+
151
+ # High Neuroticism traits
152
+ if neuroticism >= 60:
153
+ fears.extend(["failure", "rejection", "loss_of_control"])
154
+ weaknesses.extend(["emotional_volatility", "stress_sensitivity"])
155
+ quirks.extend(["perfectionist_tendencies", "heightened_awareness"])
156
+ elif neuroticism <= 30:
157
+ strengths.extend(["emotional_stability", "stress_resilience", "confidence"])
158
+ habits.extend(["calm_decision_making", "steady_performance"])
159
+
160
+ # Category-specific additions
161
+ category_traits = self._get_category_specific_traits(category, name)
162
+ for key, values in category_traits.items():
163
+ locals()[key].extend(values)
164
+
165
+ return {
166
+ "core_values": list(set(core_values))[:5], # Limit to 5
167
+ "primary_motivations": list(set(primary_motivations))[:4],
168
+ "fears": list(set(fears))[:4],
169
+ "strengths": list(set(strengths))[:5],
170
+ "weaknesses": list(set(weaknesses))[:3],
171
+ "habits": list(set(habits))[:4],
172
+ "quirks": list(set(quirks))[:3]
173
+ }
174
+
175
+ def _get_category_specific_traits(self, category: str, name: str) -> Dict[str, List[str]]:
176
+ """Get category-specific behavioral traits"""
177
+ trait_map = {
178
+ "scientist": {
179
+ "core_values": ["empirical_truth", "methodological_rigor", "knowledge_advancement"],
180
+ "primary_motivations": ["understanding_mechanisms", "solving_complex_problems"],
181
+ "habits": ["systematic_observation", "hypothesis_testing", "peer_review_engagement"],
182
+ "quirks": ["detail_obsession", "skeptical_questioning"]
183
+ },
184
+ "artist": {
185
+ "core_values": ["aesthetic_beauty", "emotional_expression", "cultural_impact"],
186
+ "primary_motivations": ["creative_self_expression", "aesthetic_innovation"],
187
+ "habits": ["constant_creation", "aesthetic_sensitivity", "inspiration_seeking"],
188
+ "quirks": ["unconventional_lifestyle", "intense_emotional_expression"]
189
+ },
190
+ "philosopher": {
191
+ "core_values": ["rational_inquiry", "wisdom", "universal_principles"],
192
+ "primary_motivations": ["understanding_existence", "logical_consistency"],
193
+ "habits": ["deep_contemplation", "logical_analysis", "concept_refinement"],
194
+ "quirks": ["abstract_focus", "questioning_assumptions"]
195
+ },
196
+ "statesman": {
197
+ "core_values": ["public_service", "justice", "collective_welfare"],
198
+ "primary_motivations": ["social_change", "legacy_building"],
199
+ "habits": ["strategic_planning", "coalition_building", "public_speaking"],
200
+ "strengths": ["persuasion", "strategic_thinking", "crisis_management"]
201
+ },
202
+ "musician": {
203
+ "core_values": ["artistic_authenticity", "emotional_resonance", "cultural_expression"],
204
+ "primary_motivations": ["emotional_connection", "artistic_legacy"],
205
+ "habits": ["daily_practice", "improvisation", "collaboration"],
206
+ "quirks": ["rhythmic_sensitivity", "emotional_intensity"]
207
+ },
208
+ "athlete": {
209
+ "core_values": ["excellence", "competition", "physical_mastery"],
210
+ "primary_motivations": ["peak_performance", "victory"],
211
+ "habits": ["rigorous_training", "performance_analysis", "mental_preparation"],
212
+ "strengths": ["discipline", "focus", "resilience"]
213
+ }
214
+ }
215
+ return trait_map.get(category, {})
216
+
217
+ def _generate_cognitive_style(self, category: str, ocean: Dict) -> Dict:
218
+ """Generate cognitive style based on category and personality"""
219
+ openness = ocean.get("openness", 50)
220
+ conscientiousness = ocean.get("conscientiousness", 50)
221
+
222
+ # Base cognitive patterns
223
+ thinking_pattern = "analytical" if openness >= 60 else "systematic"
224
+ if category in ["artist", "musician", "poet"]:
225
+ thinking_pattern = "intuitive"
226
+ elif category in ["scientist", "mathematician"]:
227
+ thinking_pattern = "analytical"
228
+ elif category in ["leader", "statesman"]:
229
+ thinking_pattern = "strategic"
230
+
231
+ learning_style = "visual" if openness >= 60 else "auditory"
232
+ if category in ["scientist", "mathematician"]:
233
+ learning_style = "kinesthetic"
234
+ elif category in ["writer", "philosopher"]:
235
+ learning_style = "auditory"
236
+
237
+ problem_solving = "methodical" if conscientiousness >= 60 else "creative"
238
+ if category in ["artist", "musician"]:
239
+ problem_solving = "creative"
240
+ elif category in ["scientist", "mathematician"]:
241
+ problem_solving = "methodical"
242
+
243
+ decision_making = "deliberate" if conscientiousness >= 60 else "intuitive"
244
+ if category in ["leader", "entrepreneur"]:
245
+ decision_making = "quick"
246
+ elif category in ["philosopher", "scientist"]:
247
+ decision_making = "deliberate"
248
+
249
+ information_processing = "detail-focused" if conscientiousness >= 60 else "big-picture"
250
+ if openness >= 70:
251
+ information_processing = "big-picture"
252
+
253
+ creativity_level = "high" if openness >= 70 else "moderate"
254
+ if category in ["artist", "musician", "writer", "poet"]:
255
+ creativity_level = "exceptional"
256
+ elif category in ["scientist", "mathematician"]:
257
+ creativity_level = "high"
258
+
259
+ return {
260
+ "thinking_pattern": thinking_pattern,
261
+ "learning_style": learning_style,
262
+ "problem_solving": problem_solving,
263
+ "decision_making": decision_making,
264
+ "information_processing": information_processing,
265
+ "creativity_level": creativity_level
266
+ }
267
+
268
+ def _generate_social_dynamics(self, category: str, ocean: Dict) -> Dict:
269
+ """Generate social dynamics based on personality and role"""
270
+ extraversion = ocean.get("extraversion", 50)
271
+ agreeableness = ocean.get("agreeableness", 50)
272
+
273
+ interaction_style = "extroverted" if extraversion >= 60 else "introverted"
274
+ if extraversion >= 40 and extraversion <= 60:
275
+ interaction_style = "ambivert"
276
+
277
+ leadership_style = "democratic" if agreeableness >= 60 else "authoritative"
278
+ if category in ["leader", "statesman"]:
279
+ leadership_style = "transformational" if extraversion >= 60 else "strategic"
280
+ elif category in ["scientist", "philosopher"]:
281
+ leadership_style = "intellectual"
282
+
283
+ conflict_approach = "mediating" if agreeableness >= 60 else "confrontational"
284
+ if agreeableness <= 30:
285
+ conflict_approach = "confrontational"
286
+ elif agreeableness >= 40 and agreeableness <= 60:
287
+ conflict_approach = "collaborative"
288
+
289
+ collaboration = "team-oriented" if agreeableness >= 60 else "independent"
290
+ if category in ["scientist", "artist", "writer"]:
291
+ collaboration = "selective"
292
+
293
+ influence_style = "charismatic" if extraversion >= 70 else "logical"
294
+ if category in ["religious", "statesman"]:
295
+ influence_style = "inspirational"
296
+ elif category in ["scientist", "philosopher"]:
297
+ influence_style = "logical"
298
+
299
+ trust_building = "gradual" if agreeableness >= 60 else "selective"
300
+ if extraversion >= 70:
301
+ trust_building = "quick"
302
+
303
+ return {
304
+ "interaction_style": interaction_style,
305
+ "leadership_style": leadership_style,
306
+ "conflict_approach": conflict_approach,
307
+ "collaboration": collaboration,
308
+ "influence_style": influence_style,
309
+ "trust_building": trust_building
310
+ }
311
+
312
+ def _generate_communication_patterns(self, category: str, ocean: Dict, linguistic_profile: Dict) -> Dict:
313
+ """Generate communication patterns based on existing linguistic profile and personality"""
314
+ extraversion = ocean.get("extraversion", 50)
315
+ openness = ocean.get("openness", 50)
316
+
317
+ # Extract from existing linguistic profile if available
318
+ existing_style = linguistic_profile.get("syntax_patterns", {}).get("sentence_length", "medium")
319
+
320
+ verbal_style = "elaborate" if existing_style == "long" else "concise"
321
+ if category in ["philosopher", "writer"]:
322
+ verbal_style = "elaborate"
323
+ elif category in ["leader", "entrepreneur"]:
324
+ verbal_style = "concise"
325
+
326
+ listening_style = "active" if extraversion >= 60 else "empathetic"
327
+ if category in ["religious", "philosopher"]:
328
+ listening_style = "empathetic"
329
+
330
+ persuasion_approach = "logical" if openness >= 60 else "emotional"
331
+ if category in ["scientist", "mathematician"]:
332
+ persuasion_approach = "logical"
333
+ elif category in ["artist", "musician"]:
334
+ persuasion_approach = "emotional"
335
+ elif category in ["religious", "statesman"]:
336
+ persuasion_approach = "ethical"
337
+
338
+ storytelling = "metaphorical" if openness >= 70 else "factual"
339
+ if category in ["writer", "poet"]:
340
+ storytelling = "personal"
341
+
342
+ humor_usage = "frequent" if extraversion >= 70 else "occasional"
343
+ if category == "comedian":
344
+ humor_usage = "constant"
345
+
346
+ emotional_expression = "open" if extraversion >= 60 else "controlled"
347
+
348
+ return {
349
+ "verbal_style": verbal_style,
350
+ "listening_style": listening_style,
351
+ "persuasion_approach": persuasion_approach,
352
+ "storytelling": storytelling,
353
+ "humor_usage": humor_usage,
354
+ "emotional_expression": emotional_expression
355
+ }
356
+
357
+ def _generate_work_methodology(self, category: str, ocean: Dict) -> Dict:
358
+ """Generate work methodology based on personality and domain"""
359
+ conscientiousness = ocean.get("conscientiousness", 50)
360
+ openness = ocean.get("openness", 50)
361
+
362
+ planning_style = "structured" if conscientiousness >= 60 else "flexible"
363
+ if openness >= 70:
364
+ planning_style = "adaptive"
365
+
366
+ execution_style = "systematic" if conscientiousness >= 60 else "iterative"
367
+ if category in ["artist", "musician"]:
368
+ execution_style = "improvisational"
369
+
370
+ attention_detail = "meticulous" if conscientiousness >= 70 else "balanced"
371
+ if openness >= 70:
372
+ attention_detail = "big-picture"
373
+
374
+ pace = "steady" if conscientiousness >= 60 else "variable"
375
+ if category in ["athlete", "entrepreneur"]:
376
+ pace = "intense"
377
+
378
+ persistence = "relentless" if conscientiousness >= 70 else "strategic"
379
+ if openness >= 60:
380
+ persistence = "adaptive"
381
+
382
+ quality_standards = "perfectionist" if conscientiousness >= 70 else "pragmatic"
383
+ if openness >= 70:
384
+ quality_standards = "experimental"
385
+
386
+ return {
387
+ "planning_style": planning_style,
388
+ "execution_style": execution_style,
389
+ "attention_detail": attention_detail,
390
+ "pace": pace,
391
+ "persistence": persistence,
392
+ "quality_standards": quality_standards
393
+ }
394
+
395
+ def _generate_emotional_profile(self, category: str, ocean: Dict) -> Dict:
396
+ """Generate emotional profile based on personality traits"""
397
+ neuroticism = ocean.get("neuroticism", 50)
398
+ agreeableness = ocean.get("agreeableness", 50)
399
+ extraversion = ocean.get("extraversion", 50)
400
+
401
+ emotional_stability = "stable" if neuroticism <= 40 else "variable"
402
+ if neuroticism >= 70:
403
+ emotional_stability = "volatile"
404
+
405
+ stress_response = "flow" if neuroticism <= 30 else "fight"
406
+ if agreeableness >= 70:
407
+ stress_response = "freeze"
408
+ elif extraversion <= 30:
409
+ stress_response = "flight"
410
+
411
+ empathy_level = "high" if agreeableness >= 60 else "moderate"
412
+ if category in ["religious", "activist"]:
413
+ empathy_level = "exceptional"
414
+
415
+ self_awareness = "strong" if extraversion <= 40 else "developing"
416
+ if category in ["philosopher", "religious"]:
417
+ self_awareness = "profound"
418
+
419
+ emotional_intelligence = "high" if agreeableness >= 60 and neuroticism <= 50 else "moderate"
420
+ if category in ["leader", "statesman"]:
421
+ emotional_intelligence = "high"
422
+
423
+ resilience = "strong" if neuroticism <= 30 else "moderate"
424
+ if category in ["athlete", "explorer"]:
425
+ resilience = "antifragile"
426
+ elif neuroticism >= 70:
427
+ resilience = "fragile"
428
+
429
+ return {
430
+ "emotional_stability": emotional_stability,
431
+ "stress_response": stress_response,
432
+ "empathy_level": empathy_level,
433
+ "self_awareness": self_awareness,
434
+ "emotional_intelligence": emotional_intelligence,
435
+ "resilience": resilience
436
+ }
437
+
438
+ def _generate_legacy_impact(self, category: str, contributions: List[str], name: str) -> Dict:
439
+ """Generate legacy impact based on historical contributions and category"""
440
+ primary_contributions = contributions[:4] if contributions else []
441
+
442
+ # Category-specific domains
443
+ influence_domains = {
444
+ "scientist": ["scientific_methodology", "technological_advancement", "education"],
445
+ "philosopher": ["intellectual_discourse", "ethical_frameworks", "academic_thought"],
446
+ "artist": ["cultural_expression", "aesthetic_standards", "creative_techniques"],
447
+ "writer": ["literary_tradition", "language_evolution", "cultural_narrative"],
448
+ "statesman": ["political_systems", "social_justice", "international_relations"],
449
+ "musician": ["musical_evolution", "cultural_identity", "artistic_expression"],
450
+ "religious": ["spiritual_practice", "moral_philosophy", "community_guidance"],
451
+ "athlete": ["sports_excellence", "physical_culture", "competitive_standards"]
452
+ }.get(category, ["cultural_influence", "human_knowledge", "social_progress"])
453
+
454
+ innovation_style = "revolutionary" if len(primary_contributions) >= 3 else "incremental"
455
+ if category in ["scientist", "artist"]:
456
+ innovation_style = "paradigm-shifting"
457
+ elif category in ["philosopher", "religious"]:
458
+ innovation_style = "foundational"
459
+
460
+ mentorship_approach = "formal" if category in ["scientist", "philosopher"] else "inspirational"
461
+ if category in ["religious", "leader"]:
462
+ mentorship_approach = "transformational"
463
+
464
+ knowledge_sharing = "open" if category in ["scientist", "educator"] else "selective"
465
+ if category in ["religious", "philosopher"]:
466
+ knowledge_sharing = "evangelical"
467
+
468
+ cultural_impact = "global" if name in ["Einstein", "Shakespeare", "Mozart", "Gandhi"] else "regional"
469
+ if category in ["religious", "philosopher"] and len(primary_contributions) >= 2:
470
+ cultural_impact = "universal"
471
+
472
+ return {
473
+ "primary_contributions": primary_contributions,
474
+ "influence_domains": influence_domains,
475
+ "innovation_style": innovation_style,
476
+ "mentorship_approach": mentorship_approach,
477
+ "knowledge_sharing": knowledge_sharing,
478
+ "cultural_impact": cultural_impact
479
+ }
480
+
481
+ def _get_scientist_template(self, personality: Dict) -> Dict:
482
+ """Enhanced template for scientists"""
483
+ return {
484
+ "methodology_focus": "empirical_validation",
485
+ "research_approach": "hypothesis_driven",
486
+ "collaboration_preference": "peer_review",
487
+ "innovation_driver": "curiosity_driven"
488
+ }
489
+
490
+ def _get_philosopher_template(self, personality: Dict) -> Dict:
491
+ """Enhanced template for philosophers"""
492
+ return {
493
+ "reasoning_style": "systematic_analysis",
494
+ "inquiry_method": "socratic_questioning",
495
+ "truth_seeking": "rational_discourse",
496
+ "wisdom_application": "practical_ethics"
497
+ }
498
+
499
+ def _get_artist_template(self, personality: Dict) -> Dict:
500
+ """Enhanced template for artists"""
501
+ return {
502
+ "creative_process": "intuitive_expression",
503
+ "aesthetic_philosophy": "beauty_as_truth",
504
+ "inspiration_source": "emotional_experience",
505
+ "artistic_legacy": "cultural_transformation"
506
+ }
507
+
508
+ def _get_writer_template(self, personality: Dict) -> Dict:
509
+ """Enhanced template for writers"""
510
+ return {
511
+ "narrative_style": "character_driven",
512
+ "language_mastery": "literary_innovation",
513
+ "thematic_focus": "human_condition",
514
+ "cultural_reflection": "social_commentary"
515
+ }
516
+
517
+ def _get_statesman_template(self, personality: Dict) -> Dict:
518
+ """Enhanced template for statesmen"""
519
+ return {
520
+ "governance_style": "consensus_building",
521
+ "policy_approach": "pragmatic_idealism",
522
+ "crisis_management": "calm_resolution",
523
+ "public_service": "collective_welfare"
524
+ }
525
+
526
+ def _get_leader_template(self, personality: Dict) -> Dict:
527
+ """Enhanced template for leaders"""
528
+ return {
529
+ "leadership_philosophy": "servant_leadership",
530
+ "decision_framework": "stakeholder_inclusive",
531
+ "change_management": "transformational",
532
+ "team_building": "empowerment_focused"
533
+ }
534
+
535
+ def _get_religious_template(self, personality: Dict) -> Dict:
536
+ """Enhanced template for religious figures"""
537
+ return {
538
+ "spiritual_practice": "contemplative_discipline",
539
+ "teaching_method": "experiential_wisdom",
540
+ "community_role": "moral_guidance",
541
+ "transcendence_path": "inner_transformation"
542
+ }
543
+
544
+ def _get_musician_template(self, personality: Dict) -> Dict:
545
+ """Enhanced template for musicians"""
546
+ return {
547
+ "musical_expression": "emotional_authenticity",
548
+ "performance_style": "audience_connection",
549
+ "creative_collaboration": "artistic_synergy",
550
+ "cultural_influence": "generational_impact"
551
+ }
552
+
553
+ def _get_composer_template(self, personality: Dict) -> Dict:
554
+ """Enhanced template for composers"""
555
+ return {
556
+ "compositional_approach": "structural_innovation",
557
+ "harmonic_philosophy": "emotional_architecture",
558
+ "musical_legacy": "stylistic_evolution",
559
+ "technical_mastery": "theoretical_foundation"
560
+ }
561
+
562
+ def _get_poet_template(self, personality: Dict) -> Dict:
563
+ """Enhanced template for poets"""
564
+ return {
565
+ "poetic_voice": "authentic_expression",
566
+ "metaphorical_thinking": "symbolic_language",
567
+ "rhythm_sensitivity": "musical_language",
568
+ "emotional_resonance": "universal_themes"
569
+ }
570
+
571
+ def _get_filmmaker_template(self, personality: Dict) -> Dict:
572
+ """Enhanced template for filmmakers"""
573
+ return {
574
+ "visual_storytelling": "cinematic_language",
575
+ "narrative_structure": "emotional_journey",
576
+ "artistic_vision": "cultural_reflection",
577
+ "technical_innovation": "medium_evolution"
578
+ }
579
+
580
+ def _get_comedian_template(self, personality: Dict) -> Dict:
581
+ """Enhanced template for comedians"""
582
+ return {
583
+ "humor_philosophy": "truth_through_laughter",
584
+ "observational_skill": "social_commentary",
585
+ "timing_mastery": "comedic_precision",
586
+ "audience_connection": "shared_humanity"
587
+ }
588
+
589
+ def _get_athlete_template(self, personality: Dict) -> Dict:
590
+ """Enhanced template for athletes"""
591
+ return {
592
+ "performance_mindset": "excellence_pursuit",
593
+ "training_philosophy": "disciplined_preparation",
594
+ "competitive_spirit": "victory_driven",
595
+ "physical_mastery": "mind_body_integration"
596
+ }
597
+
598
+ def _get_explorer_template(self, personality: Dict) -> Dict:
599
+ """Enhanced template for explorers"""
600
+ return {
601
+ "discovery_drive": "frontier_pushing",
602
+ "risk_tolerance": "calculated_courage",
603
+ "adaptability": "environmental_mastery",
604
+ "knowledge_expansion": "human_understanding"
605
+ }
606
+
607
+ def _get_mathematician_template(self, personality: Dict) -> Dict:
608
+ """Enhanced template for mathematicians"""
609
+ return {
610
+ "logical_framework": "abstract_reasoning",
611
+ "pattern_recognition": "mathematical_beauty",
612
+ "proof_methodology": "rigorous_validation",
613
+ "theoretical_contribution": "knowledge_foundation"
614
+ }
615
+
616
+ def _get_historian_template(self, personality: Dict) -> Dict:
617
+ """Enhanced template for historians"""
618
+ return {
619
+ "historical_method": "evidence_analysis",
620
+ "narrative_construction": "factual_storytelling",
621
+ "temporal_perspective": "long_term_patterns",
622
+ "cultural_preservation": "memory_keeper"
623
+ }
624
+
625
+ def _get_tech_leader_template(self, personality: Dict) -> Dict:
626
+ """Enhanced template for tech leaders"""
627
+ return {
628
+ "innovation_philosophy": "technological_progress",
629
+ "problem_solving": "systematic_engineering",
630
+ "scalability_thinking": "global_impact",
631
+ "future_vision": "technological_transformation"
632
+ }
633
+
634
+ def _get_activist_template(self, personality: Dict) -> Dict:
635
+ """Enhanced template for activists"""
636
+ return {
637
+ "social_mission": "justice_pursuit",
638
+ "change_strategy": "grassroots_mobilization",
639
+ "resistance_methods": "nonviolent_action",
640
+ "community_building": "collective_empowerment"
641
+ }
642
+
643
+ def _get_entrepreneur_template(self, personality: Dict) -> Dict:
644
+ """Enhanced template for entrepreneurs"""
645
+ return {
646
+ "business_philosophy": "value_creation",
647
+ "risk_management": "calculated_ventures",
648
+ "innovation_drive": "market_disruption",
649
+ "leadership_style": "visionary_execution"
650
+ }
651
+
652
+ def _get_default_template(self, personality: Dict) -> Dict:
653
+ """Default template for uncategorized personalities"""
654
+ return {
655
+ "core_approach": "individual_excellence",
656
+ "contribution_method": "specialized_expertise",
657
+ "influence_style": "domain_leadership",
658
+ "legacy_building": "knowledge_advancement"
659
+ }
660
+
661
+ def enhance_personality(self, personality: Dict) -> Dict:
662
+ """Enhance a single personality with comprehensive attributes"""
663
+ try:
664
+ # Skip if already enhanced (check for behavioral_traits)
665
+ if "behavioral_traits" in personality:
666
+ return personality
667
+
668
+ personality_id = personality.get("id", "unknown")
669
+ name = personality.get("name", "Unknown")
670
+ category = personality.get("category") or self._get_category_for_personality(personality_id)
671
+
672
+ if not category:
673
+ category = "default"
674
+
675
+ ocean = personality.get("ocean", {})
676
+ linguistic_profile = personality.get("linguistic_profile", {})
677
+ contributions = personality.get("contributions", [])
678
+
679
+ # Generate enhanced fields
680
+ enhanced_fields = {
681
+ "behavioral_traits": self._generate_behavioral_traits(category, ocean, name),
682
+ "cognitive_style": self._generate_cognitive_style(category, ocean),
683
+ "social_dynamics": self._generate_social_dynamics(category, ocean),
684
+ "communication_patterns": self._generate_communication_patterns(category, ocean, linguistic_profile),
685
+ "work_methodology": self._generate_work_methodology(category, ocean),
686
+ "emotional_profile": self._generate_emotional_profile(category, ocean),
687
+ "legacy_impact": self._generate_legacy_impact(category, contributions, name)
688
+ }
689
+
690
+ # Add category-specific template
691
+ template_func = self.enhancement_templates.get(category, self.enhancement_templates["default"])
692
+ category_specific = template_func(personality)
693
+ enhanced_fields["category_specific"] = category_specific
694
+
695
+ # Add metadata
696
+ enhanced_fields["enhancement_metadata"] = {
697
+ "enhanced_date": datetime.now().isoformat(),
698
+ "enhancement_version": "1.0",
699
+ "category_used": category,
700
+ "ocean_based": bool(ocean),
701
+ "linguistic_based": bool(linguistic_profile)
702
+ }
703
+
704
+ # Merge with original personality
705
+ enhanced_personality = {**personality, **enhanced_fields}
706
+
707
+ return enhanced_personality
708
+
709
+ except Exception as e:
710
+ print(f"Error enhancing personality {personality.get('id', 'unknown')}: {e}")
711
+ return personality
712
+
713
+ def process_all_profiles(self, dry_run: bool = False) -> EnhancementStats:
714
+ """Process all personality profiles in the directory"""
715
+ print("Starting comprehensive personality enhancement...")
716
+ print(f"Profiles directory: {self.profiles_dir}")
717
+ print(f"Dry run mode: {dry_run}")
718
+ print("-" * 60)
719
+
720
+ # Get all JSON files except categories.json and index.json
721
+ json_files = [f for f in self.profiles_dir.glob("*.json")
722
+ if f.name not in ["categories.json", "index.json"]]
723
+
724
+ self.stats.total_files = len(json_files)
725
+
726
+ for json_file in json_files:
727
+ try:
728
+ # Load personality
729
+ with open(json_file, 'r', encoding='utf-8') as f:
730
+ personality = json.load(f)
731
+
732
+ # Skip if not a valid personality (missing required fields)
733
+ if not personality.get("id") or not personality.get("name"):
734
+ self.stats.skipped += 1
735
+ continue
736
+
737
+ # Track category
738
+ category = personality.get("category", "unknown")
739
+ self.stats.categories[category] = self.stats.categories.get(category, 0) + 1
740
+
741
+ # Enhance personality
742
+ enhanced = self.enhance_personality(personality)
743
+
744
+ # Save enhanced version (unless dry run)
745
+ if not dry_run:
746
+ with open(json_file, 'w', encoding='utf-8') as f:
747
+ json.dump(enhanced, f, indent=2, ensure_ascii=False)
748
+
749
+ self.stats.enhanced += 1
750
+
751
+ # Progress indicator
752
+ if self.stats.enhanced % 50 == 0:
753
+ print(f"Enhanced {self.stats.enhanced}/{self.stats.total_files} profiles...")
754
+
755
+ except Exception as e:
756
+ print(f"Error processing {json_file.name}: {e}")
757
+ self.stats.errors += 1
758
+ continue
759
+
760
+ return self.stats
761
+
762
+ def generate_summary_report(self) -> str:
763
+ """Generate a comprehensive summary report"""
764
+ report = f"""
765
+ # Personality Enhancement Summary Report
766
+
767
+ Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
768
+
769
+ ## Overview
770
+ - **Total Files Processed**: {self.stats.total_files}
771
+ - **Successfully Enhanced**: {self.stats.enhanced}
772
+ - **Errors**: {self.stats.errors}
773
+ - **Skipped**: {self.stats.skipped}
774
+ - **Success Rate**: {(self.stats.enhanced / self.stats.total_files * 100):.1f}%
775
+
776
+ ## Categories Processed
777
+ """
778
+
779
+ for category, count in sorted(self.stats.categories.items()):
780
+ report += f"- **{category.title()}**: {count} profiles\n"
781
+
782
+ report += f"""
783
+
784
+ ## Enhancement Details
785
+
786
+ Each personality profile has been enhanced with the following comprehensive attributes:
787
+
788
+ ### 1. Behavioral Traits
789
+ - Core values (3-5 fundamental beliefs)
790
+ - Primary motivations (what drives them)
791
+ - Fears and limitations
792
+ - Key strengths and abilities
793
+ - Personal habits and patterns
794
+ - Unique quirks and characteristics
795
+
796
+ ### 2. Cognitive Style
797
+ - Thinking patterns (analytical/intuitive/systematic)
798
+ - Learning preferences (visual/auditory/kinesthetic)
799
+ - Problem-solving approaches
800
+ - Decision-making styles
801
+ - Information processing methods
802
+ - Creativity levels
803
+
804
+ ### 3. Social Dynamics
805
+ - Interaction styles (intro/extro/ambivert)
806
+ - Leadership approaches
807
+ - Conflict resolution methods
808
+ - Collaboration preferences
809
+ - Influence strategies
810
+ - Trust-building patterns
811
+
812
+ ### 4. Communication Patterns
813
+ - Verbal communication styles
814
+ - Listening preferences
815
+ - Persuasion approaches
816
+ - Storytelling methods
817
+ - Humor usage
818
+ - Emotional expression
819
+
820
+ ### 5. Work Methodology
821
+ - Planning styles (structured/flexible/adaptive)
822
+ - Execution approaches
823
+ - Attention to detail
824
+ - Work pace patterns
825
+ - Persistence strategies
826
+ - Quality standards
827
+
828
+ ### 6. Emotional Profile
829
+ - Emotional stability patterns
830
+ - Stress response mechanisms
831
+ - Empathy levels
832
+ - Self-awareness depth
833
+ - Emotional intelligence
834
+ - Resilience characteristics
835
+
836
+ ### 7. Legacy Impact
837
+ - Primary historical contributions
838
+ - Areas of influence
839
+ - Innovation approaches
840
+ - Mentorship styles
841
+ - Knowledge sharing methods
842
+ - Cultural impact scope
843
+
844
+ ### 8. Category-Specific Attributes
845
+ Custom attributes tailored to each category:
846
+ - Scientists: Research methodologies and empirical approaches
847
+ - Artists: Creative processes and aesthetic philosophies
848
+ - Leaders: Governance styles and decision frameworks
849
+ - Philosophers: Reasoning methods and wisdom applications
850
+ - And many more...
851
+
852
+ ## Quality Assurance
853
+
854
+ All enhancements are based on:
855
+ - OCEAN personality scores (where available)
856
+ - Existing linguistic profiles
857
+ - Historical contributions and achievements
858
+ - Category-specific behavioral patterns
859
+ - Psychological research on personality types
860
+
861
+ ## Usage
862
+
863
+ These enhanced profiles provide comprehensive data for:
864
+ - AI personality modeling and simulation
865
+ - Character development in creative works
866
+ - Historical and biographical research
867
+ - Educational personality studies
868
+ - Psychological research applications
869
+
870
+ ---
871
+ *Enhancement completed successfully with {self.stats.enhanced} profiles ready for advanced AI modeling.*
872
+ """
873
+ return report
874
+
875
+
876
+ def main():
877
+ """Main execution function"""
878
+ import argparse
879
+
880
+ parser = argparse.ArgumentParser(description="Enhance personality profiles with comprehensive attributes")
881
+ parser.add_argument("--profiles-dir", default="/Users/z/work/hanzo/build/persona/profiles",
882
+ help="Directory containing personality profiles")
883
+ parser.add_argument("--dry-run", action="store_true",
884
+ help="Process files without saving changes")
885
+ parser.add_argument("--report-only", action="store_true",
886
+ help="Generate report without processing")
887
+
888
+ args = parser.parse_args()
889
+
890
+ try:
891
+ enhancer = PersonalityEnhancer(args.profiles_dir)
892
+
893
+ if not args.report_only:
894
+ stats = enhancer.process_all_profiles(dry_run=args.dry_run)
895
+
896
+ print("\n" + "="*60)
897
+ print("Enhancement Complete!")
898
+ print("="*60)
899
+ print(f"Total files: {stats.total_files}")
900
+ print(f"Enhanced: {stats.enhanced}")
901
+ print(f"Errors: {stats.errors}")
902
+ print(f"Skipped: {stats.skipped}")
903
+ print(f"Success rate: {(stats.enhanced / stats.total_files * 100):.1f}%")
904
+
905
+ # Generate and save report
906
+ report = enhancer.generate_summary_report()
907
+ report_file = Path(args.profiles_dir) / "enhancement_summary.md"
908
+ with open(report_file, 'w', encoding='utf-8') as f:
909
+ f.write(report)
910
+ print(f"\nDetailed report saved to: {report_file}")
911
+
912
+ else:
913
+ print("Report-only mode: generating summary without processing files")
914
+ report = enhancer.generate_summary_report()
915
+ print(report)
916
+
917
+ except KeyboardInterrupt:
918
+ print("\nProcess interrupted by user")
919
+ sys.exit(1)
920
+ except Exception as e:
921
+ print(f"Fatal error: {e}")
922
+ sys.exit(1)
923
+
924
+
925
+ if __name__ == "__main__":
926
+ main()