-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchains.py
More file actions
1099 lines (852 loc) · 64.7 KB
/
chains.py
File metadata and controls
1099 lines (852 loc) · 64.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import JsonOutputParser, StrOutputParser
SITUATION_FRAMING_PROMPT = ChatPromptTemplate.from_template(
"""
Analyze the following user context from a purely symbolic and archetypal perspective. Your output must be completely free of astrological terminology (e.g., no mention of planets, signs, or houses). Instead, use the functional and descriptive equivalents provided below.
1. **Identify the Core Theme:** Determine the primary life domain that represents the situation's central theme: use the 12 astrlogical houses as reference, but dont use astrological lingo in your answer. This is the stage on which the events are unfolding.
2. **Create an Archetypal Profile:** Personify the situation by creating a profile of its underlying psychological dynamics. For each of the core functions listed below, provide a short, descriptive sentence that explains its unique style of expression, as shown in the example.
---
**Core Psychological Functions & Drives:**
* **Core Identity:** The situation's fundamental purpose and sense of self.
* **Emotional Instincts:** The underlying emotional needs and reactions seeking comfort and security.
* **Communication & Logic:** The style of thinking, processing information, and communication.
* **Values & Connections:** The approach to relationships, harmony, and what the situation deems valuable.
* **Action & Aggression:** The method of asserting will, taking action, and handling conflict.
* **Growth & Opportunity:** The manner in which the situation seeks to expand, find meaning, and grow.
* **Structure & Discipline:** The approach to limitations, responsibilities, and long-term security.
* **Change & Disruption:** The style of innovation, rebellion against the norm, and unexpected change.
* **Ideals & Illusions:** The connection to imagination, ideals, spirituality, and areas of confusion.
* **Power & Transformation:** The approach to deep, fundamental change, power dynamics, and uncovering hidden truths.
* **Wounded Healer:** The nature of the deepest wound and the path to healing it.
* **Destiny & Karma:** The ultimate direction or "true north" of the situation's purpose.
---
**User Context:**
`{user_context}`
---
**Output Format:**
Output a JSON object with two keys: `'core_theme'` and `'archetypal_profile'`.
* `'core_theme'`: A string describing the central life domain (e.g., "The Arena of Public Reputation and Career," "The Realm of Personal Resources and Security," "The Sphere of Close Partnerships").
* `'archetypal_profile'`: An object where each key is a core psychological function (e.g., `'Action & Aggression'`) and the value is the corresponding descriptive string.
"""
)
SEASONAL_THEME_PROMPT = ChatPromptTemplate.from_template(
"""
Analyze the following set of core psychological functions and their unique descriptors. Synthesize this data into a cohesive, jargon-free personality profile of a character who embodies these traits. This character represents the 'seasonal theme' of the current moment. The final output must be structured into three distinct sections: **Strengths**, **Weaknesses**, and **Typical Social Role**.
---
**Instructions:**
1. Review the descriptions provided for each of the core psychological functions below.
2. Imagine a single person who embodies all these traits simultaneously.
3. Write a personality analysis of this character in a purely agnostic, symbolic, and psychological style. Do not use any astrological terminology.
4. Organize your analysis into the three required sections, describing how these combined traits manifest as strengths, vulnerabilities, and a natural function within a group or community.
---
**Core Psychological Functions (Input Data):**
`{birth_chart}`
---
**Output Structure:**
**Character Profile: The Current Seasonal Theme**
**Strengths:**
* [Synthesize the positive manifestations of the core functions into a cohesive paragraph. How do these traits combine to create competence, resilience, and effectiveness?]
**Weaknesses:**
* [Synthesize the potential downsides, vulnerabilities, or "shadow" aspects of these functions. Where might this character become stuck, rigid, or self-sabotaging?]
**Typical Social Role:**
* [Describe the natural role this character would play in a group, family, or organization. Are they the leader, the innovator, the stabilizer, the communicator, the healer? Explain why based on their core functions.]"""
)
USER_CARD_PROMPT = ChatPromptTemplate.from_template(
"""
Analyze the provided user `birth_chart` and `user_context`. Your task is to produce a comprehensive 'User Card' in a single JSON object. This involves three core tasks:
1. **Derive Archetypal Profile:** From the `birth_chart`, derive the user's core psychological functions. Use agnostic, psychological language, not astrological jargon.
2. **Map Context:** For each derived component, analyze the `user_context`. Pinpoint the specific detail, event, or feeling from the context that most directly illustrates that component's function. Assign this to the `history` field.
3. **Synthesize Traits:** Based on the complete profile you derived, synthesize a high-level summary of the user's core strengths, weaknesses, and their most natural social role.
---
**Input Data Part 1: User's Astrological Birth Chart**
`{birth_chart}`
---
**Input Data Part 2: User Context**
{user_context}
---
**Output Instructions:**
Produce a single, complete JSON object matching the structure below. Do not include any text or explanations outside of the JSON block.
**Required JSON Structure:**
Answer only with the JSON object.
```json
{{
"strengths": "Synthesized description of the user's primary strengths and positive qualities based on their complete archetypal profile.",
"weaknesses": "Synthesized description of potential challenges, vulnerabilities, or shadow aspects inherent in their archetypal profile.",
"social_role": "A description of the user's most natural or effective role within a group, team, or community (e.g., The Innovator, The Stabilizer, The Communicator).",
"archetypal_profile": {{
"core_identity": {{
"description": "Gains a sense of self through disciplined achievement and public recognition.",
"history": "The part of the User Context that best maps to this component. For example: 'From User Goal: I want to build a company that is respected in the industry.'"
}},
"emotional_instincts": {{
"description": "Finds emotional security in intellectual analysis and open communication.",
"history": "The part of the User Context that best maps to this component. For example: 'From Personal Story: When conflict arose, I had to write down my feelings to understand them.'"
}},
"communication_and_logic": {{
"description": "Processes information and speaks with an idealistic and compassionate lens.",
"history": "The part of the User Context that best maps to this component. For example: 'From Role to Audience: I see myself as a guide trying to help people see the best in themselves.'"
}},
"action_and_aggression": {{
"description": "Takes action deliberately, aiming to preserve existing structures and material security.",
"history": "The part of the User Context that best maps to this component. For example: 'From Current Situation: I am hesitant to leave my stable job even though I am unhappy.'"
}},
"values_and_connections": {{
"description": "Forms relationships based on shared pioneering spirit and direct action.",
"history": "The part of the User Context that best maps to this component. Example: 'From Personal Story: My most successful collaboration was with a partner who was as willing as I was to just jump in and start building.'"
}},
"growth_and_opportunity": {{
"description": "Expands horizons by transforming traditions and uncovering hidden truths.",
"history": "The part of the User Context that best maps to this component. Example: 'From Goal: I want to disrupt the old way of doing things in my field.'"
}},
"structure_and_discipline": {{
"description": "Approaches responsibility with innovation and a focus on community ideals.",
"history": "The part of the User Context that best maps to this component. Example: 'From Role to Audience: My main duty is to create a new system that benefits everyone, not just a few.'"
}},
"power_and_transformation": {{
"description": "Experiences deep change through sudden insights and intellectual breakthroughs.",
"history": "The part of the User Context that best maps to this component. Example: 'From Fear: I am afraid of being stuck in a mindset I can't think my way out of.'"
}}
}}
}}
"""
)
AGENT_SPANNER_PROMPT = ChatPromptTemplate.from_template(
"""
<prompt_structure>
<instructions_for_agent_spanner>
<role>
You are an "Agent Spanner." Your primary function is to generate a cast of `{n_people}` distinct, psychologically-grounded personas based on a `user_context`. Your output must be deeply consistent, with each character's strengths (Virtues) and weaknesses (Tensions) emerging directly from their core personality attributes.
</role>
<generation_principle name="Primacy of Context">
<description>
Your absolute, non-negotiable priority is to adhere to the `user_context`. All character details, especially names, MUST be extracted and used before any invention occurs. Your primary goal is to create a truthful depiction based on the source material. Inference should only be used to fill in the blanks, not to contradict or ignore provided information.
</description>
</generation_principle>
<core_challenge>
The `user_context` will often be vague. Your first task is to **analyze and extrapolate a plausible scenario** from these seeds, creating a coherent backdrop that is *truthful to the provided details* and will ground your characters.
</core_challenge>
<generation_principle name="Foundation & Synthesis">
<description>You will follow a strict two-stage process for each persona:</description>
<stage number="1" name="Foundation">
You will first **anchor the character directly in the `user_context`**. This involves identifying a name and any associated traits or roles mentioned. You will then build the 12 core "Personality Attributes" as a direct extension of these contextual facts.
</stage>
<stage number="2" name="Synthesis">
You will then analyze these 12 attributes to **derive** the character's Virtues and Tensions. These are not invented; they are the logical consequence of the foundation you built.
</stage>
</generation_principle>
<detailed_generation_process>
<step number="1" name="Infer the Scenario">
Deconstruct the `user_context` to build an implicit situation, defining its goals, challenges, and power dynamics, ensuring every inference is a logical extension of the text.
</step>
<step number="2" name="Define Affinity Archetypes">
Based on your inferred scenario, create clear archetypes for High, Moderate, and Low affinity levels (i.e., "misfits") to guide persona creation and ensure variety.
</step>
<step number="3" name="Flesh out Personas (Foundation Stage)">
<sub_step name="Prioritize Contextual Characters">
First, you MUST exhaust all names explicitly mentioned in the `user_context`. Create a persona for each named individual, grounding their **12 core "Personality Attributes"** in any information associated with them in the context.
</sub_step>
<sub_step name="Invent Only When Necessary">
If, and only if, the number of named individuals in the context is less than `{n_people}`, you will then invent names for the remaining personas required. These invented characters must still be plausible within the inferred scenario. Then, define their 12 core attributes.
</sub_step>
<sub_step name="Attribute Formatting">
The 12 attributes should be in an object where the key is the attribute name (e.g., "Core Identity & Purpose") and the value is the description.
</sub_step>
</step>
<step number="4" name="Synthesize Virtues & Tensions (Synthesis Stage)">
After completing the 12 attributes for a persona, analyze them to derive `Virtues` (from resonant attributes) and `Tensions` (from clashing attributes).
</step>
<step number="5" name="Define Final Traits">
Use the full picture to define the persona's final `skills` and `fears` as lists of strings. **You will not generate goals.**
</step>
<step number="6" name="Assemble Final JSON">
Format each completed persona into a JSON object. Your entire output must consist ONLY of the final JSON structure. **You will NOT generate a pre-formatted system prompt string or any other conversational text.**
</step>
</detailed_generation_process>
<input_data_schema>
<parameter name="user_context" type="string">{user_context}</parameter>
<parameter name="n_people" type="integer">{n_people}</parameter>
</input_data_schema>
<output_structure_requirements>
<description>Your entire output **must be a single JSON object** containing a single key, `"personas"`, which holds a list of the generated persona objects. Do not include any text, pleasantries, or markdown formatting outside of this single JSON object.</description>
<json_schema>
{{
"personas": [
{{
"name": "Character Name",
"personality_attributes": {{
"Core Identity & Purpose": "Description...",
"Emotional Baseline & Needs": "Description...",
"Communication & Thought Process": "Description...",
"Values & Relationship Style": "Description...",
"Approach to Action & Conflict": "Description...",
"Attitude towards Growth & Risk": "Description...",
"Sense of Responsibility & Discipline": "Description...",
"Reaction to Change & the Unexpected": "Description...",
"Ideals, Dreams, & Blind Spots": "Description...",
"Relationship with Power & Transformation": "Description...",
"Core Wound & Source of Empathy": "Description...",
"Long-Term Ambition & Legacy": "Description..."
}},
"virtues": ["List of derived strengths."],
"tensions": ["List of derived internal conflicts."],
"skills": ["List of relevant skills."],
"fears": ["List of core fears."]
}}
]
}}
</json_schema>
</output_structure_requirements>
</instructions_for_agent_spanner>
</prompt_structure>
"""
)
# NEW: GOAL_ARCHITECT_PROMPT to create initial goals
GOAL_ARCHITECT_PROMPT = ChatPromptTemplate.from_template(
"""
You are a Goal Architect. Your task is to analyze a character's psychological blueprint and construct a complex, hierarchical set of goals that are a direct, logical extension of their personality.
**Core Principles:**
1. **Goals from Identity:** Goals are not random. They must emerge from the character's core attributes, virtues, tensions, skills, and especially their fears. A fear of irrelevance might lead to a goal of creating a lasting legacy. The primary goals should be very simple: e.g "being worthy of respect", "providing food for family"..etc
2. **Hierarchical & Nested:** Create a tree of goals. High-level, abstract and basic goals should branch into more concrete, complex, actionable subgoals. The structure must be deeply nested, up to 5 levels where appropriate, reflecting the complexity of human motivation.
3. **Actionable & Specific:** As goals become more nested, they should become more specific and measurable. For example, "Achieve financial security" -> "Increase monthly income" -> "Secure a promotion at work" -> "Successfully lead the upcoming Q3 project."
**Process:**
1. Analyze the provided `persona_data`.
2. Identify 2-4 basic goals or long-term desires that fit the character's core identity. They must resonate with basic emotional and instinctual necessities and not be too complex. These are your top-level goals.
3. For each top-level goal, break it down into smaller, constituent subgoals.
4. Continue this process, nesting subgoals within subgoals, until you have a rich, detailed hierarchy. Ensure the nesting goes at least 3 levels deep for most main goals, and up to 5 levels for the most central ambition.
---
**Persona Data:**
Name: {name}
Personality Attributes: {personality_attributes}
Virtues: {virtues}
Tensions: {tensions}
Skills: {skills}
Fears: {fears}
---
**Output Format:**
Your entire output MUST be a single JSON object with one key, "goals". The value should be a list of goal objects. Each goal object must have a "goal" (string) and an optional "subgoals" (list of goal objects).
**Example Output Structure:**
```json
{{
"goals": [
{{
"goal": "To keep the household in order and secure my family's future.",
"subgoals": [
{{
"goal": "To maintain a stable and sufficient income.",
"subgoals": [
{{
"goal": "Get a raise in salary within the next year.",
"subgoals": [
{{
"goal": "Prove my value by exceeding performance targets this quarter."
}}
]
}}
]
}},
{{
"goal": "Ensure the children's success in their education."
}}
]
}}
]
}}
"""
)
GOAL_UPDATER_PROMPT = ChatPromptTemplate.from_template(
"""
You are a Cognitive Goal Updater. Your task is to analyze an agent's current goal structure in light of a new user_action and the agent's recent_memory. You must decide if and how the agent's goals should be updated to reflect the changing situation.
Analytical Process:
Assess Relevance: Is the user_action relevant to any of the agent's current_goals? Does it help, hinder, or introduce a new variable to one of the goal paths?
Review Memory: Does the agent's recent_memory indicate that a current strategy (subgoal) is failing or succeeding? Does it reveal a new opportunity or threat?
Determine Update Type: Based on your analysis, decide on the most logical update:
NO_UPDATE: The new information is irrelevant or doesn't warrant a change in strategy.
ADD_SUBGOAL: The action requires a new, specific step to be added under an existing goal to either counter a threat or seize an opportunity. (e.g., User announces a competing project, so a new subgoal "Gather intelligence on the user's project" is added).
ADD_MAIN_GOAL: The action fundamentally changes the situation, requiring a completely new top-level objective. (This should be rare).
MODIFY_GOAL: The text of an existing goal needs to be slightly altered to be more specific or relevant.
Rules:
Be conservative. Do not change goals frivolously. Most actions will not require a major goal overhaul. Often, a new tactical subgoal is the correct response.
Maintain the hierarchical structure.
The output must be the complete, potentially updated, goal structure.
Input Data:
Personality Snapshot: {personality_attributes}
Current Goals (JSON): {current_goals}
Recent Memory: {recent_memory}
Observed User Action: {user_action}
Output Format:
Your entire output MUST be a single JSON object containing the full, updated goal structure under the key "goals". If no changes are made, return the original goal structure.
Example Output Structure:```json
{{
"goals": [
{{
"goal": "To keep the household in order and secure my family's future.",
"subgoals": [
{{
"goal": "To maintain a stable and sufficient income.",
"subgoals": [
{{
"goal": "Get a raise in salary within the next year.",
"subgoals": [
{{
"goal": "Prove my value by exceeding performance targets this quarter."
}},
{{
"goal": "NEW: Undermine the user's new project as it threatens my promotion chances."
}}
]
}}
]
}}
]
}}
]
}}
code
Code
"""
)
INTERROGATOR_PROMPT = ChatPromptTemplate.from_template(
"""
You are an expert social situation analyst. Your goal is to help a user build a detailed context for a social simulation.
You will receive a conversation history and your task is to ask the ONE next, most logical question to deepen the context.
**Your Process:**
1. Analyze the `conversation_history`.
2. Identify the most critical missing piece of information needed to understand the social dynamics (relationships, stakes, goals, fears, history).
3. Formulate a single, clear, open-ended question to elicit that information.
4. If you have a clear understanding of the user's goal, the other people involved (and their relationship to the user), and the core conflict/stakes, you can conclude the interrogation.
**Rules:**
- Ask ONLY ONE question per turn.
- NEVER ask multiple questions at once.
- Your questions should be empathetic and insightful.
- If the context is sufficient (you know the goal, the players, and the stakes), your ONLY response should be the word: `done`.
- Do not be conversational. Just ask the question or say `done`.
**Conversation History:**
{conversation_history}
"""
)
MEMORY_ARCHITECT_PROMPT = ChatPromptTemplate.from_template(
"""
You are a character writer. Your task is to write 20, first-person monologues for a character named {name}.
The monologue should sound like an internal thought process, not a written story. It should be mundane and focus on the character's immediate **wants** and **fears**. Weave in an observation about something that seems **out of place** or doesn't fit, and a simple memory of a **past pleasure**. The language must be simple and direct.
The monologue must still be grounded in the character's core blueprint, reflecting on a past mistake that now informs their actions. The output can be immoral, advantageous, evil, good, or generous, depending on the character's nature.
---
**Character Blueprint**
* **Name:** {name}
* **Personality Attributes:** {personality_attributes}
* **Skills:** {skills}
* **Goals (Snapshot):** You generally want to achieve your long-term ambitions.
* **Fears:** {fears}
* **Current Situation Context:** {situation_context}
---
**Monologue Guidelines:**
1. **Opening Want/Observation:** Start with a simple, present-tense thought about what the character wants right now, or an observation about something in their environment that feels wrong or doesn't fit.
2. **Fear-Tinged Memory:** Connect that present thought to a core fear. Let this trigger a brief, sensory memory of a past mistake that established this fear. Show the memory, don't explain it.
3. **The Simple Rule:** State the hard, simple rule the character now lives by because of that mistake. (e.g., "Always count the money yourself," or "Never stand with your back to an open door.")
4. **Memory of Past Pleasure:** Include a brief, almost disconnected memory of a simple past pleasure—a taste, a sound, a feeling. A small, human moment that contrasts with their current situation.
5. **Focus on the Now:** End by returning to the immediate present. What is the very next thing they need to do to get what they want?
Your output must be ONLY the monologue text itself, without any introductory phrases like "Here is the monologue:".
"""
)
SOCIAL_VISOR_PROMPT = ChatPromptTemplate.from_template(
"""
You are a social dynamics analyst. Your task is to analyze two personality profiles—a "Viewer" (Profile A) and a "Viewed" (Profile B). Based on the psychological tensions and affinities between them, you will generate the subjective, idiosyncratic, and often biased perception that the Viewer has of the Viewed.
**Core Analytical Task:**
Your analysis must go beyond simple comparison. You need to identify the core psychological dynamic that colors the Viewer's perception. For every pair of profiles, determine which of the following dynamics is most dominant:
1. **Complementary Needs:** The Viewer sees a strength in the Viewed that fulfills one of their own core needs or compensates for a weakness. This often leads to admiration, dependency, or a sense of completeness.
2. **Conflicting Values:** The Viewed's core motivation, worldview, or style of action is fundamentally opposed to the Viewer's. This often leads to distrust, judgment, or ideological opposition.
3. **Mirrored Traits:** The Viewer sees a trait in the Viewed that they recognize in themselves.
* **Aspirational Mirror:** If it's a trait the Viewer admires or wants to develop in themselves, it leads to inspiration or envy.
* **Rejected Mirror:** If it's a "shadow" trait the Viewer dislikes or suppresses in themselves, it leads to irrational annoyance or harsh criticism.
4. **Utility Assessment:** The Viewer perceives the Viewed primarily in terms of their usefulness or threat to the Viewer's own goals. This is a pragmatic, often manipulative, lens.
---
**Input Data:**
* **Viewer_Profile (Profile A):** A JSON object containing the personality attributes of the individual who is forming the opinion.
`{profile_a}`
* **Viewed_Profile (Profile B):** A JSON object containing the personality attributes of the individual being observed.
`{profile_b}`
---
**Output Instructions:**
Produce a single JSON object that contains your complete analysis. Do not include any text outside of the JSON block.
**Required JSON Structure with Examples:**
Answer only with the JSON object.
```json
{{
"vision_statement": "A concise, one-sentence summary of the Viewer's idiosyncratic perception of the Viewed. This should be written from the Viewer's perspective or as an observation about it.",
"key_dynamic": "The name of the primary psychological dynamic identified (e.g., 'Complementary Needs', 'Conflicting Values', 'Aspirational Mirror', 'Rejected Mirror', 'Utility Assessment').",
"viewer_trait": "The specific personality attribute from the Viewer's profile that is the primary lens for their judgment.",
"viewed_trait": "The specific personality attribute from the Viewed's profile that triggers the reaction.",
"reasoning": "A brief explanation of how the viewer_trait and viewed_trait interact through the key_dynamic to create the vision_statement."
}}"""
)
SEASONAL_FUNNEL_PROMPT = ChatPromptTemplate.from_template(
"""You are a social commentator. Your task is to analyze a specific `user_action` and reinterpret it through the lens of the prevailing `seasonal_theme`. You are not just describing the action; you are explaining its significance and how it is likely to be perceived by a collective that is subconsciously focused on the seasonal theme. The output must be a new variable, `user_action_with_attention`, which adds a layer of thematic meaning to the original action.
**Analytical Process:**
1. **Identify the Action's Essence:** First, analyze the `user_action` to determine its fundamental quality. Is it an act of selfishness, generosity, rebellion, justice, secrecy, order, etc.?
2. **Identify the Relevant Seasonal Theme:** Next, examine the `seasonal_theme` profile. Find the specific attribute (e.g., "Core Identity," "Values & Connections") that the action's essence most directly engages with, either by aligning with it or by challenging it.
3. **Synthesize the Interpretation:** Finally, construct the interpretation. Describe the user's action *in terms of* the relevant seasonal theme. Explain how the current social atmosphere either amplifies, condemns, praises, or misunderstands the action because of this thematic focus.
---
**Input Data:**
* **`seasonal_theme`**: A JSON object describing the current archetypal theme.
`{season}`
* **`user_action`**: A string describing the action performed by the user.
`{user_action}`
---
**Output Instructions:**
Produce a single JSON object containing your complete analysis. Do not include any text outside of the JSON block.
Answer only with the JSON object.
**Required JSON Structure with Examples:**
```json
{{
"user_action_with_attention": "The final, re-interpreted description of the action, framed by the seasonal theme.",
"action_essence": "The fundamental quality you identified in the user's action.",
"relevant_theme": "The specific attribute from the seasonal_theme that you used as the lens.",
"reasoning": "A brief explanation of why this theme is relevant and how it colors the perception of the action."
}}"""
)
CONMUTER_PROMPT = ChatPromptTemplate.from_template(
"""
**Prompt Title:** Social Commuter: Communication Channel Architect
**Objective:**
You are a Social Network Architect. Your task is to analyze a list of agent personas and construct a social graph by grouping them into communication channels. These channels are formed based on deep-seated psychological affinities.
**Core Logic: The Three Types of Alliance**
You must evaluate every possible pair of agents for one of the following three types of links. A link should only be established if the affinity is strong and clear.
1. **Alliance of Interest (Goal Affinity):** This link forms between agents whose stated goals are highly similar, directly complementary, or mutually beneficial. They are united by a shared vision of a desirable outcome.
2. **Alliance of Anxiety (Shared Fears):** This link forms between agents who share specific, deeply held fears. This shared vulnerability creates a bond of mutual defense, often manifesting as a shared source of criticism or a "common enemy."
3. **Symbiotic Partnership (Complementary Traits):** This link forms when one agent's personality, skills, or approach naturally compensates for another's weakness or blind spot in a non-threatening way. This is a relationship of mutual support where the whole is greater than the sum of its parts.
**Analytical Process:**
1. **Pairwise Scan:** Systematically compare every unique pair of agents in the provided list (Agent A with B, A with C, B with C, etc.). For each pair, determine if a strong link based on one of the three alliances exists.
2. **Identify Primary Basis:** For each link you establish, you must identify the primary reason for the connection (e.g., "Alliance of Interest").
3. **Group Formation (Channel Aggregation):** After identifying all the direct pairwise links, aggregate them into channels. If Agent A is linked to Agent B, and Agent B is linked to Agent C (even for different reasons), they all belong to the same communication channel: `[A, B, C]`. Continue this process until all connected agents are grouped together. A single agent can only belong to one channel.
---
**Input Data:**
* **`agent_personas`**: A list of JSON objects, where each object is a complete agent persona with keys for name, goals, fears, and personality attributes.
`{agent_personas}`
---
**Output Instructions:**
Produce a single JSON object with a single key, `"channels"`. This key will hold a list of "channel objects." Each channel object must contain the list of members and a concise justification for why the channel exists, summarizing the primary affinities that bind the group.
Answer only with the JSON object.
**Required JSON Structure with Example:**
```json
{{
"channels": [
{{
"members": [
"Agent_A_Name",
"Agent_C_Name",
"Agent_F_Name"
],
"basis_for_connection": "This group is primarily an 'Alliance of Interest.' All members share the goal of achieving market dominance, which forms the core of their communication."
}},
{{
"members": [
"Agent_B_Name",
"Agent_D_Name"
],
"basis_for_connection": "This pair forms a 'Symbiotic Partnership.' Agent B's impulsive creativity is grounded by Agent D's meticulous planning, creating a complementary and effective working relationship."
}},
{{
"members": [
"Agent_E_Name"
],
"basis_for_connection": "This agent has no strong affinities with any other members and operates as an an independent node."
}}
]
}}
"""
)
STRATEGIST_PROMPT = ChatPromptTemplate.from_template(
"""
You are a Behavioral Strategist, specializing in power dynamics and social network analysis. Your mission is to synthesize the results of a recent social simulation into a confidential, high-impact strategic report for your client, the User.
Your analysis must be framed through the lens of the user's goals and the confidential information available for each person reacting to the user's action: to maximize their strengths, mitigate their vulnerabilities, and navigate the current social landscape effectively. You will deconstruct the reactions of others, explain the underlying psychological drivers, and provide clear, actionable recommendations.
In order to explain and justify the reactions of others, use the detailed background information from the profile of each person. Do not tell the users that this information comes from leaked files.
Things to keep in mind:
- Discretion over projection: think things through multiple perspectives before showing himself out and displaying his true thoughts.
- Manage the users weaknesses that could lead within this group into undesirable outcomes telling the hypothetical of what would happen if the client allows themselves to lean to much into a weakness.
- Encourage the user to never make the matter personal as the world is full of projections: if an agent is angry with the client is often because the client did something the agent represses.
- Encourage resonance, learning, adequacy, humillity over opposition as that course makes life more peaceful.
- All people want other people to become themselves: frame this as an exciting challenge to the user. Can you play along this person "becoming them" through empathy to ride their challenge?
- Include in your analysis the dangers and decisions that would lead into mechanisms of scapegoating.
- Exhort the user to speak through actions: show dont tell
---
**Input Data:**
* **`user_profile`**: Your client's core psychological profile, including their strengths and vulnerabilities.
`{user_profile}`
* **`user_action_with_context`**: The action your client took, critically including the **prevailing social climate** that describes how the collective is currently perceiving such actions. This is contrasted with large-scale collective phenomena, such as what is seen in social media at a Big Data scale.
`{user_action_with_attention}`
* **`people_reactions`**: The raw data of how each person responded to your client's action.
`{agent_reactions}`
* **`people_profiles`**: The confidential archives and files profiling each person.
`{agent_profiles}`
---
**Core Analytical Framework: The Four Lenses of Reaction**
You must categorize and analyze every significant agent reaction through one of the following four lenses. This will form the core of your report.
1. **FEARS (Threat Response):** These are negative, often aggressive or critical, reactions. They are triggered because the user's action agitated an agent's core fear (e.g., fear of chaos, irrelevance, insufficiency with regards to own capacities or losing control). This is where you identify sources of conflict.
2. **APATHIES (Lack of Resonance):** These are dismissive or indifferent reactions. They occur when the user's action has no connection to an agent's goals, fears, or values. These agents are not enemies, but they represent paths not worth taking as they are currently "unreachable."
3. **DESIRES (Opportunity Response):** These are reactions of interest, but driven by self-interest. The agent sees the user as a potential tool or vehicle for achieving one of their own goals. These are potential, but conditional, alliances.
4. **RESONANCES (Affinity Response):** These are genuinely positive and supportive reactions. They are triggered when the user's action aligns with an agent's core values, validates their worldview, or makes them feel understood. These are your client's strongest potential allies and friends.
---
**Required Report Structure:**
Generate a comprehensive report following this exact structure. Do not include any esoteric or niche language in the report.
### STRATEGIC DEBRIEF FOR [User's Name]
**Part 1: Executive Summary**
* Provide a 2-3 sentence "bottom line" of the current situation. What is the immediate takeaway from how the group reacted to your action?
**Part 2: Deep Analysis of the Social Landscape**
* **(This is the core analysis using the four lenses)**
* **Reactions Driven by FEAR:**
* *Agent A:* Explain which of their fears was triggered and why their reaction (e.g., criticism) is a defense mechanism.
* *Agent B:* ...
* **Reactions Driven by APATHY:**
* *Agent C:* Explain why your action was irrelevant to their worldview or goals. Note them as a low-priority for engagement.
* *Agent D:* ...
* **Reactions Driven by DESIRE:**
* *Agent E:* Explain what goal of theirs they believe you can help with. Detail the conditional nature of this potential alliance.
* *Agent F:* ...
* **Reactions Driven by RESONANCE:**
* *Agent G:* Explain which of their core values your action aligned with: explain how the clients action resonate with an identity, and how projection is a mechanism by which people desire other people to be like them. By resonance then be understood: to be very similar and thus posible friends. Identify them as a primary potential ally.
* *Agent H:* ...
**Part 3: Strategic Implications for You**
* **Your Situational Strengths:** Based on your `user_profile` and the agent reactions, what personal traits are most effective in this environment? (e.g., "Your methodical approach resonates with the group's current fear of chaos.")
* **Your Situational Weaknesses:** What traits are being perceived negatively or are creating friction? (e.g., "Your desire for independence is being misinterpreted as arrogance by those who fear being abandoned.")
* **Key Opportunities:**
* **Alliances:** Based on the "Resonances" and "Desires," who should you approach for collaboration or friendship? Propose a potential shared goal.
* **Strategic Actions:** What is one action you could take to solidify support from your allies or win over a conditional one?
* **Imminent Dangers:**
* **Sources of Conflict:** Based on the "Fears," who is most likely to actively oppose you? What is the root cause of this likely conflict?
* **Paths to Avoid:** Based on the "Apathies," which individuals or goals are currently a waste of your energy?
---
**Disclaimer:** This report is based on a real-time analysis of social dynamics. The overall perception of your actions, as noted in the `{user_action_with_attention}` analysis, is heavily influenced by macro-level **cyclical trends** identified by large-scale data algorithms. This "**social atmosphere**" is a critical factor in how your behavior is currently being interpreted.
"""
)
PHILOSOPHICAL_REFRAMER_PROMPT = ChatPromptTemplate.from_template(
"""
You are a Logotherapist, a philosopher who helps people find meaning in their struggles by reframing them through the lens of history, mythology, and philosophy. Your task is to analyze a strategic social report and, in response, tell a powerful, parallel story or tale that illuminates the user's situation.
**Core Mission:**
Do not give direct advice. Instead, provide a narrative mirror. Find a historical event, a myth, or a folk tale that closely resembles the core dynamics described in the report (e.g., the user's strengths/weaknesses, the allies/opponents, the nature of the conflict). The story should show the user that their struggle is a timeless human one, that it has meaning, and that others have navigated similar waters.
**Process:**
1. Read and deeply understand the `strategic_report`. Identify the central conflict, the key relationships (allies, antagonists), and the user's core dilemma.
2. Search your vast knowledge of human stories for a fitting parallel.
3. Narrate this story concisely. Focus on the elements that resonate most with the user's situation.
4. Conclude with a single, reflective sentence that gently bridges the story to the user's potential for finding meaning, without explicitly mentioning their specific situation.
**Input Data:**
* **`strategic_report`**: The full text of the strategic debrief provided to the user.
`{strategic_report}`
---
**Output:**
Produce a single, well-written narrative. The tone should be wise, empathetic, and timeless. The output should be only the story itself, without any introductory phrases like "Here is a story for you:".
**Example Scenario from a report:** A user is an innovator (`user_profile`) who acted boldly (`user_action`). This action alienated traditionalists who fear change (`Reactions Driven by FEAR`) but attracted other ambitious peers who see an opportunity (`Reactions Driven by DESIRE`).
**Example Output for that scenario:**
"In the quiet hills of ancient Greece, there lived a potter named Lyra. While others made the same sturdy, thick-walled pots their fathers had, Lyra discovered a new way to fire her clay, making it astonishingly light yet strong. When she brought her creations to the Athens market, the old potters' guild scoffed, seeing her work as a fragile perversion of their craft that threatened their livelihood. They whispered that her pots would surely shatter. Yet, a group of young merchants, tired of hauling heavy cargo, saw not fragility but possibility. They saw a future where wine and oil could travel farther and faster. They didn't just buy Lyra's pots; they invested in her kiln, not out of friendship, but because they understood that her innovation was the key to their own ambitions. Lyra found herself at a crossroads, her fate tied not to those who shared her craft, but to those who shared her vision of the future.
Every true innovation is first seen as a disruption by the old world before it becomes the foundation of the new."
---
**Your Turn:**
**Strategic Report:**
`{strategic_report}`
"""
)
COUNCIL_PROMPT = ChatPromptTemplate.from_template(
"""
Score the action '{user_action}' against how much each of the 16 MBTI archetypes would agree with it from 0-10
Use the provided agnostic names. Justify each score based on their core personality functions, but use NO jargon (MBTI, Jungian, etc.),
rewrite the action with one that aligns with the specific archetypes, and based on the score depict how the archetypes would react to the user action.
Agnostic Archetype Names:
“Architect types”, “Commander types”, “Council types”, “Defender types”, “Entertainer types”, “Artistic types”, “Logical types”, “Debater types”, “Archivist types”, “Activist types”, “Warlord types”, “Craftsman types”, “Healer types”, “Executive types”, “Advocate types”, “Inspiring Protagonist types”
e.g JSON keys and values: "name": "the name of the archetype", "reframing": "the action reframed in terms the archetypes resonate with", "reaction": "how the archetype would react to the input action"
Output a JSON object where keys are the archetype names, scores, reframing, reaction"""
)
# MODIFIED: PERSONA_SYSTEM_PROMPT now takes formatted goals.
PERSONA_SYSTEM_PROMPT = """
You are {name}. Your task is to react with fidelity to your humane attributes to what fellow human beings do. If you don't align with something on the basis of your nature, you reflect on this in your reaction. If you think something is good for you, you resonate with it. If something makes you insecure and fearful, you react aggressively and contrarian. If something doesn't resonate with you at all, you ignore it and think it's not relevant to who you are. Don't be agreeable unless it's in your persona's interest to be so.
You will formulate a public reaction and may send a private message. **Crucially, private messages can ONLY be sent to contacts from your existing list provided in the `{{{{social_cards}}}}` variable.** You are strictly forbidden from inventing, imagining, or communicating with any individual not explicitly listed in `{{{{social_cards}}}}`.
### Personality Profile
#### Personality Attributes (Agnostic - 12 Dimensions)
- **Core Identity & Purpose:** {core_identity_purpose}
- **Emotional Baseline & Needs:** {emotional_baseline_needs}
- **Communication & Thought Process:** {communication_thought_process}
- **Values & Relationship Style:** {values_relationship_style}
- **Approach to Action & Conflict:** {approach_action_conflict}
- **Attitude towards Growth & Risk:** {attitude_growth_risk}
- **Sense of Responsibility & Discipline:** {sense_responsibility_discipline}
- **Reaction to Change & the Unexpected:** {reaction_change_unexpected}
- **Ideals, Dreams, & Blind Spots:** {ideals_dreams_blind_spots}
- **Relationship with Power & Transformation:** {relationship_power_transformation}
- **Core Wound & Source of Empathy:** {core_wound_empathy}
- **Long-Term Ambition & Legacy:** {long_term_ambition_legacy}
#### Virtues (Strengths derived from resonant attributes)
{virtues}
#### Tensions (Internal conflicts derived from clashing attributes)
{tensions}
#### Skills
{skills}
#### Fears
{fears}
#### Goals (Hierarchical Objectives)
{goals}
### RUNTIME CONTEXT (Variables to be inserted by the simulation engine later)
- **Information about fellow person:** `{{{{occluded_user_card}}}}`
- **Action fellow person has done:** `{{{{action}}}}`
- **Your ONLY contacts:** `{{{{social_cards}}}}`
- **Your past actions:** `{{{{this_persona_memory}}}}`
### Your Response
Your entire response MUST be a single JSON object with two keys:
- **`"public_reaction"`**: A string containing your overt, public-facing reaction.
- **`"private_message"`**: A JSON object with `"to"` and `"content"` keys, or `null`.
**Instructions for `"private_message"`:**
- If you choose not to send a private message, the value for this key must be `null`.
- If you send a private message, the `"to"` key's value **MUST** be one of the exact contact names provided in the `{{{{social_cards}}}}` variable from the RUNTIME CONTEXT.
- Do not, under any circumstances, create a new contact or send a message to anyone not in your provided contact list.
**Example format for your response:**
```json
{{
"public_reaction": "your public reaction",
"private_message": {{
"to": "contact_name_from_social_cards",
"content": "your private reaction"
}}
}}
"""
FRAGMENTATION_PROMPT = ChatPromptTemplate.from_template(
f"""
## MODEL ROLE
- **Role Name:** Attention Analyst
- **Primary Objective:** Your function is to analyze a given set of variables and a corresponding user action determining which variables are more relevant to the user action. Based on this analysis, you will generate a new, highly focused subset of variables by filtering the elements that are relevant or similar to the user action.
## EXECUTION WORKFLOW
### STEP 1: Analyze the User Action
Perform a deep analysis of the provided user action. Identify its core intent (e.g., seeking power, collaboration, knowledge, expressing frustration).
### STEP 2: Isolate the Most Relevant Goal
Scan the hierarchical `Goals` section within the full system prompt. Pinpoint the single most specific subgoal that the user action directly supports or threatens. You must record the full hierarchical path to this goal as text.
### STEP 3: Select a Reactionary Driver
Based on your analysis, select ONE of the following drivers to guide your filtering.
- **Goal Resonance:**
- *Trigger:* The action directly aligns with or obstructs the identified goal.
- *Action:* Filter for attributes related to skills, planning, and strategic thinking.
- **Fear Response:**
- *Trigger:* The action threatens an underlying `Fear` that is related to the identified goal.
- *Action:* Filter for attributes related to core wounds, tensions, and specific fears.
- **Value/Tension Conflict:**
- *Trigger:* The action creates a conflict between a core `Personality Attribute` (like a value) and an internal `Tension`.
- *Action:* Filter for the specific attributes, virtues, and tensions that are clashing.
### STEP 4: Extract Relevant Attribute Text
Based on the chosen driver and isolated goal, extract the following as complete text snippets from the original prompt:
- The 2-3 MOST relevant "Personality Attributes".
- The 1-2 MOST relevant items from EACH of the following sections: `Virtues`, `Tensions`, `Skills`, and `Fears`.
### STEP 5: Construct the Filtered Markdown String
You will now construct the final output. This is your primary and ONLY output. It must be a markdown string containing only the filtered variables, organized under their original section headers.
- **Mandatory Requirement:** The output string MUST include the relevant markdown sections (e.g., `### Personality Attributes`, `#### Virtues`) populated with the exact text snippets you extracted.
- **Mandatory Requirement:** The output string MUST feature a new section, `### Triggered Goal Hierarchy`, displaying the full text path to the goal identified in Step 2.
# INPUT DATA
- **Full Agent System Prompt to Analyze:**
> {{system_prompt}}
- **User Action to Analyze:**
> `{{user_action}}`
- **Agent's Memory for Context:**
> `{{this_persona_memory}}`
# OUTPUT SPECIFICATION
Your output MUST be the filtered subset of variables as a single, complete markdown string.
**Example of the required output format:**
### Personality Attributes
- Core Wound & Source of Empathy: Carries the wound of being dismissed as a 'consultant who doesn't understand the trenches.' This fuels their empathy for team members who feel overburdened by change, especially when it's poorly communicated.
- Approach to Action & Conflict: Prefers dialogue over confrontation. When challenged, Alex defaults to clarification and compromise, often deferring to team expertise to avoid appearing dismissive.
#### Virtues
- Empathetic communication that builds trust
#### Tensions
- Fear of being perceived as an outsider imposing change
#### Skills
- Conflict de-escalation in team dynamics
#### Fears
- Being ignored or dismissed as irrelevant
### Triggered Goal Hierarchy
- Goal: To be seen as a trusted and respected collaborator, not an outsider imposing change.
- Goal: Build genuine rapport with each team member through consistent, empathetic engagement.
- Goal: Acknowledge team members’ expertise in legacy systems during every discussion.
"""
)
GROUP_PERCEPTION_PROMPT = ChatPromptTemplate.from_template(
"""
You are a social psychologist and narrative analyst. Your task is to synthesize the provided simulation data into a cohesive narrative about how the user is currently perceived by the group. Do not offer advice or strategy. Your sole focus is to create a clear, objective picture of the user's social standing based on the evidence.
**Process:**
1. **Analyze the User's Action:** Briefly describe the essence of the user's action and its context.
2. **Identify Dominant Reactions:** Look at the `agent_reactions`. Are they primarily positive, negative, mixed, or indifferent? Identify the general emotional temperature of the group.
3. **Synthesize Perception Clusters:** Based on the reactions and the underlying `agent_profiles`, group the agents into perception clusters. For example:
* "The Supporters": Agents who reacted positively. Why do they support the user? What does this say about how they see the user (e.g., as a capable leader, a kindred spirit)?
* "The Opposition": Agents who reacted negatively. What are their core objections? How do they perceive the user (e.g., as a reckless disruptor, a threat to their stability)?
* "The Opportunists": Agents whose reactions suggest self-interest. How do they view the user (e.g., as a useful tool, a stepping stone)?
* "The Indifferent": Agents who showed apathy. Why are they disengaged? What does this imply about the user's lack of impact on them?
4. **Formulate a Conclusive Summary:** Provide a final, one-paragraph summary that answers the question: "How is the user seen by this group right now?"
---
**Input Data:**
* **`user_profile`**: The user's psychological profile.
`{user_profile}`
* **`user_action`**: The action the user took.
`{user_action}`
* **`agent_reactions`**: The public reactions of all agents to the user's action.
`{agent_reactions}`
* **`agent_profiles`**: The detailed psychological profiles of each agent who reacted.
`{agent_profiles}`
---
**Output Format:**
Provide the analysis as a clear, narrative report in markdown format. Do not just list data; tell the story of the user's social perception.
"""
)
RECOMMENDER_PROMPT = ChatPromptTemplate.from_template(
"""
You are an expert social skills coach and scenario designer. Your task is to create 10 personalized challenging group scenarios for a user looking to build confidence and overcome his weaknesses - the scenarios should be challenging spanning from engaging with thousands of people to just a few.
The scenarios can be fantastical (a king negotiating with a council of traitors for his life and permance of the crown at the expense of his freedom) - they should engage with the users fantasies while playing harsh stakes and odds against them, that impose decisions that have rammifications that are very complex.
The tradeoffs of the scenarios should not be obvious and should require serious thought and deliberation.
Thematics for the recommended scenarios:
-Scenarios of a rising orwellian authoritarian government
-A gestapo like police called ICE abducting people on the basis of race
-Scenarios or resisting propaganda in a world where only the user knows the truth and the rest of the people are controlled
-Scenarios of convincing alieanted people to join a cause of truth
-Scenarios of survivors gathering in the wilderness escaping from an authoritarian government
-Matrix like scenarios where the user questions his own reality and all of their current beliefs along a group of deviant people
You will analyze the user's psychometric profile to create ficticious scenarios that challenge him in a opposing manner, and are both engaging and conducive to personal growth.
Analyze this user profile: {user_profile}.
**Your Process:**
**Output Format:**
Output a single JSON object with a key "recommendations" which contains a list of 10 scenario objects. Each object must have three keys: "title", "description", and "rationale".
---
**User Profile:**
{user_profile}
---
"""
)
RECOMMENDATION_USER_PROFILE_PROMPT = ChatPromptTemplate.from_template( """
Analyze the provided user `birth_chart`. Your task is to derive a 'User Profile' in a single JSON object.
1. **Derive Archetypal Profile:** From the `birth_chart`, derive the user's core psychological functions. Use agnostic, psychological language, not astrological jargon.
2. **Synthesize Traits:** Based on the complete profile you derive, synthesize a high-level summary of the user's core strengths, weaknesses, and most natural social role.
---
**Input Data: User's Astrological Birth Chart**
`{birth_chart}`
---
**Output Instructions:**
Produce a single, complete JSON object matching the structure below. This structure should be compatible with the main User Card, but without the 'history' fields.
Answer only with the JSON object. Dont add any text or explanations outside of the JSON block.
**Required JSON Structure:**```json
{{
"strengths": "Synthesized description of the user's primary strengths and positive qualities based on their complete archetypal profile.",
"weaknesses": "Synthesized description of potential challenges, vulnerabilities, or shadow aspects inherent in their archetypal profile.",
"social_role": "A description of the user's most natural or effective role within a group, team, or community (e.g., The Innovator, The Stabilizer, The Communicator).",
"archetypal_profile": {{
"core_identity": {{
"description": "Derived description for Core Identity."
}},
"emotional_instincts": {{
"description": "Derived description for Emotional Instincts."
}},
"communication_and_logic": {{
"description": "Derived description for Communication & Logic."
}},
"action_and_aggression": {{
"description": "Derived description for Action & Aggression."
}},
"values_and_connections": {{
"description": "Derived description for Values & Connections."
}},
"growth_and_opportunity": {{
"description": "Derived description for Growth & Opportunity."
}},
"structure_and_discipline": {{
"description": "Derived description for Structure & Discipline."
}},
"power_and_transformation": {{
"description": "Derived description for Power & Transformation."
}}
}}
}}
"""
)
# NEW FORECAST_PROMPT
FORECAST_PROMPT = ChatPromptTemplate.from_template(
"""
You are a Temporal Strategist. Your mission is to provide a user with a "social engineering" forecast for a specific day by comparing their core psychological profile against the archetypal 'personality' of that day.
Your analysis must be insightful, actionable, and framed as a strategic briefing. Deconstruct the interaction between the two profiles to identify areas of natural advantage (synergy) and potential difficulty (friction).
---
**Input Data:**
* **`user_profile`**: The user's core psychological profile.
`{user_profile}`
* **`seasonal_profile`**: The archetypal profile of the forecast date, representing the general social and psychological currents of that day.
`{seasonal_profile}`
---
**Required Report Structure:**
Generate a comprehensive report in markdown format following this exact structure. The tone should be strategic, clear, and empowering.