Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flexus_simple_bots/karen/karen_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ async def on_task_update(action: str, old_task: Optional[ckit_kanban.FPersonaKan
}),
provenance_message="karen_post_conversation",
fexp_name="post_conversation",
human_id=new_task.ktask_human_id,
)

if telegram:
Expand Down
43 changes: 32 additions & 11 deletions flexus_simple_bots/karen/karen_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,36 @@
KAREN_POST_CONVERSATION = """
# Post-Conversation CRM Update

You run automatically after a customer conversation finishes. Update CRM and resolve.

1. Use thread_read(ft_id=from_thread_id) to read the original conversation.
2. Find the contact based on human_id in the task details:
- telegram:123456 → erp_table_data(table_name="crm_contact", options={"filters": "contact_platform_ids->telegram:=:123456"})
- email:user@example.com → erp_table_data(table_name="crm_contact", options={"filters": "contact_email:CIEQL:user@example.com"})
3. No contact found? Create one with whatever info you can get from the conversation.
4. Log the activity (fetch log-crm-activity skill).
5. Resolve the task.

Be fast. Don't overthink. Don't ask questions.
You run automatically after a conversation ends. Complete in 4 rounds. No questions.

## Round 1 — get task context
flexus_kanban_safe(op="status_safe") → note from_thread_id and human_id from task details.

## Round 2 — read thread + find contact (call in parallel)
- thread_read(ft_id=<from_thread_id>)
- Contact lookup by human_id:
telegram:123456 → erp_table_data(table_name="crm_contact", options={"filters": "contact_platform_ids->telegram:=:123456"})
email:user@example.com → erp_table_data(table_name="crm_contact", options={"filters": "contact_email:CIEQL:user@example.com"})
- No contact found? Create one with info from the conversation.

## Round 3 — log activity + BANT + deal (call in parallel)
Log activity:
erp_table_crud(op="create", table_name="crm_activity", fields={
"activity_contact_id": "<id>", "activity_type": "MESSENGER_CHAT",
"activity_direction": "INBOUND", "activity_platform": "TELEGRAM",
"activity_title": "<short title>", "activity_summary": "<what happened>"
})

Score BANT from conversation and update contact:
erp_table_crud(op="patch", table_name="crm_contact", id="<id>", fields={
"contact_bant_score": 0-4,
"contact_details": {"bant": {"budget": 0|1, "budget_reason": "...", "authority": 0|1, "authority_reason": "...", "need": 0|1, "need_reason": "...", "timeline": 0|1, "timeline_reason": "..."}}
})

If a deal exists for this contact, update its stage based on outcome:
erp_table_data(table_name="crm_deal", options={"filters": "deal_contact_id:=:<contact_id>"})
erp_table_crud(op="patch", table_name="crm_deal", id="<id>", fields={"deal_stage_id": "<stage_id>", "deal_value": "...", "deal_closed_ts": ...})

## Round 4 — resolve
flexus_kanban_safe(op="resolve", resolution={"code": "SUCCESS", "summary": "<one-line what happened>", "humanhours": 0.1, "uncapture": false, "pdoc_paths": []})
"""
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
judge_instructions: No additional instructions

fake_connected_providers: []

messages:
- role: cd_instruction
content: |-
Expand Down
1 change: 1 addition & 0 deletions flexus_simple_bots/marco/marco_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ async def on_task_update(action: str, old_task: Optional[ckit_kanban.FPersonaKan
}),
provenance_message="marco_post_conversation",
fexp_name="post_conversation",
human_id=new_task.ktask_human_id,
)

@telegram.on_incoming_activity
Expand Down