Thursday, August 20, 2026

Generative and Agentic AI now introduces two more debts : Comprehension (or Cognitive) Debt and Intent Debt

Comprehension Debt, Intent Debt, and Cognitive Surrender

Comprehension debt, intent debt, and cognitive surrender are three closely linked concepts in software engineering. They define how the widespread use of generative AI and agentic coding tools changes software risk from being a problem with the code to being a problem with human understanding.

Popularised by software leaders like Addy Osmani and researchers like Margaret-Anne Storey in the Triple Debt Model, these terms describe what happens when AI-generated code moves faster than human oversight.


🧠 1. Cognitive Surrender: The Behavioral Trigger

Cognitive surrender is the human action—or lack of action—that starts the cycle. It is the mental posture where a developer stops critically evaluating or constructing solutions from scratch, choosing instead to blindly trust the AI's output.

The Mechanism: Instead of reasoning through a bug or an architecture layout, a developer lets an AI tool generate the code and immediately merges it because "the tests passed."

Examples: Approving a 600-line Pull Request without checking the logic, or asking an agent to patch a complex stack trace without knowing why it failed in the first place.

The Danger: You take on the AI’s high confidence without doing any of the underlying critical thinking.

📉 2. Comprehension Debt: The Mental Bill

Comprehension debt (frequently called cognitive debt) is the hidden tax you pay for cognitive surrender. It is the widening gap between how much code is running in a system and how much of it any human actually understands.

The Paradox: Traditional technical debt shows up as brittle code and slow tests. Comprehension debt is insidious because your codebase looks perfectly clean, and your velocity charts look immaculate—right up until something breaks and no one on the team can read the stack trace.

The Reality: Making code cheap to generate does not make understanding it cheap to skip.

The Cost: When teams drop deep into AI generation, their ability to reason, debug, and reconstruct their own work from first principles drops significantly.

🎯 3. Intent Debt: The Missing "Why"

Intent debt is the absence of documented reasons, constraints, and business goals that explain why the software was built a certain way. It is the most dangerous debt because it is the one type of debt that an AI agent cannot pay down for you.

The Reality: An AI assistant can easily refactor messy code (fixing technical debt) or read a block of code and explain it back to you (repaying comprehension debt). But an AI cannot guess why a previous developer chose a specific database structure or a 300ms delay. It will simply make up a confident, plausible-sounding guess.

The Impact: When developers write code manually, intent is recorded in documentation, PR reviews, and commit messages. When ephemeral AI prompts generate code, that context evaporates. Without externalised intent, future AI agents or engineers will make code changes that break broader system logic.

Summary of the Triple Debt Model

Debt Type Where It Lives What It Restricts Can AI Fix It?
Technical Debt In the code How easily systems can change Yes. AI can refactor bad patterns quickly.
Cognitive / Comprehension Debt In the people How easily teams can reason about systems Partially. AI can explain code to rebuild your mental model.
Intent Debt In the artifacts / docs Knowing what the system was built for No. Only humans can provide original intent.

Loop Engineering

1. Loop Engineering vs. Prompt Engineering

The shift from prompt engineering to loop engineering represents a move from static instruction to autonomous systems.

Feature Prompt Engineering Loop Engineering
Human Role Writes and refines prompts manually for every turn. Sets the final goal and creates the automated environment.
System Flow Linear: Input → Output. Cyclical: Plan → Act → Verify → Iterate.
Error Handling Human must notice errors and prompt the AI to fix them. System feeds compiler errors/test failures directly back to the AI.
Scalability Low: Bottlenecked by human typing and oversight. High: Can run hundreds of iterations independently in minutes.

2. Guardrails and Stop Rules

Because loops run automatically, they require strict operational boundaries to prevent runaway processing, high API costs, and unintended system modifications.

  • Iteration limits: Hard caps on the number of attempts (e.g., maximum 5 or 10 loops) to solve a specific problem.
  • Token and cost ceilings: Budget controls that automatically terminate the loop if it exceeds a specified dollar amount or token count.
  • Independent verification: Never letting the agent decide on its own if it has finished. A deterministic "judge" (like a test runner or a rigid string matcher) must confirm success.
  • Human-in-the-loop (HITL): A safety trigger that pauses the loop and requests human approval if the agent attempts high-risk actions, like deleting data or deploying code to production.

3. Practical Tools and Protocols

Building loop engineering workflows relies on open frameworks that give AI agents structured ways to talk to computers and external data.

  • Model Context Protocol (MCP): An open standard created by Anthropic that provides a uniform way for developers to securely expose data sources and local tools to AI models.
  • LangGraph & AutoGen: Frameworks designed specifically for stateful, multi-agent systems where agents can hand tasks off to one another inside structured loops.
  • Code Sandboxes: Isolated execution environments (like Docker containers or E2B) where the agent can run code, view terminal errors, and iterate safely without harming the host system.

Real-World Applications of Loop Engineering

The primary real-world sectors and specific workflows actively utilizing loop engineering include:

1. Autonomous Software Engineering & CI/CD

This is the most mature application of loop engineering. Instead of developers using basic chat interfaces, engineering loops are embedded directly into development environments and deployment pipelines. 

Autonomous Bug Fixing: Production CLI tools like Claude Code and IBM Bob use a /goal command. An engineer inputs a goal (e.g., "Fix the broken checkout button"), and the loop reads the code, attempts a fix, triggers a local test suite, reads the compiler errors, and rewrites the code until the tests pass. 

Pre-commit Quality and Security Audits: Organizations use loop frameworks to evaluate newly written code before it is merged. One agent writes a feature, a separate "verifier" agent performs a mock security or performance audit, and if vulnerabilities are found, the code is passed back to the generator agent to fix automatically. 

2. DevOps & Infrastructure Monitoring

Rather than waiting for a human operator to log into a server during an outage, loop engineering structures are applied to system reliability. 

Self-Healing Servers: A monitoring alert (like an AWS CloudWatch error or a server crash log) acts as a webhook trigger to wake up an agent loop. The agent investigates the server logs, devises a safe remediation script, executes it in a test sandbox, verifies the patch works, and applies it to the active container—stopping only when the system health checks report normal status. 

3. High-Scale Content Generation & Editorial Review

In enterprise marketing and content generation, relying on a single prompt often yields generic, unvetted results. 

Multi-Agent Editorial Teams: Modern content pipelines run as automated multi-agent loops. For instance, a research agent gathers data, a drafting agent generates an article, and a strict compliance/editorial agent grades the text against specific criteria (SEO guidelines, brand guidelines, factual checks). If the draft fails any metric, it is kicked back with notes for an iterative rewrite. 

4. Continuous Competitive Intelligence & Market Research

Static scraping scripts break frequently and require constant maintenance. Loop engineering solves this by dynamically adapting to web changes. 

Deep Exploratory Harvesting: A business defines a goal (e.g., "Map out all pricing variations for software X"). The agent explores a target site, notices a wall or an unfamiliar UI, dynamically alters its search strategy, runs an internal evaluation to check if it gathered the correct data points, and pivots its browsing behavior autonomously until the specific quantitative criteria are fulfilled. 

5. Automated Data Cleaning & Financial Reconciliation

Discrepancy Resolution: Accounting and operations teams use loops to match complex ledgers. When an automated system flags a billing discrepancy, the loop takes over to query internal transaction histories, test potential accounting adjustments, run mock balance sheets, and iterate through solutions until the accounts reconcile smoothly.

LLM Post-Training & RLHF Ecosystem

The Reinforcement Learning (RL) landscape is split into two major ecosystems: Classical/Traditional RL (used for robotics, games, and continuous control) and LLM Post-Training / RLHF (used for aligning and training reasoning models like O1 or DeepSeek with GRPO). 

Here is a comprehensive list of the major open-source RL frameworks grouped by their design intent:

1. LLM Post-Training & RLHF Ecosystem

These frameworks are highly optimized for distributed cluster training, decoupling fast token generation (rollouts) from model optimization.

  • Verl (VeRL): A high-performance, flexible RL stack by ByteDance optimizing model placement and prefix-caching.
  • TRL (Transformer Reinforcement Learning): Hugging Face’s popular library supporting SFT, DPO, PPO, and GRPO. Frequently paired with Unsloth RL for memory optimization.
  • OpenRLHF: An early, widely adopted distributed framework supporting Ray, Megatron-LM, and DeepSpeed.
  • AReaL: An asynchronous framework explicitly designed to scale up hardware throughput by splitting actor and learner resources.
  • Slime: An SGLang-native RL framework integrating SGLang inference with Megatron training.
  • NeMo-RL / NeMo Aligner: NVIDIA's massive-scale alignment framework tailored for NeMo-based LLMs.
  • ROLL: Alibaba’s framework focusing on multi-turn agentic conversations and complex reasoning paths.
  • RAGEN: An extension framework built on top of Verl, specifically targeted at agentic training and multi-turn environments. 

2. General-Purpose & Scalable Production Deep RL

Built to handle traditional deep learning architectures for high-throughput and enterprise deployment.

  • Ray RLlib: The dominant framework for distributed computing, natively handling multi-agent workflows and fault-tolerant scaling.
  • Stable-Baselines3 (SB3): The gold standard for PyTorch-based implementations, known for its reliable, plug-and-play code structure.
  • Tianshou: A highly parallelized, modular PyTorch library that stands out for its high performance and native multi-agent support.
  • CleanRL: A lightweight library specializing in single-file implementations of algorithms, making it perfect for rapid prototyping and educational tweaks.
  • TorchRL: PyTorch's official modular foundation library that serves as the base for building low-level custom RL components. 

3. Big Tech Research Frameworks

Frameworks released by core research labs to publish and validate new theoretical algorithms.

  • Acme: DeepMind's flagship library structured around building actor-critic architectures and testing across environments.
  • TF-Agents: Google's structured library designed exclusively for native TensorFlow model integration.
  • Dopamine: Google’s minimalist research framework designed primarily for fast prototyping in Atari-like environments.
  • ReAgent: Meta’s discrete and continuous control platform tailored specifically for real-world production decision systems. 

4. Environments & Toolkits (The Ecosystem Glue)

While not training engines themselves, these provide standard interfaces or simulations required to run any RL algorithm. 

  • Gymnasium: The actively maintained successor to OpenAI’s original Gym, serving as the standard environment API standard.
  • Unity ML-Agents: The standard bridge allowing games and simulations built inside the Unity Engine to behave as RL environments.
  • HUD / Harbor: Frameworks optimized specifically for sandboxing and validating AI code agents against containerized terminals.

Friday, August 14, 2026

MCP 2025-11-25 vs. MCP 2026-07-28

A comparison of the major protocol changes introduced in the MCP 2026-07-28 specification.

The following table compares the earlier MCP protocol (2025-11-25 and earlier) with MCP 2026-07-28, highlighting the architectural changes introduced by the move toward a stateless, request-oriented protocol.

Category Direction Old MCP
(2025-11-25 and earlier)
MCP 2026-07-28
Handshake Client ↔ Server initialize / notifications/initialized; server returns Mcp-Session-Id Removed — version/capabilities travel per-request in _meta. No pinning to a server instance
Session both Mcp-Session-Id header on every request; needs sticky routing Removed — every request self-contained. Any instance can answer any request
Capability probe Client → Server Implicit in initialize server/discover (optional to call, MUST be implemented). Decoupled from a handshake
Routing Client → Server Gateway must parse JSON body Mcp-Method, Mcp-Name headers. Header-based routing without body parsing
Discovery Client → Server tools/list, resources/list, prompts/list — varies per connection Same calls, plus resources/templates/list; now cacheable (ttlMs, cacheScope). Cacheable since results no longer vary per-connection
Core calls Client → Server tools/call, resources/read, prompts/get Same, but can return InputRequiredResult. Adds the MRTR path
Cross-call state Client → Server Implicit via session Explicit server-minted handle passed back as a tool argument (SEP-2567). State made explicit, not connection-bound
Server-initiated input Server → Client sampling/createMessage, elicitation/create, roots/list — server calls back mid-handler Deprecated (SEP-2577) → MRTR: server returns InputRequiredResult; client re-issues original call with inputResponses + echoed requestState. True server → client calls replaced by client-driven retries
Subscribe Client → Server resources/subscribe (per URI) / resources/unsubscribe subscriptions/listen with a filter (toolsListChanged, promptsListChanged, resourcesListChanged, resourceSubscriptions: [uris]). One call can cover many watch targets; multiple concurrent listen streams allowed
Subscription push Server → Client notifications/resources/updated, notifications/*/list_changed over the session's GET/SSE connection Same notifications, now tagged with io.modelcontextprotocol/subscriptionId in _meta, delivered only on the stream that requested them. Demultiplexed by subscription, not by session
Subscription teardown Client → Server resources/unsubscribe Close the SSE stream (HTTP) / notifications/cancelled referencing listen ID (stdio); no dedicated unsubscribe RPC. Server holds no state across reconnects — must re-listen after any drop
Progress Server → Client notifications/progress, keyed by progressToken in request _meta Unchanged in spirit — still request-scoped. Same mechanism, explicitly not moved to subscriptions/listen
Logging level Client → Server logging/setLevel (session-scoped) io.modelcontextprotocol/logLevel in per-request _meta. Per-request instead of per-session

Logs are sent in the same open connection, before final response as "notifications/message".
Keepalive both ping Removed — SSE comment-line keepalives on long streams instead. No dedicated RPC
Cancellation Client → Server notifications/cancelled Close the SSE response stream (HTTP); notifications/cancelled now stdio-only. Cancellation piggybacks on stream closure over HTTP
Long-running work Client ↔ Server No first-class support tasks/get, tasks/update, tasks/cancel (extension); tools/call can return a task handle; tasks/list removed. New capability, extension framework
Interactive UI Server → Client Not supported MCP Apps extension (SEP-1865) — sandboxed iframe HTML. New capability
Stream resumability — SSE Last-Event-ID allowed reconnect/redelivery Removed — broken stream ⇒ re-issue request with new ID, no redelivery. Simplicity traded for reliability guarantee

Key takeaway: MCP 2026-07-28 moves away from connection- and session-bound behavior toward self-contained, request-scoped interactions, while introducing mechanisms such as MRTR, subscription-based listening, explicit cross-call state, tasks, and MCP Apps.

Thursday, August 13, 2026

MCP v2 changes things a lot for the developer

 As I go deep into MCP v2, overwhelming changes are being noticed:

  • Session is being done away with.
  • If at all server needs to refer to state from previous response,  server appends a requestState in response, which the client must echo in next request.
  • Server will never make a call to client - this is biggest change. Channel must be kept open if you require multiple server responses for one single request. 
    • Elicitation: Client Sends a Request to Server. Server responds to the request, which contains a field called InputRequiredResult. Then client re-issues  the request with inputResponses + requestState
    • For Progress/Notification : 
      • For non-request-scoped notification (.e.g subscription to listChanged events of tools/prompts/resources), client opens one request and that request is kept open forever (till the time required by client).
      • For request-scoped notifications such as progress and logging, the notifications (notification/progress and notification/message) are sent in the same open connection, before the final response "result" to the mcp "tools/call" request is sent. The connection closes after the final response is received by the client from server.
  • Roots is deprecated

Wednesday, August 12, 2026

Mamba

What Mamba Is

Mamba is a new large language model (LLM) architecture introduced in late 2023 by researchers from Carnegie Mellon and Princeton. It’s built on Structured State Space (S4) models and aims to overcome transformers’ inefficiencies on long sequences by using a selective, input-dependent state space mechanism.

Key Innovations

  • Selective State Spaces (SSM): Mamba’s core block dynamically filters information, keeping what’s relevant and discarding the rest as it processes each token.
  • Simplified block design: It replaces the transformer’s heavy attention + MLP blocks with a single, cohesive SSM block, reducing complexity.
  • Hardware-aware parallelism: Uses a parallel scan algorithm tuned for GPUs, optimizing memory usage and throughput.
  • Linear-time scaling: Training and inference scale linearly with sequence length, unlike transformers’ quadratic attention cost.

Architecture Highlights

Mamba introduces a selected SSM layer that:

  • Focuses on relevant info: Weights inputs differently so predictive signals dominate.
  • Adapts to inputs: Parameters change per token (time-varying), enabling flexible sequence modeling.

It’s designed to fit GPU high-bandwidth memory and exploit parallel compute, improving speed and memory efficiency.

Mamba vs Transformers

Transformers Mamba
Attention-based; excellent at capturing global relationships but suffer from high memory/compute as sequences grow (quadratic scaling). SSM-based; uses a fixed-size hidden state that compresses history, enabling much faster inference and lower memory on long contexts.

Trade-offs noted in broader research (and acknowledged in the article’s context): transformers can still outperform on some retrieval/copying tasks and may need less data to learn certain behaviors, despite Mamba’s efficiency gains.

Usage

  • Requirements: Linux, NVIDIA GPU, PyTorch 1.12+, CUDA 11.6+.
  • Install: pip install causal-conv1d (optional) and pip install mamba-ssm from the official repo; can also build from source.
  • Usage: Instantiate a Mamba module with parameters like d_model, d_state, d_conv, and expand, then pass tensors of shape (batch, length, dim) .

Applications

Because it handles long sequences efficiently, Mamba is positioned for:

  • Long-form text analysis and content generation
  • Speech/audio and time-series modeling
  • Real-time translation and chatbots that track long conversations

Domain impacts highlighted include healthcare (genomic data), finance (long-term trends), and customer service (long-context dialogues).

Bottom Line

Mamba reframes sequence modeling by replacing attention with selective state spaces, delivering linear-time scaling and major efficiency gains for long contexts—making it a strong alternative (and potential complement) to transformers in future AI systems.

Semantic Layer in Data Science

Core Idea

A semantic layer is an intermediary between raw data sources (data warehouses, lakes, etc.) and business users/tools. It translates technical schemas into business-friendly terms, defines shared vocabulary and rules, and provides a consistent, governed view of data for analytics.

Why Organizations Need It

  • Eliminates silos and inconsistency: Unifies data from many systems under one business vocabulary so “sales,” “revenue,” etc., mean the same thing across teams.
  • Improves accessibility: Lets non-technical users explore data via self-service without deep SQL or schema knowledge.
  • Speeds insights: Predefined metrics and relationships let analysts build reports faster and make decisions more quickly.

Types of Semantic Layers

  • Universal: Standalone, enterprise-wide layer acting as a single source of truth; great for governance and flexibility but costlier.
  • Data warehouse semantic layer: Lives inside the warehouse; focuses on naming, data model organization, and lineage.
  • Data lake semantic layer: Organizes schemas and meanings for unstructured/semi-structured data in lakes.
  • BI semantic layer: Sits between warehouses/lakes and tools like Power BI/Tableau; defines business concepts, relationships, and prebuilt metrics.

How It Works (Key Components)

  1. Data sources: Raw repositories (warehouses, lakes).
  2. Data integration: Extracts and transforms data into consistent formats.
  3. Metadata repository: Stores definitions, models, and relationships.
  4. Semantic model: Encodes business logic, hierarchies, metrics, and calculations.
  5. Query engine: Translates user queries into source-specific queries.
  6. Presentation layer: Dashboards/reports users interact with.

Building a Semantic Layer (High-Level Steps)

  1. Identify business requirements with analysts and domain experts.
  2. Assess existing data sources for format and quality.
  3. Design the semantic model using sound modeling techniques.
  4. Implement using BI/data modeling tools (views, calculated fields, hierarchies).
  5. Integrate with sources via connectors/APIs and ETL/ELT processes.
  6. Test, validate (including UAT), then deploy and maintain with ongoing monitoring.

Challenges to Watch

  • Complex initial setup and integration.
  • Scalability as data volume/variety grows.
  • Maintaining consistency across sources.
  • Ongoing cost, resources, and change management/user adoption.

Common Implementation Architectures

Architecture Description
Metadata-first Logical, metadata-driven unification without physical consolidation; balances standardization and agility.
Ontology modeling language (OML) Uses a shared ontology (e.g., UFO) to build a knowledge graph for federated data.
Built-for-purpose Decentralized, leveraging semantics inside individual tools (CRM, BI) per business unit.
Centralized Consolidates definitions/logic in an EDW/DL; strong governance but heavy upfront investment.

Tools with Sematic-Layer Capabilities

Cube.js, MetricFlow, dbt, Tableau, and Power BI, highlighting features like data modeling, metrics layers, caching, APIs, and visualization/integration strengths.

Comparing features of LangGraph vs CrewAI

LangGraph Orchestration vs CrewAI Orchestration The following table compares LangGraph and CrewAI orchestration across their menta...