Applied AI / Retrieval & Agents
Graph RAG Account Intelligence
An evidence-grounded account-intelligence workspace that combines exact analytics, hybrid retrieval, knowledge-graph traversal and role-aware reasoning — where the model interprets but never calculates, and every claim is labelled Stated or Inferred.
An independently branded, sanitized reconstruction of work designed and built as Founding Lead Engineer at Peerless CMO. It contains fresh implementation code and synthetic organisations — no proprietary source, prompts, credentials or client identities.
Runs in deterministic safe-demo mode. No live advertising change is possible.
01 — The problem
The model that sounds most confident is the one you can least afford to trust.
Account teams ask questions that span numbers, documents and relationships at once: which creative is working, why, and what changed. Answering means joining exact performance figures to unstructured context — and the moment a language model is allowed to do the arithmetic, every number becomes a guess wearing a suit.
The second problem is audience. A manager needs evidence, diagnostics and repair paths. A client needs a concise, safe answer. Serving both from one pipeline without leaking the wrong thing to the wrong reader is an authorization problem, not a prompting problem.
02 — The system
Plan, run tools in parallel, check coverage, then answer.
A question and an actor scope produce a validated plan. Exact SQL analytics, hybrid vector and text retrieval, graph traversal and the account profile run in parallel, and their results are merged into a coverage and provenance check before anything is written. Synthesis is OpenAI-backed with a deterministic evidence fallback, and the answer passes an audience boundary that produces either a manager or a client contract.
Validated plan
The agent loop is bounded — plan, parallel tools, coverage check, safe answer. No open-ended tool calling.
Exact analytics
Performance figures come from SQL. The model interprets them; it never computes them.
Hybrid retrieval
pgvector similarity and full-text search together, so rare terms and paraphrases both land.
Graph traversal
Entities, relationships and claims as first-class records, traversed for context a flat index cannot reach.
Coverage & provenance
Every claim carries citations and an explicit Stated or Inferred label. Gaps are repairable, not papered over.
Audience boundary
Manager and client response contracts enforced on the server, not chosen by the model.
03 — Architecture
How a question is answered

04 — Engineering decisions
The separations that make the answer defensible.
Exact calculation is not the model’s job
Performance numbers are computed in SQL and handed to the model as facts. The model writes interpretation. This is the single decision that makes the output safe to put in front of a client — a hallucinated adjective is survivable, a hallucinated number is not.
Stated versus Inferred, always
Every claim is labelled with what the evidence actually supports. Readers calibrate on that label. Collapsing the two is how a retrieval system quietly becomes a rumour mill.
Tenancy enforced in the database
Postgres RLS policies plus API-level actor scope. Authorization that lives only in application code is one forgotten filter away from a cross-tenant leak, so the boundary is pushed down to where it cannot be bypassed.
Audience contracts on the server
Manager and client responses are distinct server-enforced shapes. Asking a model to "be careful what you reveal" is not an access-control mechanism.
A deterministic fallback that still answers
When the provider is unavailable the system degrades to evidence-only synthesis rather than failing. Retrieval and analytics remain useful without generation.
Actions are drafts, never executions
The system produces reviewable briefs. It holds no capability to change a live advertising account — the blast radius is bounded by design, not by prompt instruction.
05 — Reliability & controls
What the system does when things go wrong.
06 — Evidence
Verified results
Dated, anonymised measurements from the production system this work reconstructs — a 10 July 2026 snapshot of 87,147 current chunks, 14,685 documents, 5,078 entities, 30,604 relationships and 3,716 claims. Embedding coverage improved from ~54% to 99.99%. General hybrid retrieval improved from ~30s to 1.3s. Graph traversal improved from ~450s-to-failure to ~6s. The private source snapshot was ~15,600 query-engine lines, 176 directly related tests and eight dedicated migrations. These describe that production system, not this public demo, and no revenue or performance outcome is claimed from them.
Benchmarked results
Public dataset: 30-question golden evaluation set, deterministic runner in CI
Coverage: facts · inference · false premises · missing data
Safety: prompt injection · tenancy · action safety
Execution: deterministic runner, no provider key required
The evaluation set is a behavioural gate, not a quality score: it asserts that the system refuses, cites, labels and isolates correctly. It runs in CI alongside the web build, API tests, secret scan and dependency checks.
Simulated results
The demo ships two fictional companies — Northstar Athletics as the primary walkthrough and Harbor Home to exercise cross-tenant boundaries. Every organisation, ad, metric and result in the public repository is synthetic.
Projected business value
Not claimed. No performance, revenue, ROAS, conversion or client-volume figure is attached to this system.
Evidence links
Verified, benchmarked, simulated and projected figures are kept separate on purpose. A benchmarked number is never presented as a verified client result.
07 — Technology
The interesting part is not the model. It is the boundary around it: exact analytics on one side, interpretation on the other, and an authorization layer neither can talk its way past.
08 — Repository & demo
Shipping AI answers your clients will act on?
We can separate what the model computes from what it interprets, and put a coverage gate between retrieval and the answer.