← back
Introducing Brand Brain

Introducing Brand Brain

Brand Brain is a per-property semantic knowledge base in DEJAN APP that indexes website pages, documents, and internal notes using semantic chunking, 768-dimensional halfvec embeddings, and hybrid PostgreSQL search.

Brand Brain is a per-property semantic knowledge base in DEJAN APP that stores a client's website pages, uploaded documents, and internal notes as verbatim passages in PostgreSQL. Every passage is indexed for dense vector search with gemini-embedding-2 and full-text keyword search, then merged through Reciprocal Rank Fusion so app workflows and team members can retrieve exact brand facts on demand. It is accessed from the brain icon menu in the property header (View, Add, and Search) and supports four ingestion modes: ad-hoc notes, document uploads, explicit URL lists, and automated website discovery.

Brand Brain architecture diagram showing four stages: Data Ingestion, Semantic Indexing, Hybrid Storage, and Retrieval and PR
Brand Brain pipeline from four ingestion modes through semantic boundary detection and hybrid PostgreSQL storage to Outreach PR and direct search.

What Brand Brain Is Used For

Brand Brain serves as the shared memory layer for a property in DEJAN APP, keeping all stored material strictly isolated per property. Team members and connected tools use the index in three primary ways:

  • Outreach PR brainstorming (Outreach → PR): The property-scoped PR assistant queries Brand Brain alongside the property's Outreach brief and live web and news search. When a strategist explores story angles, reactive commentary, or journalist pitches, the assistant retrieves verified product facts, spokesperson bios, proprietary research, and policy guardrails directly from the index. Every thread has a shareable URL that team members on the same property can open and continue. If a property has no indexed material yet, the PR workspace displays a prompt to populate Brand Brain first.
  • Direct knowledge search (Brand Brain → Search): Team members can run natural-language or keyword queries across the property's indexed passages. Scope filters narrow retrieval to owned website content, external sources, or all indexed items, returning verbatim text chunks alongside their source URL or document title and section heading.
  • Source inspection and maintenance (Brand Brain → View): The View screen lists every indexed web page, document, and note for the property. Users can inspect the exact chunks generated for any source and delete outdated items without affecting other properties.

Four Modes of Data Ingestion

All content enters Brand Brain through the Add screen, which separates unstructured internal knowledge from file uploads and live web pages. Each mode converts its input into clean Markdown before passing it to the same chunking and embedding pipeline.

Ingestion Mode Accepted Input Extraction Path Primary Use
Ad-hoc Note Plain text or Markdown with category tag Direct Markdown normalization Spokesperson bios, media kits, positioning rules, policy guardrails
Document Upload .md, .txt, .docx, .html, .csv, .pdf (up to 15 MB) Local parser or pdftotext with gemini-3.8-flash OCR fallback for scanned PDFs Research reports, pitch decks, brand guidelines, product sheets
Explicit URL List One URL per line Direct fetch via DejanBot, HTML-to-Markdown extraction Targeted indexing of specific product pages, press releases, or studies
Website Discovery Root URL (homepage or section path) + link depth (L1 or L1+L2) Same-host link discovery (up to 250 URLs), interactive preview, then DejanBot fetch Broad coverage of a client site or a specific section such as /blog/

Ad-hoc Notes and Document Uploads

Ad-hoc notes let teams record facts that never appear on public web pages. Each note carries a category tag (General, Spokesperson, Media Kit, Product, Research, or Policy / Guardrails) so internal rules and approved commentary stay organized alongside public pages.

Document uploads accept files up to 15 MB across Markdown, plain text, Word, HTML, CSV, and PDF formats. Text-based PDFs are extracted locally with pdftotext, while scanned or image-heavy PDFs automatically fall back to OCR using gemini-3.8-flash so slide decks and designed reports remain searchable.

Website Ingestion and DejanBot Discovery

Website ingestion supports two workflows depending on how much control a team needs. The explicit URL list mode accepts one URL per line and scrapes only those exact addresses. The root URL discovery mode starts from a homepage or any section path such as /blog/ or /research/, collects internal links on the same host at depth 1 (L1) or depth 1 and 2 (L1+L2) up to 250 URLs, and supports an optional path-prefix filter to stay within a chosen directory.

Before indexing begins, the discovery workflow renders an interactive preview table showing every discovered URL with its depth badge (L0, L1, or L2), an indexed badge for pages already stored in Brand Brain, individual checkboxes, and a live count of selected pages. Users confirm the exact subset they want to index before any embedding job runs.

Direct page fetches identify themselves with the DejanBot/1.0 (+https://dejan.ai/bot) User-Agent from fixed IP address 34.31.25.140. Full crawler details and whitelisting instructions for client infrastructure teams are published at dejan.ai/bot/.

How Brand Brain Indexes and Retrieves Content

Every ingested source passes through three stages: verbatim semantic chunking, contextual half-precision embedding, and hybrid PostgreSQL indexing.

Semantic Chunking Without Rewriting

Instead of slicing documents on fixed character counts that cut sentences and tables in half, Brand Brain splits normalized Markdown into atomic blocks (headings, paragraphs, lists, and tables). A single gemini-decision-1 call classifies every adjacent block transition as a topic boundary or continuation using binary noul classification with zero generated output tokens, following the method documented in our Agent Search DIY architecture post. Because the model scores boundaries without rewriting text, every stored chunk remains 100% verbatim. Guardrails merge non-heading fragments under 30 words into adjacent blocks and split oversized sections above 900 words.

Contextual Half-Precision Embeddings

Before vectorizing a chunk, Brand Brain prepends its document title and section hierarchy (Title > Section) so isolated passages retain their topic context during retrieval. Each contextualized chunk is embedded with gemini-embedding-2, truncated to 768 dimensions, L2-normalized, and stored as halfvec(768) (float16, 1,536 bytes per vector). In our Gemini Embedding 2 Matryoshka and halfvec benchmark, 768-dimensional float16 vectors retained 100.0% of peak 3,072-dimensional nDCG@10 on BEIR SciFact and 99.0% on BEIR NFCorpus with zero quantization loss compared to float32.

Hybrid PostgreSQL Storage and Reciprocal Rank Fusion

Chunks are stored in PostgreSQL with pgvector 0.8.6 using a halfvec(768) HNSW cosine index (m = 16, ef_construction = 64) paired with a generated tsvector GIN index weighted across document title (A), section heading (B), and body text (C). At query time, Brand Brain executes dense vector search and lexical full-text search in parallel, then merges the ranked results with Reciprocal Rank Fusion (K = 60). On a production table of approximately 9,000 chunks, the complete halfvec(768) table, HNSW index (17 MB), and TOAST storage (16 MB) occupy 50 MB on disk, or about 5.6 MB per 1,000 chunks.

AI SEO DEJAN 0299

Comments