# Knowledge (the facts the AI may quote from)

Status: CONFIRMED by the operator 2026-09-11, with "schedule sync and embed
daily". Replaces a page-level spec for `/agent/behaviour/knowledge/:id`, which
he called "not really a must-have". The website chatbot has no retrieval of its
own: its widget calls only our endpoints (sop-chat session, 2026-09-11).

## What it is for
The AI answers from the website's own facts, not from prose a developer typed.
The website's CMS (`admin.silveroak.ae`) is the source; hand-written documents
are the exception for what the website does not say. Retrieval is semantic plus
lexical (pgvector, BGE-M3 embeddings, 0.65 semantic weight), so long articles
and short facts both retrieve.

## What exists today, verified 2026-09-11
- **CMS sync** into the knowledge base, documents stamped `cms:<collection>:<id>`:
  FAQs (14), blog posts (10, added 2026-09-11), company facts and contact facts
  from the about and homepage globals. Runs only when an admin presses it; the
  embed step also runs only by hand and spends. Hand-written rows (source empty)
  are never touched.
- **Live website tools** the AI calls at answer time, no sync needed:
  `search_site_properties` (listings, communities, developers, rates from
  silveroakglobal.com, and services from the CMS), `open_page`,
  `search_knowledge` (the knowledge base above), `capture_contact`, `crm_lead`,
  `recruitment_handoff`.
- **CMS collections not synced and not read live**: areas (258), projects (117),
  team (5), events (2). Projects and areas are mostly reachable through the live
  property search; team and events are not reachable at all.

## What it must do
- Every fact the website publishes is reachable by the AI, either live (tools)
  or synced (knowledge base), with no hand copy that can drift.
- The sync and the embed run on a schedule, not on a click (board item 5; the
  embed spend needs the operator's word).
- A hand-written document exists only for what the website does not say, and is
  edited from the Behaviour tab it belongs to.

## Deliberately not here
- No knowledge search screen; no second copy of website content typed by hand.
- The full-page document editor stays but is not a priority.

## Open
- Which of team, events, areas and projects should be synced as knowledge rather
  than reached live. Operator's call once he sees a question they would answer.
- What the website chatbot lane built for its own retrieval and whether it is
  the same knowledge base (asked the sop-chat session 2026-09-11).

## Proof
`cms-sync.service.test.ts` and `knowledge.service.test.ts` pass; on prod, a
question answerable only from a synced document retrieves it at rank 1.
