<?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 Jayasagar on Medium]]></title>
        <description><![CDATA[Stories by Jayasagar on Medium]]></description>
        <link>https://medium.com/@jayasagar?source=rss-53af6f89e32e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*x3WK85ZhiRpw7JS_y9iz_Q.jpeg</url>
            <title>Stories by Jayasagar on Medium</title>
            <link>https://medium.com/@jayasagar?source=rss-53af6f89e32e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 06:31:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jayasagar/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[The 3-Layer Pipeline — When Data Lies and Truth Lives in the Gaps]]></title>
            <link>https://medium.com/@jayasagar/the-3-layer-pipeline-when-data-lies-and-truth-lives-in-the-gaps-aec638596fb8?source=rss-53af6f89e32e------2</link>
            <guid isPermaLink="false">https://medium.com/p/aec638596fb8</guid>
            <category><![CDATA[recommendation-engine]]></category>
            <category><![CDATA[ml-engineering]]></category>
            <category><![CDATA[faiss]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Jayasagar]]></dc:creator>
            <pubDate>Sun, 01 Mar 2026 10:34:12 GMT</pubDate>
            <atom:updated>2026-03-01T10:34:12.153Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*bmImpEe-aE3tixaQpwVopQ.png" /></figure><p><em>Building recommendation systems that trust all signals — and know when to trust which</em></p><p>The day I almost shipped a recommendation engine that would have destroyed technician trust, I learned something uncomfortable about data.</p><p>Two drill drivers sat in our catalog, 92% identical by every metric that mattered. Same voltage. Same torque range. Same brushless motor. Our similarity algorithm was convinced they were perfect substitutes.</p><p>But buried in 172,000 warranty claims was a different story. Technicians had never — not once — exchanged one for the other.</p><p><strong>Which signal do you trust?</strong> The pristine catalog data that says they’re twins, or the messy behavioral data that says they’re strangers?</p><p>I believe the best recommendation systems don’t choose. They trust all signals and know when to trust which.</p><p>That realization became the foundation of our tool exchange recommendation engine —<strong> a system that processes 68,000 products and returns 5 precise recommendations in 14 milliseconds.</strong> But more importantly, it became a lesson in why single-signal systems fail and how layered fusion creates something stronger than any individual data source.</p><h3>The Uncomfortable Truth About Perfect Data</h3><p>Most recommendation systems are built on a beautiful lie: that one type of data can tell the whole story.</p><p><strong>Catalog similarity alone</strong> captures the engineering truth but misses the human truth. Two products can be spec-identical but serve completely different customer segments. Or one might have a manufacturing quirk that makes technicians avoid it, despite looking perfect on paper. Specs don’t capture institutional knowledge or the collective wisdom of thousands of real-world experiences.</p><p><strong>Usage data alone</strong> has a fatal weakness that haunts every system I’ve built: <em>cold-start paralysis</em>. <strong>In our catalog, 46% of products have zero exchange history.</strong> A new impact driver added last month has no behavioral signals. Pure collaborative filtering systems are blind to nearly half their catalog — exactly when recommendations matter most.</p><p><strong>Business rules alone</strong> are brittle in ways that only surface at 3 AM during incident calls. Hardcoded rules like “always recommend within the same voltage platform” miss the nuance that a technician might prefer a slightly different voltage if the tool is otherwise superior. Rules optimize for safety but sacrifice discovery.</p><blockquote>I strongly believe the right answer is layered fusion — catalog for coverage, usage for wisdom, rules for safety. Each layer does one job well. None needs to be perfect. Together, they handle every edge case I’ve encountered in twenty years of building systems.</blockquote><h3>Layer 1: Catalog Candidates — The Foundation of Coverage</h3><p>Layer 1 answers the most basic question: given this product, which products in a 68,000-item catalog are most similar?</p><p>The answer comes through three increasingly precise filters, each building on the last.</p><p><strong>Step 1: Knowledge graph traversal.</strong> Every product connects to others through five relationship types: SAME_TOOL_TYPE, SAME_FAMILY, SAME_PLATFORM, COMPATIBLE_WITH, and UPGRADES_TO. For any query product, graph traversal generates roughly 2,000 candidates.</p><p>This isn’t just similarity — it’s structural sanity. The graph eliminates products that are categorically wrong. You don’t recommend a circular saw when someone needs a drill driver, no matter how sophisticated your similarity algorithm.</p><p><strong>Step 2: FAISS embedding retrieval.</strong> Those 2,000 graph candidates get scored by vector similarity using a 128-dimensional embedding that fuses two signals:</p><ul><li>A 64-dimensional feature vector from a PyTorch autoencoder trained on product specs (voltage, torque, power, weight, RPM)</li><li>A 384-dimensional text vector from Sentence-BERT on product names and descriptions</li></ul><p>These combine via PCA with 40% feature weight and 60% text weight. FAISS IndexFlatIP performs exact dot product search on L2-normalized vectors, narrowing 2,000 candidates to 100.</p><p><strong>Step 3: Feature ranking with domain-specific weights.</strong> This is the pattern I’m most proud of — understanding that “similar” means different things for different tools:</p><pre>drill_driver_weights = {<br>    &#39;torque&#39;: 0.25,<br>    &#39;brushless&#39;: 0.15, <br>    &#39;rpm&#39;: 0.15,<br>    &#39;voltage&#39;: 0.12<br>}<br>angle_grinder_weights = {<br>    &#39;input_power&#39;: 0.22,<br>    &#39;rpm&#39;: 0.18,<br>    &#39;weight&#39;: 0.15,<br>    &#39;kickback_protection&#39;: 0.15<br>}</pre><p>When comparing drill drivers, torque gets 25% of the weight because torque defines what makes a drill useful. When comparing angle grinders, input power matters most at 22% because power defines a grinder’s capability.</p><p>But here’s the problem: specs are often missing. Torque has a 36% fill rate across our catalog. Brushless motor data exists for only 1.2% of products. A product with two filled spec fields shouldn’t score as confidently as one with eight complete dimensions.</p><p>So we apply a coverage penalty:</p><pre>adjusted_score = raw_similarity × (0.5 + 0.5 × coverage)</pre><p>A raw similarity of 0.90 with 40% spec coverage becomes 0.90 × 0.70 = 0.63. Don’t trust thin data — penalize confidence when information is sparse.</p><p>The final Layer 1 score blends embedding similarity (50%) with feature ranking (50%), normalized to [0, 1]. This takes about 12 milliseconds — where most of the compute happens.</p><h3>Layer 2: Claims Overlay — What Technicians Actually Do</h3><p>Layer 2 answers a completely different question: given this product, what do real technicians exchange it with in the field?</p><p>The answer emerges from four co-occurrence tables built from 172,000 warranty claims, plus a statistical correction that prevents popularity bias.</p><p><strong>Table A — Direct product pairs (60% weight).</strong> Product <strong>X</strong> was exchanged with <strong>Y</strong> exactly 42 times. This is the most specific signal possible. 1,312 unique products have this direct exchange data.</p><p><strong>Table B — Family-level patterns (10% weight).</strong> The <strong>A</strong> family exchanges with other <strong>A </strong>products 78% of the time. Even when a specific <strong>A </strong>model has no direct history, the family pattern provides signal.</p><p><strong>Table C — Model variant patterns (10% weight).</strong> The first seven characters of our product codes identify model variants. Variants exchange with matching variants 85% of the time — more specific than family, less specific than direct pairs.</p><p><strong>Table D — Tool-type priors (5% weight).</strong> Drill drivers exchange with other drill drivers 95% of the time. The universal fallback for completely cold-start products.</p><p><strong>PMI — Pointwise Mutual Information (20% weight).</strong> This is where most systems get tricked by popularity. If Battery Pack X appears as a replacement 500 times, that sounds like strong evidence. But if it’s the most popular replacement across all products, that 500 count is just popularity, not specificity.</p><p>PMI corrects for this:</p><pre>PMI(X,Y) = log2(P(X,Y) / (P(X) × P(Y)))</pre><p>High PMI means X and Y co-occur more than random chance predicts. A niche replacement with 15 exchanges might have higher PMI — and be a better recommendation — than the popular battery with 500.</p><p>These five components combine into a single claims score:</p><pre>claims_score = (<br>    0.60 × direct_score +<br>    0.20 × pmi_score +<br>    0.10 × family_score +<br>    0.10 × prefix_score +<br>    0.05 × tool_type_score<br>)</pre><p><strong>Bidirectional injection.</strong> Here’s a subtle but critical detail: Layer 2 doesn’t just score Layer 1’s candidates. It also injects candidates that have strong behavioral signals but weren’t in the top 100 by catalog similarity.</p><p>A product with 50 direct exchanges might not make Layer 1’s similarity cut — but it deserves to be in the final results. These get injected with a catalog score of 0.0 and scored purely on claims strength.</p><p><strong>Adaptive fusion.</strong> Catalog and claims scores fuse with weights that adapt to data availability:</p><pre>if product_number in direct_exchange_table:<br>    # Known product: lean on behavioral data<br>    final_score = 0.4 × catalog_score + 0.6 × claims_score<br>else:<br>    # Cold-start product: lean on catalog similarity  <br>    final_score = 0.9 × catalog_score + 0.1 × claims_score</pre><p>One line of code determines the mode: is_known = product_number in table_a. Products with direct exchange history get 60% behavioral weight. Products without it get 90% catalog weight -- because for them, similarity is the strongest signal available.</p><p>This layer runs in about 1 millisecond. All tables are pre-computed. No machine learning inference, just dictionary lookups.</p><h3>Layer 3: Rules and Explanations — Making It Trustworthy</h3><p>Layer 3 transforms scored candidates into recommendations that technicians can trust and act on. Trust requires transparency.</p><p><strong>Self-exchange injection.</strong> Here’s something that surprised me: 31% of real warranty exchanges are same-model replacements. A technician returns a broken product A 18V-55 and gets a new product A 18V-55.</p><p>When a product appears in our self-exchange set (1,012 products confirmed from claims data), we inject it at rank 1 with 0.95 confidence and the reason: “Same-model exchange: confirmed in warranty claims data.”</p><p>This isn’t a recommendation from the algorithm. It’s a fact from the data.</p><p><strong>Voltage penalty.</strong> A soft constraint, not a hard filter. Products with voltage differences greater than 3 volts get their scores multiplied by 0.8 — a 20% penalty. Not rejected outright, because occasionally voltage mismatches are acceptable (upgrading to a different platform).</p><p>When voltage data is missing, we fall back to platform string matching: “18V” vs “12V” are clearly incompatible, “18V” vs “18V” are compatible.</p><p><strong>Diversity constraint.</strong> Maximum two recommendations from the same product family. Without this, a query for product A 18V-26 might return five product A variants. Useful sometimes, but technicians want to see alternatives across families.</p><p><strong>Exchange type classification.</strong> Every recommendation gets tagged as SAME_MODEL, UPGRADE, or SIMILAR using adaptive thresholds:</p><ul><li>Same model: identical product number or matching first seven characters</li><li>Upgrade: same family with demonstrably better specs. When four or more spec dimensions are available, we require improvements in two areas. When data is sparse (fewer than four dimensions), one improvement suffices.</li><li>Similar: everything else — comparable tools from different families</li></ul><p><strong>Reason generation.</strong> Every recommendation comes with human-readable explanations assembled from available signals:</p><pre>&quot;Exchanged 42x in warranty claims&quot;<br>&quot;Exact voltage match (18V)&quot; <br>&quot;Same product family (A)&quot;<br>&quot;Brushless upgrade&quot;<br>&quot;Higher torque (65 vs 55 Nm)&quot;<br>&quot;Strong match across claims data and catalog similarity&quot;</pre><p>No recommendation ever returns without at least one reason. If nothing else applies, it gets “Catalog-based recommendation.” The system never says “trust me” — it shows its work.</p><p>This layer adds less than 1 millisecond — just sorting, filtering, and string formatting.</p><h3>The Complete Funnel: 68,000 → 5</h3><p>Here’s how the entire pipeline flows:</p><pre>68,415 products in catalog<br>    ↓  Knowledge graph traversal<br>~2,000 candidates (same tool type, family, platform)<br>    ↓  FAISS embedding retrieval (128-dim vectors)<br>  100 candidates (by semantic similarity)<br>    ↓  Feature ranking (domain-specific weights)<br>  100 scored candidates (catalog_score)<br>    ↓  Claims overlay (4 tables + PMI)<br>  100+ candidates (catalog + behavioral injections)<br>    ↓  Rules, penalties, diversity constraints<br>    5 final recommendations (ranked, classified, explained)</pre><pre>Total latency: ~14ms</pre><p>Every step reduces the candidate set while enriching the signal. Knowledge graphs provide structural relevance. Embeddings provide semantic relevance. Feature ranking provides spec relevance. Claims data provides real-world relevance. Rules provide safety and transparency.</p><p>No single layer is sufficient. Together, they handle warm products and cold-start products, spec-rich items and spec-sparse ones, popular replacements and niche alternatives.Getting Started: The Pattern You Can Steal</p><p>I strongly believe this 3-layer architecture generalizes far beyond warranty claims. The pattern works anywhere you have catalog data, behavioral data, and business constraints.</p><p><strong>Layer 1 — Content-based candidates.</strong> What does static data say these items have in common? Product specifications, text descriptions, category hierarchies, knowledge graphs. This is your coverage layer — it works for every item in your catalog, even brand-new ones.</p><p><strong>Layer 2 — Behavioral overlay.</strong> What do users actually do? Click-through rates, purchase co-occurrence, return patterns, exchange history. This is your wisdom layer — it captures patterns that content similarity alone misses.</p><p><strong>Layer 3 — Rules and explanations.</strong> What constraints must hold? Compatibility requirements, diversity needs, business rules, transparency requirements. This is your trust layer — it makes the system deployable in production.</p><p>Try this approach:</p><ol><li><strong>Start with Layer 1 only.</strong> Build content-based similarity that works for your entire catalog. Use embeddings, feature similarity, or graph traversal — whatever fits your data.</li><li><strong>Add Layer 2 when you have behavioral data.</strong> Don’t wait for perfect coverage. Even partial behavioral signals improve recommendations for products that have them.</li><li><strong>Implement adaptive fusion.</strong> Use different weights based on data availability. When you have rich behavioral data, let it lead. When you don’t, let content similarity carry the load.</li><li><strong>Make it explainable.</strong> Every recommendation needs a reason. Users trust systems they can understand.</li></ol><p>The fusion formula doesn’t need to be complex. Ours is a weighted sum with two sets of coefficients. The key insight is that Layer 1 and Layer 2 don’t compete — they complement each other with weights that adapt to what you know.</p><h3>The Architecture That Lasts</h3><p>I’ve built recommendation systems for e-commerce, content discovery, and now industrial tools. The ones that lasted weren’t the most sophisticated. They were the ones with clear boundaries between layers, each doing one job well, each replaceable without breaking the others.</p><p>You can swap the knowledge graph for a different retrieval method. You can replace FAISS with Pinecone or Weaviate. You can add a fifth co-occurrence table or a different behavioral signal without touching Layer 1 or Layer 3.</p><p>The architecture decisions that matter aren’t the algorithms. They’re the boundaries between layers and the fusion formulas that connect them. When your similarity algorithm fails on edge cases, you want behavioral data to catch it. When your behavioral data is sparse, you want content similarity to fill the gaps. When both point in the wrong direction, you want business rules to provide safety.</p><p>I believe this is how you build systems that work in the real world, where data is messy, coverage is partial, and trust is earned through transparency. Single-signal systems optimize for elegance. Multi-signal systems optimize for robustness.</p><p>The drill drivers that looked identical but never got exchanged taught me something I carry into every system I build: truth lives in the gaps between data sources. The recommendation engine that trusts all signals — and knows when to trust which — is the one that finds it.</p><p>What signals are you ignoring in your system? And what truth might be hiding in those gaps?-Layer Pipeline</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aec638596fb8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trust by Default: The Leadership Philosophy That Changes Everything]]></title>
            <link>https://medium.com/@jayasagar/trust-by-default-the-leadership-philosophy-that-changes-everything-3ea0f33c3b54?source=rss-53af6f89e32e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ea0f33c3b54</guid>
            <category><![CDATA[trust-by-design]]></category>
            <category><![CDATA[trust]]></category>
            <category><![CDATA[first-trust]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[human-first-leadership]]></category>
            <dc:creator><![CDATA[Jayasagar]]></dc:creator>
            <pubDate>Fri, 27 Feb 2026 10:34:41 GMT</pubDate>
            <atom:updated>2026-02-27T10:34:41.209Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*IlX_hso0aFEH4SupNymWNg.png" /></figure><blockquote>I believe that trust is not something you earn over months of careful observation — it&#39;s something you give on day one.</blockquote><p>Most leaders have it backwards. They wait for proof before they trust. They watch, they test, they evaluate. They create elaborate systems to measure trustworthiness before they&#39;re willing to delegate real ownership. But here&#39;s what I discovered after building tech.at.core to 100+ people without hiring a single senior person: trust creates the behavior you&#39;re waiting to see.</p><p>Let me tell you about 2 Junior engineers.</p><p>When they joined t.a.c(<a href="http://techatcore.com/">tech.at.core</a>) as fresh graduates, everyone expected me to start them on small tasks, watch their progress, gradually increase responsibility. The conventional wisdom was clear: prove yourself first, then we&#39;ll trust you with important work.</p><p>Instead, I handed them ownership of our new client project. No gradual ramp-up. No months of observation. Just: &quot;I trust you to build this. Let&#39;s align on the outcome and go make it happen.&quot;</p><p>These weren&#39;t seasoned professionals with proven track records. They were seeds I was betting would become forests.</p><p>What happened next changed how I think about leadership forever.</p><p>They didn&#39;t just meet expectations — they shattered them. The fear of letting someone down who believed in them unlocked capabilities they didn&#39;t know they had. Within months, both had grown into tech leads. Today, they&#39;re among our strongest leaders, building other leaders.</p><p>This isn&#39;t management theory. This is human psychology at work.</p><blockquote><em>&quot;The way to develop self-confidence is to do the thing you fear and get a record of successful experiences behind you.&quot; — William Jennings Bryan</em></blockquote><h3>The Neuroscience of Trust-First Leadership</h3><p>Here&#39;s what most leaders don&#39;t understand: <strong><em>over 90% of our decisions are driven by the subconscious mind, not logic</em></strong>.</p><blockquote>Trust isn&#39;t just a conscious choice — it&#39;s a deeply emotional risk calculation happening beneath our awareness.</blockquote><p>When you meet someone, you form a trust impression in less than five seconds. This isn&#39;t logic working. It&#39;s micro-signals, emotional memory, and pattern recognition operating underneath consciousness. <em>Most of our thinking is fast, automatic, emotional, and subconscious. Very little of it is slow, deliberate, and conscious.</em></p><p>So why do we pretend that trust-building should be a slow, deliberate process?</p><blockquote>The real question every leader should ask: How long do you wait before trusting someone? And why?</blockquote><p>At t.a.c(tech.at.core), trust-by-default became one of our core leadership secrets. Not because we&#39;re naive, but because we understand something fundamental about human nature: people become ready because they are trusted, not the other way around.</p><h3>The Crisis of Leadership Trust</h3><p>The data tells a sobering story about where we are today. According to Gallup&#39;s latest research, only 21% of U.S. employees strongly agree that they trust the leadership of their organization — a notable decline from 24% in 2019. We&#39;re living through a trust recession in leadership, and it&#39;s getting worse.</p><p>PwC&#39;s 2026 Global Digital Trust Insights survey of 3,887 business and technology executives across 72 countries reveals how leaders are struggling with uncertainty. The traditional approach of building trust slowly, through proof and performance, isn&#39;t working in our fast-moving world.</p><p>But some leaders are taking a radically different approach.</p><h3>The Netflix Case Study: Context Over Control</h3><p>Reed Hastings built Netflix on a simple but revolutionary principle: hire good people and trust them to make decisions. Instead of creating layers of approval and oversight, Netflix leaders are expected to provide context and trust their teams to execute.</p><p>This wasn&#39;t just a nice-to-have culture experiment. It was a business strategy. By trusting first and providing context instead of control, Netflix scaled from a DVD-by-mail service to a global streaming giant that fundamentally changed how the world consumes entertainment.</p><p>The Netflix model proves something I strongly believe: control waits for proof, but trust creates proof.</p><h3>The Speed of Trust in Action</h3><p>Stephen Covey tells a powerful story in <em>The Speed of Trust</em> that perfectly illustrates this principle. A senior leader was brought in to fix a struggling business unit. The team was new, with no strong track record. Everyone expected him to spend months watching, testing, and reviewing performance.</p><p>Instead, he walked in and said something no one expected: &quot;I trust you. Right now. From Day One. Let&#39;s just align on results and go make it happen.&quot;</p><p>At first, they were shocked. Then something shifted. People leaned in. They felt responsible. They worked harder — not because they were being watched, but because they were being trusted.</p><p>This is what trust unlocks in people:</p><ul><li>It removes the fear of failure</li><li>It reveals real capability that was always there</li><li>It motivates people to push their own boundaries</li><li>It pulls maximum potential from human beings</li><li>It unleashes creativity that control suffocates</li></ul><p>I strongly believe that when you trust someone, you&#39;re not just giving them permission to succeed — you&#39;re giving them permission to become who they&#39;re meant to be.</p><h3>The Trust-by-Default Framework</h3><p>Trust-by-default isn&#39;t about being naive. It&#39;s about how you choose to see people. When a teacher trusts a student, confidence grows. When a leader trusts a team member, ownership emerges. When a mentor trusts a young mind, identity forms.</p><p>The structure I use at t.a.c is simple:</p><p>First trust. Then growth. Then structure. Then systems.</p><p>Never the reverse.</p><p>This approach flies in the face of traditional management wisdom, but the results speak for themselves. We&#39;ve grown 100+ people from ground zero into leaders who create leaders. No senior hires. No proven track records. Just trust-first leadership creating the capabilities we needed.</p><blockquote><em>&quot;Trust is the glue of life. It&#39;s the most essential ingredient in effective communication. It&#39;s the foundational principle that holds all relationships.&quot; — Stephen Covey</em></blockquote><h3>The Research Behind Trust-First Leadership</h3><p>Harvard Business Review&#39;s research on high-performing teams reveals something fascinating: the most successful teams aren&#39;t necessarily the smartest or most experienced. They&#39;re the ones with the highest levels of psychological safety and trust.</p><p>In one study of a major automotive parts manufacturer, teams that operated with high trust reduced project failures by 80% and saved the company millions in avoided &quot;big events&quot; — projects that previously went off the rails every two years like clockwork.</p><p>The difference wasn&#39;t skill or experience. It was the willingness of leaders to trust team members with real ownership from day one.</p><p>Deloitte&#39;s research through their TrustID Index, powered by more than 11 million data points annually, shows that organizations with high-trust cultures see:</p><ul><li>2.5x higher stock performance</li><li>40% less turnover</li><li>76% higher engagement</li><li>50% higher productivity</li></ul><p>But here&#39;s the key insight: these outcomes don&#39;t come from slowly building trust over time. They come from leaders who make trust their default mode of operation.</p><h3>The Philosophy Behind the Practice</h3><p>You don&#39;t trust because people are ready. People become ready because they are trusted.</p><p>This isn’t just a management technique — it’s a fundamental belief about human potential. I believe that every person has capabilities they don’t yet know they possess. The leader’s job isn’t to wait for those capabilities to emerge. The leader’s job is to create the conditions where they can emerge.</p><p>At t.a.c, I’ve seen interns become tech leads, fresh graduates become architects, and quiet team members become confident leaders. Not over years of careful development, but in months of trusted ownership.</p><p>The pattern is always the same: give someone ownership of something that matters, trust them completely with it, and watch them rise to meet the trust you’ve placed in them.</p><h3>Trust as Competitive Advantage</h3><p>In our hyperconnected world, trust has become the ultimate competitive advantage. <em>PwC’s research shows that 80% of Middle East organizations are increasing their cyber budgets in 2026, recognizing digital trust as a core investment rather than a discretionary cost.</em></p><blockquote>But the most important trust isn’t digital — it’s human.</blockquote><p>When you lead with trust-by-default, you’re not just building better teams. You’re building a culture that attracts the kind of people who want to be trusted with meaningful work. You’re creating an environment where people don’t just do their jobs — they become invested in outcomes.</p><blockquote>I strongly believe that in the next decade, the organizations that thrive will be those that master human trust as their core operating system.</blockquote><h3>The Leadership Law</h3><p>Here’s what I’ve learned after 20+ years in technology and building t.a.c from the ground up:</p><blockquote>Insecure leaders control.<br>Secure leaders trust.</blockquote><p>Control waits for proof. Trust creates proof.</p><p>The question every leader must ask themselves: <em>Which kind of leader are you?</em></p><p>When you walk into a room with your team, do you see people who need to prove themselves? Or do you see people with untapped potential waiting for someone to believe in them?</p><p>The answer to that question determines everything about your leadership legacy.</p><p>Trust is not a reward you give after someone proves themselves. <strong>Trust is an investment you make in who they can become. And sometimes, it’s the best investment you’ll ever make.</strong></p><p>What if the person sitting across from you right now — the one you’re waiting to trust — is actually waiting for you to see their potential and give them the chance to show it?</p><h3>Further Reading</h3><ul><li><strong>The Speed of Trust</strong> by Stephen Covey — A comprehensive exploration of trust as the foundation of effective leadership and organizational success</li><li><strong>Dare to Lead</strong> by Brené Brown — Insights on vulnerability, courage, and building trust through authentic leadership</li><li><strong>The Culture Map</strong> by Erin Meyer — Understanding how trust is built differently across cultures and what that means for global leadership</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ea0f33c3b54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Code Structuring Intelligence]]></title>
            <link>https://medium.com/@jayasagar/ai-code-structuring-intelligence-afa2fe998bab?source=rss-53af6f89e32e------2</link>
            <guid isPermaLink="false">https://medium.com/p/afa2fe998bab</guid>
            <category><![CDATA[ai-development]]></category>
            <category><![CDATA[ml-engineering]]></category>
            <category><![CDATA[ai-structure-intelligence]]></category>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[Jayasagar]]></dc:creator>
            <pubDate>Thu, 26 Feb 2026 09:52:54 GMT</pubDate>
            <atom:updated>2026-02-26T09:52:54.849Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Hidden Tax on AI-Assisted Development</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*uxCt0Wap8dZ73ruSSl_nJA.png" /></figure><blockquote><strong><em>Why your codebase structure determines how smart your AI partner appears</em></strong></blockquote><p>I believe the biggest bottleneck in AI-assisted development isn’t model intelligence. It’s <strong>context pollution</strong>.</p><p>Three weeks into building a production ML recommendation platform, I hit a wall that had nothing to do with algorithms. My AI partner was reading 10,000 lines of code at the start of every session — and half of it was dead weight. Archived engines it would never modify. Historical planning documents for features already shipped. A web crawler replaced months ago.</p><p>The result? Slower responses. Confused suggestions that mixed patterns from the wrong engine. Wasted tokens loading context that actively hurt the conversation.</p><p>So I did what any engineer would do when a system is slow: I profiled it, found the bottleneck, and refactored. Except this time, I wasn’t optimizing for CPU cycles. I was optimizing for AI comprehension.</p><p>Here’s what I discovered: the way you structure your codebase determines how smart your AI partner appears. Same model. Same capabilities. Radically different outcomes — based entirely on what it sees when it opens the project.</p><h3>The Problem: A Codebase That Leaked Context</h3><p>My project had five components: three recommendation engines, a data pipeline, and an analytics suite. The architecture diagram looked clean:</p><pre>product_rec/          → Product similarity engine<br>tool_exchange_rec/    → Tool exchange engine (the one I was actively building)<br>spare_part_rec/       → Spare part engine<br>pipeline/             → 7-stage ETL<br>data_science/         → EDA reports<br>shared/               → Constants, inference, classification</pre><p>But the import graph told a different story. tool_exchange_rec/engine.py had nine direct imports from product_rec:</p><pre>from product_rec.catalog_loader import load_catalog, get_product_index<br>from product_rec.config import DEFAULT_CONFIG<br>from product_rec.models import ProductForRec, RecommendationType<br>from product_rec.stages.stage1_graph_filter import GraphFilter<br>from product_rec.stages.stage2_embedding_retrieval import EmbeddingRetriever<br>from product_rec.stages.stage3_feature_ranking import FeatureRanker<br>from product_rec.build.build_knowledge_graph import build_knowledge_graph<br>from product_rec.build.build_embeddings import build_all_embeddings<br>from product_rec.build.build_faiss_index import build_all_faiss_indexes</pre><p>Nine imports. Three models. Three pipeline stages. Three build functions. Every one reaching into product_rec/ -- a component I wasn&#39;t actively developing anymore.</p><p>This meant every time Claude opened tool_exchange_rec, it needed to understand product_rec too. All 6,000 lines of it. The knowledge graph builder. The autoencoder training loop. The FAISS index construction. The feature ranking algorithm. Configuration classes. Catalog loaders.</p><p>And it got worse. I also had warranty_rec/ (an archived engine with 50MB of models), notebooks/ (legacy experiments), and crawler/ (replaced by the pipeline&#39;s internal crawlers) -- all sitting in the project root, all loaded into context by default.</p><blockquote>I strongly believe this is the hidden tax most teams pay when working with AI. Not a configuration problem. Not a model limitation. An architecture problem — expressed as wasted context.</blockquote><p>The math is brutal.</p><p>When GitHub Copilot processes your codebase, it’s working with approximately 8,000 tokens of context per session. That sounds like a lot until you realize that 10,000 lines of Python code translates to roughly 40,000–50,000 tokens.</p><p>Your AI partner is seeing maybe 20% of your actual codebase per interaction — and if half of that 20% is irrelevant legacy code, you’re down to 10% useful context.</p><h3>The Strategy: Move, Shim, Archive</h3><p>The fix wasn’t complicated. It was disciplined. Three moves, in order:</p><p><strong>Move</strong> the shared infrastructure out of product_rec and into shared/ -- where it belongs.</p><p><strong>Shim</strong> the original product_rec modules with thin re-exports, so nothing breaks.</p><p><strong>Archive</strong> inactive components behind .claudeignore, so they disappear from AI context without being deleted.</p><p>The goal was specific: tool_exchange_rec/engine.py should have zero imports from product_rec. After that, I could archive product_rec entirely.</p><blockquote>This approach mirrors what successful engineering teams do with microservices architecture.<strong> Netflix documented their transition from a monolithic codebase to microservices, noting that the biggest challenge wasn’t technical complexity — it was dependency management.</strong> They found that services with tight coupling performed worse than well-architected monoliths, while services with clean boundaries performed better than both.</blockquote><p>The same principle applies to AI-assisted development. A well-structured monorepo with clean module boundaries outperforms a microservice architecture with tangled dependencies when it comes to AI comprehension.</p><h3>Move: Extracting Shared Infrastructure</h3><p>The nine imports from product_rec fell into three categories: data models, build functions, and pipeline stages. None of these were specific to product recommendations. They were infrastructure that any recommendation engine could use.</p><p>I created twelve new files under shared/:</p><pre>shared/<br>├── rec_models.py              ← ProductForRec, RecommendationType<br>├── rec_config.py              ← RecommendationConfig, DEFAULT_CONFIG<br>├── rec_catalog_loader.py      ← load_catalog, get_product_index<br>├── build/<br>│   ├── knowledge_graph.py     ← NetworkX graph builder<br>│   ├── embeddings.py          ← Autoencoder + Sentence-BERT<br>│   └── faiss_index.py         ← FAISS indexes + FAISSSearcher<br>└── stages/<br>    ├── graph_filter.py        ← Stage 1: graph-based filtering<br>    ├── embedding_retrieval.py ← Stage 2: FAISS retrieval<br>    └── feature_ranking.py     ← Stage 3: weighted scoring</pre><p>About 2,800 lines moved. Every internal import updated — from ..models import ProductForRec became from shared.rec_models import ProductForRec.</p><p>But here’s the design decision that matters: I split the shared module into lightweight and heavyweight imports.</p><p><strong>Lightweight modules</strong> (models, config, catalog loader, constants) get re-exported from shared/__init__.py. Any consumer can write from shared import ProductForRec without triggering a PyTorch or FAISS import.</p><p><strong>Heavyweight modules</strong> (build functions, pipeline stages) require explicit imports: from shared.build.embeddings import build_all_embeddings. These pull in torch, sentence-transformers, faiss, networkx -- expensive dependencies you only want when you actually need them.</p><pre># shared/__init__.py - lightweight re-exports only<br>from .rec_models import ProductForRec, RecommendationType<br>from .rec_config import DEFAULT_CONFIG, RecommendationConfig<br>from .rec_catalog_loader import load_catalog, get_product_index</pre><pre># Heavy imports require explicit paths<br># from .build.embeddings import build_all_embeddings  # NO - too heavy<br># from .stages.graph_filter import GraphFilter        # NO - pulls NetworkX</pre><p>This distinction matters for AI context. When Claude is helping me debug a data loading issue, it doesn’t need to load 500 lines of autoencoder training code. The import boundary tells it — and me — where the complexity lives.</p><p>The pattern follows what Google’s engineering teams discovered when optimizing their monorepo for developer productivity. They found that explicit dependency boundaries reduced cognitive load more than physical code separation. A developer working on search ranking algorithms shouldn’t need to understand the ad auction system, even if both live in the same repository.</p><h3>Shim: Backward Compatibility in Two Lines</h3><p>Here’s where most refactoring stories go wrong. You move the code, update the imports, and break everything downstream. Tests fail. APIs crash. Colleagues curse your name in Slack.</p><p>I didn’t change a single test. Not one API endpoint. Not one import in product_rec/engine.py or product_rec/api.py.</p><p>Instead, I replaced each original module with a re-export shim. The entire product_rec/config.py went from 226 lines to this:</p><pre>&quot;&quot;&quot;Re-exports from shared.rec_config for backward compatibility.&quot;&quot;&quot;</pre><pre>from shared.rec_config import (<br>    get_project_root,<br>    PROJECT_ROOT,<br>    RecommendationConfig,<br>    DEFAULT_CONFIG,<br>)</pre><p>Same pattern for all eight modules. The old import paths still work. Every test that did from product_rec.config import DEFAULT_CONFIG still passes. But the actual code now lives in shared/.</p><p>I strongly believe this pattern — move the code, leave a forwarding address — is the most underused refactoring technique in our industry. It gives you the benefits of restructuring without the cost of a flag day migration. And for AI development specifically, it means your AI partner can be working with the new structure while your CI pipeline still passes against the old imports.</p><blockquote>Amazon’s engineering teams use this pattern extensively when decomposing services. They call it the “<strong>Strangler Fig</strong>” approach — gradually replacing the internals of a system while maintaining its external interface. The old system becomes a thin facade over the new implementation, then eventually disappears entirely.</blockquote><h3>Archive: Teaching Your AI to Forget</h3><p>With tool_exchange_rec fully decoupled, I could make product_rec invisible to Claude. Five lines in .claudeignore:</p><pre># Archived — do not read unless explicitly asked<br>warranty_rec/<br>product_rec/<br>notebooks/<br>crawler/<br>docs/archive/</pre><blockquote>.claudeignore works exactly like .gitignore but for AI context.</blockquote><p>Claude Code won&#39;t read these directories unless I explicitly point it there. The code still exists. Git still tracks it. Tests still run. But my AI partner starts every session with a cleaner, smaller codebase.</p><p>The documentation had to match. I restructured CLAUDE.md into a hierarchy:</p><pre>CLAUDE.md              → System architecture, active components, quick start<br>shared/CLAUDE.md       → Module structure, import rules, consumers<br>tool_exchange_rec/CLAUDE.md → Engine-specific pipeline, API, configuration<br>spare_part_rec/CLAUDE.md    → Engine-specific pipeline, API, configuration</pre><p>Root CLAUDE.md answers “what is this system?” Component files answer “how does this engine work?” The hierarchy mirrors the codebase. Claude loads the right level of detail based on where I’m working.</p><p>This documentation strategy follows the principle of progressive disclosure that Apple’s Human Interface Guidelines recommend for complex applications. Show users the minimum viable information to accomplish their current task, with clear paths to deeper detail when needed.</p><h3>The Numbers</h3><p>Before and after, measured by what Claude sees when it opens the project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aLHXz2JDoNDf1RpJ3K5XdA.png" /></figure><p>The 63% reduction in default context isn’t just a number. It’s the difference between Claude confidently suggesting the right pattern from the right engine, and Claude mixing up tool exchange logic with product recommendation logic because both were loaded into context.</p><p>Test results after the refactoring:</p><pre>tool_exchange_rec:  69 passed  (the target — zero product_rec imports)<br>spare_part_rec:     90 passed  (verified no breakage)<br>product_rec:       214 passed  (re-export shims work perfectly)</pre><p>Zero breaking changes. Zero test modifications. The refactoring was invisible to every consumer except the AI context loader.</p><p>To put this in perspective: a 63% reduction in context size is equivalent to upgrading from a 4GB to a 16GB context window in terms of information density. The AI partner isn’t just seeing less code — it’s seeing more relevant code per token consumed.</p><h3>Real-World Impact: Two Case Studies</h3><p>The context optimization had immediate effects on my development workflow, but I wanted to understand if this pattern worked for other teams. I reached out to two engineering organizations that had experimented with similar approaches.</p><p><strong>Case Study 1: E-commerce Platform (150,000 lines)</strong></p><p>A mid-stage startup rebuilding their recommendation engine worked with GitHub Copilot to migrate from a legacy PHP system to Python. Their initial approach mirrored mine — everything in one repository, but with poor module boundaries.</p><p>Before restructuring:</p><ul><li>Average Copilot suggestion accuracy: ~40%</li><li>Time to first useful suggestion: 15–30 seconds</li><li>Context pollution: Legacy PHP code mixed with new Python modules</li></ul><p>After applying the move-shim-archive pattern:</p><ul><li>Average suggestion accuracy: ~75%</li><li>Time to first useful suggestion: 3–8 seconds</li><li>Clean separation: Active Python development isolated from legacy code</li></ul><p>Their lead engineer noted: “Copilot went from suggesting PHP patterns in Python files to understanding our actual Python architecture. Same model, completely different behavior.”</p><p><strong>Case Study 2: Financial Services API (80,000 lines)</strong></p><p>A fintech company used Claude to help migrate their trading algorithms from C++ to Rust. Their challenge was different — not legacy code, but multiple algorithmic approaches that shared infrastructure.</p><p>They had five trading strategies, each importing from a shared mathematical library. But the shared library had grown to include visualization tools, backtesting frameworks, and data analysis notebooks — none relevant to production trading.</p><p>After restructuring:</p><ul><li>Separated production math libraries from analysis tools</li><li>Archived research notebooks and backtesting code</li><li>Created lightweight interfaces for strategy implementations</li></ul><p>Result: 45% reduction in context size, 60% improvement in Claude’s ability to suggest appropriate optimizations for production trading code versus research code.</p><h3>Try This: The 30-Minute Context Audit</h3><p>Here’s how to diagnose context pollution in your own codebase:</p><p><strong>Step 1: Measure your baseline</strong> (5 minutes)</p><pre># Count total lines your AI partner sees<br>find . -name &quot;*.py&quot; -not -path &quot;./.git/*&quot; | xargs wc -l | tail -1<br><br># Identify your heaviest modules<br>find . -name &quot;*.py&quot; -not -path &quot;./.git/*&quot; -exec wc -l {} + | sort -nr | head -10</pre><p><strong>Step 2: Map your import graph</strong> (10 minutes)</p><pre># Quick script to find cross-module imports<br>import ast<br>import os<br>def find_imports(file_path):<br>    with open(file_path, &#39;r&#39;) as f:<br>        tree = ast.parse(f.read())<br>    <br>    imports = []<br>    for node in ast.walk(tree):<br>        if isinstance(node, ast.ImportFrom):<br>            if node.module and not node.module.startswith(&#39;.&#39;):<br>                imports.append(node.module)<br>    return imports<br># Run on your main modules<br>for root, dirs, files in os.walk(&#39;.&#39;):<br>    for file in files:<br>        if file.endswith(&#39;.py&#39;):<br>            path = os.path.join(root, file)<br>            imports = find_imports(path)<br>            if len(imports) &gt; 5:  # Adjust threshold<br>                print(f&quot;{path}: {len(imports)} external imports&quot;)</pre><p><strong>Step 3: Identify archive candidates</strong> (10 minutes) Look for:</p><ul><li>Directories you haven’t modified in 6+ months</li><li>Experimental code or prototypes</li><li>Documentation that’s no longer current</li><li>Generated files or build artifacts</li><li>Legacy implementations of current features</li></ul><p><strong>Step 4: Create your .claudeignore</strong> (5 minutes)</p><pre># Archive old experiments<br>notebooks/<br>experiments/<br>prototypes/<br><br># Archive completed features<br>legacy/<br>deprecated/<br>old_implementation/<br><br># Archive generated content<br>docs/generated/<br>build/<br>dist/</pre><p>I believe this 30-minute investment will change how your AI partner understands your codebase. The improvement isn’t gradual — it’s immediate and dramatic.</p><h3>The Patterns Worth Stealing</h3><blockquote>After doing this across a 27,500-line codebase, I see four patterns that generalize to any project using AI-assisted development:</blockquote><p><strong>Pattern 1: Separate what AI reads from what AI ignores.</strong> .claudeignore is a context budget tool. Every line your AI partner reads is a line that competes for attention. Archived components, legacy code, completed plans, generated artifacts -- these are noise in the signal. Exclude them explicitly.</p><p><strong>Pattern 2: Extract shared infrastructure before it calcifies.</strong> The nine imports from product_rec weren&#39;t a design decision. They were an accident of build order -- product_rec was built first, so everything else reached into it. Shared code should live in a shared place from the start. If it doesn&#39;t, move it early -- before the coupling makes surgery painful.</p><p><strong>Pattern 3: Re-export shims are your best friend.</strong> When you move code, don’t break imports. Leave a two-line forwarding module at the old path. This costs nothing, preserves all downstream consumers, and lets you refactor incrementally. Delete the shims later when you’re confident nothing depends on the old paths.</p><p><strong>Pattern 4: Separate lightweight from heavyweight imports.</strong> Your shared/__init__.py should re-export only what&#39;s cheap to import. Data models, configuration, constants -- yes. PyTorch model definitions, FAISS index builders, training loops -- no. Heavy imports should require explicit paths so they only load when actually needed. This keeps your AI partner&#39;s context focused and your application&#39;s startup fast.</p><p>These patterns aren’t just about AI development. They’re about cognitive load management. The same architectural decisions that help your AI partner understand your code also help human developers navigate it.</p><h3>The Deeper Lesson</h3><p>I keep coming back to something that feels obvious in retrospect but took me three weeks of AI-assisted development to internalize.</p><blockquote>When you write code with an AI partner, you’re writing for two audiences. Humans read your code for correctness and maintainability. Your AI partner reads it for context and relevance.</blockquote><p>These audiences have different needs.</p><p><strong>Humans benefit from comprehensive documentation, thorough test suites, and complete code history.</strong></p><p><strong>AI partners benefit from focused context, clean boundaries, and explicit separation between what’s active and what’s archived.</strong></p><p><em>The good news? </em>Optimizing for AI context doesn’t hurt human readability. It improves it. A codebase where shared infrastructure lives in shared/, where inactive components are explicitly archived, where import boundaries separate lightweight from heavyweight dependencies -- that&#39;s a better codebase for everyone.</p><p>Martin Fowler wrote about this in his essay on “<strong>Evolutionary Architecture</strong>” — systems that adapt to changing requirements over time. He argued that the most successful software architectures aren’t those designed for current needs, but those designed to evolve with future needs.</p><blockquote>I believe we’re entering an era where codebase architecture serves two masters. The compiler needs your code to be correct. Your AI partner needs your code to be legible. The teams that design for both will build faster than those that design for neither.</blockquote><p>The developers who figure this out first will have an unfair advantage. Not because they’re using better AI models, but because they’re feeding those models better information.</p><p>Context is the new performance bottleneck. Optimize for it like you optimized for memory in the 90s, for CPU in the 2000s, and for network latency in the 2010s.</p><p>What’s polluting your AI partner’s context right now? And what would happen if you cleaned it up?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afa2fe998bab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Shipped Bugs With Claude Code — What AI-Assisted Development Won’t Tell You]]></title>
            <link>https://medium.com/@jayasagar/i-shipped-bugs-with-claude-code-what-ai-assisted-development-wont-tell-you-1944a5bfb2d7?source=rss-53af6f89e32e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1944a5bfb2d7</guid>
            <category><![CDATA[claude-agent-skill]]></category>
            <category><![CDATA[structured-intelligence]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-native-development]]></category>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[Jayasagar]]></dc:creator>
            <pubDate>Wed, 25 Feb 2026 11:00:46 GMT</pubDate>
            <atom:updated>2026-02-25T11:00:46.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*Y1PBveJF6-Rzr2sYkiZx8w.png" /></figure><h3>I believe the real test of any system isn’t how it performs on day one. It’s what breaks on day third — and whether you built the intelligence to catch it.</h3><p>In my last post(<a href="https://medium.com/@jayasagar/becoming-ai-native-what-four-projects-with-claude-code-taught-a-cto-about-building-systems-not-a8416b325ed5">Becoming AI-Native</a>), I wrote about becoming AI-native — building Claude.md files, creating skills, implementing agent hooks. It sounded clean. Structured. Almost elegant.</p><p>Then I spent a couple of days actually shipping with those systems. Here’s what broke, what it taught me, and the four skills I built so it never happens again.</p><h3>The Bug That I never Saw</h3><p>I built an internal tool that automates part of our content workflow — browser automation, content transformation, delivery to a platform via headless Chromium. The kind of unsexy infrastructure that saves hours every week when it works and creates chaos when it doesn’t.</p><p>It worked perfectly for shorter content. Then I ran a 2,800-word technical piece through it.</p><p>The output was truncated at section four. Everything after it — gone. No error. No warning. The system reported success. It just… stopped mid-sentence.</p><p>The root cause? I was using Cmd+A to select content in a headless browser page before copying it to the clipboard. For shorter content, the browser renders everything in the viewport and the shortcut selects it all. For longer content, elements below the fold hadn&#39;t been laid out yet. The shortcut selected only what the browser had rendered.</p><blockquote><strong>Silent data loss. The worst kind of bug.</strong></blockquote><p>The fix was straightforward — replace the keyboard shortcut with JavaScript’s Selection API:</p><pre>const range = document.createRange();<br>range.selectNodeContents(document.body);<br>const selection = window.getSelection();<br>selection?.removeAllRanges();<br>selection?.addRange(range);</pre><p>Problem solved. But the real lesson wasn’t the fix. It was this: <strong>I had no system to detect that the output was shorter than the input.</strong> Validation happened before delivery, not after. The AI produced great content. The system lost 40% of it. Nobody checked.</p><p>I strongly believe this is how most teams fail with AI tools. They validate the generation but not the delivery.</p><h3>The Quiet Bugs Were Worse</h3><p>That clipboard bug was the loudest failure. The quiet ones taught me more.</p><p><strong>I broke seven tests and didn’t know for hours.</strong> After fixing the clipboard issue, I added a page.evaluate() call but forgot to update the mock in the test file. Seven tests failed silently. I only caught it when I ran the full suite hours later for an unrelated reason. No automated check told me &quot;you just edited a source file — the matching tests are now broken.&quot;</p><p><strong>Documentation lied within the same session.</strong> I updated three doc files to reflect the new clipboard mechanism. Got two right. The third still said Cmd+A → Cmd+C. Same person, same hour. When you change code in one place and need to update docs in three, humans forget the third one every time.</p><p>These aren’t exotic failures. They’re the boring, predictable kind — and that’s exactly why they’re dangerous. Every one follows the same pattern: <strong>edit code, move on, check later (maybe).</strong></p><h3>The Pattern: Discipline Doesn’t Scale</h3><p>In 20 years of building teams, I’ve learned that the solution to human inconsistency is never “try harder.” It’s automation.</p><p>When I built <a href="http://techatcore.com/">tech.at.core</a>, I didn’t tell developers to “remember to run tests.” I made CI run them automatically. I didn’t tell them to “follow coding standards.” I built linters that enforced them.</p><p>The same principle applies — maybe even more so — to AI-assisted development.<strong> AI generates changes at a pace that human review can’t match on willpower alone. The feedback loop needs to be tighter than ever.</strong></p><blockquote><em>“First attempt will be 95% garbage. An engineer’s job is to find the best solution for the problem, not just write code.” — Staff Engineer, Sanity.io</em></blockquote><p>That quote hits harder now. The first attempt isn’t just the AI’s code. It’s the AI’s code plus the human’s review process plus the system’s verification checks. If any of those three layers is weak, garbage leaks through.Four Skills I Built After Failing</p><p>Each skill exists because a specific failure taught me a specific lesson.</p><h3>5 Skills learnt and added in this project</h3><h3>/pre-flight — Run after every code change</h3><p>The single highest-value skill I’ve created. It runs TypeScript type-checking and the test suite immediately after any code change, then checks if the changed files trigger documentation sync points.</p><pre>After ANY code change:<br>1. Run `npm run typecheck` — catch type errors immediately<br>2. Run `npm test` — catch broken tests immediately<br>3. Check sync triggers:<br>   - Changed config? → Verify .env.example and README<br>   - Changed a type? → Verify architecture docs<br>4. Report: &quot;All clear&quot; or &quot;These need attention: ...&quot;</pre><p>Would have caught the broken mock and the doc drift — within seconds of the edit, not hours later.</p><h3>/mistakes — Capture learnings in real time</h3><p>When something goes wrong during a session, this skill captures what happened, the root cause, and the fix in a structured learnings file. It also checks whether the mistake reveals a pattern that should become a hook.</p><p><strong>This is my best skill out of all I did so far</strong> :)</p><pre>When a mistake is discovered:<br>1. What happened? Root cause? Fix?<br>2. Append to docs/learnings.md<br>3. Does this pattern suggest a new automated hook?</pre><p>The key insight: <strong>mistakes are perishable context.</strong> If you don’t capture them when they happen, they’re gone when the session ends. A Claude.md file captures project-specific gotchas. A dedicated learnings file captures cross-project patterns that make you better everywhere.</p><h3>/config-audit — Find orphaned configuration</h3><p>During a refactor, I found a config option that was validated, documented, and tested — but read by absolutely nothing. The logic it controlled had been absorbed into another module. A user could spend an hour debugging why it wasn’t working.</p><pre>1. Parse every env var in .env.example<br>2. Check each is loaded in config module<br>3. Check each config field has a consumer<br>4. Flag: unused configs, missing docs, orphaned loaders</pre><p>Dead config is technical debt that actively misleads. This skill catches it before users do.</p><h3>/cleanup — Find dead code</h3><p>Scans for exports that aren’t imported anywhere, config fields that aren’t read, test files that test code which no longer exists, and source files not imported by anything.</p><pre>1. Find all exports — check if imported anywhere<br>2. Find all config fields — check if read anywhere<br>3. Find all test files — check if tested code exists<br>4. Find orphan files not imported by anything<br>5. Report with confidence levels</pre><p>One file in my project had 305 lines of code, a full test suite, and zero imports. Dead since Phase 3. This skill would have flagged it the day it became orphaned.</p><h3>Beyond Skills: Hooks as Your Immune System</h3><p>Skills are powerful, but they depend on you remembering to invoke them. For the patterns where “forgetting to check” is the failure mode, Claude Code offers something better: <strong>agent hooks</strong> — automated checks that trigger on specific events without human intervention.</p><p>I built hooks that now run automatically:</p><ul><li>A post-edit type checker that catches compilation errors within seconds of any .ts file edit</li><li>A post-edit test runner that matches changed source files to their test files and runs them immediately</li><li>A pre-commit documentation sync checker that blocks commits when docs drift from code</li></ul><p>The distinction matters. Skills encode what you’ve learned. Hooks enforce what you can’t afford to forget. Together, they form a layered defense — skills for the checks you run intentionally, hooks for the ones that must happen every single time.Build the System, Not the Habit</p><blockquote>I keep coming back to the same leadership principle: <strong>don’t rely on discipline when you can rely on design.</strong></blockquote><p>Every skill I built is a lesson encoded. Every hook is a failure prevented.</p><p><strong>The Claude.md file is the memory. The skills are the intelligence. The hooks are the immune system.</strong></p><p>I strongly believe this is where the industry is headed. Not just “AI writes code” but “AI writes code inside a system of automated checks that catch what both humans and AI miss.” The teams that build these systems first will ship faster and with fewer defects — not because their AI is better, but because their verification is.</p><p>Being AI-native isn’t just about using AI tools. It’s about building the systems that make AI partnerships reliable at scale.</p><p>What’s the last bug your AI partner shipped that you didn’t catch in time?</p><h3>Further Reading</h3><ul><li><em>First attempt will be 95% garbage: A staff engineer’s 6-week journey with Claude Code</em> — Sanity.io Engineering Blog</li><li><em>Becoming AI-Native: What Four Projects with Claude Code Taught a CTO</em> — <a href="https://medium.com/@jayasagar/becoming-ai-native-what-four-projects-with-claude-code-taught-a-cto-about-building-systems-not-a8416b325ed5">Part 1 of this series</a></li><li><em>Inside the Development Workflow of Claude Code’s Creator”</em>— InfoQ (Boris Cherny on context engineering)</li><li><em>The Pragmatic Programmer -</em> by David Thomas &amp; Andrew Hunt — the original playbook for building systems that catch human mistakesner Ships Bugs</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1944a5bfb2d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CLAUDE.md at 36,000 Characters]]></title>
            <link>https://medium.com/@jayasagar/claude-md-at-36-000-characters-0e0db6210d2f?source=rss-53af6f89e32e------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e0db6210d2f</guid>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[lessons-learned]]></category>
            <category><![CDATA[recommendation-engine]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Jayasagar]]></dc:creator>
            <pubDate>Tue, 24 Feb 2026 11:05:38 GMT</pubDate>
            <atom:updated>2026-02-24T11:05:38.932Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1TotAXUcTtkVAdUK_BC9xg.png" /></figure><h3>I believe the real test of an AI partnership isn’t the first session. It’s session seventy-five — when the project is deep, the architecture is complex, and your AI partner has no memory of anything you built together.</h3><p>I spent the last two weeks building a production ML recommendation platform from scratch — three recommendation engines, a seven-stage data pipeline, 27,500 lines of Python. Every line was written in partnership with Claude Code. Seventy-five sessions. Each one starting from zero context.</p><p>How do you build something this complex when your partner forgets everything between conversations?</p><p>You engineer the context.</p><h3>The 909-Line Seed</h3><p>It started with a PoC document. Nine hundred and nine lines of requirements, architecture decisions, and data assumptions for a warranty recommendation system at an enterprise manufacturer. The kind of document that captures what needs to be built but not what was learned along the way.</p><p>I opened my first Claude Code session, pointed it at this document, and said: “Read this. Let’s start.”</p><p>Within that first session, Claude created the initial project structure, explored the data, and hit the first wall — an Excel file with 172,000 warranty claims loaded zero rows. No error. No warning. Just an empty DataFrame.</p><p>Here’s what happened: pd.read_excel() defaults to sheet index 0. Our file had hidden SAP metadata at sheet 0. The actual data lived in Sheet1. A human who&#39;d worked with this file before would know that. Claude didn&#39;t have that assumption — which is exactly why it investigated instead of assuming.</p><p>That fix — sheet_name=&quot;Sheet1&quot; — became the first entry in what would grow into a 1,157-line living document. The CLAUDE.md file.</p><h3>What CLAUDE.md Actually Is</h3><p>I wrote about CLAUDE.md in my previous post on<a href="https://medium.com/@jayasagar/becoming-ai-native-what-four-projects-with-claude-code-taught-a-cto-about-building-systems-not-a8416b325ed5"> becoming AI-native</a>. But there’s a difference between creating a context file for a weekend project and scaling one across a production ML system with four components, 68,000 products, and three weeks of accumulated decisions.</p><p>At this scale, CLAUDE.md isn’t a README. It’s not documentation for humans. It’s an operating manual for your AI partner — structured so that every new session can pick up exactly where the last one left off.</p><p><strong>My final CLAUDE.md breaks down like this:</strong></p><p><strong>Project Purpose &amp; Architecture (~15%):</strong> What we’re building, the system diagram, how the three engines connect to the shared data layer. This section rarely changes after week one.</p><p><strong>Component Details (~40%): </strong>Each engine’s pipeline stages, API endpoints, file structures, and performance metrics. This is the densest section. It tells Claude exactly what exists, where it lives, and how it performs. When Claude opens a new session, this section means it doesn’t spend the first twenty minutes rediscovering the codebase.</p><p><strong>Critical Implementation Details (~20%)</strong> : Ten numbered entries. Each one is a bug we hit, the root cause, and the exact fix. This is the section that prevents Claude from making the same mistake twice across sessions.</p><p><strong>Running &amp; Testing (~10%): </strong>Exact commands. Every one prefixed with OMP_NUM_THREADS=1 because of the threading bug I&#39;ll explain in a moment.</p><p><strong>Troubleshooting &amp; Roadmap (~15%): </strong>Known issues with solutions, and prioritized future improvements. This section turns handoff into continuity.</p><p>I strongly believe the critical implementation details section is where most teams would stop — if they even get there. But it’s the most valuable section in the entire file.</p><p>Here’s why.</p><h3>The Critical Learnings That Saved Hours</h3><p>Every entry in the critical learnings section exists because we lost time to a bug and I refused to lose that time twice. Here are three that taught me the most:</p><p><strong>The Segfault Nobody Could Reproduce.</strong> Session twelve. Claude trained a PyTorch Two-Tower model. Session thirteen, we imported both PyTorch and LightGBM in the same pipeline. Exit code 139. Segmentation fault. No stack trace. Intermittent.</p><p>The root cause? Both libraries use OpenMP for threading on macOS. When they share a process, the thread managers fight over memory. The fix is a single environment variable: OMP_NUM_THREADS=1.</p><p>Once we documented this in CLAUDE.md, every future session knew to prefix every Python command with it. Without that entry, we would have hit this crash repeatedly, because the fix is counterintuitive (why would you limit threads?) and the symptom gives you nothing to Google.</p><p><strong>The Classification Order That Changed Everything.</strong> Our warranty system classifies replacement items — is this a spare part, a product exchange, or an upgrade?</p><p>The classification uses a five-step hierarchy. Claude discovered that steps three and four were in the wrong order: the spare part prefix check was running after the product set membership check, causing 30,000 spare parts to be misclassified as upgrades.</p><p>The fix was swapping two lines. But the discovery required tracing execution paths through every branch — the kind of tedious work where humans take shortcuts and AI doesn’t.</p><p><strong>The Model That Loaded Wrong.</strong> After retraining, the Two-Tower model produced garbage scores. Claude compared the saved <strong>state_dict</strong> dimensions against the encoder architecture and found a mismatch. The loading code assumed fixed dimensions from the encoder class, but retraining had changed hidden layer sizes.</p><p><em>Fix: infer dimensions from the saved weights, not from hardcoded architecture.</em></p><p>Each of these became an entry in CLAUDE.md. Each one would have cost hours to re-diagnose. The document turned expensive debugging sessions into instant context.</p><h3>The Monorepo Decision: One Root, Four Projects, One CLAUDE.md</h3><p>Important part now :) Here’s a decision I’d make differently if I started over.</p><p>The project is a monorepo. Four components live under one root:</p><pre>recengine/<br>├── warranty_rec/     # Engine 1: warranty claims<br>├── product_rec/      # Engine 2: product similarity<br>├── tool_exchange_rec/ # Engine 3: tool exchange<br>├── pipeline/         # 7-stage ETL<br>├── data/             # Shared data layer<br>└── CLAUDE.md         # One master context file (1,157 lines)</pre><p>I created one CLAUDE.md at the root. Each component has its own docs/ folder, but no component-level CLAUDE.md.</p><p><strong>What worked about this approach:</strong> Claude always had the full picture. When building the tool exchange engine, it could reference how the warranty engine solved cold-start. When designing the ETL pipeline, it knew exactly what the recommendation engines needed from the catalog. Cross-component decisions were easy because the context was unified.</p><p><strong>What didn’t work:</strong> The file grew to 1,157 lines. <strong>That’s a lot of context to load on every session.</strong> When I was working exclusively on the pipeline for three sessions straight, Claude was loading 700 lines of recommendation engine context it didn’t need. And when I asked Claude to focus on a specific component, it sometimes pulled patterns from the wrong engine.</p><blockquote><strong>What I’d do differently:</strong> Keep the root CLAUDE.md for architecture, shared data, and cross-component decisions. Add a focused CLAUDE.md in each component for that engine’s specifics. Something like:</blockquote><pre>CLAUDE.md              # Architecture, data layer, critical learnings (400 lines)<br>warranty_rec/CLAUDE.md  # This engine&#39;s stages, API, gotchas (200 lines)<br>product_rec/CLAUDE.md   # This engine&#39;s stages, API, gotchas (200 lines)</pre><p>The root file answers “how does the system work?” Each component file answers “how does this engine work?” Claude Code reads both when you’re working in a component directory.</p><p>I strongly believe this is the natural scaling pattern for AI context: hierarchical, like the codebase itself. One root for the forest, one file per tree.The Permission Gradient: Making Claude a Real Engineer</p><p>Context alone isn’t enough. Claude needs to actually run the code, train models, test APIs, and debug failures. That requires permissions.</p><p>My settings.local.json grew organically across sessions. Here&#39;s what the permission gradient looked like:</p><p><strong>Read and Explore:</strong></p><pre>python3:*, ls:*, find:*, cat:*, wc:*</pre><p>Claude could run scripts and explore. Basic pair programming.</p><p><strong>Install and Build:</strong></p><pre>pip install:*, brew install:*, .venv/bin/python:*</pre><p>Claude could install dependencies, set up environments. After the libomp crash, I added brew install:* so Claude could fix its own infrastructure problems.</p><p><strong>Train and Test:</strong></p><pre>OMP_NUM_THREADS=1 .venv/bin/python:*<br>.venv/bin/pytest:*<br>OMP_NUM_THREADS=1 timeout 300 .venv/bin/python:*</pre><p>Claude could run 15-minute training pipelines, execute test suites, and timeout long-running processes. The timeout 300 entries came after a training run that hung — Claude needed the ability to kill stuck processes.</p><p><strong>Debug and Manage:</strong></p><pre>kill:*, lsof:*, pkill:*, jobs:*</pre><p>Claude could investigate stuck processes, check port usage, and clean up after itself.</p><p><strong>Full Autonomy:</strong></p><pre>WebFetch(domain:www.some-websitel.com)<br>.venv/bin/playwright:*<br>git rm:*, git mv:*</pre><p>Claude could crawl product pages, automate browsers for testing, and manage the repository.</p><p>This wasn’t planned. Each permission was granted in response to a real need — Claude hit a wall, I understood why, and I opened the gate. But looking back, I see the pattern: <strong>trust expands with demonstrated competence.</strong> The same principle I’ve used to build teams for twenty years.</p><h3>The Sync Check System</h3><p>By week two, I had a new problem. CLAUDE.md was 800 lines and I’d changed code in three places without updating the corresponding documentation. The same failure mode I wrote about in my last post — except now it was my AI context file drifting from reality.</p><p>So I built a sync check table directly into CLAUDE.md:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*btjkRdb9kyl-fzwb9cNn4Q.png" /></figure><p>This table lives at the bottom of the file. At the end of every session, Claude (or I) scan it. Did this session change a stage? Check the count. Did this session add a config? Check the table.</p><p>It’s not automated — it’s a checklist. But it works because it’s embedded in the context that Claude reads on every session. Claude doesn’t forget to check it because it’s right there in the document Claude already loaded.</p><h3>What I’d Tell Someone Starting This Journey</h3><p>After seventy-five sessions and 1,157 lines of context engineering, here’s what I’ve learned:</p><p><strong>Start writing CLAUDE.md on session one.</strong> Not after the project is done. Not after you’ve figured out the architecture. The first session produces the first bug, and that bug is your first entry.</p><p><strong>Structure it for scanning, not reading.</strong> Claude doesn’t read your CLAUDE.md like a novel. It scans for relevant context. Use headers, code blocks, and tables. Put the critical learnings in a numbered list. Make every section findable.</p><p><strong>Record the why, not just the what.</strong> “Use sheet_name=&#39;Sheet1&#39;&quot; is useful. &quot;The Excel file has hidden SAP metadata at index 0, which loads zero rows silently&quot; is context that prevents a class of bugs, not just one instance.</p><p><strong>Let it grow, then refactor.</strong> My CLAUDE.md was messy by session thirty. I reorganized it once, around session forty, when I understood which sections Claude actually needed. Don’t optimize the structure too early.</p><p><strong>The permission file is part of the context.</strong> settings.local.json tells Claude what it can do. CLAUDE.md tells it what it should know. Together, they define the partnership.</p><p><strong>Pair CLAUDE.md with skills and hooks — they’re the active layer.</strong> CLAUDE.md is memory. But memory alone doesn’t prevent mistakes — action does. In my previous post on shipping bugs with AI, I built two skills that directly complement what I’m describing here:</p><p>A /mistakes skill that captures errors in real time — what happened, the root cause, the fix — and appends them to a structured learnings file. Every critical learning entry in my CLAUDE.md started as a /mistakes capture. The skill is how insights get recorded; CLAUDE.md is where they live permanently. Without the skill, I&#39;d forget to update the context file. Without the context file, the skill&#39;s output would disappear when the session ended.</p><p>A /sync-docs skill (my pre-flight check) that runs after every code change and verifies whether the change triggers any of the sync check rows I described above. It runs the type checker, runs the test suite, then scans the sync table and flags which docs need updating. This is the automated version of the manual checklist — and it works because the sync table in CLAUDE.md defines what to check while the skill enforces that it actually gets checked.</p><p>The pattern is: CLAUDE.md defines the rules. Skills execute the rules. Hooks enforce the rules automatically. Together, they form a closed loop — context informs action, action updates context. None of the three works as well alone as they do together.</p><h3>Context Engineering Is the New DevOps</h3><p>I keep coming back to this parallel. Twenty years ago, DevOps transformed how we shipped software — not by changing the code, but by engineering the systems around the code. CI/CD pipelines, infrastructure as code, monitoring dashboards.</p><p>Context engineering is doing the same thing for AI partnerships. The code is important. But the context — the CLAUDE.md files, the permission gradients, the sync checks, the critical learnings — that’s the infrastructure that makes AI-assisted development reliable and scalable.</p><p>I built 27,500 lines of production ML code across seventy-five sessions with an AI partner that has no persistent memory. The project succeeded not because Claude is brilliant (though it is) but because I engineered the context that made every session productive from minute one.</p><p>The companies that figure out context engineering first won’t just use AI better. They’ll build faster, debug faster, and accumulate knowledge faster — because their AI partners start every conversation already knowing what matters.</p><p>What’s in your CLAUDE.md? And more importantly — what should be in it that isn’t yet?</p><h3>Further Reading</h3><ul><li><em>“Becoming AI-Native: What Four Projects with Claude Code Taught a CTO”</em> — Part 1 of this series</li><li><em>“When Your AI Partner Ships Bugs”</em> — Part 2 of this series (skills and hooks)</li><li><em>“Inside the Development Workflow of Claude Code’s Creator”</em> — InfoQ (Boris Cherny on context engineering)</li><li><em>“The Pragmatic Programmer”</em> by David Thomas &amp; Andrew Hunt — the original playbook for building systems around code</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e0db6210d2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trust by Leadership — Stop Making People Earn Your Trust]]></title>
            <link>https://medium.com/@jayasagar/trust-by-leadership-stop-making-people-earn-your-trust-4c4bc17b6d87?source=rss-53af6f89e32e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c4bc17b6d87</guid>
            <category><![CDATA[team-building]]></category>
            <category><![CDATA[trust]]></category>
            <category><![CDATA[trust-first-leadership]]></category>
            <category><![CDATA[human-first-leadership]]></category>
            <category><![CDATA[leadership]]></category>
            <dc:creator><![CDATA[Jayasagar]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 19:12:02 GMT</pubDate>
            <atom:updated>2026-02-23T19:12:02.435Z</atom:updated>
            <content:encoded><![CDATA[<h3>Trust by Leadership — Stop Making People Earn Your Trust</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9H4WWNGdXqfxS5rg6yZsww.png" /></figure><blockquote>I believe the most powerful operating system in leadership isn&#39;t technology, process, or strategy — it&#39;s human trust.</blockquote><p>Most leaders approach trust like a transaction. They make people earn it. They withhold it until someone proves themselves worthy. They treat it like a precious resource that must be carefully rationed and protected.</p><p>But what if we&#39;ve got it completely backward?</p><p>What if trust isn&#39;t something people should earn, but something leaders should give first, boldly and without reservation?</p><p>This isn&#39;t just philosophical idealism. It&#39;s the foundation of everything I&#39;ve built at <a href="http://techatcore.com/"><em>tech.at.core</em></a>, where 95% started as interns or juniors and grown into tech leads, architects, and leaders from within. Every leader, every specialist, every expert in our company was developed from the ground up through one simple principle: trust first, always.</p><p>But my understanding of trust-first leadership didn&#39;t come from a business school or management book. It came from a moment of profound vulnerability in 2006 that changed the trajectory of my entire life.</p><h3>The Interview That Taught Me Everything</h3><p>I was in my final year of B.tech in India, sitting across from a manager named Bhargav at tech gaint company. I had sailed through the technical rounds: coding, problem-solving, all the measurable skills were there. But then came the question that would expose my deepest insecurity.</p><blockquote>&quot;Where do you want to be in five years?&quot;</blockquote><p>Simple question. Devastating reality.</p><p>I struggled. Not because I lacked vision or ambition, but because English wasn&#39;t my first language, and I had never learned to express complex thoughts in it fluently. Coming from a non-English medium background, I could handle technical discussions where code spoke louder than words, but this required something different, the ability to frame thoughts, construct sentences, and articulate dreams I had never put into words.</p><p>I fumbled. I stammered. I felt the shame of not being able to express what was clear in my mind but trapped by language barriers. Then Bhargav did something that still gives me chills today. Instead of ending the interview or moving on, he said, &quot;<strong>Why don&#39;t you write it down?</strong>&quot;</p><p>He gave me paper. He gave me time. He gave me a different way to express myself.</p><p>I wrote. It wasn&#39;t perfect, but it was better. More importantly, it was real.</p><p>I didn&#39;t think I had a chance. How could I? I had just demonstrated what felt like a fundamental weakness in front of a senior leader. But mysteriously, I got the job.</p><p>That mystery solved itself years later when I realized what had happened in that room. Bhargav hadn&#39;t seen my language struggles as a disqualification but he had seen potential. <strong>He had trusted first</strong>. He had looked past the surface-level communication challenge and recognized something deeper: capability, determination, and the spark of someone who just needed the right conditions to shine.</p><blockquote>That single act of trust-first leadership didn&#39;t just get me a job. It planted a seed that would grow into my entire philosophy of building people.</blockquote><h3>Trust as the Foundation of Scale</h3><p>I strongly believe that trust isn&#39;t just a nice-to-have leadership quality but it&#39;s the fundamental technology that makes scale possible.</p><p>When I look at our journey at <a href="http://techatcore.com/">tech.at.core</a>, growing to 100+ people without limited external senior hires, the secret wasn&#39;t revolutionary management techniques or cutting-edge processes.<strong> It was trust deployed as our primary scaling mechanism.</strong></p><blockquote>Here&#39;s what most leaders get wrong about delegation: they delegate tasks but withhold ownership. They give people work but not authority. They share responsibility but keep control. This isn&#39;t delegation — it&#39;s sophisticated micromanagement.</blockquote><p>True delegation is the kind that scales which requires transferring not just tasks but trust. When you trust someone with real ownership, something magical happens: they don&#39;t just complete the work, they elevate it. They bring creativity, initiative, and personal investment that you could never mandate or manage into existence.</p><p><a href="https://www.aristotleperformance.com/post/project-aristotle-google-s-data-driven-insights-on-high-performing-teams">Google&#39;s Project Aristotle</a>, which studied hundreds of teams to identify what makes them effective, found that psychological safety — essentially trust in action — was the single most important factor in team performance. Teams with high psychological safety outperformed others regardless of individual talent levels, resource availability, or technical expertise.</p><blockquote><em>&quot;The best way to find out if you can trust somebody is to trust them.&quot; — Ernest Hemingway</em></blockquote><p>PwC&#39;s Global Workforce Hopes and Fears Survey reveals that employees with the highest levels of psychological safety are 72% more motivated than those who feel the least safe. Yet only 56% of workers feel it&#39;s safe to try new approaches in their workplace, and just 54% say their team treats failures as opportunities to learn and improve.</p><p>This gap represents the massive untapped potential in most organizations. When leaders default to trust, they unlock not just better performance but human capabilities that fear-based environments suppress entirely.</p><h3>The Patagonia Model of Trust-First Leadership</h3><p>Consider Patagonia&#39;s approach under founder Yvon Chouinard. When the company implemented their &quot;<em>1% for the Planet</em>&quot; initiative, dedicating 1% of sales to environmental causes, many viewed it as risky idealism. But Chouinard trusted his team and customers to understand that authentic purpose creates sustainable value. The result? Patagonia has grown into a billion-dollar company with unprecedented customer loyalty and employee engagement.</p><p>The company&#39;s trust-first culture extends to their famous &quot;<em>Let My People Go Surfing</em>&quot; policy, where employees can leave work to surf when conditions are perfect. Rather than seeing productivity decline, Patagonia found that trusting employees with this freedom increased both job satisfaction and creative output. Employees didn&#39;t abuse the policy — they honored it, often working extra hours to ensure their responsibilities were covered.</p><p>This demonstrates a crucial principle: when you trust people with freedom, they typically respond with responsibility.</p><blockquote><em>“Trust is the lubrication that makes it possible for organizations to work.” — Warren Bennis</em></blockquote><h3>The Compound Effect of Trust Investment</h3><p>I believe that trust, like compound interest, grows exponentially when you invest in it consistently over time.</p><p>At <a href="http://techatcore.com/">tech.at.core</a>, we made trust investment a systematic practice. Every new team member, regardless of their starting level, received what we call &quot;<em>trust deposits</em>&quot; — opportunities to take ownership, make decisions, and yes, make mistakes without career-ending consequences.</p><p>The results compound in ways that traditional management approaches never could:</p><p><strong>Fear dissolves.</strong> When people know they won&#39;t be punished for honest mistakes, they take intelligent risks. They experiment. They innovate. They bring their full creative capacity to work instead of playing it safe.</p><p><strong>Real capability emerges.</strong> Trust doesn&#39;t just reveal existing capabilities and also it develops new ones. When someone knows you believe in them, they often discover strengths they didn&#39;t know they had.</p><p><strong>Motivation becomes intrinsic.</strong> External motivation has limits. But when someone feels genuinely trusted, their motivation shifts from avoiding punishment to creating value. They work not because they have to, but because they want to contribute to something meaningful.</p><p><strong>Boundaries get pushed.</strong> Trusted individuals don&#39;t just meet expectations — they exceed them. They see challenges as opportunities to prove the trust was well-placed.</p><p><strong>Creativity flourishes.</strong> Fear is creativity&#39;s greatest enemy. Trust is its greatest catalyst. When people feel safe to think differently, they generate solutions that rigid, fear-based environments never produce.</p><p>The research supports this compound effect. Employees who find their work most meaningful are 91% more motivated than those who perceive the least meaning in what they do, according to PwC&#39;s workforce research. Trust creates the psychological safety necessary for people to connect their daily work to deeper purpose and meaning.</p><h3>The Trust-First Leader&#39;s Mindset</h3><p>Leading with trust first requires a fundamental mindset shift. It means accepting that some people will disappoint you, some experiments will fail, and some trust will be misplaced. But it also means understanding that the cost of these failures is minuscule compared to the cost of creating a culture where people can&#39;t reach their full potential.</p><p>I strongly believe that every person is a seed. With the right conditions like trust, clarity, support, and growth opportunities — that seed becomes not just a tree, but potentially a forest. When leaders default to suspicion, they create conditions where seeds remain dormant. When they default to trust, they create the soil where extraordinary growth becomes possible.</p><p>This doesn&#39;t mean being naive or reckless. Trust-first leadership includes clear expectations, regular communication, and accountability systems. But it starts from a position of believing in people&#39;s potential rather than protecting against their failures.</p><p>The trust-first leader asks different questions:</p><ul><li>Instead of &quot;How can I prevent this person from failing?&quot; they ask &quot;How can I create conditions for this person to succeed?&quot;</li><li>Instead of &quot;What controls do I need?&quot; they ask &quot;What support do they need?&quot;</li></ul><h3>The Legacy of Trust</h3><p>Years later, I still think about Bhargav and that interview. He probably doesn’t remember it — it was likely just another hiring decision in a long career. But for me, it was the moment I learned that leadership isn’t about finding perfect people. It’s about seeing the spark in imperfect people and trusting them to grow into something extraordinary.</p><p>That’s the legacy I want to build through <a href="http://techatcore.com/">tech.at.core</a> and beyond. Not a company built on my individual brilliance, but a movement of leaders who understand that their greatest achievement isn’t what they create — it’s who they build.</p><p>When you lead with trust first, you don’t just build better teams or achieve better results. You participate in the profound human work of helping people discover who they can become. You create ripple effects that extend far beyond your organization, as the people you trust go on to trust others, multiplying the impact across generations.</p><p>The most powerful operating system isn’t technology. It’s human trust. And when you deploy it as your default mode, you don’t just change how you lead — you change lives.</p><p>What would happen in your organization if you started with trust instead of making people earn it?</p><h3>Further Reading</h3><p>- <strong>The Trusted Advisor</strong> by David Maister, Charles Green, and Robert Galford<br>- <strong>The Speed of Trust</strong> by Stephen M.R. Covey<br>- <strong>Psychological Safety</strong> by Amy Edmondson</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c4bc17b6d87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Becoming AI-Native: What Four Projects with Claude Code Taught a CTO About Building Systems, Not…]]></title>
            <link>https://medium.com/@jayasagar/becoming-ai-native-what-four-projects-with-claude-code-taught-a-cto-about-building-systems-not-a8416b325ed5?source=rss-53af6f89e32e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8416b325ed5</guid>
            <category><![CDATA[structured-intelligence]]></category>
            <category><![CDATA[claude-skills]]></category>
            <category><![CDATA[ai-native]]></category>
            <category><![CDATA[claude-agent-skill]]></category>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[Jayasagar]]></dc:creator>
            <pubDate>Sun, 22 Feb 2026 17:26:18 GMT</pubDate>
            <atom:updated>2026-02-22T17:26:18.315Z</atom:updated>
            <content:encoded><![CDATA[<h3>Becoming AI-Native: What Four Projects with Claude Code Taught a CTO About Building Systems, Not Just Code</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*pxRYLRzGEqChULhZxNzUtQ.png" /></figure><h3>I believe the most powerful tools are worthless without the right mindset — and that mindset isn&#39;t about speed. It&#39;s about becoming AI-native.</h3><p>After 20 years of building teams and shipping products, I spent the last two months using Claude Code across four projects. What I discovered isn&#39;t another &quot;top 10 tips&quot; list. It&#39;s a fundamental shift in how I think about building software — not as a human who uses AI tools, but as someone who architects the way intelligence flows through a codebase.</p><blockquote>Being <strong>AI-native</strong> isn&#39;t about faster implementation. It&#39;s about how you structure knowledge, preserve context, and build systems that compound over time.</blockquote><p>It&#39;s about slowing down when every instinct tells you to rush. It&#39;s about treating AI not as a code generator, but as a thinking partner who needs the same onboarding, the same documentation, the same trust you&#39;d give to any team member.</p><p>Here&#39;s what nobody told me — and what I had to learn the hard way.</p><h3>The Context Crisis Nobody&#39;s Talking About</h3><p><strong>82% of organizations have developed plans to embed generative AI into their operations</strong>, according to Microsoft&#39;s 2026 Data Security Index, but most are still treating these tools like sophisticated search engines rather than collaborative partners.</p><p>The problem isn&#39;t capability — it&#39;s continuity.</p><blockquote><em>&quot;Agents will generate and consume far more information than a single prompt can hold, so &#39;context engineering&#39; will become essential.&quot; — Dasha Metropolitansky, Microsoft Research</em></blockquote><p>I strongly believe this context crisis is the biggest barrier between AI experimentation and AI transformation. When your AI partner loses all memory between sessions, you&#39;re not building on previous work — you&#39;re rebuilding it.</p><p>I experienced this firsthand. In the first week of using Claude Code, I&#39;d spend 30 minutes setting up context at the start of every session — explaining the project, the architecture, the decisions we&#39;d already made. By the time Claude understood where we left off, I&#39;d burned through half my productive time.</p><p>That&#39;s when I realized: the real skill isn&#39;t prompting. It&#39;s system design.</p><h3>The Claude.md Foundation: Your AI&#39;s Memory System</h3><p>Every project I touch now starts with a Claude.md file. Not because it&#39;s trendy, but because it solves the fundamental problem of AI amnesia.</p><p>This isn&#39;t a universal template you copy-paste across projects. It&#39;s a living document that must be curated per project&#39;s dynamics. What works for a Python ML pipeline is completely different from what works for a Java microservices platform.</p><p>Boris Cherny, the creator of Claude Code at Anthropic, shared that their internal team keeps their Claude.md at roughly 2,500 tokens. Not a novel — a compass.</p><p>Here&#39;s what I learned works:</p><p><strong>Project Context (30%):</strong></p><ul><li>What we&#39;re building and why</li><li>Key architectural decisions already made</li><li>Technologies, versions, deployment targets</li></ul><p><strong>AI Instructions (40%):</strong></p><ul><li>Coding patterns we follow</li><li>Security requirements and constraints</li><li>Things that are non-obvious from the code alone</li></ul><p><strong>Learning Log (30%):</strong></p><ul><li>Mistakes the AI has made on this project</li><li>Solutions that worked well</li><li>Gotchas to avoid in future sessions</li></ul><p>Here&#39;s a real example from one of our Spring Boot microservices projects deployed on GKE:</p><pre># CLAUDE.md - Warranty Recommendation Service<br><br>## Project Context<br>- Spring Boot 3.2 microservice on GKE (Java 21, Gradle)<br>- Predicts warranty solutions for IoT products (spare parts, exchanges, upgrades)<br>- Deployed to GKE Autopilot, config via Spring Cloud Config Server<br>- PostgreSQL on Cloud SQL, Redis for caching, Pub/Sub for async events<br><br>## AI Instructions<br>- Follow hexagonal architecture: domain/ adapters/ ports/ application/<br>- All REST controllers in adapters/inbound/, repositories in adapters/outbound/<br>- Use record types for DTOs, sealed interfaces for domain events<br>- Never hardcode GCP project IDs or service URLs — use application.yml profiles<br>- Integration tests use Testcontainers (PostgreSQL + Redis), not H2<br>- Gradle: always use ./gradlew, not gradle directly<br><br>## Learning Log<br>- AI suggested @Autowired field injection — we use constructor injection only<br>- Generated tests with @SpringBootTest when @WebMvcTest was sufficient (slower tests)<br>- Tried to create a generic ResponseWrapper — we already have ApiResponse&lt;T&gt;<br>- Suggested HikariCP tuning that conflicts with Cloud SQL Connector defaults</pre><p>The difference this makes is dramatic. Instead of explaining the architecture every morning, I point Claude to the file and say &quot;Read Claude.md and help me implement the fault classification endpoint.&quot; Context preserved. In fact, Claude code is smart enought to build context automatucally project necessary files but sometime you need to point to right context files though.</p><h3>Skills: Encoding Your Team&#39;s Intelligence</h3><p>One of the most underutilized features in Claude Code is Skills — reusable instruction sets stored in .claude/skills/ that turn your AI into a specialist for specific tasks.</p><p>I discovered this when I kept asking Claude to &quot;<strong>create a detailed plan before coding</strong>&quot; and getting inconsistent results. Sometimes it would write a novel. Sometimes it would jump straight to implementation. I needed consistency — the kind of consistency you get from a well-onboarded team member who knows your standards.</p><p>So I built skills. Here are three real ones from my projects:</p><p><strong>The &quot;plan&quot; skill — forces structured thinking before any code:</strong></p><pre>---<br>name: plan<br>description: Create a detailed implementation plan before writing any code<br>---<br><br>## Step 1: Research<br>- Read CLAUDE.md for project context<br>- Explore relevant codebase areas<br>- Identify files to create, modify, or affect<br><br>## Step 2: Write plan to docs/plans/<br>Create `docs/plans/YYYY-MM-DD-&lt;slug&gt;.md` with:<br>- Context: what exists, why the change is needed<br>- Files to Change: table with file, action, what changes<br>- Implementation Steps: numbered, concrete, dependency-ordered<br>- Verification: typecheck, tests, manual steps<br><br>## Step 3: Present and wait for approval<br>Do NOT write implementation code until the user approves.</pre><p>This skill saved me from a critical bug. When I planned Phase 3 of my editorial pipeline, the plan revealed that validation would block the Claude rewrite stage — files would get moved to FAILED/ before Claude ever ran. Without the plan, I would have implemented the whole thing, run it, watched it fail, and spent hours debugging. The plan caught it on paper.</p><p><strong>The &quot;adr&quot; skill — captures architectural decisions while they&#39;re fresh:</strong></p><pre>---<br>name: adr<br>description: Create an Architectural Decision Record for evaluating technical options<br>---<br><br>Research the problem space, then write to docs/adr/NNNN-&lt;slug&gt;.md:<br>- Context: problem or situation requiring a decision<br>- Decision Drivers: key requirements and constraints<br>- Options Considered: each with description, effort, pros/cons<br>- Comparison table: criteria vs options<br>- Decision: chosen option with justification<br>- Consequences: good, bad, neutral outcomes</pre><p>When we had to decide between browser-based publishing (Playwright) versus the deprecated Medium API token approach, the ADR skill structured the decision perfectly. Trade-offs documented. Consequences tracked. Six months later, when Medium changed their UI selectors, we knew exactly why we&#39;d wrapped tag-adding in try-catch — the ADR said &quot;Medium selectors change; tag failure shouldn&#39;t lose the draft.&quot;</p><p><strong>The &quot;sync-docs&quot; skill — prevents documentation drift:</strong></p><pre>---<br>name: sync-docs<br>description: Audit CLAUDE.md and README against actual implementation<br>allowed-tools: Read, Grep, Glob<br>---<br><br>Check each item and report drift:<br>1. Project structure tree matches src/ layout<br>2. Pipeline stages: count, order, naming match code<br>3. Config/env vars: .env.example matches README table<br>4. CLI commands: package.json matches docs<br>5. Test count: documented count within 50 of reality</pre><p>I strongly believe documentation drift is the silent killer of AI-assisted development. When Claude.md says one thing and the code does another, every AI session starts with a lie. The sync-docs skill runs after every major change and catches drift before it compounds.</p><h3>Agent Hooks: Your AI&#39;s Safety Net</h3><p>Agent hooks let you build automated checks that run before your AI&#39;s work reaches your codebase.</p><p>The most valuable hook I&#39;ve implemented? <strong>Security scanning before Git commits.</strong> Example in <em>.claude/settings.json</em>:</p><pre>{<br>  &quot;hooks&quot;: {<br>    &quot;PreToolUse&quot;: [{<br>      &quot;matcher&quot;: &quot;Bash&quot;,<br>      &quot;hooks&quot;: [{<br>        &quot;type&quot;: &quot;command&quot;,<br>        &quot;command&quot;: &quot;.claude/hooks/scan-secrets.sh&quot;<br>      }]<br>    }]<br>  }<br>}</pre><p>The scan-secrets script checks for API keys, passwords, connection strings, and tokens in any file Claude touches. Here&#39;s the insight that most people miss:</p><blockquote><strong>AI can read your entire folder structure.</strong> Even &quot;local&quot; secrets aren&#39;t safe when your AI partner has broad file access. This hook creates a safety net that catches what humans forget.</blockquote><p>In 20 years of building software, I&#39;ve learned that the best safety measures are automatic. Hooks are the CI/CD of AI-assisted development — they catch what humans forget to check.</p><h3>The Slow-Down Principle: What Four Projects Taught Me</h3><p>Here&#39;s the hardest lesson. The temptation to rush will destroy your quality.</p><p>When Claude generates a solution in 30 seconds, every instinct screams to accept and move on. I&#39;ve been there. In my first project, I accepted Claude&#39;s code so fast that I shipped a validation stage that was checking the wrong content — it validated the raw draft instead of the Claude-rewritten article. Files went to FAILED/ and I spent hours figuring out why.</p><p>The fix wasn&#39;t technical. The fix was behavioral.</p><p><strong>My slow-down protocol after Claude completes any significant work:</strong></p><ol><li><strong>Always create .md files for context</strong> — once a session closes, that context is gone forever. Plans, research, architecture decisions — capture everything in markdown before the session ends.</li><li><strong>Ask Claude to review its own work</strong> — &quot;Review this code and challenge your own assumptions. What could go wrong?&quot; This single question has caught more bugs than any linter.</li><li><strong>Challenge the output</strong> — I treat Claude&#39;s code like a junior developer&#39;s pull request. Approve nothing without understanding it. If I can&#39;t explain what it does, I don&#39;t ship it.</li><li><strong>Never try to finish everything in one session</strong> — context degrades as sessions grow longer. Performance drops significantly in the final 20% of the context window. Commit frequently. Start fresh. Let the Claude.md carry the context forward.</li></ol><blockquote><em>&quot;First attempt will be 95% garbage. An engineer&#39;s job is to find the best solution for the problem, not just write code.&quot; — Staff Engineer, Sanity.io</em></blockquote><p>That quote resonates deeply. After four projects, I&#39;ve stopped expecting perfection on the first pass. Iteration is the process, not the failure.</p><h3>The Numbers Behind the Mindset Shift</h3><p>The market data supports what I&#39;m seeing in practice. <strong>Deloitte predicts that 75% of companies will invest in Agentic AI by 2026</strong>, with the market potentially reaching $45 billion by 2030 — but only if enterprises &quot;orchestrate agents better.&quot;</p><p>That phrase — &quot;orchestrate agents better&quot; — is everything.</p><p>Faros AI measured enterprise teams achieving a <strong>4:1 ROI</strong> with Claude Code, with a cost per incremental pull request at $37.50 versus $150 in developer time saved. But here&#39;s the paradox: teams with heavy AI usage completed 21% more tasks and merged 98% more pull requests, but their <strong>PR review times increased by 91%</strong>.</p><p>I strongly believe this paradox is a leadership challenge, not a tooling one. You ship more, but if you don&#39;t review more carefully, you ship more problems. The velocity gains are real — but only if the human system around the AI is designed to handle the throughput.</p><h3>The Leadership Lesson Behind the Technical Practice</h3><p>Here&#39;s what I&#39;ve discovered after implementing these practices across four projects: <strong>the same principles that make AI partnerships successful are the same ones I&#39;ve taught about human partnerships for 20 years.</strong></p><p>Clear communication. Documented expectations. Consistent feedback. Learning from mistakes. Building on previous work rather than starting from scratch. Trust first, then verify.</p><p>When you create systems that help AI maintain context and improve over time, you&#39;re not just optimizing a tool — you&#39;re modeling the kind of collaborative practices that scale human teams.</p><p>I strongly believe this is the real transformation happening in software development. Not AI replacing developers, but AI revealing who among us are true system thinkers — the ones who understand that sustainable productivity comes from building systems, not just writing code.</p><p>Being AI-native isn&#39;t about which tool you use. It&#39;s about how you think. It&#39;s about architecting intelligence into your workflow the way you&#39;d architect a distributed system — with clear interfaces, persistent state, graceful degradation, and the wisdom to know when to slow down.</p><p>What systems are you building to make your AI partnerships as effective as your human ones?</p><h3>Further Reading</h3><ul><li><em>&quot;First attempt will be 95% garbage: A staff engineer&#39;s 6-week journey with Claude Code&quot;</em> — Sanity.io Engineering Blog</li><li><em>&quot;Inside the Development Workflow of Claude Code&#39;s Creator&quot;</em> — InfoQ (Boris Cherny&#39;s parallel session workflow)</li><li><em>&quot;Context Rot: Why AI Gets Worse the Longer You Chat&quot;</em> — ProductTalk.orgg Systems, Not Just Code</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8416b325ed5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Static Website: Continuous Deployment on Google Cloud Platform]]></title>
            <link>https://medium.com/tech-at-core/static-website-continuous-deployment-on-google-cloud-platform-6168c076e1e8?source=rss-53af6f89e32e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6168c076e1e8</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[continuous-deployment]]></category>
            <category><![CDATA[static-website-hosting]]></category>
            <category><![CDATA[cloud-build]]></category>
            <category><![CDATA[google-cloud-storage]]></category>
            <dc:creator><![CDATA[Jayasagar]]></dc:creator>
            <pubDate>Tue, 04 Jun 2019 20:30:44 GMT</pubDate>
            <atom:updated>2025-05-25T18:07:32.864Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-kJVPCDvPhSJcVzLNNteDg.jpeg" /><figcaption><a href="https://www.fpcomplete.com/blog/continuous-integration-delivery-best-practices">https://www.fpcomplete.com/blog/continuous-integration-delivery-best-practices</a></figcaption></figure><p>How to automate the deployment of static Gatsby website application on Google Cloud Platform? This was the question I asked myself when I finished <a href="https://jayasagar.dev/">my profile website</a> and ready to host. However, I could not find the solution to host it on GCP(Google Cloud Platform).</p><p>To host your static website, no doubt there are few options out there. Out of them, you could use, almost free and best solutions to name a few, AWS S3, Google Firebase, Google Cloud Storage or Netlify as the most popular solutions available.</p><p>Choose the right solution which fits based on your experience, in my opinion, it doesn&#39;t matter much what you choose, in the end, my goal was to have a solution with maximum control of the tools I use so that I know what is happening and how to tune them later.</p><h4>What I tried</h4><p>The end goal was, I want to build a PWA static web application using Gatsby. We could buy a simple template, change the content, and host it right? However, there is no originality and personal touch on this approach. Instead, I want to have a complete brand new design with my theme, styles and able to manage the end-to-end solution on my own!</p><blockquote>Tech stack: Gatsby, Emotion CSS, Cloudflare, Google Cloud Storage, and Google Cloud Build</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*KYEW1rJWhTmK1UAWeCNKCA.png" /><figcaption>Here is the quick overview of how Cloud Build triggers automatically build containers for any changes in a master branch.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*Dqt85JS96rkgeJGc2zpeFQ.png" /><figcaption>A Simple high-level communication flow.</figcaption></figure><h3>How to deploy</h3><p>I will assume, you already have a domain!</p><p>Now I will try to explain how to automate your website deployment!</p><h4>Change DNS server to Cloudflare</h4><p>I like the Cloudflare as offers the performance, security, and reliability. First thing, it comes with Edge Certificate, which enables us to have HTTPS communication between the browser and the DNS Server. Moreover, Cloudflare has a global delivery network, and with data centers hosted in 180 cities request serves from the nearest region where the user is located!</p><p>Refer here for how to switch to Custom Domain Server on <a href="https://support.google.com/domains/answer/3290309?hl=en&amp;ref_topic=9018335">Google Domains </a>and here on <a href="https://support.cloudflare.com/hc/en-us/articles/205195708-Changing-your-domain-nameservers-to-Cloudflare">Cloudflare to see the changes</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wMaHopI0z43ikDv_x2Wvzg.png" /></figure><p>Under the Crypto page, make sure you enable “Always Use HTTPS” and SSL communication is full</p><h4>Permanent redirect to HTTPS</h4><p>Create a Page Rule on the Cloudflare to make sure every possible URL on the domain should redirect to HTTPS!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fsIBKzA_3I-86PAzMeDiQg.png" /></figure><h4>Create a Google Cloud Storage with your domain name and add a Trigger to Google Cloud Build</h4><p>The complete detailed step by step guide is here <a href="https://cloud.google.com/community/tutorials/automated-publishing-cloud-build">https://cloud.google.com/community/tutorials/automated-publishing-cloud-build</a></p><p>In the end, it should look like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3cZZZXDNJVs5MltOhGAmgA.png" /><figcaption>Bucket name as Domain name</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AlXe53L5-K3T8_Baurv6VQ.png" /><figcaption>Code build pipeline trigger</figcaption></figure><h4>Continuous Deployment</h4><p>Finally, we would like to have a fully automated solution to deploy every change we do on code should deploy on Google Cloud Storage.</p><p>It is quite simple, Create a file `codebuild.yaml` and push to your repository.</p><p>Here is an example using yarn</p><pre>steps:</pre><pre>- name: &#39;gcr.io/cloud-builders/yarn&#39;</pre><pre>args: [&#39;install&#39;]</pre><pre>- name: &#39;gcr.io/cloud-builders/yarn&#39;</pre><pre>args: [&#39;build&#39;]</pre><pre>- name: gcr.io/cloud-builders/gsutil</pre><pre>args: [&quot;-m&quot;, &quot;rsync&quot;, &quot;-r&quot;, &quot;-c&quot;, &quot;-d&quot;, &quot;./public&quot;, &quot;gs://www.example.dev&quot;]</pre><p>If you use npm , replace it with right code-builders from google! You could find them</p><ul><li><a href="https://cloud.google.com/cloud-build/docs/cloud-builders">Cloud builders | Cloud Build | Google Cloud</a></li><li><a href="https://github.com/GoogleCloudPlatform/cloud-builders">GoogleCloudPlatform/cloud-builders</a></li></ul><p>And that is it; whenever you push the changes to your master branch, your changes should appear in minutes. It is quite simple to have a continuous deployment code pipeline for static websites!</p><p>You can see my profile at <a href="https://www.jayasagar.dev/">https://jayasagar.dev</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6168c076e1e8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tech-at-core/static-website-continuous-deployment-on-google-cloud-platform-6168c076e1e8">Static Website: Continuous Deployment on Google Cloud Platform</a> was originally published in <a href="https://medium.com/tech-at-core">tech.at.core</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Cross Validation Types]]></title>
            <link>https://medium.com/@jayasagar/introduction-to-cross-validation-types-84b0de838dd4?source=rss-53af6f89e32e------2</link>
            <guid isPermaLink="false">https://medium.com/p/84b0de838dd4</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Jayasagar]]></dc:creator>
            <pubDate>Mon, 20 May 2019 20:08:48 GMT</pubDate>
            <atom:updated>2019-05-20T20:26:00.860Z</atom:updated>
            <content:encoded><![CDATA[<p>Cross-validation is a technique to measure the performance of a particular model using various datasets. It helps to understand the error rate of the model built so that we can identify the <strong>best fit</strong> and not an <strong>overfit </strong>model.</p><p>Various techniques are <strong>Holdout method, K-Fold and Leave one out</strong></p><p>In general, the main purpose of this technique is to validate the model we built, how good it can perform!</p><p>In order to do that, original training dataset has to split into two subsets i.e. Training Subset(50–80% data) and Validation/Test Subset(20–50% data)</p><h3>How to Validate</h3><blockquote><em>Root Mean Square Error for Regression problems: Check for both training set and validation set</em></blockquote><blockquote><em>Accuracy for Classification problems</em></blockquote><h3>Hold Out Method</h3><p>In this technique, randomly split the training dataset into two subsets i.e. Training Subset(50–80% data) and Validation/Test Subset(20–50% data).</p><p>Test/Validation subset is called Hold out Sample to verify the model.</p><p>As it picks ‘data points’ randomly from the dataset, so one cannot rely on the result.</p><blockquote><strong><em>Note</em></strong><em>: If you split data again, no guarantee that result will look similar.</em></blockquote><h3>K-Fold</h3><p>Split the sample into K equal size subsets, where K is the number. The usual number would be between (5–10)</p><p>Example: Total data points = 120 K = 10</p><p>We create 10 subsets with 12 data points in each subset.</p><pre>kErrors = [];<br>for each subset from 10 subsets{<br>    current subset becomes the validation set and rest of the 9 subsets becomes the training set,  **and then calculate the error rate**</pre><pre>    kErrors.add(errorRate)<br>}</pre><p>Average Error rate/Prediction error = sum(kErrors)/K</p><p>Pros:</p><ul><li>No selection bias</li></ul><p>Reference to Python API: <a href="http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.KFold.html">sklearn.model_selection.KFold — scikit-learn 0.19.1 documentation</a></p><h3>Leave one Out</h3><p>It is a special case of K-Fold validation, where K = Total data points</p><p>Prediction error = Sum(errors)/K</p><p>Cons</p><ul><li>High computation time</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84b0de838dd4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Machine Learning prediction accuracy statistics summary]]></title>
            <link>https://medium.com/@jayasagar/machine-learning-prediction-accuracy-statistics-summary-9775735eeca7?source=rss-53af6f89e32e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9775735eeca7</guid>
            <category><![CDATA[predictions]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Jayasagar]]></dc:creator>
            <pubDate>Mon, 20 May 2019 20:06:28 GMT</pubDate>
            <atom:updated>2019-05-20T20:06:28.896Z</atom:updated>
            <content:encoded><![CDATA[<p>Part of the model accuracy testing step through test dataset, Classification accuracy, Confusion Matrix, and Classification Report provides the quite useful summary information to understand the accuracy of the model on the validation/test dataset.</p><h3>Classification accuracy</h3><p>It is the score tells the accuracy of the predictions on the model.</p><blockquote><em>Classification Accuracy = correct predictions / total predictions * 100</em></blockquote><blockquote><em>Error Rate = (1 — (correct predictions / total predictions)) * 100</em></blockquote><h4>Cons</h4><ul><li>The main problem with classification accuracy comes when we have 2 or more output/class categories. That means we do not know whether all classes are equally involved in prediction or not!! One class might be used more than other or vice versa.</li></ul><h3>Confusion Matrix</h3><p>Similar to classification accuracy, confusion matrix score tells the accuracy of the predictions on the model. However, it summarizes PER class/output i.e. it shows the count of valid and invalid prediction result by each class.</p><p>Let’s understand this through the iris dataset on (Decision Tree)CART model.</p><p>Refer here for Dataset information <a href="https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.names">https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.names</a></p><p>From the above link, you understand that data has 4 input attributes and 1 output attribute i.e. Attribute Information:</p><blockquote><em>sepal length in cm<br>sepal width in cm<br>petal length in cm<br>petal width in cm</em></blockquote><h4><em>classes:</em></h4><blockquote><em>Iris Setosa, Iris Versicolour and Iris Virginica</em></blockquote><p>You can see there are 3 class types (Iris Setosa, Iris Versicolour, Iris Virginica)</p><blockquote><em>There are 150 data points in the iris training dataset</em></blockquote><h4>Class Distribution</h4><p>Iris-setosa 50 Iris-versicolor 50 Iris-virginica 50</p><blockquote><em>Output Class Distribution: 33.3% for each of 3 classes.</em></blockquote><h4>Calculate Confusion Matrix</h4><p>The first thing we need to have a validation/test dataset to get the <strong>predictions</strong> so that we can build the confusion matrix accuracy summary!</p><p><strong>X_validation</strong> and <strong>Y_validation</strong> both have sample split of 20% from the original dataset i.e. 20% from 150 data points is 30 data points! Refer to this for information dataset loading and split logic.</p><pre>from sklearn.metrics import confusion_matrix<br>from sklearn.tree import DecisionTreeClassifier<br><br>cart <strong>=</strong> DecisionTreeClassifier()<br>cart<strong>.</strong>fit(X_train, Y_train) <em>#Input Sttribute dataset and Class dataset</em><br><br>predictions <strong>=</strong> cart<strong>.</strong>predict(X_validation)<br><br><strong>print</strong>(&#39;Y_validation&#39;, Y_validation)<br><strong>print</strong>(&#39;predictions&#39;, predictions)<br><strong>print</strong>(&#39;Confusion Matrix&#39;, confusion_matrix(Y_validation, predictions))</pre><p>In the above code, two array objects,</p><p><strong>Y_validation</strong> is the REAL predictions<br><strong>predictions</strong> are the prediction result from the model CART(DecisionTreeClassifier)</p><p>From the predictions produced by the model, <strong>confusion_matrix</strong> tries to calculate the valid and invalid prediction count for each class and especially invalid predictions organized by the class that was predicted.</p><h4>Output</h4><p><strong>Confusion Matrix</strong> [[13 0 0] [ 0 5 0] [ 0 1 11]] <br><strong>Y_validation</strong> [0 0 2 2 0 0 0 2 2 0 1 2 0 0 2 2 1 0 0 2 1 2 0 0 2 2 2 1 0 1] <br><strong>predictions</strong> [0 0 2 2 0 0 0 2 2 0 1 2 0 0 2 2 1 0 0 2 1 2 0 0 1 2 2 1 0 1]</p><p>What does that output mean? Actually, it is quite important summary on how prediction accuracy on each class! To make it clear, Let’s tranform it to more clear representation with class labels!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*6EfKRfzOb2qikcjKDszJKg.png" /></figure><blockquote><em>Each row of the matrix represents the predicted class.<br>Each column of the matrix represents the actual class.</em></blockquote><blockquote><em>From above matrix, we can identify </em><strong><em>one error</em></strong><em> in predictions i.e. in 3rd row, predicted class is </em><strong><em>Iris Virginica</em></strong><em> but correct class is </em><strong><em>Iris Versicolour</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9775735eeca7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>