<?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: Ricardo Feldhaus Krisanoski</title>
    <description>The latest articles on DEV Community by Ricardo Feldhaus Krisanoski (@rkrisa).</description>
    <link>https://dev.to/rkrisa</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%2F3955754%2F6dfa9872-3be5-407e-907c-168ea2ded9c3.jpg</url>
      <title>DEV Community: Ricardo Feldhaus Krisanoski</title>
      <link>https://dev.to/rkrisa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rkrisa"/>
    <language>en</language>
    <item>
      <title>What I log from AI workflows before I trust the automation</title>
      <dc:creator>Ricardo Feldhaus Krisanoski</dc:creator>
      <pubDate>Sun, 16 Aug 2026 18:58:02 +0000</pubDate>
      <link>https://dev.to/rkrisa/what-i-log-from-ai-workflows-before-i-trust-the-automation-3pdf</link>
      <guid>https://dev.to/rkrisa/what-i-log-from-ai-workflows-before-i-trust-the-automation-3pdf</guid>
      <description>&lt;p&gt;Most AI workflow posts focus on prompts, tools or output quality.&lt;/p&gt;

&lt;p&gt;Those matter, but they are not the first thing I want to trust.&lt;/p&gt;

&lt;p&gt;The first thing I want to trust is the audit trail.&lt;/p&gt;

&lt;p&gt;If an AI workflow suggests a commercial follow-up, changes a queue, routes a conversation or asks for human review, I want to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;what surface executed the decision;&lt;/li&gt;
&lt;li&gt;what system would be affected;&lt;/li&gt;
&lt;li&gt;whether human approval was required;&lt;/li&gt;
&lt;li&gt;what context or evidence shaped the suggestion;&lt;/li&gt;
&lt;li&gt;what it likely cost;&lt;/li&gt;
&lt;li&gt;what happened after a human reviewed it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is why I started writing an observability contract for AI workflows before expanding the automation surface.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Problem
&lt;/h2&gt;

&lt;p&gt;In operational systems, the hardest bug is often not "the model answered badly."&lt;/p&gt;

&lt;p&gt;It is "nobody can explain the path from context to action."&lt;/p&gt;

&lt;p&gt;That creates a few predictable failures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;follow-up suggestions with no clean handoff reason;&lt;/li&gt;
&lt;li&gt;invisible cost growth;&lt;/li&gt;
&lt;li&gt;logs spread across workflow history, scripts and chat tools;&lt;/li&gt;
&lt;li&gt;human edits that never become quality signals;&lt;/li&gt;
&lt;li&gt;no reliable way to compare one workflow against another.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I Log
&lt;/h2&gt;

&lt;p&gt;I now prefer a small contract that every AI-assisted workflow can emit, whether it runs inside n8n or through a wrapper around an agent script.&lt;/p&gt;

&lt;p&gt;At minimum, I want:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a stable workflow name;&lt;/li&gt;
&lt;li&gt;a trace or execution ID;&lt;/li&gt;
&lt;li&gt;the execution surface, like &lt;code&gt;n8n&lt;/code&gt; or an agent wrapper;&lt;/li&gt;
&lt;li&gt;the business unit and target system;&lt;/li&gt;
&lt;li&gt;a risk level;&lt;/li&gt;
&lt;li&gt;a flag for human approval;&lt;/li&gt;
&lt;li&gt;the decision itself;&lt;/li&gt;
&lt;li&gt;the outcome;&lt;/li&gt;
&lt;li&gt;the model and estimated cost when applicable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then I add the fields that make review actually useful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;prompt or skill version;&lt;/li&gt;
&lt;li&gt;retrieved sources or evidence references;&lt;/li&gt;
&lt;li&gt;handoff reason;&lt;/li&gt;
&lt;li&gt;human review outcome;&lt;/li&gt;
&lt;li&gt;latency and token estimates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That structure is much more useful than a raw dump of prompts and responses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters For Commercial Workflows
&lt;/h2&gt;

&lt;p&gt;Imagine a workflow that suggests a commercial follow-up.&lt;/p&gt;

&lt;p&gt;If the trace only says "AI replied" or "task created", the review loop is weak.&lt;/p&gt;

&lt;p&gt;I want the system to answer higher-value questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Was this a suggestion or an action?&lt;/li&gt;
&lt;li&gt;Which system would have been touched next?&lt;/li&gt;
&lt;li&gt;Was approval required before any outbound step?&lt;/li&gt;
&lt;li&gt;If it went to human review, why?&lt;/li&gt;
&lt;li&gt;If the human edited it, was the edit approved, rejected or escalated?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That is the difference between using AI as a black box and using it as an operational component.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bridge Pattern
&lt;/h2&gt;

&lt;p&gt;One practical detail mattered a lot in my implementation work:&lt;/p&gt;

&lt;p&gt;I did not want workflow JSON carrying observability secrets everywhere.&lt;/p&gt;

&lt;p&gt;So instead of wiring keys directly into each workflow, I prefer a small internal bridge:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;workflow -&amp;gt; trace payload -&amp;gt; internal bridge -&amp;gt; observability backend
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That keeps the trace contract shared while reducing secret sprawl.&lt;/p&gt;

&lt;p&gt;It also makes it easier to instrument different surfaces with the same schema.&lt;/p&gt;

&lt;h2&gt;
  
  
  Human Review Is Part Of Observability
&lt;/h2&gt;

&lt;p&gt;The most useful signal is often not the first model decision.&lt;/p&gt;

&lt;p&gt;It is what happened after a person saw it.&lt;/p&gt;

&lt;p&gt;Did they approve it?&lt;br&gt;
Did they edit it?&lt;br&gt;
Did they reject it?&lt;br&gt;
Did they mark it as needing review?&lt;/p&gt;

&lt;p&gt;Those outcomes turn observability into the start of an eval loop instead of a passive log archive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Public-Safe By Design
&lt;/h2&gt;

&lt;p&gt;For operational AI, public proof needs constraints.&lt;/p&gt;

&lt;p&gt;So the public version of this work avoids:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;raw customer messages;&lt;/li&gt;
&lt;li&gt;phone numbers or candidate data;&lt;/li&gt;
&lt;li&gt;private workflow URLs;&lt;/li&gt;
&lt;li&gt;webhook paths;&lt;/li&gt;
&lt;li&gt;internal secrets or auth headers;&lt;/li&gt;
&lt;li&gt;unsupported metric claims.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Where a number is not approved, I keep it as &lt;code&gt;metrics to collect&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Practical Lesson
&lt;/h2&gt;

&lt;p&gt;Before expanding an AI workflow, I want to make its decisions inspectable.&lt;/p&gt;

&lt;p&gt;Not just its prompt.&lt;br&gt;
Not just its output.&lt;br&gt;
Its actual operational path.&lt;/p&gt;

&lt;p&gt;That is why I now treat observability as part of workflow design:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;trace the decision;&lt;/li&gt;
&lt;li&gt;trace the risk;&lt;/li&gt;
&lt;li&gt;trace the human review;&lt;/li&gt;
&lt;li&gt;trace the cost;&lt;/li&gt;
&lt;li&gt;keep the action path explainable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Public case study:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/rkrisa/portfolio-ai-ops/tree/main/cases/ai-workflow-observability-contract" rel="noopener noreferrer"&gt;https://github.com/rkrisa/portfolio-ai-ops/tree/main/cases/ai-workflow-observability-contract&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>observability</category>
      <category>n8n</category>
      <category>architecture</category>
    </item>
    <item>
      <title>AI Coding Agents Need a Decision Gate Before the Implementation Loop</title>
      <dc:creator>Ricardo Feldhaus Krisanoski</dc:creator>
      <pubDate>Thu, 13 Aug 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/rkrisa/ai-coding-agents-need-a-decision-gate-before-the-implementation-loop-3eb8</link>
      <guid>https://dev.to/rkrisa/ai-coding-agents-need-a-decision-gate-before-the-implementation-loop-3eb8</guid>
      <description>&lt;p&gt;AI-assisted development has changed the economics of implementation.&lt;/p&gt;

&lt;p&gt;A plausible architecture can become a working prototype before the team has finished asking whether it solves the right problem.&lt;/p&gt;

&lt;p&gt;That is useful — and dangerous.&lt;/p&gt;

&lt;p&gt;The failure mode I kept seeing was not poor execution. It was premature commitment: a request arrived with a tool, repository, architecture, or output format already selected, and the implementation loop started before the decision had been challenged.&lt;/p&gt;

&lt;p&gt;That is why I built &lt;a href="https://github.com/rkrisa/decision-path-challenger" rel="noopener noreferrer"&gt;Decision Path Challenger&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It is an open-source Agent Skill for OpenAI Codex and Claude Code. Its job is to create a decision gate before meaningful implementation work begins.&lt;/p&gt;

&lt;h2&gt;
  
  
  The solution is often baked into the request
&lt;/h2&gt;

&lt;p&gt;Consider a request such as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Build a weekly sales dashboard in Notion.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It sounds concrete. It also contains several decisions that may never have been made consciously:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the output must be a dashboard;&lt;/li&gt;
&lt;li&gt;the dashboard must be interactive;&lt;/li&gt;
&lt;li&gt;the work must live in Notion;&lt;/li&gt;
&lt;li&gt;storage and delivery should happen in the same system;&lt;/li&gt;
&lt;li&gt;someone will maintain that workspace every week.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The actual outcome may be much simpler:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Deliver a consistent weekly decision brief that managers can review, archive, and forward to the sales team.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once the outcome is clear, the solution space changes. A collaborative dashboard remains possible, but so do a controlled HTML report, a PDF snapshot, a spreadsheet template, a concise automated briefing, or a hybrid workflow with human approval.&lt;/p&gt;

&lt;p&gt;The point is not that Notion is wrong. The point is that the tool should not silently define the outcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four layers before technology
&lt;/h2&gt;

&lt;p&gt;Decision Path Challenger separates a request into four layers.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Outcome
&lt;/h3&gt;

&lt;p&gt;What must become true for the user, team, or business?&lt;/p&gt;

&lt;p&gt;This should be stated without inheriting the proposed tool. A weekly decision brief is an outcome. A Notion dashboard is a possible mechanism and technology choice.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Operating experience
&lt;/h3&gt;

&lt;p&gt;How will the result be consumed, reviewed, shared, maintained, and repeated?&lt;/p&gt;

&lt;p&gt;This layer surfaces practical questions that architecture discussions often miss. Does the result need to be editable? Must it be forwarded? Do historical copies matter? Who corrects errors? Is the user opening a workspace, receiving an alert, or approving a fixed artifact?&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Mechanism
&lt;/h3&gt;

&lt;p&gt;What is the simplest reliable way to produce that operating experience?&lt;/p&gt;

&lt;p&gt;The mechanism may be a template, a script, a native feature, a scheduled workflow, a human review step, or a custom service. It should earn its complexity.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Technology
&lt;/h3&gt;

&lt;p&gt;Which tools, repositories, models, APIs, and frameworks implement the chosen mechanism?&lt;/p&gt;

&lt;p&gt;Technology comes last because it is easier to evaluate once the outcome and operating model are explicit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why exactly three questions
&lt;/h2&gt;

&lt;p&gt;An effective decision gate cannot become another long intake form.&lt;/p&gt;

&lt;p&gt;The skill asks exactly three high-value questions. Together they resolve three categories:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Success and consumption&lt;/strong&gt; — what the result must enable and how people will use it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operating constraints&lt;/strong&gt; — frequency, maintenance, acceptable manual work, control, cost, and reliability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hard boundaries and hidden flexibility&lt;/strong&gt; — what is truly mandatory and what is merely inherited from the first proposed solution.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Three is a deliberate constraint. One question rarely exposes enough. Ten questions create friction and encourage generic answers. Three forces the skill to select the decisions that materially change the path.&lt;/p&gt;

&lt;p&gt;If the answers already exist in the current context, the skill does not ask them again. It states the inferred answers and continues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compare solution classes, not cosmetic alternatives
&lt;/h2&gt;

&lt;p&gt;Tool comparison often means evaluating three products from the same category. That is useful only after the category itself has been justified.&lt;/p&gt;

&lt;p&gt;Decision Path Challenger compares materially different solution classes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Native or no-code:&lt;/strong&gt; built-in features, templates, exports, or scheduled functions in tools already in use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lightweight composition:&lt;/strong&gt; HTML, spreadsheets, scripts, low-code workflows, serverless functions, or simple API orchestration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom product:&lt;/strong&gt; a bespoke application, agent, service, dashboard, or data pipeline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hybrid:&lt;/strong&gt; native storage combined with custom rendering, or automation combined with human approval.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Process redesign:&lt;/strong&gt; changing the workflow or output so that less technology is needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At least one option must challenge the original framing. Otherwise the comparison only optimizes a decision that has already been made.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build cost is not total cost
&lt;/h2&gt;

&lt;p&gt;Implementation speed is only one part of the decision.&lt;/p&gt;

&lt;p&gt;The skill distinguishes four costs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Build cost:&lt;/strong&gt; what it takes to create the first working version.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run cost:&lt;/strong&gt; infrastructure, licenses, manual operations, monitoring, and recurring attention.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Change cost:&lt;/strong&gt; how difficult it is to modify the system when the process evolves.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failure cost:&lt;/strong&gt; what happens when the workflow is wrong, unavailable, stale, or trusted too much.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It also considers reversibility. An uncertain workflow should not begin with a hard-to-exit architecture unless there is evidence that the extra commitment is justified.&lt;/p&gt;

&lt;p&gt;This is especially important in AI-assisted development. Generating code quickly can make build cost look small while run, change, and failure costs remain hidden.&lt;/p&gt;

&lt;p&gt;Possible is not the same as appropriate.&lt;/p&gt;

&lt;h2&gt;
  
  
  A decisive output
&lt;/h2&gt;

&lt;p&gt;The skill is not designed to end with “it depends.”&lt;/p&gt;

&lt;p&gt;It returns one of seven decision labels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Proceed as proposed&lt;/li&gt;
&lt;li&gt;Proceed with simplification&lt;/li&gt;
&lt;li&gt;Adapt the proposed path&lt;/li&gt;
&lt;li&gt;Use a hybrid&lt;/li&gt;
&lt;li&gt;Run a small proof of concept first&lt;/li&gt;
&lt;li&gt;Choose another path&lt;/li&gt;
&lt;li&gt;Do not implement yet&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every recommendation includes the reason, the most tempting rejected alternative, what was intentionally excluded, and the smallest reversible next step.&lt;/p&gt;

&lt;p&gt;For the recurring-report example, the decision may be &lt;strong&gt;Proceed with simplification&lt;/strong&gt;: use a controlled HTML template rendered to PDF, populate it from existing sources, and preserve a human approval step before distribution.&lt;/p&gt;

&lt;p&gt;That recommendation is not universally better than a dashboard. It wins only when consistency, portability, archival snapshots, and low weekly maintenance matter more than collaborative editing and interactive exploration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cross-agent by design
&lt;/h2&gt;

&lt;p&gt;The canonical behavior lives in a platform-neutral &lt;code&gt;SKILL.md&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The repository includes installation paths for both Codex and Claude Code, Codex-specific interface metadata, examples, evaluation references, a static validator, and a GitHub Actions workflow.&lt;/p&gt;

&lt;p&gt;For Codex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$decision-path-challenger

I found a repository that may help me orchestrate multiple coding agents.
Evaluate the approach before installing or modifying my project.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/decision-path-challenger

I want to build a weekly operations dashboard in Notion.
Challenge the implementation path before we start.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The skill does not replace project governance, security review, or human approval. It adds a structured pre-implementation review layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the skill intentionally does not do
&lt;/h2&gt;

&lt;p&gt;Decision Path Challenger does not make every task slower. It should not trigger for a small copy edit, a routine command, an emergency restoration, or a narrowly scoped bug with an already-defined fix.&lt;/p&gt;

&lt;p&gt;It also does not treat complexity as a problem by itself. A custom product, agent, or integration can be the right answer. The requirement is that the extra burden is connected to a confirmed operating need rather than to excitement about the technology.&lt;/p&gt;

&lt;p&gt;Finally, the skill does not make the decision on hidden assumptions. When a critical preference cannot be discovered from the environment, it asks the user. The goal is a decision-complete path, not autonomous certainty theater.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it on a real decision
&lt;/h2&gt;

&lt;p&gt;Clone the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/rkrisa/decision-path-challenger.git
&lt;span class="nb"&gt;cd &lt;/span&gt;decision-path-challenger
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install for Codex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./scripts/install.sh codex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install for Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./scripts/install.sh claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or install for both:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./scripts/install.sh all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PowerShell users can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;/scripts/install.ps1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Target&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;all&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The repository is MIT licensed. Issues and contributions are welcome.&lt;/p&gt;

&lt;p&gt;AI agents do not only need more implementation capability.&lt;/p&gt;

&lt;p&gt;They also need better judgment about what deserves to be implemented, how the result will operate, and whether a simpler path would work better.&lt;/p&gt;

&lt;p&gt;Decision Path Challenger is my attempt to make that judgment explicit, repeatable, and inspectable.&lt;/p&gt;

&lt;p&gt;Try it on a real decision. If it changes or confirms your original path, I would like to hear what happened.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>architecture</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Why my first RAG layer starts in Postgres, not in a standalone vector database</title>
      <dc:creator>Ricardo Feldhaus Krisanoski</dc:creator>
      <pubDate>Sat, 13 Jun 2026 12:30:37 +0000</pubDate>
      <link>https://dev.to/rkrisa/why-my-first-rag-layer-starts-in-postgres-not-in-a-standalone-vector-database-29e0</link>
      <guid>https://dev.to/rkrisa/why-my-first-rag-layer-starts-in-postgres-not-in-a-standalone-vector-database-29e0</guid>
      <description>&lt;p&gt;When people say they are "adding RAG" to a workflow, the conversation often jumps too quickly to infrastructure choices.&lt;/p&gt;

&lt;p&gt;Should this use a vector database?&lt;br&gt;
Should there be a reranker?&lt;br&gt;
Should everything go into a knowledge graph?&lt;/p&gt;

&lt;p&gt;Those are valid questions, but they are usually not the first question.&lt;/p&gt;

&lt;p&gt;The first question is narrower:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What approved knowledge should the workflow be allowed to retrieve before an AI decision happens?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is why my first retrieval layer for operational AI workflows starts in Postgres, not in a standalone vector database.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Workflow Problem
&lt;/h2&gt;

&lt;p&gt;In operations-heavy systems, the model usually should not answer from raw memory or from a giant prompt dump.&lt;/p&gt;

&lt;p&gt;The useful context already exists somewhere else:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;approved response rules;&lt;/li&gt;
&lt;li&gt;handoff criteria;&lt;/li&gt;
&lt;li&gt;product or service notes;&lt;/li&gt;
&lt;li&gt;source or campaign guidance;&lt;/li&gt;
&lt;li&gt;operational decisions that were already made by humans.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The hard part is not generating fluent text.&lt;/p&gt;

&lt;p&gt;The hard part is retrieving the right approved context, showing which source influenced the decision and refusing when no safe source exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Postgres First
&lt;/h2&gt;

&lt;p&gt;For this kind of workflow, most of the surrounding data is already relational:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;leads or conversations;&lt;/li&gt;
&lt;li&gt;workflow names;&lt;/li&gt;
&lt;li&gt;stages and owners;&lt;/li&gt;
&lt;li&gt;human review outcomes;&lt;/li&gt;
&lt;li&gt;source metadata;&lt;/li&gt;
&lt;li&gt;trace logs;&lt;/li&gt;
&lt;li&gt;document versions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the first technical choice is not "where do vectors live in the abstract?"&lt;/p&gt;

&lt;p&gt;It is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Where can I keep retrieval close to the operational data model?&lt;/li&gt;
&lt;li&gt;Where can I log the retrieval path and the final decision together?&lt;/li&gt;
&lt;li&gt;Where can I evolve the schema without creating a second system too early?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Postgres plus &lt;code&gt;pgvector&lt;/code&gt; is a good first answer to that set of questions.&lt;/p&gt;

&lt;p&gt;It lets me keep:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;documents and chunks;&lt;/li&gt;
&lt;li&gt;metadata such as allowed use and approval requirements;&lt;/li&gt;
&lt;li&gt;retrieval traces;&lt;/li&gt;
&lt;li&gt;cost estimates;&lt;/li&gt;
&lt;li&gt;human review outcomes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;in one place.&lt;/p&gt;

&lt;h2&gt;
  
  
  What The First Version Needs
&lt;/h2&gt;

&lt;p&gt;The first version does not need to be broad.&lt;/p&gt;

&lt;p&gt;It needs to be inspectable.&lt;/p&gt;

&lt;p&gt;My narrow retrieval scope looks like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;approved response rules;&lt;/li&gt;
&lt;li&gt;product/service notes;&lt;/li&gt;
&lt;li&gt;handoff and escalation criteria;&lt;/li&gt;
&lt;li&gt;campaign/source guidance;&lt;/li&gt;
&lt;li&gt;commercial playbooks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each retrieved chunk should carry more than text. It should also carry metadata such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;source name;&lt;/li&gt;
&lt;li&gt;document version;&lt;/li&gt;
&lt;li&gt;business domain;&lt;/li&gt;
&lt;li&gt;allowed use;&lt;/li&gt;
&lt;li&gt;whether human approval is required.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That metadata matters because a workflow may be allowed to use one chunk as internal reasoning support, but not as customer-facing language.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Eval Mindset
&lt;/h2&gt;

&lt;p&gt;I do not think a retrieval layer is real until it has failure criteria.&lt;/p&gt;

&lt;p&gt;So the public prototype includes a small golden-question set:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does the expected source appear in the top results?&lt;/li&gt;
&lt;li&gt;Does the workflow return no-answer or handoff when the source is missing?&lt;/li&gt;
&lt;li&gt;Does customer-facing language come only from allowed chunks?&lt;/li&gt;
&lt;li&gt;Can I review which chunks influenced the decision later?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That matters more than announcing that the system has embeddings.&lt;/p&gt;

&lt;p&gt;Without retrieval checks, a RAG layer can look sophisticated while still pulling the wrong context.&lt;/p&gt;

&lt;h2&gt;
  
  
  Observability Is Part Of The Design
&lt;/h2&gt;

&lt;p&gt;The retrieval step and the AI decision step should be traceable together.&lt;/p&gt;

&lt;p&gt;I want the same review surface to show:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieved chunk IDs;&lt;/li&gt;
&lt;li&gt;similarity or retrieval score;&lt;/li&gt;
&lt;li&gt;model name;&lt;/li&gt;
&lt;li&gt;token and cost estimates;&lt;/li&gt;
&lt;li&gt;final decision;&lt;/li&gt;
&lt;li&gt;handoff reason;&lt;/li&gt;
&lt;li&gt;human review outcome.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is the bridge between "the system answered" and "the system answered for a defensible reason."&lt;/p&gt;

&lt;h2&gt;
  
  
  When I Would Add More Infrastructure
&lt;/h2&gt;

&lt;p&gt;I am not against standalone vector databases.&lt;/p&gt;

&lt;p&gt;I would add one later if the system needed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;more search traffic;&lt;/li&gt;
&lt;li&gt;more complex filtering boundaries;&lt;/li&gt;
&lt;li&gt;separate deployment requirements;&lt;/li&gt;
&lt;li&gt;recall/latency needs that justify the extra moving parts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But before that point, I prefer a smaller stack that makes retrieval, evaluation and auditability visible.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Practical Lesson
&lt;/h2&gt;

&lt;p&gt;For AI workflows in revenue or operations contexts, the first retrieval layer should optimize for control, review and schema clarity.&lt;/p&gt;

&lt;p&gt;Not for maximum architectural novelty.&lt;/p&gt;

&lt;p&gt;That is why my first RAG layer starts in Postgres:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;closer to operational data;&lt;/li&gt;
&lt;li&gt;easier to trace;&lt;/li&gt;
&lt;li&gt;easier to evaluate;&lt;/li&gt;
&lt;li&gt;easier to keep human-in-the-loop.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The public case study is here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/rkrisa/portfolio-ai-ops/tree/main/cases/operational-knowledge-retrieval-layer" rel="noopener noreferrer"&gt;https://github.com/rkrisa/portfolio-ai-ops/tree/main/cases/operational-knowledge-retrieval-layer&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>postgres</category>
      <category>architecture</category>
    </item>
    <item>
      <title>I added a context resolver before an AI sales agent replies</title>
      <dc:creator>Ricardo Feldhaus Krisanoski</dc:creator>
      <pubDate>Thu, 28 May 2026 05:38:41 +0000</pubDate>
      <link>https://dev.to/rkrisa/i-added-a-context-resolver-before-an-ai-sales-agent-replies-2o5f</link>
      <guid>https://dev.to/rkrisa/i-added-a-context-resolver-before-an-ai-sales-agent-replies-2o5f</guid>
      <description>&lt;p&gt;Most AI sales agents fail before the model writes a single word.&lt;/p&gt;

&lt;p&gt;The failure is not always the prompt. It is usually the context.&lt;/p&gt;

&lt;p&gt;In a real chat-commerce workflow, a lead can arrive with several competing signals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the latest customer message;&lt;/li&gt;
&lt;li&gt;CRM stage and owner;&lt;/li&gt;
&lt;li&gt;previous conversation history;&lt;/li&gt;
&lt;li&gt;campaign or source data;&lt;/li&gt;
&lt;li&gt;product/category assumptions;&lt;/li&gt;
&lt;li&gt;approved response rules;&lt;/li&gt;
&lt;li&gt;handoff and support policies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If all of that gets dumped into a prompt, the model may produce a fluent answer based on the wrong clue.&lt;/p&gt;

&lt;p&gt;That is not an AI problem in the abstract. It is an operating-system problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;I was designing an AI reception agent for a chat-driven commerce operation.&lt;/p&gt;

&lt;p&gt;The goal was simple: help the business reply faster and more consistently without losing the commercial context behind each lead.&lt;/p&gt;

&lt;p&gt;But the first automated reply had a hidden risk.&lt;/p&gt;

&lt;p&gt;A customer might send a short message like "hi" or "I want more information." On its own, that message is weak. The stronger signal may be the campaign, source, CRM stage, product page, previous conversation or approved sales rule.&lt;/p&gt;

&lt;p&gt;If the AI agent receives all possible context at once, it still has to decide what matters.&lt;/p&gt;

&lt;p&gt;That decision should not be left entirely to generation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Design Choice
&lt;/h2&gt;

&lt;p&gt;I added a context-resolution step before the AI response.&lt;/p&gt;

&lt;p&gt;Instead of asking the model to inspect every clue and improvise, the workflow first resolves a smaller object:&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;"source_priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"campaign_or_crm_or_message_or_fallback"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"resolved_commercial_category"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"confidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"high_or_medium_or_low"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"selected_directive"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"one_approved_response_rule"&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;The important part is not the exact schema. It is the order of decisions.&lt;/p&gt;

&lt;p&gt;The system first decides which commercial context is most trustworthy. Only then does the AI agent write the reply.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Architecture
&lt;/h2&gt;

&lt;p&gt;The workflow looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Incoming chat lead.&lt;/li&gt;
&lt;li&gt;CRM and conversation lookup.&lt;/li&gt;
&lt;li&gt;Campaign or source-context lookup.&lt;/li&gt;
&lt;li&gt;Context resolver.&lt;/li&gt;
&lt;li&gt;Resolved commercial context.&lt;/li&gt;
&lt;li&gt;AI response agent.&lt;/li&gt;
&lt;li&gt;Structured response and routing decision.&lt;/li&gt;
&lt;li&gt;Customer reply or human handoff.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The resolver is intentionally boring.&lt;/p&gt;

&lt;p&gt;It is a control layer, not a creativity layer.&lt;/p&gt;

&lt;p&gt;It exists to answer questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the lead probably asking about?&lt;/li&gt;
&lt;li&gt;Which source should win when signals conflict?&lt;/li&gt;
&lt;li&gt;Is confidence high enough to answer directly?&lt;/li&gt;
&lt;li&gt;Which approved sales rule should be used?&lt;/li&gt;
&lt;li&gt;Should the system reply, ask a clarifying question or hand off to a human?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;In business workflows, "more context" is not always better.&lt;/p&gt;

&lt;p&gt;More context can mean more ambiguity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;old messages compete with new ones;&lt;/li&gt;
&lt;li&gt;generic playbooks compete with campaign-specific offers;&lt;/li&gt;
&lt;li&gt;product assumptions compete with what the customer actually asked;&lt;/li&gt;
&lt;li&gt;internal rules compete with customer-facing language.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The context resolver reduces that ambiguity before the model responds.&lt;/p&gt;

&lt;p&gt;The AI layer becomes easier to debug because every reply can be traced back to a chosen context, confidence level and directive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Guardrails
&lt;/h2&gt;

&lt;p&gt;The workflow keeps several guardrails around the AI response:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;low confidence triggers a consultative fallback;&lt;/li&gt;
&lt;li&gt;sensitive commercial cases can be routed to human review;&lt;/li&gt;
&lt;li&gt;approved response rules are selected before generation;&lt;/li&gt;
&lt;li&gt;the agent receives a compact context package instead of a noisy dump;&lt;/li&gt;
&lt;li&gt;the system logs what context was used.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is not about making the AI sound more impressive.&lt;/p&gt;

&lt;p&gt;It is about making the operational decision safer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Would Measure Next
&lt;/h2&gt;

&lt;p&gt;The current public version keeps metrics as &lt;code&gt;metrics to collect&lt;/code&gt;, because I do not want to publish numbers that are not validated.&lt;/p&gt;

&lt;p&gt;The useful metrics would be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;lead volume handled by the context resolver;&lt;/li&gt;
&lt;li&gt;reduction in wrong-context replies;&lt;/li&gt;
&lt;li&gt;human handoff rate by risk category;&lt;/li&gt;
&lt;li&gt;response-time impact;&lt;/li&gt;
&lt;li&gt;manual review time saved.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Lesson
&lt;/h2&gt;

&lt;p&gt;For AI agents in revenue workflows, the prompt is only one part of the system.&lt;/p&gt;

&lt;p&gt;The harder design question is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What should the model be allowed to know, trust and act on?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is why I prefer designing AI agents as operating workflows: context resolution, retrieval, guardrails, structured outputs, human review and observability.&lt;/p&gt;

&lt;p&gt;The public case study is here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/rkrisa/portfolio-ai-ops/tree/main/cases/context-aware-ai-reception-agent" rel="noopener noreferrer"&gt;https://github.com/rkrisa/portfolio-ai-ops/tree/main/cases/context-aware-ai-reception-agent&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>crm</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
