<?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 Mathivanan Mani on Medium]]></title>
        <description><![CDATA[Stories by Mathivanan Mani on Medium]]></description>
        <link>https://medium.com/@mathivananmani?source=rss-41e4936bf66f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*DOxE3wuz6ilAyzYy.</url>
            <title>Stories by Mathivanan Mani on Medium</title>
            <link>https://medium.com/@mathivananmani?source=rss-41e4936bf66f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:25:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mathivananmani/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[Reviving Brownfield Projects with AI: A Comparative Look at GitHub Spec Kit, OpenSpec, and BMAD]]></title>
            <link>https://medium.com/@mathivananmani/reviving-brownfield-projects-with-ai-a-comparative-look-at-github-spec-kit-openspec-and-bmad-a7bc5116dd9a?source=rss-41e4936bf66f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7bc5116dd9a</guid>
            <category><![CDATA[spec-driven-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-engineering]]></category>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Mathivanan Mani]]></dc:creator>
            <pubDate>Sun, 08 Feb 2026 19:50:30 GMT</pubDate>
            <atom:updated>2026-02-08T19:50:30.832Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Why specification beats improvisation when AI meets existing codebases.</em></p><p>AI coding agents are brilliant with greenfield projects. With brownfield? They hallucinate with confidence.</p><p>Over the past few weeks, I’ve been exploring three frameworks — <a href="https://github.com/github/spec-kit">GitHub Spec Kit</a>, <a href="https://github.com/Fission-AI/OpenSpec">OpenSpec</a>, and <a href="https://github.com/bmad-code-org/BMAD-METHOD">BMAD</a> — to see how they handle existing codebases. This is my opinionated take on what I discovered while applying them to real brownfield projects. Your mileage may vary, but here’s what worked (and didn’t work) for me.</p><p><strong>Testing Setup:</strong> All my explorations used <strong>Claude Sonnet 4.5</strong> via <strong>GitHub Copilot</strong> on a brownfield <strong>Java Spring Boot</strong> project for consistency across frameworks.</p><h3>The Problem: AI Agents Need Memory, Not Just Prompts</h3><p>My journey started with tools like Windsurf and Cursor, back when GitHub Copilot was just a polite chatbot in “Ask mode.” As Copilot evolved into a full-fledged editor, I eagerly applied it to my daily work. But here’s the catch: for greenfield (new) projects, AI is a wizard. For brownfield projects? It’s often a confident hallucinator.</p><p>I found myself constantly “nannying” the agents — updating instruction files to curb hallucinations, rewriting code to be “AI-friendly,” and wrestling with the model to get it to plan before it coded.</p><blockquote><em>The solution wasn’t better prompting; it was better </em><strong><em>Specification Based Development (SDD : Spec-Driven-Development)</em></strong><em>.</em></blockquote><p>It’s about <strong>Context Engineering</strong> — providing the AI with a curated “long-term memory” (via structured markdown files, which I call my constitution.md—a living document of coding standards and architectural constraints) to anchor its probabilistic generation to deterministic constraints.</p><h3>A Critical Note on Context Windows</h3><p>Before diving into the frameworks, here’s something I learned the hard way: <strong>don’t dump too much context</strong>.</p><p>Every AI request includes more than just your input:</p><ul><li>System Prompt</li><li>Tool Descriptions</li><li>User Prompt (plus agent-added context)</li><li>Conversation History</li></ul><p>In my experience with Copilot, the system prompt and tool descriptions alone consumed <strong>~35,000 tokens</strong>. This means your actual working context window is much smaller than you think.</p><p><strong>Best Practice</strong>: Keep your constitution.md focused on <em>must-have</em> rules and principles. I see developers stuffing it with generic best practices they found online. Instead, include only:</p><ul><li>Project-specific architectural constraints</li><li>Critical coding standards unique to your codebase</li><li>Domain-specific business rules</li><li>Integration patterns that are non-negotiable</li></ul><p>Think of it as your agent’s <strong>rulebook</strong> — every word should be essential.</p><p>Here’s what I learned.</p><h3>1. GitHub Spec Kit: The Structured Specialist</h3><p><strong>The Gist</strong>: A Python-based CLI tool <a href="https://github.com/github/spec-kit">directly from GitHub</a>. It follows a “Spec-First” — it makes AI write detailed specifications and plans before touching code.</p><h3>Architecture</h3><ul><li><strong>Agents</strong>: All agent definitions are placed in the .agents folder.</li><li><strong>Templates</strong>: Agents use these templates to generate the required markdown files.</li><li><strong>Workflow</strong>: Managed by shell scripts (for Mac). These scripts are invoked by the agent and validate prerequisites for each task. For example, while executing the plan agent, the script validates if the necessary spec was generated by the specify agent.</li><li><strong>State</strong>: Managed as checklists in the respective spec files (e.g., tasks.md). If you have 10 tasks, completing one updates the checklist. This allows the agent to resume exactly where it left off if re-run.</li></ul><h3>Workflow</h3><figure><img alt="Spec Kit Workflow" src="https://cdn-images-1.medium.com/max/1024/1*W165Js3c-So5s3fB7x1xXA.png" /></figure><h3>Artifacts</h3><ul><li>spec.md: User Stories along with success criteria.</li><li>research.md: Covers low-level design by analyzing the codebase.</li><li>data-model.md: Table designs along with data flow diagrams.</li><li>plan.md: Technical context of the repo &amp; rules to be followed against constitution.md.</li><li>contracts.md: Maintains API &amp; Event contracts.</li><li>tasks.md: The final implementation checklist.</li></ul><h3>My Experience</h3><p>I tested Spec Kit on a medium-complexity feature. Here’s what happened:</p><p><strong>What Worked Well:</strong></p><ul><li><strong>Smart Edge Case Handling</strong>: It came up with thoughtful queries about edge cases and failure scenarios — questions that shaped the final spec.</li><li><strong>Integration Discovery</strong>: Identified touch points in existing classes without explicit guidance, showing genuine code comprehension.</li><li><strong>Comprehensive Planning</strong>: The multi-stage spec process caught gaps I would’ve missed.</li></ul><p><strong>The Challenges:</strong></p><ul><li><strong>Branch Naming Rigidity</strong>: Enforces strict branch naming conventions that may conflict with your team’s existing workflow (<a href="https://github.com/github/spec-kit/issues/1454">open issue #1454</a>).</li><li><strong>Post-Implementation Cleanup</strong>: After the “implement” phase completed, I faced compilation errors and failing unit tests. Fixing these took multiple iterations and ate up significant time.</li><li><strong>File Management Overhead</strong>: So many spec files meant thorough review was required. Certain things repeated across files, and any late-stage gap required updates in multiple places.</li><li><strong>SRP Violations</strong>: Some generated implementations violated Single Responsibility Principle.</li><li><strong>Spec Review Time</strong>: While execution (specify → implement) took about 2.5 hours, spec reviews extended the total to <strong>~5 hours</strong> for the complete feature.</li></ul><p><strong>Bug Fixing Reality:</strong> There’s no clear bug fixing workflow. Running the complete specify-to-implement cycle for a bug is impractical. The community has raised this (<a href="https://github.com/github/spec-kit/issues/442">issue #442</a>), with suggestions to introduce a dedicated bug fixing agent, but it’s not available yet.</p><p><strong>Best For</strong>: Teams that don’t have restrictions on branch naming conventions and need detailed, exhaustive documentation</p><h3>2. OpenSpec: The Lightweight Sprinter</h3><p><strong>The Gist</strong>: A <a href="https://github.com/Fission-AI/OpenSpec">Node.js-based tool</a> that keeps things simple. It follows a “Spec-Anchored” approach (as defined in <a href="https://martinfowler.com/articles/exploring-gen-ai/sdd-3-tools.html">Martin Fowler’s blog</a>) with no complex agent personas, just three core prompts and a clean workflow.</p><h3>Architecture</h3><ul><li><strong>Agents</strong>: Instructions are maintained in the prompts folder.</li><li><strong>Templates</strong>: Spec templates are maintained in the agents.md file.</li><li><strong>Workflow</strong>: There are no dedicated script files for validation. Prerequisites are mentioned directly in the agent’s instructions.</li><li><strong>State</strong>: Maintained as checklists in markdown files, similar to GitHub Spec Kit.</li></ul><h3>Workflow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b-rDnDKtGElpoatrIv8FJA.png" /></figure><h3>Artifacts</h3><ul><li>Project.md: Context file scanning the entire repo.</li><li>proposal.md: Captures Intent, Scope, and Approach.</li><li>specs/: Features are logically separated and each sub-feature has its own spec with detailed user stories.</li><li>tasks.md: Implementation checklist.</li></ul><h3>My Experience</h3><p>I tested the same feature with OpenSpec. The contrast was immediate:</p><p><strong>What Worked Well:</strong></p><ul><li><strong>Superior Requirements</strong>: It generated proper user stories for edge cases as <em>first-class requirements</em> rather than afterthought queries — a big improvement over Spec Kit.</li><li><strong>Production Thinking</strong>: Included a feature flag with a rollout plan (UAT → Production), showing operational awareness.</li><li><strong>Clean Design</strong>: Clear separation of concerns, proper feature flag implementation, and identified existing integration points accurately.</li><li><strong>Faster Iteration</strong>: Limited spec files meant quicker reviews and less context-switching.</li><li><strong>Speed</strong>: Execution (proposal → archive) took about <strong>~1.15 hours</strong>, with total duration including reviews around <strong>~1.75 hours</strong> — significantly faster than Spec Kit.</li><li><strong>Constitution.md Reusability</strong>: I successfully reused the constitution.md concept from Spec Kit here, which improved results with less manual intervention.</li><li><strong>The Spec-Anchored Philosophy</strong>: The “Archive” step keeps your active specs folder clean, allowing the spec to evolve alongside the code as a living artifact.</li></ul><p><strong>The Challenges:</strong></p><ul><li><strong>Same Build Issues</strong>: Like Spec Kit, I encountered compilation errors and needed to prompt for fixes to ensure successful builds.</li></ul><p><strong>Bug Fixing Reality:</strong> OpenSpec documentation suggests bugs can be fixed directly without proposals, but when I tried that, it didn’t follow our coding standards.</p><p><strong>The Fix</strong>: I created a custom agent (openspec-bugfix-prompt.md) with explicit instructions to:</p><ul><li>Reference constitution.md</li><li>Ensure unit tests are covered</li><li>Validate build success</li></ul><p>After this customization, bug fixing worked smoothly without intervention.</p><p><strong>Best For</strong>: Teams with experienced developers who need to move fast on well-understood problems.</p><h3>3. BMAD: The Virtual Organization</h3><p><strong>The Gist</strong>: If OpenSpec is a freelancer, <a href="https://github.com/bmad-code-org/BMAD-METHOD">BMAD</a> is a consulting firm. It’s a <strong>Simulation</strong> of an entire Agile organization.</p><h3>Architecture: A “Game Console” Design</h3><p>Think of BMAD differently than the other tools:</p><ul><li><strong>The Core (Infrastructure)</strong>: The bmad-core is the underlying infrastructure that runs everything. It doesn&#39;t contain the specific &quot;agile method&quot; itself, but rather the capability to run agents, manage memory, and execute workflows. It is domain-agnostic.</li><li><strong>The Modules (Capabilities)</strong>: These are the specific packages you install to give the system skills. For instance, the bmad-method module installs Agile agents (PM, Architect, Dev), while the tea module installs QA agents.</li><li><strong>State Management</strong>: Every interaction is stateful, tracked in the frontmatter of the markdown artifacts. This creates a persistent “save state” for your project.</li></ul><p><strong>The “Game Console” Analogy</strong>: Think of the Core as the <strong>Console</strong> (hardware/OS) and the Modules as <strong>Cartridges</strong>. The console runs the system, but the cartridge determines whether you are playing the “Agile Development” game or the “Enterprise Testing” game.</p><p>Upon installation, BMAD structures your repository with:</p><ul><li>_bmad/: The &quot;Brain&quot; containing Agents, Strategies, and definitions.</li><li>_bmad-output/: The &quot;Work Product&quot; (PRDs, Specs, Code).</li></ul><h3>Workflows:</h3><p>BMAD understands that not all tasks are equal:</p><h4>The Full Flow (Complex Features)</h4><figure><img alt="BMM Full Flow" src="https://cdn-images-1.medium.com/max/1024/1*Lhg9wN65NhFsBRkqE4GO1g.png" /></figure><p><strong>What makes this different:</strong></p><p><strong>Domain Intelligence &amp; End-User Simulation:</strong> Unlike standard coding assistants, the PM Agent acts like a true Product Manager. It doesn’t just read requirements; it <strong>simulates production usage</strong>.</p><ul><li><strong>Persona Discovery:</strong> For a given feature, it automatically identifies who will actually use it (e.g., “Compliance Officer,” “Customer Support Agent,” “Novice User”).</li><li><strong>Real-World Scenarios:</strong> It walks these personas through “Day in the Life” examples to validate if the feature solves their actual problems.</li><li><strong>Metrics-Driven:</strong> By understanding the <em>who</em> and <em>how</em>, it defines clear success metrics and performance benchmarks before a single line of code is written.</li></ul><h4>The Quick Flow (Small/Medium Features)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vH66OcvQpYya_sr8uKVIbw.png" /></figure><p>This focuses strictly on the “How” (Technical Spec) executed by specialized “Dev” agents.</p><h3>My Experience</h3><p>I used BMAD’s Quick Spec approach (single spec, not the full BMM method) for the same feature:</p><p><strong>What Worked Well:</strong></p><ul><li><strong>Design Quality</strong>: Good overall design with proper identification of touch points in existing classes.</li><li><strong>Fast Initial Implementation</strong>: Completing the implementation phase took only <strong>~55 minutes</strong> — the fastest of the three.</li></ul><p><strong>The Challenges:</strong></p><ul><li><strong>Build Issues (Again)</strong>: Like the others, compilation errors and failing unit tests required fixing.</li><li><strong>Context Window Pressure</strong>: Even starting from a fresh chat, the context window hit 100% quickly during UT fixes. I could see the tool responses consuming massive context, leaving less room for actual work.</li><li><strong>Hardcoded Values</strong>: Certain events (Kafka topics) were hardcoded directly instead of properly externalized — something the other two tools handled better.</li><li><strong>UT Fixing Time</strong>: While implementation was fast, fixing unit tests alone took <strong>~40 minutes</strong>, bringing total duration to <strong>~1.5 hours</strong>.</li></ul><p><strong>Design Comparison Note:</strong> Of all three frameworks, OpenSpec produced the cleanest design and best coding standards for this particular feature. BMAD’s full spec implementation (BMM method) with its domain intelligence might deliver better results, but I intentionally skipped it given the medium feature size — the quick spec was more appropriate.</p><p><strong>Bug Fixing Reality:</strong> Used the quick-flow-solo-agent for bug fixing. I gave it clear instructions to:</p><ul><li>Reference constitution.md</li><li>Ensure unit tests are covered</li><li>Validate build success</li></ul><p>With these explicit guidelines, bug fixing worked smoothly without intervention.</p><p><strong>Best For</strong>: Implementing complex features, brainstorming new capabilities, and navigating domains where product thinking and architectural validation matter more than raw speed — especially when using the full BMAD flow to ensure <strong>thorough reasoning</strong>.</p><h3>Side-by-Side: The Same Feature, Three Approaches</h3><p>Here’s how each framework performed on the same medium-complexity feature:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oWtVGwkQ1lmP7tCr9YQp3Q.png" /></figure><h3>The Verdict: My Opinionated Take</h3><p>Based on my exploration, here’s when I’d reach for each tool:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFnjQ0L1rqoXarZrmvvZ9A.png" /></figure><h3>What I Learned</h3><ol><li><strong>Your </strong><strong>constitution.md is critical</strong>: All three tools are only as good as your context engineering—but keep it focused. Don&#39;t bloat it with generic advice.</li><li><strong>Context window management is real</strong>: System prompts and tool descriptions consume 30–40K tokens before you start. Budget accordingly. <strong>Pro tip</strong>: Once the state is updated in your spec files, start with a fresh chat window for better context window management.</li><li><strong>Post-implementation cleanup is unavoidable</strong>: All three frameworks produced compilation errors and failing unit tests. Budget time for this phase.</li><li><strong>Hallucinations are subtle</strong>: In several bug fixes, the generated code looked perfect at first glance — it compiled and followed the style guide. But a proper review revealed <strong>logic blunders</strong> that would have caused regression. <strong>Mandatory Code Review</strong> by someone who knows the <em>existing</em> system is non-negotiable; you cannot blindly trust the agent to understand the ripple effects of a change.</li></ol><p><strong>Note:</strong> All these learnings are as of <strong>Jan 2026</strong>. In the world of AI, a week is a long time. Models are updating rapidly, and what requires a complex workaround today might be solved natively by next month. Treat this as a snapshot in time, not a permanent law.</p><p><strong>Have you tried any of these frameworks on brownfield projects? What was your experience?</strong> I’d love to hear what worked (or didn’t) for your team.</p><h3>Resources</h3><p><strong>Official Documentation:</strong></p><ul><li><a href="https://github.com/github/spec-kit">GitHub Spec Kit</a> — Python-based spec-first framework</li><li><a href="https://github.com/Fission-AI/OpenSpec">OpenSpec</a> — Node.js lightweight spec-anchored tool</li><li><a href="https://github.com/bmad-code-org/BMAD-METHOD">BMAD Method</a> — Multi-agent virtual organization</li><li><a href="https://www.youtube.com/watch?v=6LtrJD5Dz40">BMAD V6 Feature Video</a> — Visual walkthrough of the framework</li></ul><p><strong>Further Reading:</strong></p><ul><li><a href="https://martinfowler.com/articles/exploring-gen-ai/sdd-3-tools.html">Understanding Spec-Driven Development</a> — Martin Fowler’s analysis</li><li><a href="https://martinfowler.com/articles/exploring-gen-ai/context-engineering-coding-agents.html">Context Engineering for Coding Agents</a> — Deep dive into memory management</li></ul><p><strong>Tags</strong>: AI Coding, Software Architecture, Context Engineering, Brownfield Development, Tech Debt, Specification-Driven Development , SDD</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7bc5116dd9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>