feat: adjust tools and knowledge separation between planning and building
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
"""Debug tool to print the queen's running phase prompt."""
|
||||
"""Debug tool to print the queen's phase-specific prompts."""
|
||||
|
||||
from framework.agents.hive_coder.nodes import (
|
||||
_appendices,
|
||||
@@ -10,32 +10,36 @@ from framework.agents.hive_coder.nodes import (
|
||||
_queen_tools_running,
|
||||
)
|
||||
|
||||
_DEFAULT_WORKER_IDENTITY = (
|
||||
"\n\n# Worker Profile\n"
|
||||
"No worker agent loaded. You are operating independently.\n"
|
||||
"Handle all tasks directly using your coding tools."
|
||||
)
|
||||
|
||||
def print_running_prompt(worker_identity: str | None = None) -> None:
|
||||
"""Print the composed running phase prompt.
|
||||
|
||||
Args:
|
||||
worker_identity: Optional worker identity string. If None, shows
|
||||
the "no worker loaded" placeholder.
|
||||
"""
|
||||
if worker_identity is None:
|
||||
worker_identity = (
|
||||
"\n\n# Worker Profile\n"
|
||||
"No worker agent loaded. You are operating independently.\n"
|
||||
"Handle all tasks directly using your coding tools."
|
||||
)
|
||||
def print_planning_prompt(worker_identity: str | None = None) -> None:
|
||||
"""Print the composed planning phase prompt."""
|
||||
from framework.agents.hive_coder.nodes import (
|
||||
_planning_knowledge,
|
||||
_queen_behavior_planning,
|
||||
_queen_identity_planning,
|
||||
_queen_tools_planning,
|
||||
)
|
||||
|
||||
wi = worker_identity or _DEFAULT_WORKER_IDENTITY
|
||||
|
||||
prompt = (
|
||||
_queen_identity_running
|
||||
_queen_identity_planning
|
||||
+ _queen_style
|
||||
+ _queen_tools_running
|
||||
+ _queen_tools_planning
|
||||
+ _queen_behavior_always
|
||||
+ _queen_behavior_running
|
||||
+ worker_identity
|
||||
+ _queen_behavior_planning
|
||||
+ _planning_knowledge
|
||||
+ wi
|
||||
)
|
||||
|
||||
print("=" * 80)
|
||||
print("QUEEN RUNNING PHASE PROMPT")
|
||||
print("QUEEN PLANNING PHASE PROMPT")
|
||||
print("=" * 80)
|
||||
print(prompt)
|
||||
print("=" * 80)
|
||||
@@ -45,19 +49,15 @@ def print_running_prompt(worker_identity: str | None = None) -> None:
|
||||
def print_building_prompt(worker_identity: str | None = None) -> None:
|
||||
"""Print the composed building phase prompt."""
|
||||
from framework.agents.hive_coder.nodes import (
|
||||
_agent_builder_knowledge,
|
||||
_building_knowledge,
|
||||
_gcu_building_section,
|
||||
_queen_behavior_building,
|
||||
_queen_identity_building,
|
||||
_queen_phase_7,
|
||||
_queen_tools_building,
|
||||
)
|
||||
|
||||
if worker_identity is None:
|
||||
worker_identity = (
|
||||
"\n\n# Worker Profile\n"
|
||||
"No worker agent loaded. You are operating independently.\n"
|
||||
"Handle all tasks directly using your coding tools."
|
||||
)
|
||||
wi = worker_identity or _DEFAULT_WORKER_IDENTITY
|
||||
|
||||
prompt = (
|
||||
_queen_identity_building
|
||||
@@ -65,10 +65,11 @@ def print_building_prompt(worker_identity: str | None = None) -> None:
|
||||
+ _queen_tools_building
|
||||
+ _queen_behavior_always
|
||||
+ _queen_behavior_building
|
||||
+ _agent_builder_knowledge
|
||||
+ _building_knowledge
|
||||
+ _gcu_building_section
|
||||
+ _queen_phase_7
|
||||
+ _appendices
|
||||
+ worker_identity
|
||||
+ wi
|
||||
)
|
||||
|
||||
print("=" * 80)
|
||||
@@ -87,12 +88,7 @@ def print_staging_prompt(worker_identity: str | None = None) -> None:
|
||||
_queen_tools_staging,
|
||||
)
|
||||
|
||||
if worker_identity is None:
|
||||
worker_identity = (
|
||||
"\n\n# Worker Profile\n"
|
||||
"No worker agent loaded. You are operating independently.\n"
|
||||
"Handle all tasks directly using your coding tools."
|
||||
)
|
||||
wi = worker_identity or _DEFAULT_WORKER_IDENTITY
|
||||
|
||||
prompt = (
|
||||
_queen_identity_staging
|
||||
@@ -100,7 +96,7 @@ def print_staging_prompt(worker_identity: str | None = None) -> None:
|
||||
+ _queen_tools_staging
|
||||
+ _queen_behavior_always
|
||||
+ _queen_behavior_staging
|
||||
+ worker_identity
|
||||
+ wi
|
||||
)
|
||||
|
||||
print("=" * 80)
|
||||
@@ -111,17 +107,47 @@ def print_staging_prompt(worker_identity: str | None = None) -> None:
|
||||
print(f"\nTotal length: {len(prompt):,} characters")
|
||||
|
||||
|
||||
def print_running_prompt(worker_identity: str | None = None) -> None:
|
||||
"""Print the composed running phase prompt.
|
||||
|
||||
Args:
|
||||
worker_identity: Optional worker identity string. If None, shows
|
||||
the "no worker loaded" placeholder.
|
||||
"""
|
||||
wi = worker_identity or _DEFAULT_WORKER_IDENTITY
|
||||
|
||||
prompt = (
|
||||
_queen_identity_running
|
||||
+ _queen_style
|
||||
+ _queen_tools_running
|
||||
+ _queen_behavior_always
|
||||
+ _queen_behavior_running
|
||||
+ wi
|
||||
)
|
||||
|
||||
print("=" * 80)
|
||||
print("QUEEN RUNNING PHASE PROMPT")
|
||||
print("=" * 80)
|
||||
print(prompt)
|
||||
print("=" * 80)
|
||||
print(f"\nTotal length: {len(prompt):,} characters")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
phase = sys.argv[1] if len(sys.argv) > 1 else "running"
|
||||
phase = sys.argv[1] if len(sys.argv) > 1 else "planning"
|
||||
|
||||
if phase == "all":
|
||||
print_planning_prompt()
|
||||
print("\n\n")
|
||||
print_building_prompt()
|
||||
print("\n\n")
|
||||
print_staging_prompt()
|
||||
print("\n\n")
|
||||
print_running_prompt()
|
||||
elif phase == "planning":
|
||||
print_planning_prompt()
|
||||
elif phase == "building":
|
||||
print_building_prompt()
|
||||
elif phase == "staging":
|
||||
@@ -131,6 +157,6 @@ if __name__ == "__main__":
|
||||
else:
|
||||
print(f"Unknown phase: {phase}")
|
||||
print(
|
||||
"Usage: uv run scripts/debug_queen_prompt.py [building|staging|running|all]"
|
||||
"Usage: uv run scripts/debug_queen_prompt.py [planning|building|staging|running|all]"
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user