Knowledge Base Sync

Knowledge Base Sync

Keep TR-AI's vector index up to date as your knowledge base evolves.

How sync works

TR-AI crawls your KB sources and generates vector embeddings for each content chunk. These embeddings are stored in the database and used for similarity search when a ticket arrives.

The sync process:

  • Crawls your website starting from the root URL, following internal links
  • Fetches pages from Confluence or Notion via API
  • Splits content into ~400-token chunks
  • Generates 384-dimension embeddings using the all-MiniLM-L6-v2 model (local WASM)
  • Stores chunks and embeddings in the database
  • Uses SHA-1 deduplication to skip unchanged pages

Automatic sync by plan

Under Settings → Knowledge base sync you choose how often TR-AI checks your documentation for changes (it only re-embeds pages that changed). Each plan sets the most frequent interval; choosing a slower one is always possible.

PlanMost frequent auto-syncKnowledge sourcesTicket history learned from
StarterWeekly1 source6 months
BronzeDaily3 sources12 months
Growth ProEvery 6 hoursUnlimited24 months

After a downgrade, a previously chosen faster interval is kept but auto-sync runs at the new plan's interval.

Triggering a manual re-index

Trigger a re-index from the Dashboard → Knowledge Base card → Re-index button. This rebuilds all embeddings from scratch.

Note:A re-index is automatically blocked if one is already running within the last 3 hours (returns 409). Wait for the current re-index to complete before triggering another.

You can also trigger a re-index via the API:

Manual re-index API
POST /api/admin/reindex
Content-Type: application/json

// Re-index a specific trial account:
{ "trialAccountId": 42 }

// Re-index all accounts (admin only):
{}

Auto re-index on startup

On server startup, TR-AI automatically detects trial accounts that have KB chunks but no 384-dimension embeddings (e.g. accounts that were indexed with the old 1536-dimension OpenAI model). These accounts are re-indexed in the background automatically.

While a re-index is running, tickets for that account are routed directly to the agent (routed_to_agent outcome) to avoid low-quality resolutions.

Vector stats

Check the current state of your embeddings via the API:

Vector stats API
GET /api/admin/vector-stats?trialAccountId=42

Response:
{
  "chunks": [
    { "model": "minilm384", "dims": 384, "count": 1247 },
    { "model": "openai",    "dims": 1536, "count": 0 }
  ]
}

A healthy account should show a non-zero count for minilm384 (384 dims) and zero for openai (1536 dims). If you see 1536-dim vectors, trigger a re-index to rebuild with the local model.

KB source limits

SourceLimitNotes
WebsiteUp to 1,000 pages per crawlCursor-paginated; SHA-1 dedup skips unchanged pages
ConfluenceAll pages in the specified spaceConcurrency: 6 parallel requests
NotionAll pages shared with the integrationDepth: 5 levels; concurrency: 6
KB URLs stored2 per account (current limit)URLs 3–5 entered in the UI are silently dropped — fix planned
Warning:The current limit of 2 KB URLs per account is a known issue. If you need more than 2 sources, contact support.