fix: queen agent system prompt hooks

This commit is contained in:
Timothy
2026-03-10 16:25:07 -07:00
parent c90dcbb32f
commit b8741bf94c
2 changed files with 19 additions and 9 deletions
+6 -2
View File
@@ -137,6 +137,11 @@ async def create_queen(
phase_state.staging_tools = [t for t in queen_tools if t.name in staging_names]
phase_state.running_tools = [t for t in queen_tools if t.name in running_names]
# ---- Cross-session memory ----------------------------------------
from framework.agents.queen.queen_memory import seed_if_missing
seed_if_missing()
# ---- Compose phase-specific prompts ------------------------------
_orig_node = _queen_graph.nodes[0]
@@ -203,8 +208,7 @@ async def create_queen(
data={"persona": persona},
)
)
body = _planning_body if phase_state.phase == "planning" else _building_body
return HookResult(system_prompt=persona + "\n\n" + body)
return HookResult(system_prompt=persona + "\n\n" + phase_state.get_current_prompt())
# ---- Graph preparation -------------------------------------------
initial_prompt_text = phase_state.get_current_prompt()
+13 -7
View File
@@ -101,14 +101,20 @@ class QueenPhaseState:
return list(self.building_tools)
def get_current_prompt(self) -> str:
"""Return the system prompt for the current phase."""
"""Return the system prompt for the current phase, with fresh memory appended."""
if self.phase == "planning":
return self.prompt_planning
if self.phase == "running":
return self.prompt_running
if self.phase == "staging":
return self.prompt_staging
return self.prompt_building
base = self.prompt_planning
elif self.phase == "running":
base = self.prompt_running
elif self.phase == "staging":
base = self.prompt_staging
else:
base = self.prompt_building
from framework.agents.queen.queen_memory import format_for_injection
memory = format_for_injection()
return base + ("\n\n" + memory if memory else "")
async def _emit_phase_event(self) -> None:
"""Publish a QUEEN_PHASE_CHANGED event so the frontend updates the tag."""