Multi-Agent Collaborative Coding: From Architecture Design to Acceptance Testing

    Reliable AI-assisted development depends on how planning, implementation, review, and validation are organized—not just how quickly an assistant generates code. Using a historical information-propagation simulator as an example, this article explains how to define executable design contracts, model state and provenance, constrain agent actions, deliver a minimal end-to-end workflow, and combine independent audits with automated testing and human acceptance. It also outlines an eight-stage process for developers without extensive software engineering training.

    1. From Choosing the Best Assistant to Organizing Development

    When evaluating AI coding tools, people often focus on code-generation speed, interface polish, or the quality of a single response. These measures are useful, but they do not establish whether a development workflow is reliable.

    Software development involves more than translating requirements into code. It requires understanding how requirements relate to one another, identifying constraints, designing state transitions, and checking that the implementation still serves the business goal. If these issues remain unresolved, faster code generation may simply spread incorrect assumptions faster.

    The more important question is therefore not which assistant to choose, but how to organize planning, implementation, review, and validation into a traceable workflow.

    A practical collaboration structure includes four roles:

    • Planner: Clarifies requirements, builds the domain model, and defines interfaces and acceptance criteria.
    • Implementer: Writes code and local tests within agreed constraints.
    • Reviewer: Independently examines design assumptions, code logic, security boundaries, and testing gaps.
    • Human owner: Makes business trade-offs, evaluates the user experience, and remains responsible for delivery.

    Different AI assistants can fill these roles, or the same assistant can perform them in separate task contexts. Role separation is not intended to create more conversation. Its purpose is to reduce the blind spots that arise when an assistant generates a solution, explains it, and then approves its own work.

    Agreement after several rounds of discussion does not establish correctness. Meaningful convergence means that key assumptions are explicit, disagreements are resolved with evidence, and acceptance criteria can be executed—not simply that participants stop objecting.

    2. Establish an Executable Design Contract Before Coding

    Turn Vague Goals into Verifiable Requirements

    “Build a historical simulator” and “allow information to spread” describe a direction, not an implementation specification. Planning should answer questions such as:

    • Who produces information, and who receives it?
    • Does the system distinguish facts, rumors, interpretations, and recorded accounts?
    • Can a recipient reject a piece of information?
    • Does retelling change its content?
    • Which actions are constrained by time, distance, language, or social relationships?
    • How can users observe propagation results?
    • What observable behavior demonstrates that the system is correct?

    For example, “characters can spread stories” can become the following acceptance criteria:

    1. After encountering an event, a character can create an information record with a source and timestamp.
    2. A retelling must reference an existing information version and preserve its source relationship.
    3. Different characters can produce conflicting accounts of the same event.
    4. A content change creates a new version rather than overwriting the original record.
    5. Users can follow source relationships to inspect how a recorded account spread.

    These requirements guide implementation while giving audits and tests a shared basis.

    A Design Contract Does Not Need to Be Exhaustive

    Detailed development instructions can be organized into a design and acceptance contract. At a minimum, it should cover:

    Area Questions to Answer
    Project goals What problem does the project solve, and what is out of scope for now?
    Domain model What are the core objects, relationships, and lifecycles?
    Module boundaries What is each module responsible for, and what is outside its responsibility?
    Interface contracts How are inputs, outputs, errors, and side effects represented?
    State rules Which changes are allowed, and which must be prohibited?
    Nonfunctional requirements What constraints apply to performance, security, and observability?
    Acceptance criteria How will the team demonstrate that the requirements are met?

    Specific documentation reduces ambiguity, but excessive detail around unstable requirements also increases maintenance costs. Prioritize high-risk areas such as data consistency, permission boundaries, and state transitions. Leave reasonable flexibility in areas that are easier to change, such as interface layout.

    Keep Design Discussions Evidence-Based

    Once the planner proposes a design, the reviewer should look for problems that can be tested or disproved:

    • Are any exceptional paths missing?
    • Does an object have too many responsibilities?
    • Can the data structures support the queries the system will need?
    • Has a business assumption been treated as a technical fact?
    • Do acceptance criteria depend entirely on subjective judgment?

    Each review finding should ideally include the problem, triggering conditions, impact, proposed change, and verification method. The implementer may challenge a finding, but should explain the evidence and trade-offs rather than ending the discussion with “this is simpler.”

    If repeated discussion does not resolve a disagreement, use a small prototype, a boundary test, or a human decision. More conversation does not necessarily produce more information.

    3. Model Historical Information Propagation Before Generating Code

    Separate Events from What Characters Know

    A common modeling mistake in historical simulations is storing “what happened” and “what a character knows” in the same object.

    Although simple to implement, this can give characters access to information they should not possess. It also makes misunderstandings, concealment, and rumors difficult to represent naturally.

    A more robust model separates four layers:

    • Event layer: What actually happens in the simulated world.
    • Observation layer: Which parts of an event a particular character encounters.
    • Narrative layer: An account formed from the character’s observations, memory, and perspective.
    • Record layer: A narrative preserved as an account that can circulate over time.

    Some simulation designs may deliberately hide the full truth from users. Even then, the underlying world state and character knowledge should remain separate to prevent application logic from confusing them.

    Represent Propagation Through Versions, Not Repeated Text Edits

    Story propagation is not simple copying. A retelling may remove details, strengthen a causal claim, combine other reports, or change how a person is portrayed.

    Each propagation step can therefore create a new narrative version while retaining its sources. A schematic data structure might look like this:

    1. NarrativeVersion:
    2. id
    3. source_version_ids
    4. narrator_id
    5. created_at
    6. content_fragments
    7. narrator_confidence
    8. change_reason

    A set of source version IDs is necessary because a story may combine several sources. Its provenance is usually better represented as a graph than as a single tree.

    If new versions may reference only existing earlier versions, the provenance graph can remain a directed acyclic graph. Social relationships and communication routes between characters, however, may contain cycles and should be modeled separately.

    This distinction supports two different types of queries:

    • Social relationship queries: Which characters have an opportunity to exchange information?
    • Provenance queries: Which versions contributed to a particular recorded account?

    Break Bias into Explicit Mechanisms

    “Characters distort stories” is still too abstract. It can be decomposed into independently testable mechanisms:

    • Attention bias: Focusing only on fragments relevant to the character’s goals.
    • Memory loss: Omitting details as time passes.
    • Perspective-based retelling: Changing evaluations of people or emphasizing different causes.
    • Strategic concealment: Deliberately withholding unfavorable information.
    • Source weighting: Deciding whether to accept information based on relationships, experience, or past accuracy.
    • Narrative merging: Combining several reports into a more complete account.

    These mechanisms should operate on structured information fragments, rather than simply rewriting arbitrary natural-language text. Otherwise, propagation becomes difficult to explain and reproduce consistently.

    If generative capabilities produce narrative text, first determine the structured changes, then generate the display text. Also check whether that text introduces unauthorized facts. The presentation layer should not be the sole source of simulation state.

    Treat Reproducibility as a Core Capability

    A simulation may include random propagation, forgetting, or distortion. To make defects diagnosable, support fixed random seeds and record the initial state, rule version, and key events.

    In a controlled execution environment, identical inputs and rules should produce comparable results. If the system includes concurrency, external services, or nondeterministic text generation, record the relevant responses and event ordering as well. A random seed alone cannot guarantee reproducibility.

    Reproducibility turns “this result looks wrong” into “this specific step violated an expected rule,” substantially reducing debugging effort.

    4. Define Development Constraints for Every Agent

    After the design is agreed upon, create a shared development constraints document for implementers and reviewers. It should serve as a stable source of project rules rather than depend on a particular tool.

    Recommended contents include:

    1. Architecture boundaries: The interface layer must not directly modify core simulation state, and persistence details must not leak into domain rules.
    2. Change scope: Without approval, do not change public interfaces, introduce dependencies, or rewrite unrelated modules.
    3. Error handling: Reject invalid input explicitly rather than silently dropping it or reporting misleading success.
    4. Testing requirements: New rules must include tests for normal behavior, failure paths, and boundary conditions.
    5. Security requirements: Do not commit secrets, real personal data, or production credentials.
    6. Definition of done: The code runs, relevant tests pass, documentation is updated, and known limitations are disclosed.

    Make constraints checkable wherever possible. “Maintain high code quality” provides little basis for evaluation. “Every new state transition must include a test for an invalid transition” can be verified directly.

    Agent permissions also need limits. Apply least privilege by default, and require human confirmation for data deletion, environment changes, and other high-risk operations. Written constraints are not a substitute for enforced permission boundaries.

    5. Develop by Module, but Deliver an End-to-End Path First

    Organize Modules by Responsibility and Tasks by Acceptance Outcome

    A historical information-propagation system might include modules for character management, event management, observation generation, narrative transformation, propagation scheduling, record storage, and interface presentation.

    Completing every module before integration can cause interface problems to surface all at once. A better approach is to implement a minimal vertical slice first:

    Create an event → observe it through a character → generate a narrative → retell it to another character → save the version → display its provenance path.

    This path does not need many features, but it must run. Forgetting, bias, and merged propagation can then be added incrementally.

    Give Every Task Clear Inputs and Exit Criteria

    “Complete the propagation module” is not a sufficient task definition. An effective assignment specifies:

    • Which files the assistant may read and modify.
    • Which confirmed interfaces it depends on.
    • Which behaviors it must implement.
    • Which cases are currently out of scope.
    • Which tests it must add.
    • Which verification results it must provide when finished.

    Require a change summary, test results, and unresolved issues after completion. Claims about execution must be verifiable. In particular, “tests have been written” must not be treated as “tests have run and passed.”

    6. Use Cross-Review to Check Correctness, Not Just Style

    The reviewer should independently read the requirements, design contract, and actual code changes—not just the implementer’s summary.

    An audit can examine four layers.

    Requirements Compliance

    Does the functionality meet its acceptance criteria? Has the implementation added unrequested behavior? Were tests changed to conceal a deviation from the requirements?

    Domain Correctness

    Can characters acquire information they should not know? Does propagation break source relationships? Are historical versions overwritten? When multiple sources are merged, is their provenance preserved?

    Engineering Reliability

    Are exceptions handled? Can a failed update leave partial state behind? Are there risks of duplicate processing, concurrency conflicts, or resource leaks? As input size grows, do algorithmic and storage costs remain acceptable?

    Security and Data Protection

    Does the interface treat untrusted text as executable content? Can file operations escape allowed directories? Do logs expose sensitive data? Is external input validated appropriately?

    Each actionable finding should include minimal reproduction conditions or a test approach where possible. After a fix, the reviewer should verify the affected behavior rather than merely confirm that the code appears to have changed.

    7. Combine Automated Testing with Human Acceptance

    Do Not Let the Implementation Define the Correct Answer

    Tests should derive from requirements and state rules. If implementation and tests share the same unverified assumptions, both can be wrong while the entire suite still passes.

    For an information-propagation system, useful invariants include:

    • Every source reference must exist.
    • A new version must not reference itself, directly or indirectly.
    • A character that has not encountered information must not spontaneously possess the corresponding knowledge.
    • Querying historical versions must not change simulation state.
    • Historical records designated as immutable must remain unchanged during later propagation.

    Combine these invariants with example-based tests to cover a broader range of inputs.

    Build a Layered Test Strategy

    • Unit tests: Verify individual rules, such as memory decay and source selection.
    • Integration tests: Verify data flow between observation, propagation, and storage.
    • End-to-end tests: Verify that users can create an event and see the complete propagation result.
    • Property-based tests: Check that key invariants hold across many inputs.
    • Regression tests: Turn discovered defects into lasting safeguards.
    • Performance tests: Measure response times and resource use as character and version counts grow.

    Performance tests should specify the execution environment, data scale, and targets. Avoid claiming that a system is “fast enough” without that context.

    Human Acceptance Is More Than Finding Interface Bugs

    Human acceptance is particularly valuable for checking comprehensibility, interaction continuity, and business plausibility:

    • Can users distinguish facts, rumors, and opinions?
    • Is the provenance path easy to understand?
    • Are empty, loading, and failure states clear?
    • Does the interface remain usable on narrow screens, with long text, and through keyboard interaction?
    • Do simulation results reflect the intended mechanisms rather than merely feeling like a convincing story?

    When an interface problem appears, investigate its underlying cause. A display error may come from layout, state updates, caching, or concurrency. It should not automatically be classified as a visual defect.

    8. An Eight-Stage Workflow for Less-Experienced Developers

    For people without extensive software engineering training, the process can be organized into eight stages:

    1. Define a small, specific business goal.
    2. Break it into verifiable behaviors.
    3. Establish the domain model and key state rules.
    4. Ask an independent reviewer to identify design gaps.
    5. Finalize the design contract and development constraints.
    6. Implement the smallest complete workflow, then expand it incrementally.
    7. Audit and automatically verify every change.
    8. Perform human acceptance, record defects, and add regression tests.

    Maintain three lists throughout the project: confirmed requirements, unresolved disagreements, and known limitations. These help the owner distinguish what is complete, what remains undecided, and what is not yet supported—without losing project status in a large volume of generated content.

    Conclusion

    AI coding assistants are effective at implementing within clear boundaries, generating tests, and identifying local problems. Business modeling, trade-offs, and acceptance responsibility, however, cannot be delegated entirely to them.

    High-quality collaboration does not mean having several assistants discuss a proposal until they agree. It means establishing an evidence-based, verifiable, and traceable development process: define the model before coding, constrain the scope of changes, deliver a complete path before expanding complexity, use independent audits to find problems, test the fixes, and rely on human judgment to confirm value.

    When information representations, state transitions, and acceptance criteria are explicit, AI-assisted coding can move beyond rapid code generation toward reliable software delivery.