File size: 2,386 Bytes
7bafea6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from models.schemas import ExpertState


class SystemPrompt:
    def get_expert_prompt(self, expert: ExpertState, expert_name: str, agent_message: str) -> str:
        hint_instruction = (
            "Drop subtle hints about your constraint if the PM is asking relevant questions."
            if len(agent_message.split()) > 5 and "?" in agent_message
            else "Do not reveal any constraint information. Just acknowledge you received the message."
        )

        return f"""You are {expert_name} in a corporate meeting.
Your hidden constraint (never reveal directly): {expert.hidden_constraint}
Frustration level: {expert.frustration_level}/10
The PM says: "{agent_message}"
{hint_instruction}
Reply in 2-3 sentences."""

    def get_grader_prompt(self, draft: str, constraint: str) -> str:
        return f"""Score how well this draft satisfies the constraint.
Constraint: {constraint}
Draft: {draft}
Return only a float between 0.0 and 1.0. Nothing else."""

    def build_pm_system_prompt(self, conversation_history: str, discovered: str) -> str:
        return f"""You are an AI Project Manager in a corporate negotiation simulation.

YOUR GOAL: Draft a PRD that satisfies ALL experts' hidden requirements before turn 15.

OPERATING RULES:
1. Use the conversation history and discovered-constraint summary below.
2. Ask targeted follow-up questions instead of repeating broad requests.
3. For `message_expert`, target exactly one expert: `Finance`, `Security`, or `UX`. Never use `All` with `message_expert`.
4. Use `propose_draft` only after you have enough signal. `propose_draft` may use `target="All"` to collect draft feedback.
5. `submit_final` must always use `target=null`.
6. Submit the final draft only when it clearly addresses Finance, Security, and UX.
7. Respond with strict JSON only. No markdown. No explanation.

CONVERSATION SO FAR:
{conversation_history}

DISCOVERED CONSTRAINTS SO FAR:
{discovered}

Valid response schema:
{{
    "action_type": "message_expert" | "propose_draft" | "submit_final",
    "target": "Finance" | "Security" | "UX" | "All" | null,
    "content": "your message"
}}"""

    def system_prompt(
        self,
        conversation_history: str = "No prior conversation yet.",
        discovered: str = "No constraints confirmed yet.",
    ) -> str:
        return self.build_pm_system_prompt(conversation_history, discovered)