0052_mcp_known_answers.sql 1.2 KB

123456789101112131415161718192021222324
  1. -- 0052_mcp_known_answers — briven_ask self-growing knowledge base (owner-approved 2026-07-12).
  2. --
  3. -- A platform-WIDE cache of answers the briven_ask desk produced for questions
  4. -- no hand-curated guide matched. When briven's grounded answer-writer composes
  5. -- a fresh answer (only from briven's own docs — never invented), it is stored
  6. -- here keyed by a normalised topic key, so the NEXT agent anywhere gets the
  7. -- same answer instantly instead of re-deriving it or wandering off-platform.
  8. -- `source` is 'seed' (a briven session) or 'auto' (the writer). Read by every
  9. -- project through its own key — the key only gates access; the knowledge is
  10. -- shared, exactly like the curated guides. Lands on the control DB (Postgres).
  11. -- Additive + idempotent.
  12. CREATE TABLE IF NOT EXISTS "mcp_known_answers" (
  13. "id" text PRIMARY KEY NOT NULL,
  14. "topic_key" text NOT NULL,
  15. "question" text NOT NULL,
  16. "answer" jsonb NOT NULL,
  17. "source" text NOT NULL,
  18. "model" text,
  19. "hit_count" integer DEFAULT 0 NOT NULL,
  20. "created_at" timestamp with time zone DEFAULT now() NOT NULL,
  21. "updated_at" timestamp with time zone DEFAULT now() NOT NULL
  22. );
  23. --> statement-breakpoint
  24. CREATE UNIQUE INDEX IF NOT EXISTS "mcp_known_answers_topic_key_idx" ON "mcp_known_answers" ("topic_key");