A Multi-Agent Consensus Protocol for Stable Software Remodularization

Ahmed F. Ibrahim · 2026

Read A Multi-Agent Consensus Protocol for Stable Software Remodularization by Ahmed F. Ibrahim (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-04188.txt.

Introduction

Ahmed F. Ibrahim recasts the task of reorganising old software into modules as a negotiation among software agents. Each agent speaks for part of a system and wants a grouping that keeps related code together while also staying stable as the code changes over time.

Ibrahim presents a protocol in which agents make one-way concessions until they agree, and he proves that the process ends and stays within set limits. Early tests on a made-up benchmark and a Java framework match strong search methods when stability limits are loose, and block harmful changes when those limits are tight.

Catalog record

CREATORAhmed F. Ibrahim
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE24 KB
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2605.04188

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

A Multi-Agent Consensus Protocol for Stable Software Remodularization Ahmed F. Ibrahim Abstract Automatic software remodularisation is typically cast as a single-objective optimization problem. While recent metaheuristics have improved search efficiency, real-world architecture recovery must reconcile the conflicting attributes of structural cohesion and evolutionary stability. We reframe software module clustering as a distributed consensus problem among autonomous agents. We introduce an Asymmetric Monotonic Concession Protocol (AMCP) that enables agents to negotiate decompositions that respect multi-attribute utility thresholds. We formally prove the protocol’s termination, its bounded concession behaviour consistent with the Zeuthen Strategy under closed‑instance conditions, and the local Pareto‑satisfactoriness of the resulting partitions. Preliminary experiments on a synthetic benchmark and the Xwork Java framework confirm that our negotiated consensus matches state‑of‑the‑art optimisers when stability budgets are loose, while acting as a “circuit breaker” to enforce strict stability constraints. Extended results on ten further systems, including comparisons with multi‑objective evolutionary algorithms and multi‑version chains, will be reported in a forthcoming full paper. I Introduction The way a software system is designed fundamentally shapes its maintainability and the resources required for its evolution. As systems grow and undergo continuous change, their originally neat module structures degrade, a phenomenon often termed architectural erosion. To address this, software clustering algorithms have been used to recover or improve modular organization by grouping source-code entities into cohesive, loosely coupled clusters [ 10 , 11 ] . Traditional clustering tools, such as Bunch [ 11 ] , treat remodularisation as a single-objective optimization problem: they search for a partition that maximizes a metric like TurboMQ, which rewards intra-module connections and penalizes inter-module coupling. While such an objective captures structural quality, it neglects a crucial pragmatic concern: evolutionary stability. A decomposition that changes dramatically from one release to the next, even if slightly more cohesive, imposes a heavy cognitive burden on developers who must re-learn the system layout. Thus, cohesion and stability often pull in opposite directions, yet existing optimizers are “budget-blind”. They either ignore stability entirely or merge it into a fixed weighted sum with arbitrary coefficients. In earlier work, we took a first step towards reconciling multiple clustering criteria with CC/G [ 4 , 5 ] , a centralized ensemble that fuses several clustering outputs into a single static consensus. Although CC/G improved over individual algorithms, it lacks the flexibility to adapt to differing stakeholder preferences or to enforce specific constraints on the accepted solution. The present work makes a qualitative leap forward: we replace the one-shot fusion with a dynamic, multi-agent negotiation. We propose to view software modularisation not as an optimization problem but as a distributed consensus problem among autonomous agents, each advocating a different quality attribute. A Cohesion Agent strives for maximal structural density, while a Stability Agent seeks to preserve the layout of the previous version. Through an Asymmetric Monotonic Concession Protocol (AMCP), these agents exchange concessions and gradually converge on a decomposition that respects explicit survival thresholds set by the architect. By adjusting the stability threshold \tau_{sta} , the architect can mathematically enforce a “stability budget” that the system cannot exceed. The main contributions of this work are twofold. First, we introduce a formal mathematical model of software remodularisation as a distributed consensus problem among autonomous utility-driven agents, and we propose the Asymmetric Monotonic Concession Protocol (AMCP) with formal proofs of its termination, its mapping to the Zeuthen Strategy, and its local Pareto-satisfactoriness (Lemmas 1–3). Second, we provide preliminary experimental evidence on a synthetic benchmark and on the real‑world Xwork framework, demonstrating the protocol’s core budget‑enforcement behavior. A more extensive empirical evaluation, covering ten additional systems and comparisons with multi‑objective evolutionary baselines, is deferred to a forthcoming full paper. The remainder of the paper is organized as follows. Section II reviews related work. Section III presents the mathematical framework and the AMCP protocol. Section IV presents the experimental setup and analysis on the Xwork dataset. Section V summarises preliminary findings on additional systems and outlines future work. Section VI concludes the paper. II Background and Related Work II-A Software Module Clustering Software remodularisation has been an active research area for more than two decades [ 10 , 11 ] . Bunch pioneered the field by formulating modularisation as a graph‑partitioning problem and using genetic algorithms to maximize a single‑value fitness function, TurboMQ [ 11 , 17 ] . Although Bunch finds good solutions, its approach remains single‑objective because cohesion and coupling are collapsed into one score [ 12 , 15 ] . Later work introduced more advanced search strategies and better scalability, but largely retained Bunch’s reliance on scalar fitness optimization. Techniques such as Sand Cat Swarm Optimization (SCSO), differential evolution, and chaos‑based heuristics have been used for Software Architecture Recovery (SAR), often improving on the earlier GA‑based results [ 2 , 3 , 8 ] . The Fast Clustering Algorithm (FCA) tackled scalability by working directly on the dependency matrix, enabling it to handle systems as large as Chromium [ 18 ] . Regardless of their improved search efficiency, these methods, including recent control‑flow‑aware GA variants [ 15 ] , still rely on scalar fitness functions. Consequently, they cannot reason about explicit design trade‑offs or enforce hard stability budgets. II-B Ensemble and Cooperative Clustering A different strand of work—ensemble clustering—attempts to address the limitation of single‑objective methods by aggregating the outputs of multiple algorithms, yet it too offers only a static compromise rather than a principled mechanism for managing trade‑offs. Ensemble clustering techniques, such as the author’s earlier CC/G [ 4 ] , attempt to combine multiple perspectives by fusing the outputs of several algorithms. CC/G operates in two phases: first, an agreement vector identifies sub‑clusters where the input clusterings concur; then a merging heuristic fuses those sub‑clusters into a final decomposition. Although this approach yields improved results, it represents a static, one‑shot compromise that cannot react to different architectural priorities or evolve incrementally as the system changes. II-C Multi‑Agent Negotiation at the Architecture Level The use of autonomous agents to negotiate quality‑attribute trade‑offs has shown promise at the high‑level architectural model level. Frameworks like SQuAT and DesignBots employ specialized agents (e.g., performance or modifiability “dbots”) that perform local optimizations before engaging in utility‑based negotiation to find balanced alternatives [ 14 , 13 , 16 ] . However, these systems manipulate models like Palladio (PCM), not source‑code dependency graphs. Although recent work has applied multi‑agent reasoning to dependency management [ 1 , 9 ] , the AMCP is the first to transpose the negotiation paradigm directly to the code level. By generalizing the concepts of cooperative grouping [ 6 ] into a decentralized protocol, we provide the first SAR framework that focuses on remodularization as a negotiation between quality‑driven agents with formal guarantees and practical stability budgets. III Mathematical Framework III-A Software Graph and Partitions A software system is modeled as a directed dependency graph G=(V,E) , where V is the set of modules (classes) and E the set of dependency edges. We assume two versions are available: the current dependency matrix \mathbf{DSM}_{curr} (an n\times n adjacency matrix) and the accepted decomposition of the previous version D_{prev} , which is a flat partition of a common set of modules V_{common}\subseteq V into k_{prev} clusters. A partition D assigns each module m\in

Read the complete text