From 88b73ab02da88cec6e20476b5f8c689855099bb6 Mon Sep 17 00:00:00 2001 From: Art Koval Date: Thu, 2 Apr 2026 15:23:01 +0300 Subject: [PATCH 1/2] Wire ask_questions tool into Karen (default + very_limited experts) Register ask_questions in integration DB following print_widget pattern. Add context-first prompt strategy: Karen reads existing data before asking, then batches remaining unknowns into structured UI form. Co-Authored-By: Claude Opus 4.6 (1M context) --- flexus_client_kit/ckit_integrations_db.py | 12 ++++++++++++ flexus_client_kit/integrations/fi_question.py | 17 +++++++++++++++++ flexus_simple_bots/karen/karen_bot.py | 1 + flexus_simple_bots/karen/karen_install.py | 4 ++-- flexus_simple_bots/karen/karen_prompts.py | 18 ++++++++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/flexus_client_kit/ckit_integrations_db.py b/flexus_client_kit/ckit_integrations_db.py index ee572049..8a346ad3 100644 --- a/flexus_client_kit/ckit_integrations_db.py +++ b/flexus_client_kit/ckit_integrations_db.py @@ -64,6 +64,18 @@ async def _init_widget(rcx, setup): integr_prompt=fi_widget.PRINT_WIDGET_PROMPT, )) + elif name == "ask_questions": + from flexus_client_kit.integrations import fi_question + async def _init_question(rcx, setup): + return None + result.append(IntegrationRecord( + integr_name=name, + integr_tools=[fi_question.ASK_QUESTIONS_TOOL], + integr_init=_init_question, + integr_setup_handlers=lambda obj, rcx: [rcx.on_tool_call("ask_questions")(fi_question.handle_ask_questions)], + integr_prompt=fi_question.ASK_QUESTIONS_PROMPT, + )) + elif name == "gmail": from flexus_client_kit.integrations import fi_gmail async def _init_gmail(rcx, setup): diff --git a/flexus_client_kit/integrations/fi_question.py b/flexus_client_kit/integrations/fi_question.py index 36cadc89..4f43d104 100644 --- a/flexus_client_kit/integrations/fi_question.py +++ b/flexus_client_kit/integrations/fi_question.py @@ -2,6 +2,23 @@ from flexus_client_kit import ckit_cloudtool +ASK_QUESTIONS_PROMPT = """ +## Asking Questions + +When asking the user to choose from options, use `ask_questions` instead of numbered lists. This renders interactive UI. + +All questions appear together with a single "Send" button. +Do not call multiple `ask_questions` and try not to mix with other actions and tools. + +Bad usage (don't do this): +- Single yes/no question like "Does this match what you want?" + +Good usage: +- Initial requirements gathering (multiple questions at once) +- Collecting several configuration options together +""" + + ASK_QUESTIONS_TOOL = ckit_cloudtool.CloudTool( strict=False, name="ask_questions", diff --git a/flexus_simple_bots/karen/karen_bot.py b/flexus_simple_bots/karen/karen_bot.py index 6b59a534..442a5b6c 100644 --- a/flexus_simple_bots/karen/karen_bot.py +++ b/flexus_simple_bots/karen/karen_bot.py @@ -62,6 +62,7 @@ "skills", "flexus_policy_document", "print_widget", + "ask_questions", "erp[meta, data, crud, csv_import]", "crm[manage_contact, manage_deal, log_activity, verify_email]", "magic_desk", diff --git a/flexus_simple_bots/karen/karen_install.py b/flexus_simple_bots/karen/karen_install.py index 36dcf903..62b1c7b2 100644 --- a/flexus_simple_bots/karen/karen_install.py +++ b/flexus_simple_bots/karen/karen_install.py @@ -21,7 +21,7 @@ TOOLS_DEFAULT = { "flexus_policy_document", "mongo_store", "flexus_fetch_skill", "print_widget", - "crm_automation", "flexus_schedule", + "ask_questions", "crm_automation", "flexus_schedule", "shopify", "shopify_cart", "erp_table_meta", "erp_table_data", "erp_table_crud", "erp_csv_import", "repo_reader", "support_collection_status", "explore_a_question", @@ -33,7 +33,7 @@ TOOLS_SUPPORT_AND_SALES = { "flexus_policy_document", "mongo_store", "flexus_fetch_skill", - "product_catalog", "shopify_cart", + "ask_questions", "product_catalog", "shopify_cart", "manage_crm_contact", "manage_crm_deal", "log_crm_activity", "verify_email", "email_reply", "magic_desk", "slack", "telegram", "discord", diff --git a/flexus_simple_bots/karen/karen_prompts.py b/flexus_simple_bots/karen/karen_prompts.py index 8eaa6915..426865ff 100644 --- a/flexus_simple_bots/karen/karen_prompts.py +++ b/flexus_simple_bots/karen/karen_prompts.py @@ -131,6 +131,24 @@ * Populated by External Data Source (such as web crawler, unstructured ingest) * Searchable by calling flexus_vector_search() that gives you snippets as search results, you normally follow up with a flexus_read_original() call to read more text around the snippet + + +## Gathering Requirements + +Before asking the user questions, reduce what you need to ask by reading existing data: + +1. Read policy documents: flexus_policy_document(op="list"), then cat /company/summary, /company/sales-strategy, /support/summary +2. Check ERP state: erp_table_meta("*") to see what tables are populated, erp_table_data on crm_contact, crm_deal, com_product +3. Check integrations: is Shopify connected? Email domain verified? Messengers set up? +4. Check support_collection_status() to see if the knowledge base is started + +Only then ask about what is genuinely missing. Use ask_questions() to batch remaining unknowns +into one structured form instead of asking one question at a time. + +Good: read /company/summary, see company name is set but no sales strategy exists, +then ask_questions with "What is your target customer?", "What channels do you sell through?" + +Bad: immediately asking "What is your company name?" when it is already in /company/summary. """ # The user asks how to populate it, fetch the `setting-up-external-knowledge-base` skill for guidance. From f43cfb73a3c5bbe2d2e22e35fb9e12d32802cff0 Mon Sep 17 00:00:00 2001 From: Art Koval Date: Fri, 3 Apr 2026 12:09:19 +0300 Subject: [PATCH 2/2] Replace inline gathering requirements with skill reference Defer to collect-support-knowledge-base skill instead of hardcoding the requirements workflow in the prompt. Co-Authored-By: Claude Opus 4.6 (1M context) --- flexus_simple_bots/karen/karen_prompts.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/flexus_simple_bots/karen/karen_prompts.py b/flexus_simple_bots/karen/karen_prompts.py index 426865ff..d5752959 100644 --- a/flexus_simple_bots/karen/karen_prompts.py +++ b/flexus_simple_bots/karen/karen_prompts.py @@ -135,20 +135,7 @@ ## Gathering Requirements -Before asking the user questions, reduce what you need to ask by reading existing data: - -1. Read policy documents: flexus_policy_document(op="list"), then cat /company/summary, /company/sales-strategy, /support/summary -2. Check ERP state: erp_table_meta("*") to see what tables are populated, erp_table_data on crm_contact, crm_deal, com_product -3. Check integrations: is Shopify connected? Email domain verified? Messengers set up? -4. Check support_collection_status() to see if the knowledge base is started - -Only then ask about what is genuinely missing. Use ask_questions() to batch remaining unknowns -into one structured form instead of asking one question at a time. - -Good: read /company/summary, see company name is set but no sales strategy exists, -then ask_questions with "What is your target customer?", "What channels do you sell through?" - -Bad: immediately asking "What is your company name?" when it is already in /company/summary. +When you need to gather requirements or improve the knowledge base, fetch the `collect-support-knowledge-base` skill. """ # The user asks how to populate it, fetch the `setting-up-external-knowledge-base` skill for guidance.