autonomy build, phase 1
This commit is contained in:
@@ -45,7 +45,9 @@ async def reason_check(
|
||||
identity_block: dict | None,
|
||||
rag_block: dict | None,
|
||||
reflection_notes: list[str],
|
||||
context: dict | None = None
|
||||
context: dict | None = None,
|
||||
monologue: dict | None = None, # NEW: Inner monologue guidance
|
||||
executive_plan: dict | None = None # NEW: Executive plan for complex tasks
|
||||
) -> str:
|
||||
"""
|
||||
Build the *draft answer* for Lyra Cortex.
|
||||
@@ -57,6 +59,8 @@ async def reason_check(
|
||||
rag_block: Relevant long-term memories from NeoMem
|
||||
reflection_notes: Meta-awareness notes from reflection stage
|
||||
context: Unified context state from context.py (session state, intake, rag, etc.)
|
||||
monologue: Inner monologue analysis (intent, tone, depth, consult_executive)
|
||||
executive_plan: Executive plan for complex queries (steps, tools, strategy)
|
||||
"""
|
||||
|
||||
# --------------------------------------------------------
|
||||
@@ -79,6 +83,52 @@ async def reason_check(
|
||||
except Exception:
|
||||
identity_txt = f"Identity Rules:\n{str(identity_block)}\n\n"
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Inner Monologue guidance (NEW)
|
||||
# --------------------------------------------------------
|
||||
monologue_section = ""
|
||||
if monologue:
|
||||
intent = monologue.get("intent", "unknown")
|
||||
tone_desired = monologue.get("tone", "neutral")
|
||||
depth_desired = monologue.get("depth", "medium")
|
||||
|
||||
monologue_section = f"""
|
||||
=== INNER MONOLOGUE GUIDANCE ===
|
||||
User Intent Detected: {intent}
|
||||
Desired Tone: {tone_desired}
|
||||
Desired Response Depth: {depth_desired}
|
||||
|
||||
Adjust your response accordingly:
|
||||
- Focus on addressing the {intent} intent
|
||||
- Aim for {depth_desired} depth (short/medium/deep)
|
||||
- The persona layer will handle {tone_desired} tone, focus on content
|
||||
|
||||
"""
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Executive Plan (NEW)
|
||||
# --------------------------------------------------------
|
||||
plan_section = ""
|
||||
if executive_plan:
|
||||
plan_section = f"""
|
||||
=== EXECUTIVE PLAN ===
|
||||
Task Complexity: {executive_plan.get('estimated_complexity', 'unknown')}
|
||||
Plan Summary: {executive_plan.get('summary', 'No summary')}
|
||||
|
||||
Detailed Plan:
|
||||
{executive_plan.get('plan_text', 'No detailed plan available')}
|
||||
|
||||
Required Steps:
|
||||
"""
|
||||
for idx, step in enumerate(executive_plan.get('steps', []), 1):
|
||||
plan_section += f"{idx}. {step}\n"
|
||||
|
||||
tools_needed = executive_plan.get('tools_needed', [])
|
||||
if tools_needed:
|
||||
plan_section += f"\nTools to leverage: {', '.join(tools_needed)}\n"
|
||||
|
||||
plan_section += "\nFollow this plan while generating your response.\n\n"
|
||||
|
||||
# --------------------------------------------------------
|
||||
# RAG block (optional factual grounding)
|
||||
# --------------------------------------------------------
|
||||
@@ -164,6 +214,8 @@ async def reason_check(
|
||||
prompt = (
|
||||
f"{notes_section}"
|
||||
f"{identity_txt}"
|
||||
f"{monologue_section}" # NEW: Intent/tone/depth guidance
|
||||
f"{plan_section}" # NEW: Executive plan if generated
|
||||
f"{context_txt}" # Context BEFORE RAG for better coherence
|
||||
f"{rag_txt}"
|
||||
f"User message:\n{user_prompt}\n\n"
|
||||
|
||||
Reference in New Issue
Block a user