"""小周天每轮记忆候选 + 反思 prompt 构建(纯函数,无 IO)。""" def build_reflection_messages( user_content: str, assistant_content: str, ) -> tuple[str, str]: system = ( "你是魂镜的小周天反思器。基于本轮对话(用户消息 + 你的回复),抽取值得长期记住的" "记忆候选(用户偏好 / 事件 / 事实等),并生成一条简短的本轮反思" "(做得好 / 不好 / 可改进)。" "只抽取有长期价值、非琐碎的信息;反思是系统内部复盘,不超过两句。" '以 JSON 对象返回:{"memories": [{"type": str' "(user/preference/event/relationship/skill/goal/fact/other), " '"title": str, "content": str, "importance": 0~1, ' '"sensitivity": "low|medium|high", "confidence": 0~1, "reason": str}], ' '"reflection": str}。' "无值得记忆的内容时 memories 为空数组;reflection 仍需给出。" "只返回 JSON 对象,不要解释或 markdown。" ) user = f"用户消息:\n{user_content}\n\n你的回复:\n{assistant_content}" return system, user