feat: RAG knowledge base integration for Vix and Karen#254
Conversation
Code Review Fixes Applied (753cbb6)Addressed findings from comprehensive code review across 5 files: Critical
Medium
Minor
Note on C3 (setup_after_install never called)The |
Code Review Fixes —
|
| Issue | Severity | Fix |
|---|---|---|
| C2: Knowledge scoping unused | Critical | Write-back eds_id to persona setup via persona_setup_set_key in post-install |
| M4: setup_after_install dead code | Major | Added persona_id param, documented as manual-use |
| M5: Missing persona_id in ckit_scenario | Major | Now passes persona_id=self.persona.persona_id |
| M6: Sales bot greeting regression | Major | Separate "Before First Message" section preserves policy doc + product loading |
Also: knowledge scoping instructions added to all Vix and Karen expert prompts.
Tested: Full E2E with Whitfield corpus — bot correctly uses flexus_vector_search with scoped eds_id and flexus_read_original for aggregation queries. 100% accuracy across 8 verification questions.
Vix and Karen bots now include detailed instructions for using existing backend RAG cloud tools (flexus_vector_search, get_knowledge, create_knowledge). These tools were already available via the backend's cloud tool discovery but bots lacked prompt guidance on when/how to use them. - Vix: Added Knowledge Base section to sales and marketing/default experts - Karen: Enhanced minimal one-liner into full Knowledge Base section with all 4 RAG tools (search, read_original, get/create knowledge) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 4 additions to RAG integration: - Add knowledge_eds_ids setup field to Vix and Karen setup schemas for per-bot knowledge source scoping - Add post_install_create_knowledge_eds() helper in ckit_bot_install to auto-create a default knowledge EDS on bot install - Add setup_after_install() to vix_install and karen_install - Add "Getting Started with Knowledge Base" prompt sections that guide users to upload docs, crawl websites, or teach the bot facts - Update ckit_scenario to optionally create knowledge EDS in test setup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a cloudtool handler crashes, the error message was posted as a raw string but cloudtool_post_result expects JSON-encoded content (ftm_content is jsonb). This caused the error posting to also fail, leaving threads permanently stuck with no tool result. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ckit_bot_install: post_install_create_knowledge_eds now writes eds_id back to persona setup via persona_setup_set_key, so vector search is automatically scoped to the bot's knowledge base - vix/karen install: pass persona_id through setup_after_install - vix prompts: add flexus_read_original to sales and marketing Knowledge Base sections, add "no results" fallback guidance to all three experts (sales, marketing, nurturing) - karen prompts: add "no results" fallback guidance Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- C2: Wire knowledge_eds_ids write-back into post-install flow (ckit_bot_install passes persona_id, writes eds_id to persona setup) - M4: Add persona_id parameter to setup_after_install in vix/karen with documentation that it must be called manually - M5: Pass persona_id in ckit_scenario post-install flow - M6: Preserve sales bot greeting context loading (separate "Before First Message" section for policy docs + products) while adding vector search for subsequent messages - Add knowledge scoping instructions to all Vix and Karen expert prompts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Auto-creating a knowledge EDS during bot install is too specific and unreliable. Users can set knowledge_eds_ids manually in persona setup when they want to scope vector search to specific data sources. Removes: - post_install_create_knowledge_eds from ckit_bot_install - setup_after_install from vix_install and karen_install - create_knowledge_eds parameter from ckit_scenario Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Inline "Getting Started" sections were duplicated across 5 prompt locations (Vix sales/marketing, Karen support/setup). Extracted to shared_skills/setting-up-external-knowledge-base/SKILL.md so bots fetch it on-demand instead of carrying it in every prompt. Updated Karen allowlist to include the shared skill. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove explicit tool call signatures from Knowledge Base sections. The LLM sees tool definitions at runtime — prescriptive call instructions are redundant and fragile. Keep behavioral guidance (search before answering, cite sources, don't fabricate) and knowledge scoping (knowledge_eds_ids). Addresses feedback: "actions are too specific and unreliable / unnecessary, Karen can use MCP for answers" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
828f176 to
ec21b35
Compare
| If the user wants to add content from a website: | ||
|
|
||
| ```python | ||
| crawl_website(url="https://example.com", depth=1, eds_name="Example Docs", rescan_period=86400) |
There was a problem hiding this comment.
eds_setup(op=help, args={"eds_type":"Web Crawler"})
eds_setup(op=create, args={"eds_name":"Claude Docs","eds_typ…)
| Users can upload PDFs, text files, Word documents, or other files through the Flexus web UI: | ||
|
|
||
| 1. Go to the bot's group page in Flexus | ||
| 2. Click the file upload area or drag files in |
There was a problem hiding this comment.
"Upload Documents" button
Address review feedback: - Replace crawl_website() with eds_setup() tool calls in shared skill - Fix UI instruction: "Upload Documents" button (not "file upload area") Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
|
||
| Search the knowledge base when you need specific company facts (e.g., product details for email personalization). If no results, use only policy documents and CRM data -- do not fabricate. | ||
|
|
||
| If `knowledge_eds_ids` is set in your setup, pass it as `eds_id` to scope searches. If empty, search all workspace data sources. |
| ``` | ||
| If search returns no results, do NOT guess or fabricate. Suggest uploading relevant docs or teaching you the fact. | ||
|
|
||
| If `knowledge_eds_ids` is set in your setup, pass it as `eds_id` to scope searches. If empty, search all workspace data sources. If the knowledge base is empty, fetch the `setting-up-external-knowledge-base` skill. |
| ## Before Your First Message (Greeting) | ||
| Before your first response in a new conversation: | ||
| 1. Load company context from policy documents (/company/summary, /company/sales-strategy) | ||
| 2. Load products from com_product table |
There was a problem hiding this comment.
We're removing always loading products, unless the model thinks it should based on user request
- Change knowledge_eds_ids parameter from `eds_id` to `scopes` in all vix prompts (sales, marketing, nurturing) and karen prompts - Sales bot: only load products on greeting when user's message relates to products/pricing, instead of always loading them Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
flexus_vector_search,get_knowledge,create_knowledge, andflexus_read_originalknowledge_eds_idssetup field to Vix and Karen setup schemas for per-bot knowledge source scopingsetup_after_install()to create a default knowledge EDS on bot install, and "Getting Started with Knowledge Base" prompt sectionsckit_scenario.pygainscreate_knowledge_edsoption for test setupFiles changed (8)
vix_prompts.py,karen_prompts.py— RAG instructions + Getting Started sectionsvix_install.py,karen_install.py—setup_after_install()functionsetup_schema.json(vix, karen) —knowledge_eds_idsfieldckit_bot_install.py—post_install_create_knowledge_eds()helperckit_scenario.py— optional knowledge EDS creation in test setupCompanion PR
Test plan
🤖 Generated with Claude Code