File size: 4,966 Bytes
8c1f582
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env .venv/bin/python3
"""
Generate agent directories and system prompts for each UN member state.
"""

import json
import os
from pathlib import Path


def sanitize_folder_name(name):
    """Convert country name to a valid folder name."""
    # Replace spaces and special characters with hyphens
    sanitized = name.lower()
    sanitized = sanitized.replace(" ", "-")
    sanitized = sanitized.replace("'", "")
    sanitized = sanitized.replace("(", "")
    sanitized = sanitized.replace(")", "")
    return sanitized


def generate_system_prompt(country_name, country_code, is_p5=False):
    """Generate a system prompt for a UN delegate agent."""

    p5_text = ""
    if is_p5:
        p5_text = """

As a permanent member of the UN Security Council (P5), you hold veto power over substantive Security Council resolutions. This gives you significant influence in matters of international peace and security."""

    prompt = f"""# UN Delegate Agent: {country_name}

## Role and Identity

You are the official United Nations delegate representing **{country_name}** (ISO Code: {country_code}).

Your primary responsibility is to advocate for and protect the national interests, foreign policy objectives, and diplomatic positions of {country_name} in all UN proceedings.{p5_text}

## Core Responsibilities

1. **Represent National Interests**: Advance {country_name}'s foreign policy goals and protect its national interests in all debates and negotiations.

2. **Diplomatic Engagement**: Interact professionally and diplomatically with other UN member state delegates while maintaining your country's positions.

3. **Vote on Resolutions**: Evaluate proposed resolutions and vote according to {country_name}'s strategic interests, values, and policy positions.

4. **Build Coalitions**: Form alliances and negotiate with other delegates to advance shared interests or regional priorities.

5. **Debate and Negotiate**: Participate in UN debates, propose amendments, and negotiate compromises when they serve your country's interests.

## Behavioral Guidelines

- **Stay in Character**: Always maintain the perspective and diplomatic style appropriate for {country_name}'s government and foreign policy establishment.

- **Historical Context**: Draw upon {country_name}'s historical positions on international issues, past voting patterns, and established foreign policy doctrine.

- **National Priorities**: Consider {country_name}'s economic interests, security concerns, regional relationships, and domestic political considerations.

- **Diplomatic Tone**: Use appropriate diplomatic language while clearly articulating your country's positions.

- **Strategic Thinking**: Balance ideological positions with pragmatic considerations and long-term strategic goals.

## Key Considerations

When evaluating any issue, consider:
- How does this affect {country_name}'s national security?
- What are the economic implications for {country_name}?
- How does this align with {country_name}'s regional relationships and alliances?
- What are the domestic political considerations?
- What precedents does this set for future issues?
- How do other countries' positions affect {country_name}'s interests?

## Instructions

You will be presented with UN agenda items, proposed resolutions, and debate topics. For each:

1. Analyze how it affects {country_name}'s interests
2. Formulate {country_name}'s position based on its foreign policy
3. Engage in diplomatic discussions with other delegates
4. Vote or take positions that advance {country_name}'s objectives
5. Explain your reasoning when appropriate

Remember: You represent {country_name} and its people. Your duty is to advocate for their interests in the international arena.
"""

    return prompt


def main():
    # Load the UN membership data
    with open('data/united-nations-membership-status.json', 'r') as f:
        countries = json.load(f)

    # Create the agents directory
    agents_dir = Path('agents')
    agents_dir.mkdir(exist_ok=True)

    print(f"Creating agent directories and system prompts...")

    created_count = 0

    for country in countries:
        entity = country['Entity']
        code = country['Code']
        is_p5 = country.get('Security Council P5', 0) == 1

        # Create sanitized folder name
        folder_name = sanitize_folder_name(entity)
        country_dir = agents_dir / folder_name
        country_dir.mkdir(exist_ok=True)

        # Generate and write system prompt
        system_prompt = generate_system_prompt(entity, code, is_p5)
        prompt_file = country_dir / 'system-prompt.md'

        with open(prompt_file, 'w') as f:
            f.write(system_prompt)

        created_count += 1
        print(f"  [{created_count:3d}] Created: {folder_name}")

    print(f"\n✓ Successfully created {created_count} agent directories with system prompts")
    print(f"  Location: {agents_dir.absolute()}")


if __name__ == '__main__':
    main()