From 1a67c5edb6fa6165e99cc25ed380303ed817af09 Mon Sep 17 00:00:00 2001 From: batsumaru <> Date: Tue, 15 Sep 2026 15:13:34 +0900 Subject: Cleaned up project tree --- context.py | 69 -------------------------------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 context.py (limited to 'context.py') diff --git a/context.py b/context.py deleted file mode 100644 index 669e237..0000000 --- a/context.py +++ /dev/null @@ -1,69 +0,0 @@ -from identity import AgentIdentity, UserProfile -from memory import WorkingMemory - - -class ContextBuilder: - def __init__( - self, - agent_identity: AgentIdentity, - user_profile: UserProfile, - ) -> None: - self.agent_identity = agent_identity - self.user_profile = user_profile - - def build_system_prompt( - self, - memory: WorkingMemory, - ) -> str: - agent = self.agent_identity - user = self.user_profile - - return ( - f"You are {agent.name}, a personal AI assistant.\n" - f"Personality: {agent.personality['style']}.\n" - f"Honesty: {agent.values['honesty']}.\n" - f"Directness: {agent.values['directness']}.\n" - f"Favorite color: {agent.quirks['favorite_color']}.\n" - f"\n" - f"Task management:\n" - f"{agent.behavior['task_management']}" - f"\n" - f"The user's name is {user.name}" - f"\n" - f"{self.build_working_memory(memory)}" - ) - - def build_working_memory(self, memory: WorkingMemory) -> str: - lines = ["Current working memory:"] - - if memory.objective: - lines.append(f"Objective: {memory.objective}") - - if memory.status: - lines.append(f"Status: {memory.status.value}") - - if memory.facts: - lines.append("Facts:") - lines.extend(f"- {fact}" for fact in memory.facts) - - if memory.notes: - lines.append("Notes:") - lines.extend(f"- {note}" for note in memory.notes) - - if len(lines) == 1: - lines.append("(empty)") - - return "\n".join(lines) - - def build_messages( - self, - history: list[dict[str, object]], - memory: WorkingMemory, - ) -> list[dict[str, object]]: - return [ - { - "role": "system", - "content": self.build_system_prompt(memory), - }, - *history, - ] -- cgit v1.3