{
  "video": {
    "id": "ORVh4GivEU0",
    "title": "Beyond RAG: A Relational Context Engine That Cuts Token Burn — Unblocked",
    "duration": 1184,
    "upload_date": null,
    "channel": "AI Engineer",
    "source": "AI Engineer",
    "event_format": ""
  },
  "analysis": {
    "video_id": "ORVh4GivEU0",
    "title": "Beyond RAG: A Relational Context Engine That Cuts Token Burn — Unblocked",
    "one_liner": "RAG answers content questions, but questions like 'open PRs by Rashene' or 'PRs I merged last week' are queries, not semantic searches. Turning natural language into a safe structured query is easy at the LLM step; the hard part is the scaffolding around it: schema discovery, identity resolution, validation and self-correction.",
    "summary": "Peter from Unblocked argues that, before agents, people were the context layer, and that a context engine should take scattered institutional knowledge (code, PRs, Notion docs, Slack, tickets) and return grounded context that is interrelated, intent-specific, personalized and permissions-aware. He demos Claude with and without the Unblocked context engine, which roughly halves cost, and a colleague's session where Unblocked diagnosed and fixed a code-review regression. He then builds the 'other half of RAG' live in an open-source document query engine: dynamic schema discovery, identity resolution, query synthesis, validation, a self-correction retry loop and full-text search, which then also powers a chat agent.",
    "key_points": [
      "Asked to plan an optimization of the 'source mark engine', Claude without a context engine searched the codebase like a new employee. With Unblocked attached, it got a task-specific context bundle that linked source code, Notion architecture docs, PRs and Slack threads. The run cost $1.29 and took about 1.5 minutes, versus up to $2.60 and 3 minutes without, which the speaker calls a 50% cost reduction.",
      "A colleague, Richie, noticed the Unblocked code review product was surfacing fewer issues. Unblocked traced the likely cause to a model switch (transcribed as Opus 46 to Opus 48), then opened a fix PR. The PR description cited the PR that caused the regression and a Slack conversation about it.",
      "Retrieval has two halves. RAG plus an agent loop with file search handles semantic questions. Structural questions such as 'PRs I merged last week', 'who reviewed payments the most', open PRs, or a weekly ratio chart since January 1st need a query engine, because that information isn't encoded in a vector store.",
      "Schema discovery works at runtime by sampling documents in a schemaless store and deriving a schema, including inferring enums and noting indexes. The speaker's point: you can use an LLM as a Thor hammer here, but traditional procedural methods get you really far because the task is actually deterministic.",
      "Identity resolution (mapping a name like Rashene to a GitHub username) uses fuzzy matching across systems. Only if needed is a list of names passed to an LLM as a tiebreaker. He says this is more or less how Unblocked does it.",
      "Query synthesis is the easiest step: give the LLM the discovered schema, the current date and time, and information about the asking user so 'my PRs' resolves correctly.",
      "He calls validation the most important step. LLM-generated queries are untrusted. They can contain dangerous operators, such as a function operator that runs raw JavaScript on the DB server, cross tenant boundaries, or touch hidden fields. Keep tenant ID metadata hidden from the LLM entirely and inject those constraints underneath. In the demo, a regex query for 'PRs with authentication in the title' was rejected.",
      "Self-correction is just a loop with a maximum retry count that feeds validation or DB errors back to the LLM. In the demo it fell back to an exact title match that returned nothing, so full-text search was added. The finished engine supports filters, aggregations, time scoping and self-correction, and it powers a chat agent that shows each query it creates. Unblocked also offers an open-source context engine simulator that builds per-task context bundles locally and A/B tests the same task with and without them."
    ],
    "takeaways": [
      "Split retrieval into semantic (RAG/vector) and structured (query engine) paths. Send temporal, aggregate and 'who/which/how many' questions to generated structured queries, not embeddings.",
      "Treat LLM-generated queries as untrusted. Allowlist operators (block things like raw JavaScript function operators and, if needed, regex), hide sensitive or tenant fields from the LLM, and inject tenant constraints server-side.",
      "Use deterministic code first for schema discovery (sampling documents, inferring enums) and identity mapping (fuzzy matching). Call an LLM only as a tiebreaker.",
      "Put the current date/time and the asking user's identity into the query-synthesis prompt so relative and personal questions ('last week', 'my PRs') resolve.",
      "Wrap query execution in a bounded retry loop that feeds validation and database errors back to the LLM, and add full-text search so it doesn't fall back to exact matches."
    ],
    "topics": [
      "context engineering",
      "rag",
      "text-to-query",
      "agents",
      "query validation",
      "identity resolution",
      "token cost",
      "multi-tenancy"
    ],
    "tools": [
      "Unblocked",
      "Claude",
      "Claude Opus",
      "Notion",
      "Slack",
      "GitHub",
      "document query engine (Unblocked open source)",
      "context engine simulator (Unblocked open source)"
    ],
    "quotes": [
      {
        "text": "So what you see essentially is a 50% reduction in cost which is pretty incredible.",
        "at": "04:15",
        "url": "https://www.youtube.com/watch?v=ORVh4GivEU0&t=255s"
      },
      {
        "text": "these are queries. They're not semantic searches.",
        "at": "07:20",
        "url": "https://www.youtube.com/watch?v=ORVh4GivEU0&t=440s"
      },
      {
        "text": "But generating the queries is actually the easy part. The hard part is the scaffolding that sits around it.",
        "at": "08:20",
        "url": "https://www.youtube.com/watch?v=ORVh4GivEU0&t=500s"
      },
      {
        "text": "don't always fall back to an LLM to do this kind of what looks like non-deterministic work. This is actually quite deterministic this kind of thing.",
        "at": "11:19",
        "url": "https://www.youtube.com/watch?v=ORVh4GivEU0&t=679s"
      }
    ],
    "words": 3289
  },
  "summary_url": "/#ORVh4GivEU0",
  "transcript": {
    "html": "/transcripts/ORVh4GivEU0.html",
    "txt": "/transcripts/ORVh4GivEU0.txt",
    "vtt": "/transcripts/ORVh4GivEU0.vtt"
  }
}