<?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 Akash Lomas on Medium]]></title>
        <description><![CDATA[Stories by Akash Lomas on Medium]]></description>
        <link>https://medium.com/@akashlomas?source=rss-763dc423c140------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*l2ENnjCttSzgEpT8.</url>
            <title>Stories by Akash Lomas on Medium</title>
            <link>https://medium.com/@akashlomas?source=rss-763dc423c140------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 15:48:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akashlomas/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[How a 30B Model Fits on Your Laptop]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@akashlomas/how-a-30b-model-fits-on-your-laptop-b5ffa1ec4863?source=rss-763dc423c140------2"><img src="https://cdn-images-1.medium.com/max/1069/1*Ju-XbOxtEa-g9CXb6RpJPw.jpeg" width="1069"></a></p><p class="medium-feed-snippet">Big technology companies invest tens of billions of dollars building data centers filled with high-end GPUs to run large language models&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@akashlomas/how-a-30b-model-fits-on-your-laptop-b5ffa1ec4863?source=rss-763dc423c140------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@akashlomas/how-a-30b-model-fits-on-your-laptop-b5ffa1ec4863?source=rss-763dc423c140------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5ffa1ec4863</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Akash Lomas]]></dc:creator>
            <pubDate>Thu, 06 Aug 2026 07:00:29 GMT</pubDate>
            <atom:updated>2026-08-06T07:33:42.087Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[GraphQL Isn’t Dead Yet, AI Agents Revived It]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@akashlomas/graphql-isnt-dead-yet-ai-agents-revived-it-489e82326c23?source=rss-763dc423c140------2"><img src="https://cdn-images-1.medium.com/max/2600/1*0QDdeCo777kkTYFJyqUm7A.png" width="2816"></a></p><p class="medium-feed-snippet">Is GraphQL about to make a comeback because of AI?</p><p class="medium-feed-link"><a href="https://medium.com/@akashlomas/graphql-isnt-dead-yet-ai-agents-revived-it-489e82326c23?source=rss-763dc423c140------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@akashlomas/graphql-isnt-dead-yet-ai-agents-revived-it-489e82326c23?source=rss-763dc423c140------2</link>
            <guid isPermaLink="false">https://medium.com/p/489e82326c23</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Akash Lomas]]></dc:creator>
            <pubDate>Thu, 30 Jul 2026 13:22:45 GMT</pubDate>
            <atom:updated>2026-07-30T13:22:45.817Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[SDLC to ADLC]]></title>
            <link>https://medium.com/@akashlomas/sdlc-to-adlc-bb5d398f94b0?source=rss-763dc423c140------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb5d398f94b0</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Akash Lomas]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 04:57:11 GMT</pubDate>
            <atom:updated>2026-07-06T04:57:11.753Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HIDE4A12DL5m7li0dWu3mA.png" /><figcaption>SDLC to ADLC</figcaption></figure><p>Enterprise software development is undergoing a fundamental structural shift. For decades, the traditional Software Development Life Cycle (SDLC) relied on human engineers writing deterministic code. Today, code generation is increasingly shifted to autonomous AI agents.</p><p>According to the <em>McKinsey State of AI</em> report, <strong>78% of organizations</strong> have integrated AI into at least one business function. This operational shift is mirrored at the developer level; the <em>2026 Stack Overflow Developer Survey</em> indicates that <strong>84% of engineers</strong> now utilize or plan to deploy AI tools.</p><p>For initial baseline tasks, such as boilerplate code, standard API integrations, and basic scaffolding. The efficiency gains remain clear. GitHub data shows that developers complete these isolated tasks <strong>55% faster</strong> when utilizing basic AI coding assistants.</p><h3>The Pull Request Bottleneck</h3><p>The core complication stems from integrating high-velocity AI generation tools into legacy, human centric review workflows. This structural mismatch has shifted the engineering bottleneck from code production to code verification.</p><p>Data from software delivery platform LinearB reveals that while organizations face a <strong>2X or greater increase in pull request (PR) volume</strong>, net engineering productivity gains remain in the low double digits. Senior engineers now has to spend disproportionate time auditing vast volumes of AI generated code rather than designing system architecture.</p><p>Furthermore, standard AI tools frequently fail during the “last 40% ” of the development cycle, which includes complex system integration, scalability testing, and non-functional requirements.</p><p>Consequently, an Atlan study projects that <strong>over 40% of agentic AI initiatives will face cancellation by 2027</strong> due to context gaps and inadequate methodology. McKinsey data confirms these execution failures, tracing them directly to:</p><ul><li><strong>A lack of clear specifications:</strong> 61% of failed implementations</li><li><strong>Data quality issues:</strong> 55%</li><li><strong>An absence of governance frameworks:</strong> 48%</li></ul><h3>The Scaling Dilemma</h3><blockquote>How can enterprise engineering organizations transition from isolated, developer centric AI assistants to an operating model that scales autonomous execution without introducing architectural debt, overwhelming human reviewers, or incurring unsustainable inference costs?</blockquote><h3>Transitioning to the Agentic Development Life Cycle (ADLC)</h3><p>The industry’s emerging resolution is the <strong>Agentic Development Life Cycle (ADLC)</strong>, an architecture that replaces sequential human hand-offs with multi-agent AI networks operating across a continuous layer of shared context. This structural shift eliminates legacy queues that traditionally consume <strong>60 to 70% of a project’s calendar time</strong>.</p><h4>The Core Framework Shifts</h4><ul><li><strong>Role Reconfiguration:</strong> Engineers transition from line-by-line syntax writers to intent architects who define environmental boundaries, security constraints, and success criteria.</li><li><strong>Specification-Driven Engineering:</strong> Teams utilize frameworks like SPARC (Situation, Problem, Action, Result, Constraints). Because agents execute exactly what is specified, precision in the initial product requirement document dictates output quality.</li><li><strong>Distribution-Based Evaluation:</strong> Because agent outputs are probabilistic rather than deterministic, traditional binary pass/fail testing is replaced by automated evaluation harnesses that measure code quality consistency across thousands of parallel simulations.</li></ul><h4>Adoption Patterns and Market Realities</h4><p>The corporate landscape is currently divided between AI-native startups and legacy incumbents retrofitting their workflows. Gartner and McKinsey data indicates that early adopters are deploying parallel sub-agents to manage testing, build infrastructure, and automate canary deployments.</p><p>However, systemic execution remains rare. McKinsey notes that only <strong>6% of organizations</strong> qualify as AI “high performers” (deriving over 5% of EBIT from AI). These leaders are <strong>three times more likely</strong> to have fundamentally re-engineered their operational workflows rather than simply adding tools to legacy SDLC structures.</p><h3>The Operational Balance Sheet</h3><h4>The Targeted ROI</h4><ul><li><strong>Compressed Time-to-Market:</strong> ADLC delivery teams compress traditional 4-to-6-month MVP timelines down to <strong>6 to 8 weeks</strong>, representing a <strong>60% reduction</strong> in overall calendar time.</li><li><strong>Direct Cost Reduction:</strong> Full agentic integration lowers total project expenses by <strong>40 to 65</strong>% , driven by a <strong>75% reduction</strong> in manual coding time.</li><li><strong>Early Defect Prevention:</strong> Generating automated test scripts directly from the requirements stage makes defect remediation <strong>5X to 10X cheaper</strong> than fixing bugs during post-development QA.</li></ul><h4>The Accompanying Risks</h4><ul><li><strong>Novel Governance Hazards:</strong> McKinsey reports that <strong>12% of AI agent deployments</strong> introduce entirely new technical risks, including recursive execution loops, prompt injections, and authorization drift.</li><li><strong>Logic Inaccuracy:</strong> Code hallucinations remain a persistent factor, with <strong>33% of enterprise AI users</strong> experiencing logic errors that bypassed unguided agent systems.</li><li><strong>Escalating Inference Costs:</strong> Multi-agent cognitive loops significantly increase token consumption, risking budget overruns comparable to early cloud migration miscalculations.</li><li><strong>Regulatory Compliance:</strong> Under frameworks like the EU AI Act, companies must maintain a <strong>100% auditable trail</strong> of an agent’s reasoning steps, tool interactions, and data origins.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb5d398f94b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architectural Collapse: How Extension Poisoning, Node Vulnerabilities, and Infrastructure Fog…]]></title>
            <link>https://medium.com/@akashlomas/architectural-collapse-how-extension-poisoning-node-vulnerabilities-and-infrastructure-fog-a29f762f188f?source=rss-763dc423c140------2</link>
            <guid isPermaLink="false">https://medium.com/p/a29f762f188f</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[vscode]]></category>
            <dc:creator><![CDATA[Akash Lomas]]></dc:creator>
            <pubDate>Mon, 25 May 2026 07:38:52 GMT</pubDate>
            <atom:updated>2026-05-25T07:38:52.905Z</atom:updated>
            <content:encoded><![CDATA[<h3>Architectural Collapse: How Extension Poisoning, Node Vulnerabilities, and Infrastructure Fog Enabled the GitHub Repository Breach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GsWsDo1J4tjymtyVeEbdWw.png" /></figure><p>Enterprise perimeter defenses are fundamentally built on an obsolete assumption that, the developer’s workstation is a secure, trusted anchor point. The massive security breach executed by the threat group <strong>TeamPCP</strong>, resulting in the exfiltration of <strong>3,800 internal GitHub source code repositories</strong>, completely shattered this illusion.</p><p>This was not a standalone exploit. It was a multi-vector convergence where vulnerabilities in the Node/NPM ecosystem, the systemic ungoverned architecture of the Visual Studio Code Marketplace, and the tactical “fog of war” caused by a period of historic GitHub infrastructure instability came together to create the perfect attack.</p><h3>Phase 1: The Root Exploitation (Node/NPM and the TanStack Supply Chain Pivot)</h3><p>The kill chain did not begin at GitHub, it originated deep within the modern JavaScript developer tool-chain. TeamPCP executed a localized supply chain compromise targeting upstream open-source utilities, specifically targeting contributors to <strong>TanStack</strong> npm packages (a widely relied-upon suite for state management and routing).</p><blockquote>[TanStack NPM Compromise]</blockquote><blockquote>-&gt; [Stolen ‘gh’ CLI Tokens]</blockquote><blockquote>-&gt; [Nx Console Pipeline Hijack (No Multi-Admin Approval)]</blockquote><blockquote>-&gt; [Malicious Extension Version 18.95.0 Published]</blockquote><p>By injecting malicious code into these highly trusted downstream dependencies, the attackers performed targeted local credential harvesting. Their primary target was not production application code, but the development environments of the maintainers themselves.</p><p>The exploit successfully extracted long-lived GitHub CLI (`gh`) authentication tokens from a legitimate core developer who maintained both TanStack and the <strong>Nx Console</strong> ecosystem. Because these developer access tokens lacked granular scoping restrictions, they provided direct administrative write access to the main release pipelines of secondary repositories.</p><h3>Phase 2: VS Code Extension Poisoning (The Nx Console Triage (CVE-2026–48027))</h3><p>Armed with the stolen gh tokens, TeamPCP bypassed standard perimeter security by pivoting to the Visual Studio Marketplace. On May 18, version <strong>18.95.0</strong> of <strong>Nx Console</strong> (a heavily utilized Monorepo orchestration extension with over 2.2 million installs) was maliciously built and uploaded.</p><p>The deployment revealed two fatal flaws within modern developer workflows,</p><h4>1. The Single-Factor Release Pipeline</h4><p>The malicious version was uploaded directly to both the Visual Studio Marketplace and the open-source OpenVSX registry. Because the Nx Console publishing architecture lacked a “two-admin manual validation mandate” for automated releases, the publishing pipeline accepted the stolen developer token at face value without triggering a secondary verification gate.</p><h4>2. The “Silent Killer”: Marketplace Metrics vs. Background Sync</h4><p>Microsoft’s public marketplace logs initially registered a negligible <strong>28 manual downloads</strong> before the package was identified and yanked 18 minutes later. However, Nx’s internal telemetry revealed that <strong>~6,000 extension activation’s</strong> occurred simultaneously.</p><p>This massive discrepancy highlights the danger of <strong>VS Code’s background auto-update synchronization</strong>. Thousands of developer environments pulled down, unzipped, and executed the malicious version automatically while the developers’ IDEs were running in the background.</p><pre>// Example of the target parameters within compromised developer workspaces<br>{<br>  &quot;extensions.autoUpdate&quot;: true, <br>  // The default vulnerability exploited by TeamPCP<br>  &quot;terminal.integrated.profiles.osx&quot;: <br>    {<br>      &quot;malicious-hook&quot;: <br>        {<br>          &quot;path&quot;: &quot;/bin/bash&quot;,<br>          &quot;args&quot;: [&quot;-c&quot;, &quot;python3 ~/.local/share/kitty/cat.py &amp;&quot;]<br>        }<br>    }<br>}</pre><h4>The Node Execution Layer</h4><p>Upon extension activation, the poisoned payload immediately dropped an obfuscated Node.js post-install hook. Operating completely within user space to evade basic Endpoint Detection and Response (EDR) behavioral hooks, it set an environmental marker (`__DAEMONIZED=1`) and spawned a background Python process (`<a href="http://cat.py/">cat.py</a>`).</p><p>The malware systemically scanned local paths for,</p><p><strong>Infrastructure Configuration</strong>: Plaintext HashiCorp Vault tokens (`~/.vault-token`), local Kubernetes kubeconfig files, and AWS/Azure IAM metadata endpoint hashes.</p><p><strong>Ecosystem Identity</strong>: Plaintext .npmrc registry tokens and active GitHub tokens (`ghp_`, gho_, ghs_).</p><p><strong>Active Memory Subsystems</strong>: Contents of 1Password vaults via the op CLI by hijacking active, unlocked terminal sessions.</p><h3>Phase 3: The Climax (The Internal GitHub Breach)</h3><p>The payload achieved its ultimate goal when an internal GitHub software engineer, who utilized Nx Console for local workflow management, had their workstation pull down the background update.</p><p>The malware executed on the engineer’s local machine, scraped their active internal enterprise session tokens, and exfiltrated them to a remote command-and-control (C2) server. TeamPCP then used these highly privileged internal access credentials to bypass GitHub’s corporate identity perimeters entirely.</p><p>Because internal repository boundaries operate on flat network access structures once an authenticated developer endpoint is cleared, the threat actors systematically cloned and exfiltrated <strong>3,800 proprietary internal GitHub source code repositories</strong> before the endpoint could be isolated.</p><h3>Phase 4: The Tactical Fog of War (GitHub’s Infrastructure Instability)</h3><p>The velocity and stealth of this attack were significantly aided by an ongoing reliability crisis within GitHub’s core infrastructure. During the 12-month window surrounding the breach, GitHub recorded a massive spike in service degradation.</p><p><strong>Total Tracked Incidents</strong>: 257 distinct technical incidents.</p><p><strong>Major Outages</strong>: 48 major service shutdowns, totaling <strong>112 hours and 18 minutes</strong> of total downtime.</p><p><strong>Primary Failure Vector</strong>: GitHub Actions experienced 57 outages , three times the incidence rate of core Git storage operations.</p><p><strong>On October 29:</strong> Outage in compute dependency (Microsoft Azure). <br>90% error rate across Codespaces/ Actions affected Telemetry gaps, security monitoring systems failed to track cross-border API token replication.</p><p><strong>On February 2: </strong>Configuration failure in user settings caching, cascading failures in the Git HTTPS proxy affected High volume of synchronous cache writes generated a deluge of network errors, masking anomalous Git clone calls.</p><p><strong>On February 12:</strong> Authorization claim changes in core networking dependencies, 90% Codespace provisioning failure affected Security alerts failed to populate due to misclassified severity ratings, delaying incident detection by hours.</p><h4>The Alert Fatigue Vulnerability</h4><p>This constant infrastructural noise created an ideal tactical environment for the attackers. SecOps and DevSecOps teams were caught in a continuous state of <strong>alert fatigue</strong> dealing with broken GitHub Actions pipelines, Elasticsearch cluster degradation, and database timeouts.</p><p>When TeamPCP’s automated scripts began running rapid API queries and pulling massive volumes of repository data using the compromised engineer’s token, the unusual spikes in data transfer blended into the background noise of an infrastructure already struggling with systemic capacity and networking failures.</p><h3>Hard Takeaways: How Developers Must Harden Their Environments</h3><p>If your environment was active or using automated tools during this period, you must shift your development machine from an implied trust zone to a completely zero-trust environment.</p><h4>1. Kill IDE Auto-Updates Globally</h4><p>Never allow your IDE to pull un-vetted code in the background. Explicitly configure your editor to require manual permission before updating any third-party extension.</p><p>In VS Code’s global settings.json, enforce:</p><pre>&quot;extensions.autoUpdate&quot;: false,<br>&quot;extensions.autoCheckUpdates&quot;: false</pre><h4>2. Isolate Development Runtimes</h4><p>Stop running compilers, package managers, and complex IDE extensions directly on your bare-metal operating system.</p><p><em>Utilize isolated, ephemeral development environments (e.g., containerized </em>Dev containers or heavily scoped virtual environments) where local file-system access is completely decoupled from your master ~/.ssh/, ~/.aws/, or .npmrc configuration folders.</p><h4>3. Implement Strict Token Volatility</h4><p>Eliminate long-lived personal access tokens (`ghp_`). Switch entirely to fine-grained personal access tokens configured with strict, single-repository scope constraints and maximum 7-day expiration dates.</p><p><em>Explicitly configure your local password managers and authentication tools to require biological verification (e.g., TouchID/FaceID) or short timeout windows for </em>every individual call executed via the terminal command line (`op signin timeout`).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a29f762f188f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Moving Beyond MediatR: Implementing Cross-Cutting Concerns with Native .NET Dependency Injection]]></title>
            <link>https://medium.com/@akashlomas/moving-beyond-mediatr-implementing-cross-cutting-concerns-with-native-net-dependency-injection-0e7ad61abd16?source=rss-763dc423c140------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e7ad61abd16</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[software-design-patterns]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[dotnet]]></category>
            <dc:creator><![CDATA[Akash Lomas]]></dc:creator>
            <pubDate>Thu, 21 May 2026 14:05:01 GMT</pubDate>
            <atom:updated>2026-05-21T14:05:01.374Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lL3UDZI4rRJ14-CAJQUtEg.png" /></figure><p>For years, the MediatR package has been a default inclusion in almost every new .NET project template. It is frequently hailed as the gold standard for decoupling controllers or minimal APIs from business logic and implementing Clean Architecture or CQRS patterns.</p><p>However, as ASP.NET Core has matured, many of the architectural justifications for adding MediatR as a heavy third-party dependency have faded. If you are building standard CRUD or even moderately complex enterprise APIs, it might be time to ask yourself,</p><blockquote><strong>Why am I routing my HTTP requests through an abstract in-memory bus when native alternatives exist?</strong></blockquote><p>Let’s explore why MediatR might be an unnecessary abstraction in your codebase and how you can replace its most beloved feature <strong>Pipeline Behaviors </strong>using pure .NET Dependency Injection (DI) plumbing and the Decorator pattern.</p><h3>The Core Critique of MediatR</h3><p>While MediatR provides an elegant mechanism for decoupling, it introduces specific friction points into a code-base,</p><ul><li><strong>Obfuscated Control Flow:</strong> Because handlers are resolved dynamically, it is impossible to use standard “Go to Definition” (F12) in your IDE to trace execution directly from an endpoint to its handler. You are forced to search for the corresponding IRequestHandler type implementation.</li><li><strong>Debugging Overhead:</strong> Stepping through code becomes a tedious exercise of bypassing internal library code generator stacks instead of moving sequentially through your business logic.</li><li><strong>Unnecessary Architecture:</strong> In standard Web APIs, the mapping between an endpoint and its handler is almost always 1:1. Introducing a mediator pattern for a direct request-response cycle over complicates the system with minimal structural payback.</li></ul><p>If you are using Minimal APIs or standard Controllers, you already have powerful endpoint routing. So why use MediatR? The answer almost always boils down to one critical feature, <strong>Pipeline Behaviors</strong>.</p><h3>The “Killer Feature”: Cross-Cutting Concerns</h3><p>Developers love MediatR because it makes addressing cross-cutting concerns, such as centralized logging, validation pipelines (e.g., using FluentValidation), metrics collection, and OpenTelemetry tracking incredibly clean.</p><p>Instead of cluttering every single business handler with repetitive try-catch blocks or explicit validation calls, MediatR lets you define a generic middleware pipeline around your requests:</p><pre>// The classic MediatR approach<br>builder.Services.AddMediatR(cfg =&gt; {<br>    cfg.RegisterServicesFromAssembly(typeof(Program).Assembly);<br>    cfg.AddOpenBehavior(typeof(LoggingBehavior&lt;,&gt;));<br>    cfg.AddOpenBehavior(typeof(ValidationBehavior&lt;,&gt;));<br>});</pre><p>It is a fantastic architectural model, but <strong>you do not need a third-party package to achieve it.</strong> Modern .NET allows you to implement this exact pattern natively using compile-time type-safe decorators.</p><h3>The Native Alternative: DI-Based Decoration</h3><p>Instead of an abstract pipeline behavior model, we can leverage the <strong>Decorator Pattern</strong> natively supported by the Microsoft.Extensions.DependencyInjection container. This allows us to transparently wrap any standard interface registration with cross-cutting behaviors.</p><h3>1. Defining a Domain-Driven Request Handler Interface</h3><p>First, let’s establish our own lightweight, explicit handler contract. This preserves your CQRS separation without binding your domain to external packages.</p><pre>public interface IRequestHandler&lt;in TRequest, TResponse&gt;<br>{<br>    Task&lt;TResponse&gt; HandleAsync(TRequest request, CancellationToken cancellationToken = default);<br>}</pre><h3>2. Creating a Concrete Business Handler</h3><p>Your concrete query or command handlers remain pristine. They are entirely unaware of logging, telemetry, or validation logic, adhering perfectly to the Single Responsibility Principle.</p><pre>public record CreateProductCommand(string Name, decimal Price) : IRequest;<br><br>public class CreateProductHandler : IRequestHandler&lt;CreateProductCommand, Guid&gt;<br>{<br>    private readonly IProductRepository _repository;<br><br>    public CreateProductHandler(IProductRepository repository)<br>    {<br>        _repository = repository;<br>    }<br><br>    public async Task&lt;Guid&gt; HandleAsync<br>      (  CreateProductCommand request, <br>         CancellationToken cancellationToken = default)<br>    {<br>        var id = Guid.NewGuid();<br>        // Core business logic goes here...<br>        return id;<br>    }<br>}</pre><h3>3. Implementing the Cross-Cutting Decorator</h3><p>Now, let’s implement a generic decorator that intercepts the request execution. It implements the same interface but accepts the <em>inner</em> concrete handler as a dependency, wrapping it with infrastructure logic.</p><pre>public class LoggingHandlerDecorator&lt;TRequest, TResponse&gt; : IRequestHandler&lt;TRequest, TResponse&gt;<br>{<br>    private readonly IRequestHandler&lt;TRequest, TResponse&gt; _inner;<br>    private readonly ILogger&lt;LoggingHandlerDecorator&lt;TRequest, TResponse&gt;&gt; _logger;<br><br>    public LoggingHandlerDecorator(<br>        IRequestHandler&lt;TRequest, TResponse&gt; inner, <br>        ILogger&lt;LoggingHandlerDecorator&lt;TRequest, TResponse&gt;&gt; logger)<br>    {<br>        _inner = inner;<br>        _logger = logger;<br>    }<br><br>    public async Task&lt;TResponse&gt; HandleAsync<br>      (TRequest request, CancellationToken cancellationToken = default)<br>    {<br>        var requestName = typeof(TRequest).Name;<br>        _logger.LogInformation(&quot;Executing request: {RequestName}&quot;, requestName);<br><br>        try<br>        {<br>            var response = await _inner.HandleAsync(request, cancellationToken);<br>            _logger.LogInformation(&quot;Successfully executed request: {RequestName}&quot;, requestName);<br>            return response;<br>        }<br>        catch (Exception ex)<br>        {<br>            _logger.LogError(ex, &quot;Request failed: {RequestName}&quot;, requestName);<br>            throw;<br>        }<br>    }<br>}</pre><h3>Wiring It Together Natively in Program.cs</h3><p>To register these decorators without external help, we can write a clean extension method using the native DI container’s service factory capabilities. This gives us full architectural control over which handlers get decorated and in what order.</p><pre>public static class RequestHandlerRegistrationExtensions<br>{<br>    public static IServiceCollection AddDecoratedRequestHandler&lt;TRequest, TResponse, THandler&gt;(<br>        this IServiceCollection services) <br>        where THandler : class, IRequestHandler&lt;TRequest, TResponse&gt;<br>    {<br>        // 1. Register the concrete handler with its own concrete type<br>        services.AddTransient&lt;THandler&gt;();<br><br>        // 2. Register the interface using a factory method that constructs the decorator chain<br>        services.AddTransient&lt;IRequestHandler&lt;TRequest, TResponse&gt;&gt;(sp =&gt;<br>        {<br>            var concreteHandler = sp.GetRequiredService&lt;THandler&gt;();<br>            var logger = sp.GetRequiredService&lt;ILogger&lt;LoggingHandlerDecorator&lt;TRequest, TResponse&gt;&gt;&gt;();<br><br>            // Wrap the core handler with our logging decorator<br>            return new LoggingHandlerDecorator&lt;TRequest, TResponse&gt;(concreteHandler, logger);<br>        });<br><br>        return services;<br>    }<br>}</pre><blockquote><strong><em>Pro-Tip:</em></strong><em> If manual registration feels too verbose for thousands of handlers, you can use assembly scanning utilities like </em><strong><em>Scrutor</em></strong><em> to dynamically apply the </em><em>.Decorate() method across your entire service collection automatically.</em></blockquote><p>Your application endpoints remain perfectly clean, directly consuming the generic interface via native dependency injection:</p><pre>app.MapPost(&quot;/products&quot;, async (<br>    CreateProductCommand command, <br>    IRequestHandler&lt;CreateProductCommand, Guid&gt; handler) =&gt;<br>{<br>    var result = await handler.HandleAsync(command);<br>    return Results.Ok(result);<br>});</pre><h3>Architectural Advantages</h3><p>By shifting from an in-memory mediator library to native DI decoration, you unlock major engineering benefits:</p><ul><li><strong>No Black Boxes:</strong> Your execution pathway is clear. If you place a breakpoint inside your API endpoint and step into handler.HandleAsync(), you will sequentially enter the LoggingDecorator, step through any validation layers, and land cleanly inside your actual business logic handler.</li><li><strong>Zero Third-Party Vendor Lock-in:</strong> Your core business logic blocks do not depend on external packages. Upgrading your framework version will never be delayed due to a breaking change in an open-source messaging mediator.</li><li><strong>Granular Structural Control:</strong> Unlike globally forced middleware pipelines, you can explicitly choose which command or query handlers receive specific decorators. If a high-throughput endpoint requires raw performance without validation overhead, you can register it without its decorator wrap.</li></ul><h3>Summary</h3><p>MediatR has served the .NET community exceptionally well over the last decade. However, frameworks evolve. With modern ASP.NET Core DI plumbing, we can maintain clean separation of concerns, enforce CQRS principles, and leverage pipeline behaviors seamlessly using standard patterns built straight into the runtime.</p><p>Evaluate your current architecture.</p><blockquote>Is MediatR solving a foundational problem for you, or is it merely acting as boilerplate code that your native framework can already handle?</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e7ad61abd16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reduce Frontend Complexity in ASP.NET Razor Pages Using HTMX]]></title>
            <link>https://medium.com/@akashlomas/reduce-frontend-complexity-in-asp-net-razor-pages-using-htmx-b37d06c9a3b1?source=rss-763dc423c140------2</link>
            <guid isPermaLink="false">https://medium.com/p/b37d06c9a3b1</guid>
            <category><![CDATA[htmx]]></category>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Akash Lomas]]></dc:creator>
            <pubDate>Fri, 06 Mar 2026 11:08:42 GMT</pubDate>
            <atom:updated>2026-03-06T11:08:42.419Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oRBF1Js2ybFezmOdGNXRyQ.png" /><figcaption>htmx-vs-spa-vs-island-architecture</figcaption></figure><h3>Executive Summary</h3><p>Modern web development often defaults to heavy client-side frameworks (React/Angular) for CRUD applications, introducing significant architectural overhead and “dependency hell.” By integrating <strong>HTMX</strong> with <strong>ASP.NET Razor Pages</strong>, we shifted DOM rendering back to the server, utilizing HTML fragments instead of JSON APIs. This approach eliminated complex client-side state management, reduced custom JavaScript by approximately <strong>85%</strong>, and maintained a seamless, single-page application (SPA) feel with minimal infrastructure costs.</p><h3>The “Failure” of the Modern SPA Forest</h3><p>Engineers often find themselves trapped in a “forest” of NPM packages, Webpack configurations, and Vite build scripts just to render a simple list or validate a form field. In our initial architectural attempts, using a heavy SPA framework for a standard CRUD application manifested in:</p><ul><li><strong>Excessive Latency:</strong> p95 latency spikes during hydration and client-side rendering.</li><li><strong>Maintenance Debt:</strong> Frequent breakage in the node_modules tree and complex JSON-to-HTML mapping logic.</li><li><strong>Log Bloat:</strong> Metrics showed that 40% of client-side errors originated from state synchronization issues between the API and the frontend.</li></ul><p>We realized that for most data-driven applications, the complexity of a virtual DOM was a liability, not an asset.</p><h3>Structured Decision: Server-Driven Interactivity</h3><p>To solve the complexity crisis, we evaluated shifting back to a server-centric model while retaining modern UX.</p><ul><li><strong>Problem:</strong> Implementing “live” features (loaders, infinite scroll, real-time validation) without full page reloads.</li><li><strong>Constraints:</strong> High SEO requirements, limited frontend team bandwidth, and a strict .NET backend ecosystem.</li><li><strong>Decision:</strong> Adopt <strong>HTMX</strong> to extend HTML with declarative AJAX attributes.</li><li><strong>Trade-offs:</strong> We sacrificed the ability to perform complex offline-first state manipulation for a significantly simplified deployment pipeline and faster “Time to Interactive.”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvhv97csMIRNVz47b-eHPQ.png" /><figcaption>htmx-request-life-cycle</figcaption></figure><h3>Beyond the Hype: Tabular Comparison of Modern Frontend Architectures</h3><p>Choosing the right frontend strategy depends heavily on team composition, SEO requirements, and the nature of interactivity. Below is a structured comparison of the core approach discussed (HTMX + Razor) against traditional and modern alternatives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CzPkitj6KyG5Sokh6kvOtw.png" /></figure><h3>Implementing HTMX in the Razor Pages Lifecycle</h3><h4>How Do We Achieve SPA Behavior with hx-boost?</h4><p>The hx-boost attribute is the &quot;low-hanging fruit&quot; of HTMX. By adding hx-boost=&quot;true&quot; to a navigation container, HTMX intercepts all anchor tags. Instead of a full postback, it fetches the page via AJAX and swaps the &lt;body&gt; content. This preserves the browser history while eliminating the &quot;white flash&quot; of a reload.</p><h4>How Do We Handle Real-Time Server-Side Validation?</h4><p>Instead of duplicating validation logic in JavaScript and C#, we use the blur trigger to hit a Razor Page handler:</p><p>HTML</p><pre>&lt;input type=&quot;text&quot; <br>       name=&quot;slug&quot; <br>       hx-get=&quot;/Profile/Create?handler=CheckSlug&quot; <br>       hx-trigger=&quot;blur changed&quot; <br>       hx-target=&quot;#slug-validation&quot; /&gt;<br>&lt;span id=&quot;slug-validation&quot;&gt;&lt;/span&gt;</pre><h4>Insight Block: The Power of Partial Rendering</h4><blockquote><em>By returning </em><em>PartialView or </em><em>Partial from a Razor Page handler, the server sends only the necessary HTML fragment. This reduces the payload size from a full ~50KB page to a ~200B fragment, drastically improving p95 response times for interactive elements.</em></blockquote><h3>Technical Deep Dive: Out-of-Band (OOB) Swaps</h3><p>A common engineering challenge is updating multiple disconnected DOM elements simultaneously (e.g., adding an item to a list and updating a counter in the header). HTMX solves this with <strong>Out-of-Band Swaps</strong>.</p><p>When the server responds with a primary fragment, it can include additional fragments marked with hx-swap-oob=&quot;true&quot;. HTMX will automatically find the targets by ID and update them, regardless of where they are in the DOM hierarchy. This allows for complex UI synchronization without a centralized client-side state store like Redux.</p><h3>Technical FAQs</h3><p><strong>1. Why not just use Blazor for server-side interactivity?</strong></p><p>While Blazor is powerful, it requires a persistent SignalR connection (WebSockets), which can be resource-intensive for high-traffic sites. HTMX uses standard stateless HTTP requests, making it more resilient to flaky connections and easier to scale horizontally.</p><p><strong>2. How do you handle security and Anti-forgery tokens?</strong></p><p>ASP.NET Razor Pages requires an __RequestVerificationToken for POST requests. We handle this by adding a global HTMX configuration that includes the token in the X-XSRF-TOKEN header for every request initiated by HTMX.</p><p><strong>3. Is HTMX compatible with existing CSS frameworks like Bulma or Bootstrap?</strong></p><p>Yes. Since HTMX works by swapping standard HTML, it is completely agnostic of your styling. We successfully implemented loaders and modals using Bulma classes and HTMX’s hx-indicator attribute.</p><h3>Internal Alternatives Considered</h3><ul><li><strong>Full React Rewrite:</strong> Rejected due to integration risk and the need for a separate API layer.</li><li><strong>ASP.NET Update Panels (Legacy):</strong> Rejected due to the heavy ViewState payload and lack of modern browser support.</li><li><strong>Plain Vanilla JS (Fetch API):</strong> Rejected as it would require writing significant “glue code” for DOM manipulation and event handling.</li></ul><h3>Actionable Conclusion: Reusable Takeaways</h3><ul><li><strong>Start with </strong><strong>hx-boost:</strong> Immediately improve the &quot;feel&quot; of existing Razor Pages applications by eliminating full-page refreshes.</li><li><strong>Leverage Handlers:</strong> Use OnGet[HandlerName] in your PageModel to return partials for specific UI components.</li><li><strong>Quantify Your JavaScript:</strong> Before reaching for a framework, ask if the interaction can be described as a “Server-Side DOM Swap.” If yes, HTMX is the more efficient tool.</li></ul><p><strong>References:</strong></p><ul><li><a href="https://htmx.org/docs/">HTMX Official Documentation</a></li><li><a href="https://learn.microsoft.com/en-us/aspnet/core/razor-pages/">ASP.NET Core Razor Pages Handlers Documentation</a></li><li><a href="https://datatracker.ietf.org/doc/html/rfc7231">RFC 7231: Hypertext Transfer Protocol (HTTP/1.1)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b37d06c9a3b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Death of the Cache?]]></title>
            <link>https://medium.com/@akashlomas/the-death-of-the-cache-3bb7c1b1402b?source=rss-763dc423c140------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bb7c1b1402b</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[best-practices]]></category>
            <dc:creator><![CDATA[Akash Lomas]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 05:32:55 GMT</pubDate>
            <atom:updated>2026-02-23T05:32:55.928Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CV9XjAtTHlUMwfUpOD1OQw.png" /><figcaption>the-death-of-the-cache</figcaption></figure><p>For years, the “Standard Stack” was a law of nature, you have your relational database (PostgreSQL) for persistence, and you have your in-memory store (Redis) for performance. If you didn’t have a cache, your app was “slow.” If you didn’t have a task queue, your app was “broken.”</p><p><strong>PostgreSQL 18</strong>, released late 2025, has rendered these rules as obsolete.</p><p>This isn’t just an incremental update with a few new syntax sugarings. Version 18 introduces fundamental architectural shifts, specifically <strong>Native Asynchronous I/O (AIO)</strong> and <strong>UUIDv7 support. </strong>These changes bridge the gap between “slow” disk-based storage and “fast” in-memory caching.</p><h3>1. The Heavy Hitter: Native Asynchronous I/O (AIO)</h3><p>Historically, Postgres was synchronous. When a process needed data from the disk, it sat there and waited. This “I/O Wait” was the primary reason developers reached for Redis was to avoid hitting the disk at all costs.</p><p>PostgreSQL 18 introduces a complete <strong>AIO subsystem</strong>. By leveraging Linux io_uring or internal background workers, Postgres can now fire off dozens of I/O requests simultaneously without blocking.</p><blockquote><strong><em>Business Case:</em></strong><em> An e-commerce platform during Black Friday. Previously, a surge in “Read-Heavy” traffic (product listings) would saturate I/O threads, leading to 500ms+ latencies. With AIO, the database saturates the underlying hardware’s throughput instead of its own process limits, keeping latencies in the 5–10ms range under load.</em></blockquote><h3>2. No More “Cache Warming”, UUIDv7 and Index Skip Scans</h3><p>Two features in v18 work together to make the internal shared_buffers (Postgres&#39;s internal cache) exponentially more efficient,</p><ul><li><strong>Native UUIDv7:</strong> Unlike the random UUIDv4, UUIDv7 is <strong>time-ordered</strong>. This means new rows are written sequentially to the end of the B-tree index.</li><li><strong>The Result:</strong> Drastically reduced “page splits” and better data locality. Your “hot” data (recent records) is naturally packed together, making it 2–3x more likely to be in the internal RAM cache already.</li><li><strong>Index Skip Scans:</strong> You no longer need to create “perfect” composite indexes for every query variation. If you have an index on (org_id, status, created_at), Postgres 18 can now &quot;skip&quot; through it even if you only query by status.</li></ul><h3>3. Feature Breakdown: The “Before vs. After” Reality</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cf7-aP_q791Mrv_K0VomUw.png" /><figcaption>pg18-features</figcaption></figure><h3>4. The Cost-Benefit Analysis</h3><h4>Before PostgreSQL 18</h4><ul><li><strong>Infrastructure:</strong> $200/mo (Postgres) + $100/mo (Managed Redis) + $50/mo (Worker Nodes for Queue).</li><li><strong>Complexity:</strong> Managing cache invalidation logic (“The two hardest problems in CS”).</li><li><strong>Latency:</strong> 1ms (Cache Hit) / 50ms+ (Cache Miss/DB Hit).</li></ul><h4>With PostgreSQL 18</h4><ul><li><strong>Infrastructure:</strong> $250/mo (Slightly larger Postgres instance).</li><li><strong>Complexity:</strong> Single source of truth. ACID compliance for your “cache” and “queue” automatically.</li><li><strong>Latency:</strong> 2ms-8ms (Consistent DB performance via AIO).</li></ul><p><strong>Total Savings:</strong> ~25% in direct cloud costs and 100% reduction in “distributed system headache” hours.</p><h3>5. Pros and Cons: Is the Cache Really Dead?</h3><p><strong>The Pros:</strong></p><ul><li><strong>Simplicity:</strong> One connection string, one backup strategy, one security model.</li><li><strong>Consistency:</strong> No more “stale cache” bugs where the user sees old data.</li><li><strong>Performance:</strong> AIO brings Postgres performance so close to Redis for many workloads that the 1-2ms difference is negligible for 95% of apps.</li></ul><p><strong>The Cons:</strong></p><ul><li><strong>Extreme Scale:</strong> If you are doing 1M+ simple key-value look-ups per second, Redis is still the king of throughput.</li><li><strong>Memory Overhead:</strong> Turning Postgres into your “everything” store means you need to be generous with RAM for shared_buffers.</li></ul><h3>Final Verdict: The “Postgres-Only” Era</h3><p>PostgreSQL 18 is a declaration of independence from the “sidecar” database. For most technical teams in 2026, adding Redis is no longer a performance requirement , it’s a <strong>premature optimization</strong>.</p><p>By utilizing AIO and the new storage efficiencies, you can simplify your stack, lower your bill, and sleep better knowing your “cached” data is actually backed by ACID-compliant durability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bb7c1b1402b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Orchestrating Parallel AI Agents with Git Worktree]]></title>
            <link>https://medium.com/@akashlomas/orchestrating-parallel-ai-agents-with-git-worktree-d26e5b579712?source=rss-763dc423c140------2</link>
            <guid isPermaLink="false">https://medium.com/p/d26e5b579712</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[gitflow]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Akash Lomas]]></dc:creator>
            <pubDate>Wed, 21 Jan 2026 05:11:07 GMT</pubDate>
            <atom:updated>2026-01-21T05:11:07.525Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*Syidct78UXxi0zLKUqTztw.png" /><figcaption>gitflow</figcaption></figure><p>As we move deeper into the era of <strong>Agentic Development</strong>, our primary bottleneck has shifted. We are no longer limited by how fast we can type, but by how much context an AI agents like those powering <strong>Cursor’s Composer</strong> or <strong>Antigravity</strong> can juggle without losing the plot.</p><p>If you’ve ever felt the frustration of an AI agent “forgetting” its progress because you had to switch branches to fix a hotfix mid-stream, you have hit the “Context-Switch Tax.” The agent’s local file references change, the indexed codebase shifts, and its “train of thought” is broken. Returning later often requires a complete re-indexing or fresh prompts, wasting both tokens and time.</p><p>To scale agentic development, we need to stop treating our development environment as a single-threaded process. We need parallel realities. We need <strong>Git Worktree</strong>.</p><h3>The Solution</h3><p>git worktree is a native Git feature that allows you to have <strong>multiple branches checked out simultaneously in different physical directories</strong>, all linked to the same underlying .git repository history.</p><p>For agentic development, this is a superpower. It allows you to become an <strong>Orchestrator</strong>. You aren’t just coding; you are managing parallel streams of execution:</p><ol><li><strong>Folder A (Worktree 1):</strong> Agent “Alpha” building the new authentication API on feature-auth.</li><li><strong>Folder B (Worktree 2):</strong> Agent “Beta” refactoring the React frontend on feature-ui-refactor.</li><li><strong>Folder C (Main Repo):</strong> You, the human, reviewing PRs or fixing a critical bug on main.</li></ol><p>Each folder is physically separate. An npm install in Folder A does not affect Folder B. Most importantly, Cursor builds a unique, independent context index for each folder, ensuring Agent Alpha never hallucinates code based on what Agent Beta is doing.</p><h3>Step 1: Spinning Up Your “Agentic Lab”</h3><p>Instead of the standard git checkout -b, we use worktree add.</p><h3>The Architecture</h3><p>To avoid recursive indexing nightmares (where Cursor tries to index a worktree inside another worktree), maintain a clean root directory structure.</p><p><strong>Recommended Structure:</strong></p><pre>/development/<br>  ├── my-project-main/       (Your primary repo, usually checked out to main)<br>  ├── my-project-api-dev/    (Worktree for Agent 1)<br>  └── my-project-ui-dev/     (Worktree for Agent 2)</pre><h3>The Execution</h3><p>Let’s say you are in your main repo (my-project-main) and want to spin up an agent to work on a new API feature.</p><p>Run this command from your main terminal:</p><pre># Syntax: git worktree add &lt;path_to_new_folder&gt; &lt;new_branch_name&gt;<br>git worktree add ../my-project-api-dev feature/api-v2</pre><p>Git will create the directory ../my-project-api-dev, create the branch feature/api-v2, and check it out in that new folder.</p><p>You now open a <strong>new instance of Cursor</strong> pointing specifically at that new folder. The agent in that window is now hermetically sealed in its own context, free to generate code without interfering with your main branch or other agents.</p><h3>Step 2: The Exit Strategy (Merge and Cleanup)</h3><p>Moving from parallel development back into a single source of truth is the most critical phase. If you don’t handle the “cleanup” correctly, you risk leaving orphaned directories or losing the agent’s final refinements.</p><p>When your agent signals that the task is complete and tests are passing within its worktree, follow this three-step protocol: <strong>Sync, Merge, and Prune.</strong></p><h3>Step 3: Final Audit (Inside the Worktree)</h3><p>Before you even think about merging, perform a final human review <em>inside</em> the agent’s dedicated worktree directory.</p><ol><li><strong>Run Linting/Formatting:</strong> Ensure the agent didn’t introduce style inconsistencies.</li><li><strong>Verify Tests:</strong> Run the test suite specific to that worktree’s environment.</li><li><strong>Commit:</strong> Ensure all agentic changes are captured.</li></ol><pre># Inside the worktree directory (e.g., /development/my-project-api-dev)<br>git add .<br>git commit -m &quot;feat: agent completed api v2 endpoints&quot;</pre><h3>Step 4: The Merge (Return to Origin)</h3><p>Return to your <strong>Main Repo</strong> folder to handle the merge. It keeps your primary terminal context as the “Source of Truth.”</p><pre># Move back to your main development folder<br>cd ../my-project-main</pre><pre># Ensure main is up to date<br>git checkout main<br>git pull origin main</pre><pre># Merge the agent&#39;s branch<br>git merge feature/api-v2</pre><p><em>Tip: If conflicts arise, it is often easier to go back to the agent’s worktree, merge </em><em>main into it, and ask the agent (using Cursor&#39;s Composer) to resolve the conflicts there, rather than trying to fix them during the final merge.</em></p><h3>Step 5: The Cleanup (Crucial)</h3><p>This is where many developers make a mess of their .git folder.</p><p><strong>Do NOT simply </strong><strong>rm -rf the worktree directory.</strong></p><p>Git keeps administrative records of active worktrees hidden in your main .git/worktrees folder. If you delete the directory manually, Git will think the worktree is &quot;missing&quot; but still active, cluttering your repository metadata.</p><p>The Correct Way to Delete:</p><p>Run this command from your main repository:</p><p>Bash</p><pre># Syntax: git worktree remove &lt;path_to_the_worktree&gt;<br>git worktree remove ../my-project-api-dev</pre><p>This command performs a clean operation: it deletes the physical directory <em>and</em> removes the associated administrative data from the .git folder.</p><h3>Summary</h3><p>The “one repo, one window” mindset is a relic of manual coding. In the age of AI, your productivity is defined by how many parallel streams of precise execution you can manage simultaneously. Git Worktree is the essential infrastructure that makes that orchestration possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d26e5b579712" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Deep Dive into the Four Pillars of Observability]]></title>
            <link>https://medium.com/@akashlomas/a-deep-dive-into-the-four-pillars-of-observability-6524f9a1d83f?source=rss-763dc423c140------2</link>
            <guid isPermaLink="false">https://medium.com/p/6524f9a1d83f</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[observability]]></category>
            <category><![CDATA[systems-thinking]]></category>
            <dc:creator><![CDATA[Akash Lomas]]></dc:creator>
            <pubDate>Mon, 29 Dec 2025 07:06:06 GMT</pubDate>
            <atom:updated>2025-12-29T07:06:06.117Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sh5Oy3V83kxzv_G7xJyN3g.jpeg" /><figcaption>observability</figcaption></figure><p>It is a quiet Tuesday afternoon until the latency spikes begin. In the world of modern software engineering, we have moved far beyond the era of simple server monitoring. We no longer just “build and hope.” Instead, we strive for <strong>Continuous Reliability</strong>, a state where our systems are designed to be interrogated, understood, and improved in real-time. This is the essence of <strong>Observability</strong>.</p><p>To truly master a running system, we must look through four distinct lenses, often called the pillars of telemetry. Each provides a different chapter of the story, and together, they offer a level of visibility that transforms production from a “black box” into an open book.</p><h3>1. The First Lense, Logs</h3><p><strong>What are Logs</strong></p><p>Every request that hits your system begins its story with a log. A log is a discrete, timestamped record — a “journal entry” of a specific event. When a system fails, the log is often the first place an engineer looks to find the exact line of code that threw an exception or the specific user ID that triggered a 500 error.</p><p>While the benefit of logging is its absolute precision and non-repudiable audit trail, it comes with significant risk. In high-traffic environments, logging everything at a “debug” level creates a “data tax” that can crash storage backends and bloat cloud bills. If not managed properly, logs can also become a liability by accidentally leaking personally identifiable information (PII) into unencrypted storage.</p><p><strong>How it’s done</strong></p><p>Applications emit strings of text to stdout or files. A logging agent then “tails” these sources, processes them, and ships them to a centralized storage/ database.</p><p><strong>The Benefits</strong></p><ul><li><strong>Precision:</strong> Logs tell you exactly which user ID failed and which exception was thrown.</li><li><strong>Auditability:</strong> Essential for security forensics and compliance.</li></ul><p><strong>Cloud-Native Implementations</strong></p><ul><li><strong>AWS CloudWatch Logs:</strong> The default for almost all AWS services. It offers <strong>CloudWatch Logs Insights</strong>, a powerful query engine that allows you to perform complex searches across log groups without managing a database.</li><li><strong>Azure Monitor Logs (Log Analytics):</strong> Based on the Kusto Query Language (KQL), it centralizes logs from VMs, Kubernetes (AKS), and Azure Functions. It integrates natively with <strong>Microsoft Sentinel</strong> for security.</li></ul><p><strong>Other Tools</strong></p><ul><li><strong>Grafana Loki:</strong> High-efficiency, metadata-only indexing.</li><li><strong>Elasticsearch (ELK):</strong> Powerful full-text search for complex audits.</li><li><strong>Vector / Fluent Bit:</strong> High-performance routing and transformation agents.</li></ul><h3>2. The Second Lens, Metrics (The Pulse of the Infrastructure)</h3><p><strong>What it means</strong></p><p>While logs tell the story of a single request, metrics describe the health of the entire population. Metrics are the pulse, the numerical heartbeat of your infrastructure measured over time. They tell us about the 99th percentile latency, the error rates, and the saturation of our CPU.</p><p>The beauty of metrics lies in their low overhead; numbers are incredibly cheap to store compared to text. This allows us to trigger automated alerts long before a human notices a problem. However, the risk here is “Cardinality Explosion.” If an engineer incorrectly tags a metric with a unique ID for every user, the underlying time-series database can collapse under the sheer volume of unique data streams.</p><p><strong>How it’s done</strong></p><p>Systems expose a /metrics endpoint that a collector “scrapes” periodically, or the app “pushes” data points to a time-series database (TSDB).</p><p><strong>The Benefits</strong></p><ul><li><strong>Low Overhead:</strong> Numbers are cheap to store and fast to query.</li><li><strong>Alerting:</strong> Metrics are the primary source for triggering on-call alerts.</li></ul><p><strong>Cloud-Native Implementations</strong></p><ul><li><strong>Amazon Managed Service for Prometheus (AMP):</strong> A fully managed, Prometheus-compatible monitoring service that scales automatically.</li><li><strong>AWS CloudWatch Metrics:</strong> Provides standard metrics (CPU, Disk, Network) for every AWS resource by default.</li><li><strong>Azure Monitor Metrics:</strong> Offers near real-time alerting and works seamlessly with <strong>Azure Autoscale</strong> to trigger resource changes based on demand.</li></ul><p><strong>Other Tools</strong></p><ul><li><strong>Prometheus:</strong> The standard for scraping and alerting.</li><li><strong>Grafana Mimir:</strong> Long-term, multi-tenant storage for Prometheus.</li><li><strong>VictoriaMetrics:</strong> Extreme performance for massive-scale time-series data.</li></ul><h3>3. The Third Lens, Tracing (The Request Journey)</h3><p><strong>What it means</strong></p><p>As our architectures transitioned from monoliths to microservices, we lost the ability to see how a single request travels. A user might experience a three-second delay, but which of the twenty downstream services is to blame? Distributed Tracing solves this by following a transaction’s journey, linking together “spans” of time spent in the frontend, various backends, and databases.</p><p>The implementation of tracing requires a “Trace ID” to be passed like a baton between services. The risk is that if one service in the chain is not “instrumented,” the baton is dropped, and the trace becomes a broken, useless fragment. To mitigate this, the industry has rallied around <strong>OpenTelemetry (OTel)</strong>, a vendor-neutral standard that ensures your tracing logic isn’t locked into a single provider</p><p><strong>How it’s done</strong></p><p>A unique “Trace ID” is injected into the header of a request. Every service it touches records its start and end time, passing the ID to the next hop.</p><p><strong>The Benefits</strong></p><ul><li><strong>Bottleneck Identification:</strong> Instantly see which microservice is causing the delay.</li><li><strong>Dependency Mapping:</strong> Automatically visualize how your services interact.</li></ul><p><strong>Cloud-Native Implementations</strong></p><ul><li><strong>AWS X-Ray:</strong> Specifically designed to trace requests through API Gateway, Lambda, SQS, and DynamoDB. It provides a “Service Map” to visualize hotspots.</li><li><strong>AWS Managed Service for OpenTelemetry (ADOT):</strong> A secure, AWS-supported distribution of the OTel project to send traces to X-Ray or other backends.</li><li><strong>Azure Application Insights:</strong> A feature of Azure Monitor that provides end-to-end distributed tracing and “Application Maps.” It is particularly strong for .NET and Java environments.</li></ul><p><strong>Other Tools</strong></p><ul><li><strong>Grafana Tempo:</strong> Scalable trace storage that integrates with logs/metrics.</li><li><strong>Jaeger:</strong> The CNCF-graduated UI for visualizing trace spans.</li></ul><h3>4. The Fourth Lens, Profiling</h3><p><strong>What it means</strong></p><p>Even with logs, metrics, and traces, we might still be blind to why a service is inefficient. We know the CPU is high, but we don’t know why. This is where Continuous Profiling enters — the code surgeon that measures resource consumption at the function-call level, 24/7.</p><p><strong>How it’s done</strong></p><p>An agent periodically “interrupts” the CPU to see which function is currently executing, building a statistical map of resource usage.</p><p><strong>The Benefits</strong></p><ul><li><strong>Cost Savings:</strong> Pinpoint the exact line of code to optimize, potentially reducing cloud bills.</li><li><strong>Heisenbug Hunting:</strong> Find intermittent performance issues that don’t show up in metrics.</li></ul><p><strong>Cloud-Native Implementations</strong></p><ul><li><strong>Amazon CodeGuru Profiler:</strong> Uses machine learning to identify the “most expensive” lines of code in your Java or Python applications and provides recommendations on how to fix them.</li><li><strong>Azure Monitor Application Insights Profiler:</strong> Automatically captures profiles for .NET applications running in App Service, Functions, or Cloud Services when the system is under stress.</li></ul><p><strong>Other Tools</strong></p><ul><li><strong>Grafana Pyroscope:</strong> Aggregates profiles into searchable Flame Graphs.</li><li><strong>Parca:</strong> eBPF-based, zero-instrumentation profiling.</li></ul><h3>Observability Decision Matrix</h3><p>The following table shows the decision matrix of which lens is instrumental in solving specific problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*XJfP4BpTx26A3a67g_gLCQ.png" /><figcaption>observability decision matrix</figcaption></figure><h3>Implementation Strategy (The Toolchain Plumbing)</h3><p>To make these pillars actionable, you need a “plumbing” layer to move data:</p><ol><li><strong>Instrumentation:</strong> Use <strong>OpenTelemetry</strong> or cloud-native SDKs (ADOT).</li><li><strong>Collection:</strong> <strong>Grafana Alloy</strong> or the <strong>OpenTelemetry Collector</strong> acts as your central nervous system.</li><li><strong>Auto-Visibility:</strong> Use <strong>Grafana Beyla</strong> (eBPF) for instant visibility on legacy systems.</li><li><strong>Action &amp; ROI:</strong> Connect everything to <strong>Grafana OnCall</strong>. When a metric fails, the alert includes a link to the relevant Trace, which leads to the specific Log, which points to the Profile.</li></ol><h3>The ROI (Return on Investment)</h3><p>By leveraging managed services like <strong>AWS AMP</strong> or <strong>Azure Log Analytics</strong>, teams reduce “Operational Overhead.” You no longer spend time patching the observability database; you spend time fixing the application. This efficiency reduces <strong>MTTR (Mean Time to Recovery)</strong> and optimizes infrastructure spend through code-level visibility.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6524f9a1d83f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From 1.2 GB to 10 MB: Docker Best Practices]]></title>
            <link>https://medium.com/@akashlomas/from-1-2-gb-to-10-mb-docker-best-practices-9bf1cc0de8ca?source=rss-763dc423c140------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bf1cc0de8ca</guid>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[cost-optimization]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[best-practices]]></category>
            <dc:creator><![CDATA[Akash Lomas]]></dc:creator>
            <pubDate>Tue, 09 Dec 2025 03:51:02 GMT</pubDate>
            <atom:updated>2025-12-09T03:51:02.673Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Choose the Ultimate Base: Scratch and Distroless</h3><p>The original tutorial showed you the power of Alpine, but to hit that 10 MB target, we need to go even smaller in the final, production stage.</p><h4>Scratch: The Zero-Byte Base</h4><p>The scratch image is the smallest possible base—it&#39;s empty. It contains <strong>no operating system, no shell, and no package manager</strong>. It’s perfect for self-contained, statically compiled applications (like those written in Go, Rust, or C). You copy only the final application binary into it.</p><p><strong>Example Code (Go Application using Scratch):</strong></p><p>Dockerfile</p><pre># --- Stage 1: The Builder (Uses full Go image for compilation) ---<br>FROM golang:1.21 AS builder<br>WORKDIR /app</pre><pre># Ensure the binary is statically compiled for &#39;scratch&#39;<br>RUN CGO_ENABLED=0 go build -o /app/my_app .</pre><pre># --- Stage 2: The Final Image (Uses the absolute minimum) ---<br>FROM scratch<br>COPY --from=builder /app/my_app /usr/bin/my_app<br>ENTRYPOINT [&quot;/usr/bin/my_app&quot;]</pre><h4>Distroless: Bare Runtime Essentials</h4><p>If your application needs a runtime (like Java or Node.js) or standard C libraries, <strong>Distroless</strong> images are the next best thing. They contain <em>only</em> the application’s runtime dependencies, eliminating the shell and common Linux utilities that an attacker could use. They offer better security than Alpine with minimal size overhead.</p><h3>2. 🧹 Master Layer Squashing and Cleanup</h3><p>You know that deleting a file in a new layer doesn’t remove it from the previous immutable layer — it just hides it. This is a common source of image bloat! The solution is to use the &amp;&amp; operator to chain commands together and ensure all cleanup happens in the same layer where the installation occurred.</p><h4>Clean Up Package Manager Cache</h4><p>After installing dependencies with tools like apt, apk, or yum, always clean their cache immediately.</p><p><strong>Example Code (Cleaning up APT cache):</strong></p><p>Dockerfile</p><pre># Install dependencies AND clean cache in a single layer<br>RUN apt-get update \<br>    &amp;&amp; apt-get install -y --no-install-recommends my-package build-essential \<br>    # The crucial step to keep the layer small:<br>    &amp;&amp; apt-get autoremove -y \<br>    &amp;&amp; apt-get clean \<br>    &amp;&amp; rm -rf /var/lib/apt/lists/*</pre><h4>Optimize .dockerignore Strategically</h4><p>Your .dockerignore file prevents unnecessary files from even entering the build context (Layer 0). Beyond node_modules and .git, ensure you exclude:</p><ul><li>Local IDE files (.vscode, .idea)</li><li>Temporary artifacts (.tmp, logs)</li><li>Configuration files that belong in secrets (.env, config/*.yaml)</li></ul><h3>3. 🛡️ Hardening Your Image: Security First</h3><p>Size is great, but security is non-negotiable. These steps minimize your container’s attack surface, making it significantly harder for an intruder to exploit.</p><h4>Run as a Non-Root User</h4><p>Running your container as <strong>root</strong> is a huge security risk. If the container is compromised, the attacker has root privileges inside the container, which, depending on your setup, can lead to serious system access. Always create and switch to a dedicated, non-root user.</p><p><strong>Example Code (Switching to Non-Root User):</strong></p><p>Dockerfile</p><pre># Install and setup steps require root<br>FROM node:20.10.0-slim AS base<br>WORKDIR /app</pre><pre># Step 1: Create a dedicated, non-root user<br># --disabled-password prevents login, --gecos &quot;&quot; skips info setup<br>RUN adduser --disabled-password --gecos &quot;&quot; appuser</pre><pre># Step 2: Switch to the non-root user for all subsequent commands<br>USER appuser</pre><h4>Pin Dependency Versions</h4><p>Using generic tags like FROM node:latest means your image&#39;s base could change tomorrow, potentially introducing a vulnerability or a breaking change. Always use a specific version tag. For maximum security and reproducibility, use a <strong>digest (SHA256 hash)</strong>.</p><p><strong>Best Practice (Using a specific version and digest):</strong></p><p>Dockerfile</p><pre>FROM node:20.10.0-slim@sha256:d8ff551f33f8d38e...</pre><h4>Use BuildKit Secrets (Do NOT Use ARGs for Secrets!)</h4><p>If your build needs a secret (like a private NPM key or a Git token), <strong>never</strong> pass it using ARG or embed it in a layer, as it will be discoverable. Use Docker&#39;s <strong>BuildKit secrets feature</strong> to access secrets only during the RUN command, ensuring they are never recorded in the final image.</p><p><strong>Example Code (Using Secrets for an </strong><strong>npm install):</strong></p><p>Dockerfile</p><pre># Build command setup: docker build --secret id=npm,src=~/.npmrc .</pre><pre># This command requires BuildKit to be enabled<br>FROM node:20.10.0-slim<br>WORKDIR /app</pre><pre># The secret is mounted to /run/secrets/npm, used by npm install, and then vanishes.<br>RUN --mount=type=secret,id=npm npm install</pre><h3>🛠️ Optimization Tools You Must Use</h3><p>Complex Dockerfiles are hard to maintain. Use these tools to inspect and streamline your work:</p><ul><li><strong>Dive</strong>: An image explorer that lets you visually inspect every single layer and what files were added or removed. This is your go-to tool for finding hidden bloat from messy cache or intermediate files.</li><li><strong>Slim.AI</strong>: This platform can automatically analyze your running container and rebuild a minimal, secure, production-ready version, often eliminating dozens of unnecessary packages and files that were missed during the multi-stage build process. It can help you achieve the final <strong>10 MB</strong> goal with minimal manual effort.</li></ul><p><strong>By combining aggressive base image selection, single-layer cleanup, and robust security measures, you will consistently build tiny, secure, and fast-deploying Docker images!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bf1cc0de8ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>