ReplyBrain Docs LLMs

Facts and Account Scope

Facts are what your app says about one customer and their records, read live when a draft is written: their plan, their recent orders, the state of an export. Your app serves them from its own models; only what your serializer returns ever leaves it.

account_scope

Every fact request carries an account_scope: your app's own id for the customer's account. Your app answers only for records that account owns, and a record of another account answers exactly like a missing one (404 not_found), so nothing leaks, not even that it exists.

The account_scope always comes from ReplyBrain's own records (a verified binding, or the key's bounds), never from what a customer or a caller typed. In the API, you name an account by its ReplyBrain account_id; account_ref and an account_scope inside a resource reference are refused.

Binding a case to an account

A signed event proves where it came from, not who the customer is. So a case reads a customer's facts only once it is bound to their account, by one of:

  • A verified session. Your app adds requester.session to an inbound message event when its server verified the customer's signed-in session as they posted it.
  • A signed-in desk. ReplyBrain is told your in-app desk accepts messages only from signed-in customers, so every in-app message binds its case.
  • A confirmed identity (mail). Your app's identity.lookup names which customer holds the sender's address; a teammate confirms it per case.

Two accounts on one case are a person's to tell apart; nothing is guessed.

Topics

Your app declares an account topic (default user) and record topics (order, invoice, …). For a draft, ReplyBrain reads the account topic with the account_scope as its id, then up to three records the customer's message cites, found in the account's lists: the items of a recent list under a key naming the topic (orders: { recent: [...] } → order), or of a <topic>_candidates list. Each listed item has an id, and may have a reference (the number customers see).

Freshness

Every answer carries your app's observed_at. A fact holds for one hour from it, and is read again right before a draft is placed: a changed value or no answer stops the draft (stale_facts), and a new one is written.

See the facts guide for the code.