The Multi-Agent Problem
Modern AI-assisted development often involves multiple agents working in parallel:- Agent A implements user authentication
- Agent B implements data management
- Agent C implements reporting features
Common Conflict Types
Here are the conflicts that emerge when agents work without architectural guidance:API Style Conflicts
Without architecture:- Agent A implements REST endpoints:
GET /users/{id} - Agent B implements GraphQL mutations:
mutation updateProduct - Agent C implements RPC-style POST endpoints:
POST /executeReport
- Frontend developers face 3 different API patterns
- Documentation is inconsistent
- Testing strategies differ per agent
- Client libraries can’t be standardized
- ADR specifies: “Use GraphQL for all client-server communication”
- All agents implement GraphQL resolvers
- Consistent patterns, single client library, unified docs
Database Design Conflicts
Without architecture:- Agent A uses snake_case:
user_id,created_at - Agent B uses camelCase:
productId,updatedAt - Agent C uses PascalCase:
ReportName,ExecutionTime
- Database schema is inconsistent
- Queries become confusing
- ORM mappings are complex
- Migrations are error-prone
- Standards document specifies: “Use snake_case for all database columns”
- All agents follow the same naming convention
- Consistent schema, predictable queries
State Management Conflicts
Without architecture:- Agent A implements Redux for user state
- Agent B implements React Context for product state
- Agent C implements local component state with hooks
- Three state management approaches in one app
- Complex debugging across state systems
- New developers face steep learning curve
- State synchronization issues
- ADR specifies: “Use Zustand for global state, React Query for server state”
- All agents implement consistent state patterns
- Predictable data flow, easier debugging
Authentication/Authorization Conflicts
Without architecture:- Agent A implements JWT tokens in localStorage
- Agent B implements session cookies
- Agent C implements API keys in headers
- Users need multiple authentication methods
- Security vulnerabilities from inconsistent approaches
- Authorization checks differ per feature
- ADR specifies: “JWT in httpOnly cookies, refresh token rotation”
- All agents implement same auth flow
- Consistent security posture
Error Handling Conflicts
Without architecture:- Agent A returns:
{ success: false, message: "Error" } - Agent B throws exceptions with custom error classes
- Agent C returns HTTP status codes only
- Frontend can’t standardize error handling
- Logging and monitoring fragmented
- User experience inconsistent
- Standards document specifies error format:
- All agents return errors in same format
- Centralized error handling, consistent UX
How Architecture Prevents Conflicts
Architecture documentation acts as a contract that all agents must follow:1. Explicit Decisions via ADRs
Architecture Decision Records (ADRs) document every significant technology choice: ADR Template:2. FR/NFR-Specific Guidance
Architecture maps each functional requirement to technical approach:3. Standards and Conventions
Explicit documentation of cross-cutting concerns:Architecture as Shared Context
Think of architecture as the shared context that all agents read before implementing:Key ADR Topics
These decisions prevent the most common conflicts:| Topic | Example Decision |
|---|---|
| API Style | GraphQL vs REST vs gRPC |
| Database | PostgreSQL vs MongoDB, schema design patterns |
| Authentication | JWT vs sessions, token storage |
| State Management | Redux vs Zustand vs Jotai, server state handling |
| Styling | CSS Modules vs Tailwind vs Styled Components |
| Testing | Jest + RTL + Playwright vs Vitest + Cypress |
| Error Handling | Error format, logging strategy, user messaging |
| Data Fetching | React Query vs SWR vs Apollo Client |
| Form Management | React Hook Form vs Formik vs uncontrolled |
| Date/Time | Library choice (date-fns vs dayjs), timezone handling |
| File Structure | Feature-based vs layer-based organization |
| Type Safety | TypeScript strict mode, Zod for runtime validation |
Not every decision needs an ADR. Focus on choices that cross epic boundaries and affect multiple agents.
Anti-Patterns to Avoid
Implicit Decisions
Bad:“We’ll figure out the API style as we go.”Why it fails: First agent picks REST. Second agent picks GraphQL. Conflict. Good:
“ADR-001 specifies GraphQL. All agents implement GraphQL resolvers.”
Over-Documentation
Bad:50-page architecture document covering every function signature and variable name.Why it fails: No one reads it. Agents ignore it. Becomes stale immediately. Good:
Focused ADRs for conflict-prone decisions. Standards for cross-cutting concerns. Everything else is agent discretion.
Stale Architecture
Bad:Architecture written once during planning, never updated.Why it fails: Reality diverges from docs. New agents follow outdated patterns. Conflicts re-emerge. Good:
Living architecture updated as you learn. correct-course workflow for significant pivots.
Missing Rationale
Bad:“Use PostgreSQL.”Why it fails: Agents don’t understand why. Can’t make good decisions for edge cases. Good:
“Use PostgreSQL for structured data requiring ACID guarantees. Rationale: Our data is relational (users, products, orders), we need transactions for order processing, team has PostgreSQL expertise.”
Technology Without Context
Bad:“Stack: React, Node.js, PostgreSQL, Redis, S3, GraphQL.”Why it fails: Doesn’t explain when to use each technology. Good:
- React: Frontend UI components
- Node.js + Express: GraphQL server
- PostgreSQL: Transactional data (users, orders)
- Redis: Session storage, caching, pub/sub
- S3: User-uploaded files, static assets
- GraphQL: Client-server API communication
Best Practices
Document Decisions That Matter
Focus on:- Cross-epic concerns - Choices that affect multiple features
- Conflict-prone areas - API patterns, data models, state management
- Non-obvious trade-offs - Decisions where the rationale isn’t obvious
- Consistency requirements - Patterns that must be uniform
Update as You Learn
Architecture isn’t static:- After spikes - Update ADRs based on what you discovered
- When pivoting - Use
correct-courseto revise decisions - During retrospectives - Capture lessons learned
- When patterns emerge - Document successful approaches
Make Architecture Discoverable
Agents need to find and use architecture:- Consistent location -
_bmad-output/planning-artifacts/architecture/ - Clear naming -
adr-001-api-protocol.md,standards-frontend.md - Index file -
architecture/index.mdlinking to all ADRs - Workflow integration -
implementworkflow loads relevant ADRs
Validate Adherence
Check that agents follow architecture:- Code review - Verify patterns match ADRs
- Adversarial review - Find deviations from standards
- Automated linting - Enforce naming conventions, structure
- Integration tests - Validate cross-epic compatibility
Real-World Example
Consider a SaaS application with three major features: Without Architecture:- Auth feature (Agent A): JWT in localStorage, REST endpoints, Redux state
- Products feature (Agent B): Session cookies, GraphQL mutations, React Context state
- Billing feature (Agent C): API keys, RPC endpoints, local component state
- Auth tokens don’t work for GraphQL requests
- Product state doesn’t sync with auth state
- Billing can’t access user info from auth
- 3 different loading/error patterns in UI
- JWT tokens in httpOnly cookies
- Refresh token rotation
- All features use same auth context
- GraphQL for all client-server communication
- Shared schema with modular resolvers
- Code-generated TypeScript types
- React Query for server state
- Zustand for client state
- No Redux, no Context for global state
- Standardized error format (code, message, details)
- Centralized error boundary
- Toast notifications for user-facing errors
- Auth feature (Agent A): GraphQL mutations, JWT cookies, Zustand for auth state
- Products feature (Agent B): GraphQL queries/mutations, React Query for server state
- Billing feature (Agent C): GraphQL mutations, React Query + Zustand
- All features work together immediately
- Auth state accessible everywhere via Zustand hook
- Consistent error handling across features
- Type-safe API calls via generated types
Using correct-course for Architecture Updates
When significant changes are needed:
Summary
Preventing agent conflicts requires:- Explicit architecture - ADRs for key decisions, standards for patterns
- Shared context - All agents read architecture before implementing
- Focused documentation - Cover conflict-prone areas, skip the obvious
- Living documents - Update architecture as you learn
- Validation - Review code for adherence to architecture
