# DESIGN-0.17.0 — Persona-KB Binding + Enterprise KB Mode ## Overview Personas become **gateways** to knowledge. In enterprise deployments, users don't interact with KBs directly — they talk to Personas that have KBs attached. This is the core differentiator for enterprise use. Depends on: knowledge bases (v0.14.0), user groups (v0.16.0). **Design principle: Personas carry context, not users.** When a user selects a Persona with bound KBs, the KB context flows automatically — no manual KB selection, no toggle management, no confusion about which KBs are in scope. Admins curate the KB↔Persona relationships; users just pick a Persona. --- ## 1. Schema ### `persona_knowledge_bases` (new join table) ```sql CREATE TABLE persona_knowledge_bases ( persona_id UUID NOT NULL REFERENCES personas(id) ON DELETE CASCADE, kb_id UUID NOT NULL REFERENCES knowledge_bases(id) ON DELETE CASCADE, auto_search BOOLEAN NOT NULL DEFAULT false, created_at TIMESTAMPTZ NOT NULL DEFAULT now(), PRIMARY KEY (persona_id, kb_id) ); ``` `auto_search` controls whether the KB is searched automatically on every message (top-K results prepended to context) or only via explicit `kb_search` tool calls. Default `false` = tool-only. ### `knowledge_bases.discoverable` (new column) ```sql ALTER TABLE knowledge_bases ADD COLUMN discoverable BOOLEAN NOT NULL DEFAULT true; ``` When `false`, the KB does not appear in user-facing listings (`ListDiscoverableKBs`). It remains searchable through Persona bindings. ### `platform_policies.kb_direct_access` (new row) Seeded as `'true'` (permissive default). When set to `'false'`, the channel KB popup is hidden — users access KBs exclusively through Persona bindings. --- [... full content ...]