Dev.to AI 🤖 Ai 👁 0 📖 7 min read

Why Two Developers Using AI on the Same Project Generate Incompatible Code — And How We Solved It with SCAD

SCAD: A Software Engineering Methodology for Governing Parallel AI Agent Development When a senior developer works independently with a capable AI coding agent — such as Claude Code, Claude Desktop, or Cursor — develop

SCAD: A Software Engineering Methodology for Governing Parallel AI Agent Development

When a senior developer works independently with a capable AI coding agent — such as Claude Code, Claude Desktop, or Cursor — development velocity can feel almost magical. Entire features can materialize in minutes.

However, at BDTech, when we scaled this workflow to parallel team development, we encountered a hidden bottleneck that eroded much of those productivity gains: context divergence.

The Invisible Problem of Team-Based Agentic Development

Imagine two developers working simultaneously on the same codebase. Developer A asks their AI agent to build the billing module. Developer B asks their agent to build the order management module.

Even when both agents have access to the same project, each AI session operates within its own isolated context and makes dozens of implicit technical decisions:

  • One session models currency values as decimal(10,2); the other stores integer cents (integer).
  • One uses UUID v4 as primary keys; the other chooses ULID or auto-increment.
  • One implements custom domain exceptions; the other returns raw error arrays directly from controllers.
  • Even worse: when running the test suite and encountering a pre-existing broken test in another module, an agent might "help" by modifying that test simply to make the build pass — masking an existing bug and potentially causing painful merge conflicts.

When it is time to integrate the branches, the pieces may no longer fit together as expected. The time saved during code generation is consumed by refactoring, architectural adjustments, and conflict resolution.

The problem is not necessarily the quality of individual agents. It is the absence of a shared, enforceable engineering context.

The Turning Point: Compiling Reality Before Writing Code

To address this problem at its root, I systematized a methodology called SCAD (Spec-Compiled Agentic Development).

The core principle of SCAD is to invert the traditional approach to AI-assisted engineering:

Instead of trying to align independently generated code after implementation, we compile and structure business reality, physical constraints, and architectural decisions before the first line of code is written.

Rather than treating prompts as casual conversations, SCAD treats the project specification as source material for a compilation pipeline, producing structured artifacts that AI agents can consume consistently.

The objective is to reduce ambiguity, prevent architectural divergence, and establish a common operational framework for every agent involved in development.

How SCAD Works in Practice: The Four Phases

1. Reality & Topology Engineering (RTE)

Before discussing frameworks, programming languages, or databases, we conduct a systematic investigation of the real-world operation.

We map:

  • Operational bottlenecks and business workflows.
  • Regulatory and compliance requirements.
  • Physical infrastructure and environmental constraints.
  • Connectivity limitations, internet outages, and power failures.
  • Hardware integration requirements, such as scales, turnstiles, and thermal printers.

Only after understanding the actual operating environment do we define the system topology.

This prevents both under-engineering and unnecessary architectural complexity.

The objective is to build a system that reflects operational reality rather than forcing the business to adapt to arbitrary technical assumptions.

2. Structural Architecture & Evolutionary Design (SAED)

Before any agent touches the codebase, we establish the structural boundaries that protect the system's core architecture.

This includes:

  • Defining entity granularity and domain boundaries.
  • Establishing the multi-tenancy strategy as a mandatory rule at the data-access layer.
  • Defining architectural contracts and responsibilities.
  • Isolating external services — such as payment gateways, messaging providers, and tax APIs — behind strict interfaces and adapters.

The goal is to ensure that agents operate within an established architectural structure instead of independently inventing implementation patterns.

These decisions become shared constraints for all subsequent development tasks.

3. Context Compilation & Semantic Minification (CCGA)

This is the technical heart of SCAD.

We consolidate the decisions made during Phases I and II into a comprehensive, human-readable document:

MASTER_SPEC.md

Then, we use AI to semantically minify that document into a compact artifact designed specifically for AI agents:

AI_CONTEXT.min.md

The process is conceptually similar to minifying CSS or JavaScript for production, but with an important distinction: specification minification involves semantic interpretation rather than simply removing whitespace or comments.

We eliminate discursive prose, filler words, and redundancies while preserving the relevant technical constraints in a compact, structured format.

The resulting artifact must be validated against the original specification to ensure that essential requirements, restrictions, and architectural decisions have not been lost or altered.

Here is a simplified example:

Before (MASTER_SPEC.md — Human-readable):

All financial values stored in the database and transmitted across internal services must be represented strictly as integer cents to avoid floating-point rounding issues. Additionally, all core tables must use ULIDs as primary keys to enable chronological sorting without exposing record volume.

After (AI_CONTEXT.min.md — Compiled for AI agents):

DATA_RULES:
- currency: INT (cents only; NO float/decimal)
- primary_keys: ULID (all core tables; NO auto-increment)

The expected benefits are twofold:

  1. Reduced token consumption: A smaller context artifact means less repetitive information needs to be supplied in every agent session.
  2. Improved interpretive consistency: Removing linguistic noise and expressing constraints explicitly helps agents follow the same technical rules.

Mandatory Operational Skills

In addition to the compiled context, we attach mandatory operational Skills to every agent involved in the project.

These Skills establish behavioral boundaries and define how agents must interact with the repository, tests, and development workflow.

Failure Containment Protocol

If an agent encounters a broken test that was not caused by its current task card, it is strictly forbidden from modifying that test or touching unrelated code.

The agent must document the technical incident and remain within its assigned scope.

This prevents agents from silently masking pre-existing problems simply to achieve a successful build.

Token Efficiency

Blind repository scans are discouraged or prohibited according to the project's governance rules.

Agents must prioritize structural navigation techniques, such as AST analysis, dependency graphs, and targeted file inspection. Terminal output should also be compressed to avoid unnecessary context consumption.

Self-Contained Cards (Zero-Exploration Tasks)

The backlog is divided into atomic development tasks.

Each task card must contain enough information for an agent to execute its assignment without independently exploring the entire repository.

This includes:

  • Exact file paths.
  • Input and output contracts.
  • Implementation requirements.
  • Relevant architectural constraints.
  • Dependency relationships (Blocked By / Blocks).

The goal is to minimize exploratory work and keep agents focused on implementation within clearly defined boundaries.

4. Parallel Execution & Hybrid QA (PEHQ)

With every developer operating their agents under the same AI_CONTEXT.min.md and mandatory operational Skills, parallel development becomes more consistent and architectural divergence is significantly reduced.

However, shared context alone is not enough. Agents also need clearly defined operational boundaries and lifecycle-specific rules.

Development Lifecycle Governance: PRE-PROD vs. PROD

SCAD establishes different operational permissions depending on the environment lifecycle.

  • PRE-PROD: Agents can rebuild migrations when necessary to accelerate data modeling and structural adjustments.
  • PROD: Destructive database changes are prohibited by governance rules. Schema evolution must use safe, incremental migrations that preserve existing production data.

This distinction prevents development shortcuts from becoming production risks.

Hybrid Quality Assurance

Quality assurance is divided into two complementary layers.

Deterministic Agentic QA

The QA agent validates objective requirements, including CRUD operations, routes, business rules, and expected system behavior.

Its primary responsibility is diagnosis, not correction.

The agent must follow one fundamental rule: it never fixes the bug it discovers.

Instead, it creates a detailed issue or ticket on the project board, documenting the problem and preserving traceability.

This separation prevents QA agents from modifying the implementation they are supposed to evaluate and helps maintain an independent validation process.

Human-Centered QA

Some aspects of software quality are difficult to evaluate reliably through automated agents alone.

Human-centered QA focuses on elements that require human perception and judgment, including:

  • User journey fluidity.
  • Interface ergonomics.
  • Visual alignment and consistency.
  • Interaction clarity.
  • Real-world responsiveness and usability.

This layer complements deterministic validation by evaluating the experience beyond objective technical requirements.

Open Source & Ready-to-Use Templates

Engineering practices evolve faster when they are shared, tested, and improved by the community.

That is why I published the complete SCAD specification in both English and Portuguese under the Apache License 2.0.

The repository also includes a ready-to-use /templates directory that can be copied into an existing project.

The available materials include:

  • MASTER_SPEC — Human-readable project specification template.
  • Context semantic minification guide.
  • Governance Skills for AI agents.
  • Task Card template.

Official Resources

If you lead engineering teams or build complex systems with AI coding agents, I invite you to explore the methodology and experiment with its templates in your next project.

Feedback, criticism, and practical experiences are welcome. Feel free to open an Issue or Discussion in the repository to share your findings and contribute to its evolution.

Discussion

How are you currently structuring governance across multiple AI coding agents in your repositories?

Are you using shared specifications, agent-specific instructions, operational Skills, or another approach to prevent context divergence?

I'd love to hear about your experiences.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.