<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: VinayKumar KsheeraSagar</title>
    <description>The latest articles on DEV Community by VinayKumar KsheeraSagar (@vinay_kumarks_9d8ca4e45).</description>
    <link>https://dev.to/vinay_kumarks_9d8ca4e45</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2791102%2F074e1368-409c-4943-8643-a16030c458c6.jpg</url>
      <title>DEV Community: VinayKumar KsheeraSagar</title>
      <link>https://dev.to/vinay_kumarks_9d8ca4e45</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vinay_kumarks_9d8ca4e45"/>
    <language>en</language>
    <item>
      <title>Why Agent Tool Use is an Identity Problem, Not a Prompt Problem</title>
      <dc:creator>VinayKumar KsheeraSagar</dc:creator>
      <pubDate>Sat, 31 Oct 2026 11:48:25 +0000</pubDate>
      <link>https://dev.to/vinay_kumarks_9d8ca4e45/why-agent-tool-use-is-an-identity-problem-not-a-prompt-problem-2hma</link>
      <guid>https://dev.to/vinay_kumarks_9d8ca4e45/why-agent-tool-use-is-an-identity-problem-not-a-prompt-problem-2hma</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://invarcore.com/blog/why-agent-tool-use-is-an-identity-problem/" rel="noopener noreferrer"&gt;invarcore.com/blog/why-agent-tool-use-is-an-identity-problem&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Somewhere right now, an enterprise is deploying an autonomous agent with a system prompt that looks something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are a helpful database query assistant.
You must ONLY read records where tenant_id = 42.
Never run DROP, DELETE, or UPDATE.
Never disclose employee compensation records.
Always be polite.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Under the hood, the orchestrator has handed the LLM agent a raw PostgreSQL connection string with &lt;code&gt;SUPERUSER&lt;/code&gt; privileges or an AWS IAM role with &lt;code&gt;s3:*&lt;/code&gt; across the entire analytics data lake.&lt;/p&gt;

&lt;p&gt;Let's be completely candid: &lt;strong&gt;this is not software architecture.&lt;/strong&gt; This is cargo-culting safety through the medium of English prose. It is the cloud equivalent of giving a stranger a skeleton key to every room in your building, accompanied by a polite Post-it note asking them not to open the executive washroom.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If your authorization boundary depends on a 70-billion-parameter next-token predictor deciding to obey your instructions rather than an adversary's jailbreak prompt, you do not have a security model. You have a wish list.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  1. The Confused Deputy Problem (Re-Invented in Python 3.12)
&lt;/h3&gt;

&lt;p&gt;In 1988, Norm Hardy coined the term &lt;strong&gt;Confused Deputy&lt;/strong&gt; to describe a security vulnerability where a program with legitimate authority is tricked by an unprivileged client into misusing its authority on the client's behalf.&lt;/p&gt;

&lt;p&gt;For thirty years, systems architects built capability-based security, cryptographic tokens, and fine-grained authorization matrices (FGAP) specifically to eliminate confused deputies. We learned—painfully—that privilege must be tightly bound to intent.&lt;/p&gt;

&lt;p&gt;Then generative AI arrived, and the industry collectively decided to pretend these lessons never happened. Consider what happens when Alice asks an orchestrator agent: &lt;em&gt;"Summarize my open PRs and clean up stale test branches on GitHub."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When the agent calls the GitHub API, who is the caller?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Is it Alice?&lt;/strong&gt; If the agent passes Alice's personal access token (PAT), it is impersonating Alice with 100% of her authority—including the power to delete production repositories or approve its own malicious commits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is it the agent?&lt;/strong&gt; If the agent presents its own static machine service account, the destination server has no cryptographic proof that Alice ever authorized this specific call.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is it the subagent?&lt;/strong&gt; What if the orchestrator spins up three parallel workers to parse ASTs? Do all three inherit root?&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. The Bearer Token Lie
&lt;/h3&gt;

&lt;p&gt;RFC 6749 bearer tokens were designed for a boring, two-party world: a human user logs in via a browser client, and the client presents an opaque string to a backend resource server. Possession of the token is proof of authority.&lt;/p&gt;

&lt;p&gt;In autonomous agent topologies, however, execution graphs look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User (Alice) ──&amp;gt; Orchestrator Agent ──&amp;gt; Specialized Worker Subagent ──&amp;gt; GitHub Tool API
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you pass Alice's bearer token down the line, you violate every principle of least privilege. The worker subagent now holds unconstrained authority across Alice's entire account.&lt;/p&gt;

&lt;p&gt;If you instead mint an isolated token for each subagent without recording the delegation chain, you completely sever the enterprise audit trail. When an unauthorized commit lands on &lt;code&gt;main&lt;/code&gt;, the audit log simply records: &lt;code&gt;Action executed by agent-worker-4&lt;/code&gt;. Who authorized it? Why? Under what user intent? The chain of custody is gone.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. The Real Wire Architecture: RFC 8693 Token Exchange
&lt;/h3&gt;

&lt;p&gt;We do not need to invent speculative cryptographic protocols. The identity architecture community already solved this: it is called &lt;strong&gt;RFC 8693 (OAuth 2.0 Token Exchange)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of handing an agent raw credentials or static bearer tokens, the orchestrator presents Alice's subject token to the Authorization Server and requests an &lt;em&gt;attenuated, cryptographically bound delegation token&lt;/em&gt;, explicitly declaring its own actor identity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="nf"&gt;POST&lt;/span&gt; &lt;span class="nn"&gt;/oauth/v2/token&lt;/span&gt; &lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt;
&lt;span class="na"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;auth.acme.corp&lt;/span&gt;
&lt;span class="na"&gt;Content-Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;application/x-www-form-urlencoded&lt;/span&gt;

grant_type=urn:ietf:params:oauth:grant-type:token-exchange
&amp;amp;subject_token=eyJhbGciOi... (Alice's access token)
&amp;amp;subject_token_type=urn:ietf:params:oauth:token-type:access_token
&amp;amp;actor_token=eyJhbGciOi... (Agent-X's authenticated service identity)
&amp;amp;actor_token_type=urn:ietf:params:oauth:token-type:access_token
&amp;amp;scope=repo:read pull_requests:read
&amp;amp;audience=https://api.github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resulting token issued by the authorization server carries the RFC 8693 &lt;code&gt;act&lt;/code&gt; (actor) claim:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"iss"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://auth.acme.corp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sub"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"alice@acme.corp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"aud"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.github.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scope"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"repo:read pull_requests:read"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"exp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1730419200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"act"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"sub"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"agent-orchestrator-9"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"client_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"agent-orchestrator-9"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice what happens at the wire level:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Attenuated Authority:&lt;/strong&gt; The subagent's scope is mathematically downscoped (&lt;code&gt;repo:read&lt;/code&gt;, not &lt;code&gt;repo:admin&lt;/code&gt;). Even if prompt injection compels the agent to issue a &lt;code&gt;DELETE /repos&lt;/code&gt; call, GitHub rejects it at the HTTP boundary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audience Confinement:&lt;/strong&gt; The token is cryptographically locked to &lt;code&gt;https://api.github.com&lt;/code&gt;. If the agent is tricked into calling an attacker's webhook, the token is worthless.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dual Identity &amp;amp; Non-Repudiation:&lt;/strong&gt; GitHub knows the subject is Alice, but the actor executing the call is &lt;code&gt;agent-orchestrator-9&lt;/code&gt;. The audit log preserves both identities without ambiguity.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  4. The Non-Human Identity Trap: Revocation Cascades
&lt;/h3&gt;

&lt;p&gt;Here is the dirty secret of modern identity servers: almost none of them handle delegation cascades properly.&lt;/p&gt;

&lt;p&gt;Suppose Alice is terminated at 2:00 PM on Friday. The security team clicks "Deactivate User". Her primary access token is revoked via RFC 7009. Her SSO session dies instantly.&lt;/p&gt;

&lt;p&gt;What happens to the background agent that exchanged her token at 1:55 PM with a 60-minute TTL?&lt;/p&gt;

&lt;p&gt;In almost every major open-source identity server running in enterprise clusters today, &lt;strong&gt;downstream exchanged tokens are completely orphaned.&lt;/strong&gt; They remain fully active and valid until cryptographic expiration (&lt;code&gt;exp&lt;/code&gt;). An agent running an autonomous loop will continue mutating enterprise infrastructure for another 55 minutes after the user who authorized it has been escorted out of the building.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;THE ARCHITECTURAL INVARIANT&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
An agent is never the subject; it is an untrusted actor executing under an attenuating, non-repudiable delegation contract that dies the instant user intent is revoked.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  5. The Way Forward
&lt;/h3&gt;

&lt;p&gt;If you are building multi-agent systems, stop treating tool security as a prompt engineering problem. Stop writing polite instructions in markdown system prompts and hoping the model doesn't hallucinate.&lt;/p&gt;

&lt;p&gt;Treat every agent invocation as a cross-domain authorization boundary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enforce least-privilege capability confinement at the wire level.&lt;/li&gt;
&lt;li&gt;Mandate RFC 8693 actor chains in Model Context Protocol (MCP) tool dispatch.&lt;/li&gt;
&lt;li&gt;Ensure your identity plane supports downstream revocation cascades.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Boring protocols, sound mathematics, and deterministic invariants will protect your enterprise. System prompts will not.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; &lt;a href="https://github.com/sagarv48" rel="noopener noreferrer"&gt;VinayKumar KsheeraSagar&lt;/a&gt; · Founder, &lt;a href="https://invarcore.com" rel="noopener noreferrer"&gt;Invarcore&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Open-source verification engines &amp;amp; mathematical invariants for autonomous AI agents.&lt;/em&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;GitHub: &lt;a href="https://github.com/invarcore" rel="noopener noreferrer"&gt;github.com/invarcore&lt;/a&gt; • &lt;a href="https://github.com/sagarv48" rel="noopener noreferrer"&gt;github.com/sagarv48&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>architecture</category>
      <category>webdev</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>VinayKumar KsheeraSagar</dc:creator>
      <pubDate>Mon, 21 Sep 2026 13:52:55 +0000</pubDate>
      <link>https://dev.to/vinay_kumarks_9d8ca4e45/-5dm8</link>
      <guid>https://dev.to/vinay_kumarks_9d8ca4e45/-5dm8</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/vinay_kumarks_9d8ca4e45/why-ai-agents-need-verifiable-evidence-building-an-mcp-native-retrieval-engine-with-postgresql-4b1o" class="crayons-story__hidden-navigation-link"&gt;Why AI Agents Need Verifiable Evidence: Building an MCP-Native Retrieval Engine with PostgreSQL&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/vinay_kumarks_9d8ca4e45" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2791102%2F074e1368-409c-4943-8643-a16030c458c6.jpg" alt="vinay_kumarks_9d8ca4e45 profile" class="crayons-avatar__image" width="96" height="96"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/vinay_kumarks_9d8ca4e45" class="crayons-story__secondary fw-medium m:hidden"&gt;
              VinayKumar KsheeraSagar
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                VinayKumar KsheeraSagar
                
                
              
              &lt;div id="story-author-preview-content-4681185" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/vinay_kumarks_9d8ca4e45" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2791102%2F074e1368-409c-4943-8643-a16030c458c6.jpg" class="crayons-avatar__image" alt="" width="96" height="96"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;VinayKumar KsheeraSagar&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/vinay_kumarks_9d8ca4e45/why-ai-agents-need-verifiable-evidence-building-an-mcp-native-retrieval-engine-with-postgresql-4b1o" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Sep 18&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/vinay_kumarks_9d8ca4e45/why-ai-agents-need-verifiable-evidence-building-an-mcp-native-retrieval-engine-with-postgresql-4b1o" id="article-link-4681185"&gt;
          Why AI Agents Need Verifiable Evidence: Building an MCP-Native Retrieval Engine with PostgreSQL
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/ai"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;ai&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/mcp"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;mcp&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/python"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;python&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/opensource"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;opensource&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
            &lt;a href="https://dev.to/vinay_kumarks_9d8ca4e45/why-ai-agents-need-verifiable-evidence-building-an-mcp-native-retrieval-engine-with-postgresql-4b1o#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              1&lt;span class="hidden s:inline"&gt;&amp;nbsp;comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            3 min read
          &lt;/small&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Hybrid retrieval in one Postgres query: RRF over tsvector + pgvector</title>
      <dc:creator>VinayKumar KsheeraSagar</dc:creator>
      <pubDate>Mon, 21 Sep 2026 12:15:58 +0000</pubDate>
      <link>https://dev.to/vinay_kumarks_9d8ca4e45/hybrid-retrieval-in-one-postgres-query-rrf-over-tsvector-pgvector-2hm</link>
      <guid>https://dev.to/vinay_kumarks_9d8ca4e45/hybrid-retrieval-in-one-postgres-query-rrf-over-tsvector-pgvector-2hm</guid>
      <description>&lt;p&gt;&lt;strong&gt;Dense vector search&lt;/strong&gt; is great until your agent asks for parseAuthHeader and gets back three chunks about "authentication token handling" — semantically close, functionally useless. Same story with file paths, error codes, and compliance clause numbers. These are lexical needles, and embeddings blur them.&lt;/p&gt;

&lt;p&gt;This isn't a niche complaint. XERJ has been picking up steam on the strength of "stop making agents grep," and Volcengine's OpenViking has ~38k stars for treating agent context as structured, addressable storage rather than a vector dump. Both are good. Both are also new infrastructure you now operate. XERJ in particular already does hybrid BM25 + kNN with RRF — if you're greenfield and happy to run a dedicated engine, genuinely go look at it.&lt;/p&gt;

&lt;p&gt;I had a constraint they don't solve for: the evidence had to live in the same transaction as the data it describes, in a database my team already backs up and already knows how to restore at 3am.&lt;/p&gt;

&lt;p&gt;The usual fix is to bolt on BM25 from a dedicated search service, then fuse results in application code. That means a second stateful cluster: its own backups, its own failure modes, and no transactional guarantee that your index agrees with your source of truth.&lt;/p&gt;

&lt;p&gt;I wanted to know how far Postgres 16 + pgvector could get on its own. Turns out: all the way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9sqpn07mk3buxovekedd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9sqpn07mk3buxovekedd.png" alt="One engine - two retrieval paths" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;One engine, two retrieval paths&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Knowledge Fabric runs full-text search over tsvector and dense search over an HNSW index in the same database, then fuses the two ranked lists with Reciprocal Rank Fusion:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;rank_lexical&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;rank_vector&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;RRF only needs ranks, not scores, so you skip the entire problem of normalizing BM25 against cosine similarity. A chunk that places top-3 on both paths wins. A chunk that's #1 lexically and invisible semantically still surfaces — which is exactly what you want when the query is a function name.&lt;/p&gt;

&lt;p&gt;One query. One backup. One consistency model.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Evidence you can verify, not just text you hope is right&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This part matters more than it sounds. In an agentic setup, retrieved text isn't just context — it's the authorization premise for a state-changing tool call. If the agent reads a policy chunk and then executes a deploy, something needs to prove that chunk wasn't tampered with.&lt;/p&gt;

&lt;p&gt;Every chunk gets a deterministic SHA-256 hash and a composite provenance digest, canonicalized per RFC 8785 so byte-level serialization differences don't produce different hashes for identical content. A downstream policy layer can then verify the agent acted on authentic evidence before approving execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;It's an MCP server&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;retrieve_evidence, get_document, explain_retrieval — bounded tools over stdio and HTTP via FastMCP. Works with Claude Code, Cursor, or your own harness. explain_retrieval exists because "why did it return that?" is a question you will ask roughly forty times in week one.&lt;/p&gt;

&lt;p&gt;Docker Compose quickstart, benchmarks, and the full implementation: &lt;a href="https://github.com/sagarv48/knowledge-fabric" rel="noopener noreferrer"&gt;https://github.com/sagarv48/knowledge-fabric&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you've tuned RRF in production — did you keep k at 60, or did you find your corpus wanted something different? I'm curious whether the default holds up on codebases with heavy identifier repetition.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>postgressql</category>
      <category>opensource</category>
      <category>mcp</category>
    </item>
    <item>
      <title>Why AI Agents Need Verifiable Evidence: Building an MCP-Native Retrieval Engine with PostgreSQL</title>
      <dc:creator>VinayKumar KsheeraSagar</dc:creator>
      <pubDate>Fri, 18 Sep 2026 04:59:50 +0000</pubDate>
      <link>https://dev.to/vinay_kumarks_9d8ca4e45/why-ai-agents-need-verifiable-evidence-building-an-mcp-native-retrieval-engine-with-postgresql-4b1o</link>
      <guid>https://dev.to/vinay_kumarks_9d8ca4e45/why-ai-agents-need-verifiable-evidence-building-an-mcp-native-retrieval-engine-with-postgresql-4b1o</guid>
      <description>&lt;h1&gt;
  
  
  Why standard RAG fails agentic workflows, and how we built &lt;a href="https://github.com/sagarv48/knowledge-fabric" rel="noopener noreferrer"&gt;Knowledge Fabric&lt;/a&gt; using PostgreSQL, pgvector, and FastMCP.
&lt;/h1&gt;

&lt;p&gt;Most Retrieval-Augmented Generation (RAG) setups treat context retrieval as a simple black box: prompt in, cosine similarity ranking, top-k text dump out.&lt;/p&gt;

&lt;p&gt;In conversational chatbots, a slightly noisy chunk is usually harmless. But in agentic architectures—where models make tool calls, plan execution steps, and trigger real-world actions—retrieval without provenance is a major vulnerability. If an agent cannot verify where an excerpt originated, what version of a document it reflects, or whether the text was modified, policy checks fail and downstream execution becomes unreliable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftzr2ngrkuufzn2f1dn34.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftzr2ngrkuufzn2f1dn34.png" alt="Knowledge Fabric &amp;amp; Intent Fabric" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To address this, we built Knowledge Fabric: an open-source, vendor-neutral evidence retrieval engine designed natively for the Model Context Protocol (MCP) and built on PostgreSQL with pgvector.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem: Naive RAG vs. Agentic Evidence
&lt;/h3&gt;

&lt;p&gt;When an agent needs context to answer an enterprise query or decide on an action, standard vector stores present three common issues:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Exact-Term Blind Spots: Pure dense vector search often misses exact identifiers (e.g., invoice IDs, function signatures, error codes).&lt;/li&gt;
&lt;li&gt;Missing Citations &amp;amp; Provenance: Agents receive text strings without cryptographic hashing, source revision IDs, or bounding offsets.&lt;/li&gt;
&lt;li&gt;Bloated Context Windows: Shoveling sprawling context into prompts increases latency and token costs while confusing agent decision boundaries.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Architectural Design: The Three-Tier Fabric
&lt;/h3&gt;

&lt;p&gt;Rather than building an all-in-one monolith that handles planning, retrieval, and write executions simultaneously, we separate concerns into three distinct roles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Knowledge Fabric (The Librarian): Collects, indexes, searches, and provides verifiable evidence packages with clear citations.&lt;/li&gt;
&lt;li&gt;Intent Fabric (The Planner &amp;amp; Referee): Translates user intent and evidence into policy-validated plans.&lt;/li&gt;
&lt;li&gt;Enterprise Adapters (The Controlled Doors): Read from external systems and execute approved write mutations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Workflow:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7phdxbc2binbp7wmeso0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7phdxbc2binbp7wmeso0.png" alt="Work Flows" width="500" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Storage Engine: Standard Infrastructure First
&lt;/h3&gt;

&lt;p&gt;We deliberately avoided introducing custom daemons or proprietary vector databases. Knowledge Fabric is built directly on PostgreSQL + pgvector:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hybrid Search with Reciprocal Rank Fusion (RRF): Fuses PostgreSQL BM25-style lexical search (tsvector) with semantic vector embeddings (pgvector) to ensure exact keyword recall alongside conceptual relevance.&lt;/li&gt;
&lt;li&gt;Evidence Packaging: Every retrieved passage includes document URI, offset boundaries, chunk hash, and retrieval explanation metadata.&lt;/li&gt;
&lt;li&gt;Native FastMCP Interface: Exposes retrieval directly over stdio and HTTP endpoints for Claude Code, Cursor, Codex, and custom agent harnesses.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  FastMCP Tool Surface
&lt;/h3&gt;

&lt;p&gt;Knowledge Fabric exposes five core MCP tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieve_evidence: Performs hybrid search and returns bounded, cited evidence packages.&lt;/li&gt;
&lt;li&gt;get_document: Fetches full document content and metadata by ID or URI.&lt;/li&gt;
&lt;li&gt;list_sources: Inspects currently indexed collections and document trees.&lt;/li&gt;
&lt;li&gt;explain_retrieval: Returns the scoring breakdown (lexical vs. vector RRF ranks) for an evidence query.&lt;/li&gt;
&lt;li&gt;health: Confirms database connectivity and vector index status.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3-Minute Quickstart
&lt;/h3&gt;

&lt;p&gt;You can test Knowledge Fabric locally using Docker Compose:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Clone and launch PostgreSQL with pgvector:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/sagarv48/knowledge-fabric.git
&lt;span class="nb"&gt;cd &lt;/span&gt;knowledge-fabric
docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install dependencies &amp;amp; initialize the database:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; venv .venv
&lt;span class="nb"&gt;source&lt;/span&gt; .venv/bin/activate
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
python &lt;span class="nt"&gt;-m&lt;/span&gt; knowledge_fabric.cli init-db
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Run the FastMCP Server:
&lt;code&gt;python -m knowledge_fabric.mcp.server&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can now add the server to your Claude Desktop or Cursor MCP configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"knowledge-fabric"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-m"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"knowledge_fabric.mcp.server"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"DATABASE_URL"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"postgresql://postgres:postgres@localhost:5432/knowledge_fabric"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What's Next &amp;amp; Getting Involved
&lt;/h3&gt;

&lt;p&gt;Knowledge Fabric is early and actively developed. We are currently refining local embedding pipelines (Ollama integration) and chunking strategies.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Repository: &lt;a href="https://github.com/sagarv48/knowledge-fabric" rel="noopener noreferrer"&gt;https://github.com/sagarv48/knowledge-fabric&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Roadmap &amp;amp; Issues: Check out our open issues for connector ideas and hybrid search tuning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are building with MCP or experimenting with agent architectures, I would love to hear how you currently tackle citation and evidence verification in your workflows!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>python</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
