<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tal Tchernihovski on Medium]]></title>
        <description><![CDATA[Stories by Tal Tchernihovski on Medium]]></description>
        <link>https://medium.com/@tal_9252?source=rss-c5286f547276------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UoOhCebLFhxTo5ZAuppyuQ.jpeg</url>
            <title>Stories by Tal Tchernihovski on Medium</title>
            <link>https://medium.com/@tal_9252?source=rss-c5286f547276------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 02:22:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tal_9252/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Reading production safely — for humans and AI agents]]></title>
            <link>https://medium.com/tailor-tech/reading-production-safely-for-humans-and-ai-agents-b0a70b006de0?source=rss-c5286f547276------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0a70b006de0</guid>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[data-masking]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[pii]]></category>
            <category><![CDATA[mcp-server]]></category>
            <dc:creator><![CDATA[Tal Tchernihovski]]></dc:creator>
            <pubDate>Tue, 21 Jul 2026 08:17:14 GMT</pubDate>
            <atom:updated>2026-07-21T08:17:14.912Z</atom:updated>
            <content:encoded><![CDATA[<h4>Read-only, least-privilege, just-in-time, audited access through a single MCP — with sensitive data masked by default.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OeVVvKIjbe-3-jiJ7wUN9A.jpeg" /></figure><p>Every so often an engineer needs to read production directly — chasing a customer bug, confirming a data shape, checking whether a backfill actually landed. Most of the time there are better-scoped ways in (internal APIs, dashboards), but every now and then you need the raw rows. Increasingly, AI coding agents need the same thing — they’re only as useful as the real state they can observe.</p><p>Giving out that access safely is more work than it looks. You have to control who can connect and what they’re allowed to do, keep production stable while someone pokes at it, keep an audit trail of what was read, and make sure customer data doesn’t walk out the door. Data masking tends to get the attention, but it’s one facet of a broader problem.</p><p>Here’s the shape of what we built.</p><h3>One seam: an MCP</h3><p>All production reads go through a single read-only <a href="https://modelcontextprotocol.io/">MCP</a> server over a production replica. Concentrating access in one place is what makes everything else tractable — it’s the single point where we can enforce least privilege, mask data, audit queries, and bound sessions. And the same interface serves a human in their editor and an autonomous agent, so there’s one path to secure and reason about, not two.</p><p><strong>Least privilege by construction.</strong> The connection is read-only, against a replica — no writes, no schema changes, no path to the primary. An investigator, human or agent, can read, only read, and only through this seam.</p><p><strong>Stability.</strong> The MCP reads from a dedicated replica we stood up for exactly this, separate from the writer and from the replicas that serve the application. On Aurora a reader instance shares the cluster’s storage but runs on its own compute, so a heavy ad-hoc query can’t affect production performance — investigation load and live traffic never contend for the same resources.</p><h3>Access is just-in-time and audited</h3><ul><li><strong>Just-in-time.</strong> There’s no standing connection sitting around. Access is granted per investigation, and each time, you state what you’re looking into and why — access is tied to an intent, not a permanent grant.</li><li><strong>Short sessions.</strong> Sessions expire after ten minutes, so nothing lingers as an idle privileged connection.</li><li><strong>Audit.</strong> pgaudit records every statement that runs through the path, so “who read what, and when” is always answerable.</li></ul><h3>Masking: allowlist, not blocklist</h3><p>Now the data-masking part. The decision that matters most here is choosing an allowlist over a blocklist.</p><p>A blocklist — “hide these known-sensitive columns” — only ever protects you from the columns you remembered. Add a tax_id column and forget to update the list, and it’s exposed. An allowlist flips the risk: every column comes back masked <em>unless</em> it’s on a short, reviewed list of columns we’re confident are safe — stable identifiers, timestamps, enums like status. Everything else — email, first_name, phone, ip_address — comes back as a masked token by default, whether or not anyone flagged it. A brand-new column is masked until someone reviews it onto the safe list. Safe is the default; exposing a column is the thing that takes a deliberate, reviewed step.</p><p>A few details that made it usable:</p><ul><li><strong>Stable tokens.</strong> A masked value is deterministic, not a random blob — you can still group by it or join on it, you just never see the underlying value.</li><li><strong>It follows the real column.</strong> Masking keys off the underlying table column, not the SQL you wrote. SELECT secret AS id still masks — you can’t launder a sensitive column through an alias.</li><li><strong>It happens at the source.</strong> Values are replaced inside the access path, before the response is assembled. For an AI agent that matters a lot: raw sensitive data never enters the model’s context, so it can’t leak into a prompt, a trace, or a log — it simply never arrives.</li></ul><h3>Catching it earlier</h3><p>Masking at read time is the backstop. We’d rather sensitive data never be stored in the clear to begin with, so the same notion of “what looks sensitive” that the masker uses also runs in code review: when a change adds a database column, the column is classified, and one that looks sensitive either blocks or routes to a human before it merges. When a column genuinely needs to hold sensitive data, the guidance is to encrypt it with KMS rather than store it raw.</p><h3>Why bother</h3><p>The goal was never to lock production down. It was to make reading production <em>safe to do</em> — so an engineer or an agent can get the answer they need, and the careful thing is simply what happens by default. Access is scoped, short-lived, and audited; sensitive data is masked unless it’s been proven safe; and every exception is a deliberate, reviewed step. Nobody has to remember to be careful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0a70b006de0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tailor-tech/reading-production-safely-for-humans-and-ai-agents-b0a70b006de0">Reading production safely — for humans and AI agents</a> was originally published in <a href="https://medium.com/tailor-tech">Tailor Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build vs. Buy: Strategic Lessons from Scaling RAG at Tailor Brands]]></title>
            <link>https://medium.com/tailor-tech/build-vs-buy-strategic-lessons-from-scaling-rag-at-tailor-brands-e587e1449016?source=rss-c5286f547276------2</link>
            <guid isPermaLink="false">https://medium.com/p/e587e1449016</guid>
            <category><![CDATA[writing-prompts]]></category>
            <category><![CDATA[agentic-rag]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Tal Tchernihovski]]></dc:creator>
            <pubDate>Mon, 26 Jan 2026 12:29:37 GMT</pubDate>
            <atom:updated>2026-01-26T12:29:37.731Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iUHSVPgGFJ3JP3HmmMYZ6g.jpeg" /></figure><p>As we work to help millions of people build and scale their businesses at <strong>Tailor Brands</strong>, the role of AI has shifted from a “feature” to a foundational layer of the experience.</p><p>When we introduced our AI assistant, we faced a classic engineering crossroads: <strong>Do we build the retrieval infrastructure ourselves or leverage a managed service?</strong> Our journey through both paths revealed that the real “cost” of building isn’t just developer time — it’s the relentless pursuit of response quality.</p><h3>What is RAG? (A 30-Second Primer)</h3><p><strong>Retrieval-Augmented Generation (RAG)</strong> is an architecture that gives an LLM a “source of truth.” While an LLM is trained on a vast amount of general data, it doesn’t know the specifics of your business or your current customer offerings.</p><p>RAG works by first searching your private database for relevant documents (the <strong>Retrieval</strong>) and then providing those facts to the LLM to write a response (the <strong>Generation</strong>). It turns a general-purpose AI into a specialized expert that stays grounded in your data.</p><h3>Why Tailor Brands Needed RAG</h3><p>Our business owners don’t just ask about products; they ask about complex business-building concepts, formation strategies, and how to set up their brand for long-term growth. We needed the LLM to have access to our proprietary knowledge base so it could provide accurate, context-aware guidance that aligns with the specialized services we provide.</p><h3>The “Build” Phase: Learning by Doing</h3><p>We started by building a “naive” version ourselves. This wasn’t because we lacked other options — there are plenty of off-the-shelf libraries — but because we wanted to master the “physics” of the system.</p><p>By building it from scratch, we learned a critical technical lesson: <strong>Semantic search is not a new invention.</strong> Modern RAG is essentially an evolution of the search technologies we’ve been using for decades (like vector similarity and keyword matching), but now applied to a generative context.</p><h3>The Turning Point: The Signal-to-Noise Trap</h3><p>The most important rule in RAG is: <strong>Load as few tokens as possible.</strong> In our initial naive implementation, our retriever was <strong>“greedy.”</strong> It would always fetch a fixed number of data chunks, regardless of how relevant they actually were.</p><p><strong>Our “War Story”:</strong> If a business owner asked a question about <strong>business formation costs</strong>, our naive RAG would find the correct pricing data, but it felt “obligated” to fill the rest of the prompt with chunks about unrelated business setup tips just because they were the next closest match.</p><p>The LLM would then receive a prompt like: <em>“The formation fee is $X; also, you should remember to choose a color palette for your social media posts.”</em> This “greedy” retrieval didn’t just waste tokens; it diluted the <strong>quality</strong> of the answer. It made the assistant feel unfocused and less authoritative.</p><h3>Shifting Focus: From Infrastructure to Quality</h3><p>Once the MVP was live, we realized that “reasonable” results weren’t enough for our business owners. We had to decide: do we continue building out advanced retrieval features (like Reranking and Hybrid Search) internally, or do we use a managed service like <strong>AWS Bedrock Knowledge Bases</strong>?</p><p>In this case, we decided to move to a managed service. This wasn’t just about saving “months of work” — it was a strategic choice to focus on <strong>Quality vs. Infrastructure.</strong></p><h3>The Decision Matrix</h3><p>While we often “Build” at Tailor Brands when the technology is unique to our core value, RAG infrastructure is increasingly a commodity.</p><ul><li><strong>Quality First:</strong> Modern managed services offer optimized <strong>Reranking</strong> — an extra layer that sorts retrieved data and disces the noise. Achieving this level of precision internally would require constant tuning.</li><li><strong>Strategic Focus:</strong> Every hour spent maintaining the “pipes” of a vector database is an hour not spent improving the actual AI experience for someone starting a new company.</li><li><strong>Observability:</strong> Managed solutions provide native “health checks” and trace logs, making it significantly easier to debug <em>why</em> the AI said what it said.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KEuliUSeOP8x9UtT5YfUVA.png" /></figure><h3>Summary: Lessons from the Journey</h3><ul><li><strong>Start with “Build” to understand the “Why”:</strong> Building the prototype taught us exactly what makes a RAG system fail (like our signal-to-noise issue).</li><li><strong>Precision beats Volume:</strong> In RAG, more data is usually worse. High-quality answers come from providing the LLM with the <em>least</em> amount of highly relevant context possible.</li><li><strong>Know where to innovate:</strong> At Tailor Brands, we “Build” where it creates a unique advantage. For RAG, the advantage isn’t in the retrieval code — it’s in the quality of the data and the prompts that help our business owners succeed.</li></ul><h3>Final Thoughts</h3><p>Choosing a managed service allowed us to stop worrying about “plumbing” and start worrying about <strong>outcomes.</strong> We still use the deep knowledge we gained from our initial build every day, but we use it to refine our business owners experience rather than fixing the infrastructure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e587e1449016" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tailor-tech/build-vs-buy-strategic-lessons-from-scaling-rag-at-tailor-brands-e587e1449016">Build vs. Buy: Strategic Lessons from Scaling RAG at Tailor Brands</a> was originally published in <a href="https://medium.com/tailor-tech">Tailor Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Effective real-time inter-service communication in a micro-service architecture]]></title>
            <link>https://medium.com/tailor-tech/effective-real-time-inter-service-communication-in-a-micro-service-architecture-24eb8e801a8a?source=rss-c5286f547276------2</link>
            <guid isPermaLink="false">https://medium.com/p/24eb8e801a8a</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[service-design]]></category>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Tal Tchernihovski]]></dc:creator>
            <pubDate>Mon, 23 Oct 2023 15:25:57 GMT</pubDate>
            <atom:updated>2025-08-13T12:27:44.280Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WvoTgqWCx5hDBhmMuy59xg.png" /></figure><p>We’ve been using a micro-service architecture at Tailor Brands for over 6 years now. If you’re reading this you are probably considering or are already using such an architecture, welcome!</p><p>Working in such an architecture brings a lot of benefits and also some not-so-pleasant tradeoffs — but that’s a subject for another article.<br>In this article, we’ll focus on exploring how we handle internal inter-service communication at Tailor Brands. This isn’t really such a complex subject when working in a monolith but when working in a micro-service architecture it can prove quite complex if we want to support many different use cases.<br>As with anything we do — we’re also trying to make sure our engineers have the best developer experience possible.</p><p>As a company with dozens of micro-services, we follow the best practice of having each one of them serve a specific logical purpose and cover a specific area of our product. I won’t be covering the why’s in this article but feel free to let me know if you want a deep dive into that as well.</p><p>While each service maintains its own “domain”, as can be expected, sometimes services need to share information between them.<br>As with any products we’ll eventually end up at a point where some business logic components have some dependencies between them.<br>So? Sharing is caring, right? If a service needs some information from another service — we can just save the information we need in its own database and be done with it.<br>As you’re probably already thinking, this approach will create some problems, such as — what we’re actually doing is creating a strong coupling between the services since now two services are responsible for storing, maintaining, and synchronizing some info.</p><p>Obviously, we don’t want to do that — we want our services to have access to all the information they need while keeping decoupled with good separation of concerns and a single source of truth for each piece of information. All while making everything easily accessible, including change notifications and more.<br>You could say we want a <strong>good private API</strong>.</p><p>In this article we’ll focus only on our synchronous/real-time APIs — we’ll be skipping PubSub and other message/event-based communication.</p><p>Let’s dive in!</p><h3>How we started</h3><p>Initially, we added internal APIs so each service can expose information relevant to other services — so when other services need this information, they can just query it and be sure that it is always up to date since each service has a clear responsibility.</p><p>As a convention — every API under internal/api/vX will be used internally by other services when needed. We used HTTP Rest APIs with <a href="https://jsonapi.org/">JSON:API</a> schema for all private and public APIs.<br>Since it is an internal API, some considerations work differently like:</p><ol><li>No user authentication was needed — each service is responsible for making sure it is pulling the exact information it needs.</li><li>Rate limiting works differently.</li><li>At times, HPA’s and scaling are different.</li></ol><p>This solution served us quite well for a while, we liked the KISS approach, and using Rest and JSON:API as we do on public APIs made it very quick and easy for existing and new joiners in the team to get productive quickly. It also meant that moving between different services and implementing cross-features was very intuitive.</p><p>As with any solution we like to try not to over-engineer from the get-go, start simple, and extend/change once our requirements change.</p><h3>Why is a change a good thing?</h3><p>Our different backend services are written using a few different technologies, mostly Golang, Ruby on Rails, and then some NodeJS and even Python.</p><p>Since we have complex flows that involve many services, we reached a point where different services, written using different languages, are using the same internal APIs (e.g. payments, product permissions, notifications, user authentication, etc.).</p><p>This meant that we implemented the same HTTP API handling code in several different languages, things like:</p><ol><li>JSON serialization/deserialization.</li><li>Network error retries.</li><li>Tracing/Instrumentation.</li></ol><p>As you’re probably realizing this is a lot of boilerplate code, which not only needs to be written multiple times, but updating it can become quite annoying as well across multiple languages and so many services.</p><p>We knew there were better ways of doing this out there so we went about looking into them.</p><h3>First iteration</h3><p>As we added more and more services — we could share code to invoke actions in other services by creating private packages (e.g. Golang private package, Ruby gem, NPM package, etc.) so we could save the work of rewriting all the boilerplate code.</p><p>This worked well for a while since most of our services were built using a single language so the overlap was minimal.</p><h3>Trigger for change</h3><p>Eventually, when we had a lot more services in a mix of languages, we noticed the duplication wasn’t resolved as we had to build a private package per internal API x programming languages .</p><p>We wanted something even more generic to allow us to save as much “meta work” as possible to allow our engineers to focus on meaningful and impactful work.</p><blockquote>Meta work — work that doesn’t directly contribute to the desired impact. Might be work that enables meaningful work.</blockquote><p>We ended up going with <a href="https://grpc.io/"><strong>gRPC</strong></a>. We’ll cover why next</p><h3><strong>gRPC trade-offs</strong></h3><p>As with any other solution — every approach has its advantages and disadvantages, and so does gRPC. One of the main considerations we had, was to make sure the development experience improves, and the velocity increases, and that we won’t end up with a high-maintenance infrastructure that overall, won’t make our lives any easier.</p><p>The following are not exhaustive and focus on what was important to us when making this decision. You can find tons of material online diving into the specific subject of gRPC vs &lt;something-else&gt;.</p><h4>The advantages:</h4><ul><li>One source of truth that covers all object and API signatures that, once defined, becomes immediately available for all languages we use.</li><li>Protobuf has a mechanism to check for breaking changes — so we will have a mechanism to <em>save</em> us from destructive changes that will break the usage of the API.</li><li>Everything is typed — so we will have a safe and easy way to call and use all of the internal API without the risk of creating invalid requests when we are creating API calls without the use of some private wrapper package.</li></ul><h4>The disadvantages:</h4><ul><li>For each gRPC method and object that we are creating and modifying, we will have to carefully think about future use and ease of changing and adding more properties to the response and make sure that you are always backward compatible in all the endpoints that you are creating.<br>In a way, it doesn’t seem like such a disadvantage, since it protects us from making destructive changes, but on the other hand — since the system continues to grow and develop, it is quite hard to guess the future features and changes we’ll need. So when the time comes and we’ll need a breaking change in an internal API (and we must assume it will happen) — the workaround migrating to the new API might end up a bit more complex than in a <em>simple</em> HTTP API call.</li><li>We’ll need to teach the team a new technology.</li></ul><p>Even with these disadvantages, we felt like this was the right approach and went about trying to minimize the impact of the disadvantages we found.</p><h3>Making life easy — as good as it gets</h3><p>We wanted the development process to be as automated and simple for the engineers as possible. In order to do that, we took a few steps:</p><ul><li>Created a centralized <em>mono repo</em> that will hold and maintain all the proto files. The repository is structured in a way that each service providing internal APIs has its own folder with all the relevant proto-files.</li><li>Each proto-file resembles a DB model for which we would like to expose a gRPC server with its method, request, and response messages.</li><li>Once an engineer wants to push some changes to the repository, as part of our CI we are running a Github action that makes sure the change isn’t a breaking one, since as mentioned above, we must be backward compatible when handling gRPC methods. If a breaking change is introduced — it will block the PR and it won’t be mergeable.</li><li>Once a PR is merged — the CI process creates the appropriate private packages for all the languages we need, with all the Proto outputs. In order to do that, the CI runs the main two parts to create the proto files outputs. A couple of examples below.</li></ul><p><em>Golang &amp; Ruby examples:</em></p><pre>go install google.golang.org/protobuf/cmd/protoc-gen-go<br>go install google.golang.org/grpc/cmd/protoc-gen-go-grpc<br><br>protoc --go_out=../../pb/&lt;service_name&gt;/internal_api/v1 --go_opt=paths=source_relative \                              <br>    --go-grpc_out=../../pb/&lt;service_name&gt;/internal_api/v1 --go-grpc_opt=paths=source_relative \<br>    *.proto</pre><pre>gem install grpc<br>gem install grpc-tools<br><br>grpc_tools_ruby_protoc --ruby_out=. --grpc_out=. &lt;service_name&gt;.proto</pre><p>That way — by making changes in a single proto-file — we are creating a unified output that can be used in all of our services regardless of the programming language in which they are written.<br>Every time a change has been merged to the main branch — the automated CI process creates a tag so we can still control exactly which version each service uses — so we won’t introduce changes to the service builds without noticing.</p><h3>So the switch is instant?</h3><p>Well, not exactly.</p><p>Similar to any other large-scale project — you would have to plan this and see what would be the best way to start incorporating this new technology and methodology in your organization.</p><p>In most cases, you won’t have the privilege to do a designated feature freeze and have the time to modify the internal communication between all of your services.<br>So, practically — you would probably have to think of a way to do it gradually until eventually, you’ll cover all the internal communication. When planning such a migration, there are several key points you can think about that might help you:</p><ul><li><strong>Knowledge transfer </strong>—As with any other new technology, if it’s in production, your team needs to know how to work with it.<br>Work on a plan to introduce gRPC to the team and train them on the basics.<br>Document as much as possible and help the team build the skills and mindset for working with this new approach.<br>Doing this will not only allow for a smooth transition — it’ll also boost your teammate&#39;s abilities!</li><li><strong>Make it gradual </strong>— The transition will probably be done over time. as such, figuring out how to streamline it with the day-to-day tasks could prove to be a huge indicator of success for the transition. Plan it in a way where you can migrate the internal APIs piece by piece while the engineers do it as they go through the areas they work on regardless. Thus minimizing the overhead the migration might cause.<br>Another benefit is that having smaller changes makes it easier to track regressions and bugs — which brings us to the next point.</li><li><strong>Monitor</strong> — make sure you have the tools (either proper logging, monitors, or any other tool that you are using), so you can make sure that there was no regression caused, either in functionality or in performance.</li></ul><h3>Where do we go from here?</h3><p>Even tho <a href="https://en.wikipedia.org/wiki/No_free_lunch_theorem"><em>There are no free lunches</em></a>, gRPC provides a great approach to internal communication between services. It can be used externally as well if your client isn’t a web browser (or with some library as a proxy).<br>Protobuf can reduce bloat and duplication quite a bit, we didn’t even touch on its usages for Pubsub and more.</p><p>While there are many ways for services to communicate, with the right planning, good Developer experience, and decent training you can make the most out of gRPC.</p><p>The right tool — for the right job, at the right time by the right team. That’s all you need! easy isn’t it?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24eb8e801a8a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tailor-tech/effective-real-time-inter-service-communication-in-a-micro-service-architecture-24eb8e801a8a">Effective real-time inter-service communication in a micro-service architecture</a> was originally published in <a href="https://medium.com/tailor-tech">Tailor Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>