Software traceability method and system based on multi-agent collaborative decision-making

By employing a multi-agent collaborative decision-making method, a structured requirement and code tracing chain is generated, which solves the problem of incomplete understanding of document and code dependencies in existing technologies, and achieves efficient and accurate software traceability and consistency detection.

CN121680790BActive Publication Date: 2026-06-09BEIJING HUAXIN MEASUREMENT & CONTROL TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING HUAXIN MEASUREMENT & CONTROL TECH CO LTD
Filing Date
2025-12-18
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing technologies lack a comprehensive understanding of the multi-level dependencies in documents when dealing with complex documents and multi-level code dependencies. This leads to incomplete or mismatched traceability chains between documents and code, reducing the accuracy of consistency detection and traceability chain generation. The application of multi-agent methods in software traceability still has research gaps.

Method used

The multi-agent collaborative decision-making method utilizes a requirement parsing agent and a code parsing agent to generate structured requirement representations and structured descriptions of code modules, respectively. The traceability chain generation agent generates a traceability chain between requirements and code, and the consistency judgment agent performs consistency judgment. Finally, the analysis report agent generates a software traceability analysis report.

Benefits of technology

It enables efficient and accurate traceability of complex documents and code, improves the accuracy and robustness of consistency detection, and can fully understand and correctly map the multi-level dependencies between documents and code, avoiding errors and delays caused by manual intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121680790B_ABST
    Figure CN121680790B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of software tracing, in particular to a software tracing method and system based on multi-agent collaborative decision-making, which comprises the following steps: acquiring an initial data set, wherein the initial data set comprises a requirement document and source code; using a requirement analysis agent to analyze the requirement document to generate a structured requirement representation, and simultaneously using a code analysis agent to analyze the source code to generate a code module structured description; and inputting the structured requirement representation and the code module structured description into a tracking chain generation agent. Through the division and cooperation of multiple agents, the application combines a knowledge base and a large language model to realize more efficient and accurate requirement and code tracing. The agent collaboration improves the processing capacity of complex tasks through a task allocation and feedback mechanism, and has a significant advantage in requirement change and multi-level dependency relationship processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software traceability technology, specifically to a software traceability method and system based on multi-agent collaborative decision-making. Background Technology

[0002] Currently, existing technologies have significant shortcomings in handling complex documents and multi-level code dependencies. Existing methods typically rely only on large models to extract code elements, lacking a comprehensive understanding of multi-level dependencies in documents. Especially when facing scenarios involving complex interactions between multiple classes, methods, and functions, the traceability chain between documents and code is often incomplete or mismatched, leading to reduced accuracy in consistency detection and traceability chain generation.

[0003] Furthermore, there are still some research gaps in the application of current multi-agent methods in software traceability. How to efficiently integrate large language models, knowledge bases and agent collaboration mechanisms, and how to handle multi-level dependencies remain technical challenges that urgently need to be addressed. Summary of the Invention

[0004] To achieve the above objectives, the present invention provides the following technical solution: a software tracing method based on multi-agent collaborative decision-making, comprising:

[0005] Obtain an initial dataset, which includes a requirements document and source code;

[0006] The requirement document is parsed using a requirement parsing agent to generate a structured requirement representation. At the same time, the source code is parsed using a code parsing agent to generate a structured description of the code modules.

[0007] The structured requirement representation and the structured description of the code module are input into the tracking chain generating agent, so that the tracking chain generating agent outputs the tracking chain between the requirement and the code, wherein the tracking chain is used to show the mapping relationship between the requirement and the code;

[0008] The tracing chain is input into the consistency judgment agent, which outputs the consistency judgment result between the requirements and the code. The consistency judgment result includes an identifier of whether there is an inconsistency between the requirements and the code and a specific description of the inconsistency.

[0009] The consistency judgment result is input into the analysis report agent, which then outputs a software traceability analysis report. The software traceability analysis report includes a summary of the consistency between requirements and code, as well as repair suggestions.

[0010] Preferably, the requirement document is parsed using a requirement parsing agent to generate a structured requirement representation, including:

[0011] The large language model is used to perform preliminary semantic analysis on the requirements document, and the preliminary semantic analysis results are obtained.

[0012] Based on the keywords and semantic features in the preliminary semantic analysis results, functional requirement recognition rules are set.

[0013] Based on the functional requirements identification rules, the preliminary semantic parsing results are traversed to identify paragraphs that meet the functional requirements of the rules.

[0014] The identified functional requirement-related paragraphs are combined to generate a functional requirement paragraph set.

[0015] For each paragraph in the set of functional requirement paragraphs, a large language model is used to perform deep semantic analysis to extract functional module description information, input and output identification information, functional logic description information, and boundary condition setting information.

[0016] Based on the preset structured requirements representation template, determine the corresponding positions of functional module descriptions, input / output identifiers, functional logic descriptions, and boundary condition settings in the template;

[0017] Fill the extracted functional module description information, input and output identification information, functional logic description information, and boundary condition setting information into the corresponding positions in the structured requirement representation template;

[0018] The format of the structured requirement representation template after the information is filled in is adjusted and the content is optimized to generate a structured requirement representation document. The structured requirement representation includes functional module descriptions, input and output identifiers, functional logic descriptions, and boundary condition settings.

[0019] Extract key information from the structured requirements document and generate a key information summary;

[0020] Output key information summaries to user terminals and receive feedback from user terminals on the key information summaries;

[0021] Based on user feedback, the structured requirements document was modified.

[0022] Preferably, for each paragraph in the set of functional requirement paragraphs, deep semantic analysis is performed using a large language model to extract functional module description information, input / output identification information, functional logic description information, and boundary condition setting information, including:

[0023] For each paragraph in the set of paragraphs with functional requirements, the data is input into the large language model again. The large language model performs semantic role labeling and semantic relationship analysis on the paragraphs.

[0024] Based on the semantic role labeling and semantic relationship analysis results, functional module description information, input and output identification information, functional logic description information, and boundary condition setting information are identified.

[0025] The identified information is organized and extracted to obtain the corresponding functional module description information, input and output identification information, functional logic description information, and boundary condition setting information.

[0026] Preferably, the source code is parsed using a code parsing agent to generate a structured description of the code modules, including:

[0027] The target source code is parsed using an abstract syntax tree parser to obtain the abstract syntax tree structure corresponding to the source code;

[0028] Traverse the abstract syntax tree structure, identify code blocks with specific identifiers or that conform to specific structural characteristics, and determine these code blocks as functional modules;

[0029] The name of each functional module is determined based on the comments within the functional modules, the naming rules for functions and classes, and the functional logic of the code.

[0030] Extract the subtree structure corresponding to each functional module from the abstract syntax tree structure, and convert the subtree structure into the corresponding code snippet;

[0031] For each functional module's code snippet, the abstract syntax tree structure is further parsed to identify the functions and classes contained within the functional module, and to determine the name of each function and class;

[0032] Locate function and class call nodes within the abstract syntax tree structure;

[0033] Based on the module location of the calling node, determine whether it is a call between functional modules or a call between functions or classes within a functional module;

[0034] Record the names of the initiator and the callee to form a list of call relationships between functional modules, functions, and classes;

[0035] In the abstract syntax tree substructure corresponding to the functional module, find the condition judgment node, determine the expression of the condition judgment and the execution logic of different branches;

[0036] Locate the loop structure node to determine the loop condition, loop body, and loop termination condition;

[0037] The conditional statements and loop structures are arranged according to their execution order in the code to form a description of the internal logic flow of the functional module.

[0038] Based on the name of the functional module, the extracted code snippets, the determined call relationships, and the sorted internal logic flow, a structured description of the code module is generated. The structured description of the code module includes the module name, module function, module call relationships, and module internal logic.

[0039] Preferably, the structured requirement representation and the structured description of the code module are input into the tracing chain generating agent, such that the tracing chain generating agent outputs the tracing chain between the requirement and the code, including:

[0040] Natural language processing techniques are used to perform semantic parsing on each requirement module in the structured requirement representation, and the semantic feature vector of each requirement module is extracted.

[0041] Semantic parsing is performed on each code module in the structured description of the code modules to extract the semantic feature vector of each code module;

[0042] Input the semantic feature vectors of the requirement module and the code module into the large language model;

[0043] The similarity between the semantic feature vector of each requirement module and the semantic feature vector of each code module is calculated using a large language model.

[0044] Based on the similarity calculation results, the most matching code module for each requirement module is determined, and the correspondence between requirement modules and code modules is obtained;

[0045] Based on the correspondence, a tracing chain between requirements and code is generated through semantic analysis and mapping. The tracing chain displays the relationship between requirements and code in a structured form and indicates the code module corresponding to each functional requirement.

[0046] Preferably, based on the correspondence, a tracing chain between requirements and code is generated through semantic analysis and mapping, including:

[0047] Based on the correspondence between requirement modules and code modules, determine the code module corresponding to each requirement module;

[0048] For each requirement module, analyze the mapping relationship between its required functional points and the internal logic of the corresponding code module;

[0049] Based on the mapping relationship, the requirement module is associated with the corresponding code module, forming a tracing chain node between the requirement and the code;

[0050] Connect all trace chain nodes in the order of the requirement modules to obtain a complete trace chain between requirements and code.

[0051] Preferably, the tracing chain is input into a consistency judgment agent, causing the consistency judgment agent to output a consistency judgment result between the requirement and the code, including:

[0052] Natural language processing technology is used to segment and semantically analyze the requirement descriptions in the tracking chain, extracting the core words and key semantics in the requirement descriptions to form the key information of the requirement descriptions;

[0053] The required functional points are analyzed one by one to determine the specific requirements and expected effects of each functional point, thus forming the key information of the required functional points.

[0054] The code module names are standardized to remove redundant information and extract the core module name identifiers;

[0055] Semantic analysis is performed on the code module functions to extract the main functions and key operations implemented by the code module, forming key information of the code module functions. The key information in the requirements section includes the requirement description and requirement function points, while the key information in the code section includes the code module name and code module functions.

[0056] Compare the key information in the requirement description with the reasonable range of requirements in the knowledge base to determine whether the requirement description is within a reasonable range;

[0057] The key information of the required functional points is initially matched with the common requirements and code correspondence patterns in the knowledge base to filter out possible corresponding code patterns.

[0058] Compare the key information of the code module name and code module function with the code style requirements in the knowledge base to determine whether the code module conforms to the style requirements;

[0059] A detailed comparison was made between the key information of the code module functions and the common requirements and code correspondence patterns initially matched, to further verify the correspondence between the code modules and the functional points of the requirements.

[0060] Based on the comparison results, a large language model is used to reason about whether the requirements are reasonable and whether the code complies with regulations;

[0061] Based on the results of reasoning and rule checks, determine whether the requirements match the code; if they match, proceed to the next step; if they do not match, mark the inconsistencies between the requirements and the code.

[0062] Based on the matching results and the marked inconsistencies, a consistency judgment result between requirements and code is generated.

[0063] Preferably, the knowledge base and the agent interact through a retrieval-enhanced generative technology framework. The agent generates a query based on task requirements and sends the query to the knowledge base for information retrieval. The knowledge base uses a vector database and knowledge graph to perform retrieval based on the vector representation of the query, and returns the documents, code segments, and design specifications most relevant to the query semantics. The agent generates further reasoning results based on the retrieval results and its own knowledge.

[0064] Preferably, the knowledge base and the agent interact through a retrieval-enhanced generative technology framework. The agent generates a query based on task requirements and sends the query to the knowledge base for information retrieval. The knowledge base uses a vector database and knowledge graph to perform retrieval based on the vector representation of the query, returning documents, code snippets, and design specifications most relevant to the query semantics. The agent then generates further reasoning results based on the retrieval results and its own knowledge, including:

[0065] The agent generates initial query content based on task requirements and sends the initial query content to the knowledge base;

[0066] After receiving the initial query content, the knowledge base uses a pre-defined semantic vectorization model to convert the initial query content into a vector representation to obtain the query vector.

[0067] The vector database stores a large number of vectors corresponding to documents, and each document vector is semantically related to the document content.

[0068] The knowledge base calculates the similarity between the query vector and the document vectors in the vector database, using a preset similarity calculation method;

[0069] Based on the similarity calculation results, several document vectors with similarity higher than the preset similarity threshold are selected as candidate document vectors.

[0070] The knowledge base starts with the semantic concept corresponding to the query vector in the preset knowledge graph, expands the retrieval according to the preset node association rules, obtains knowledge graph node information related to the query semantics, and locates the relevant documents, code segments and design specifications corresponding to these nodes.

[0071] The knowledge base integrates the documents corresponding to the candidate document vectors obtained from the initial retrieval of the vector database with the relevant documents, code segments, and design specifications obtained from the knowledge graph retrieval. After removing duplicate content, the documents are sorted according to semantic relevance, and the documents, code segments, and design specifications most relevant to the query semantics are returned to the agent as the retrieval results.

[0072] After receiving the search results, the intelligent agent combines its existing knowledge to conduct in-depth analysis and reasoning on the search results.

[0073] A software traceability system based on multi-agent collaborative decision-making, applicable to the aforementioned software traceability method based on multi-agent collaborative decision-making, includes:

[0074] A data acquisition unit is used to acquire an initial dataset, wherein the initial dataset includes a requirements document and source code;

[0075] The text parsing unit is used to parse the requirement document using a requirement parsing agent to generate a structured requirement representation, and at the same time, to parse the source code using a code parsing agent to generate a structured description of the code modules.

[0076] The requirement tracing unit is used to input the structured requirement representation and the structured description of the code module into the tracing chain generating agent, so that the tracing chain generating agent outputs the tracing chain between the requirement and the code, wherein the tracing chain is used to show the mapping relationship between the requirement and the code;

[0077] A consistency judgment unit is used to input the tracing chain into a consistency judgment agent, so that the consistency judgment agent outputs a consistency judgment result between the requirements and the code, wherein the consistency judgment result includes an identifier of whether there is an inconsistency between the requirements and the code and a specific description of the inconsistency.

[0078] The report generation unit is used to input the consistency judgment result into the analysis report agent, so that the analysis report agent outputs a software traceability analysis report, wherein the software traceability analysis report includes a summary of the consistency between requirements and code and repair suggestions.

[0079] Compared with the prior art, the beneficial effects of the present invention are:

[0080] This invention achieves more efficient and accurate requirement and code tracing through the division of labor and cooperation among multiple intelligent agents, combined with a knowledge base and a large language model. The intelligent agent collaboration improves the processing capability of complex tasks through task allocation and feedback mechanisms, especially in the handling of requirement changes and multi-level dependencies. The introduction of a tracing chain generation and comparison method improves the accuracy and robustness of consistency detection compared to traditional direct comparison.

[0081] This invention utilizes multi-agent collaboration based on a large model. First, it uses static analysis tools to extract key code elements such as classes, methods, and attributes from the source code. Then, it leverages agents to perform deep semantic understanding and reasoning on these code elements. The agents can not only understand the function of a single code element, but also identify the multi-level functional relationships described in the document by reasoning and analyzing the complex relationships between code elements.

[0082] This invention generates accurate documents and traceability chains through intelligent agent collaboration, ensuring a comprehensive understanding and correct mapping of multi-level dependencies between documents and code. The agents, combined with code elements extracted by static analysis tools, perform semantic reasoning, enabling them to understand the complex functional relationships described in the documents and avoiding the shortcomings of existing methods that cannot understand multi-level dependencies. It can accurately handle complex dependencies involving multiple code modules, classes, and methods, ensuring the integrity and accuracy of the traceability chain between documents and code. Through a multi-agent system, it achieves full automation of document generation, traceability chain construction, and consistency detection, avoiding errors and delays caused by manual intervention. Attached Figure Description

[0083] Figure 1 This is a flowchart of the multi-agent workflow in one embodiment of the present invention;

[0084] Figure 2 This is a schematic flowchart of the overall method in one embodiment of the present invention;

[0085] Figure 3 This is a schematic diagram of the overall system architecture in one embodiment of the present invention.

[0086] In the diagram: 1. Data acquisition unit; 2. Text parsing unit; 3. Requirement tracking unit; 4. Consistency judgment unit; 5. Report generation unit. Detailed Implementation

[0087] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0088] Example 1, please refer to Figure 1 This invention provides a technical solution: a software tracing method based on multi-agent collaborative decision-making, comprising:

[0089] S1. Obtain the initial dataset, which includes the requirements document and source code;

[0090] S2. Use the requirement parsing agent to parse the requirement document and generate a structured requirement representation. At the same time, use the code parsing agent to parse the source code and generate a structured description of the code modules.

[0091] S3. Input the structured requirement representation and the structured description of the code module into the trace chain generating agent, so that the trace chain generating agent outputs the trace chain between the requirement and the code, wherein the trace chain is used to show the mapping relationship between the requirement and the code.

[0092] S4. Input the tracing chain into the consistency judgment agent, so that the consistency judgment agent outputs the consistency judgment result between the requirements and the code. The consistency judgment result includes an indicator of whether there is an inconsistency between the requirements and the code and a specific description of the inconsistency.

[0093] S5. Input the consistency judgment result into the analysis report agent, so that the analysis report agent outputs the software traceability analysis report, which includes a summary of the consistency between requirements and code and repair suggestions.

[0094] It should be noted that building a knowledge base that supports software traceability is the core of achieving automated consistency detection; the choice of data source directly affects the quality of the knowledge base and the reasoning ability of the agent; therefore, a knowledge base structure containing multiple data sources was designed to ensure that the knowledge base can provide rich background information and support the agent's efficient reasoning.

[0095] To effectively support agents in generating consistency checks and remediation suggestions, the knowledge base's data sources are divided into two main categories: internal data sources and external data sources. Internal data sources include requirements documents and code, while external data sources include industry standards and design specifications. Details are as follows:

[0096] Internal data source:

[0097] Requirements document: The requirements document defines the functional and non-functional requirements of the system and is the basis for the agent to judge the consistency between requirements and code. The requirements document is usually written by the project manager and includes system function descriptions, interface requirements, performance standards, etc. In the knowledge base, the requirements document will be parsed into structured functional requirement items for the agent to match with the code during the consistency detection process.

[0098] Source code: Source code is the implementation carrier of functional requirements. It transforms the functions described in the requirements document into actual business logic and processing procedures. In the knowledge base, the source code is processed through an abstract syntax tree to extract key modules and functions, forming a functional description that can be understood by the intelligent agent, and matching it with the functional requirements in the requirements document.

[0099] External data source:

[0100] Design specifications and industry standards: Design specifications and industry standards provide best practices and unified standards for the development process, ensuring that system design and implementation meet technical requirements; these specifications and standards will be stored as background knowledge in a knowledge base, and agents can check the implementation of requirements and code according to industry standards;

[0101] Frequently Asked Questions and Solutions: This section provides a reference for common problems and their solutions for intelligent agents, helping them identify common error types during consistency checks and offering correct remediation suggestions.

[0102] To build an efficient and scalable knowledge base, all data sources need to undergo preprocessing, standardization, and structuring. For requirement documents, a requirement understanding agent is used to extract the core content of the documents, and this data will be converted into a structured format (JSON) for storage, facilitating subsequent querying and analysis. For code, a code parsing agent uses an abstract syntax tree to parse the module composition and calling relationships between code, facilitating the matching of requirements with code. Design specifications and industry standards are semantically analyzed using a large language model to extract and associate effective information into the knowledge base.

[0103] To achieve efficient data access and retrieval, the knowledge base's storage structure must be able to support large-scale data storage, efficient retrieval, and flexible data updates. A diverse range of storage structures were adopted, combining the advantages of vector databases and knowledge graphs to construct a flexible and scalable storage solution.

[0104] Vector databases are a storage method based on the vector space model, suitable for handling semantic matching tasks of text and code. By converting data such as requirement documents, source code, and design specifications into vector representations, efficient retrieval and matching can be achieved by calculating the similarity between vectors. The specific process is as follows:

[0105] Data vectorization:

[0106] Semantic coding models are used to convert text data into vector representations. Vector representations can capture the semantic information of text, so that semantically similar texts can be mapped to similar vector spaces. For source code, code understanding models are used to convert code snippets into vector representations, which can handle the semantic mapping between code and requirements documents.

[0107] Semantic retrieval:

[0108] Vector databases enable semantic similarity-based retrieval through vectorized queries; agents can retrieve the most similar entries in the vector database based on the query vector of the required document or code snippet; this method allows agents to quickly obtain documents or code related to the query, achieving efficient semantic matching.

[0109] Knowledge graphs can express the relationships between entities and are an effective tool for storing and reasoning about complex relationships. In a knowledge base, knowledge graphs are used to represent the relationships between entities such as requirement documents, code modules, design specifications, and error cases. By storing these relationships in a graph database, intelligent agents can perform cross-module relationship queries and reasoning.

[0110] Knowledge graph construction:

[0111] Graph databases (such as Neo4j, ArangoDB, AmazonNeptune, etc.) are used to model entities of data such as requirements documents, source code, and design specifications as graph nodes. Edges between nodes represent functional implementations, dependencies, and connections between code modules.

[0112] Relationship lookup:

[0113] Through the node relationships in the knowledge graph, the intelligent agent can efficiently query the associations between requirement documents, code and design specifications, and can also infer new relationships or information based on existing data;

[0114] The interaction between the knowledge base and the agent is based on Retrieval Augmentation (RAG) technology, using the RAG framework RAGFlow. RAG combines two key processes: information retrieval and augmentation generation. It enhances the agent's reasoning ability through information in the knowledge base, generating more accurate and relevant outputs. Specifically, the agent retrieves relevant background knowledge by querying the knowledge base, and then combines the retrieved information with the capabilities of the generative model to generate consistency detection results, repair suggestions, or other decision support information. The interaction process is as follows:

[0115] Query generation:

[0116] The agent first generates a query based on the task requirements;

[0117] Information retrieval:

[0118] After the query is generated, the agent sends the query to the knowledge base for information retrieval. At this stage, the knowledge base will use vector databases and knowledge graphs to perform retrieval based on the vector representation of the query, and return information such as documents, code segments, and design specifications that are most relevant to the semantics of the query.

[0119] Enhanced generation:

[0120] After the retrieval results are returned, the agent generates further reasoning results based on the returned information and its own knowledge; this process combines knowledge base information with the agent's reasoning ability to ensure that the generated results are based on relevant background knowledge.

[0121] In summary, a software traceability knowledge base was constructed, supporting multiple data sources such as requirement documents, source code, and design specifications. Through a well-designed storage structure and an efficient retrieval mechanism, the knowledge base can provide accurate background support for intelligent agents, helping them to perform consistency checks and generate repair suggestions.

[0122] The collaboration mechanism between agents is crucial, especially in multi-agent systems. Efficient task allocation and data sharing are the foundation for ensuring smooth system operation. Agents collaborate through data sharing and feedback mechanisms to ensure that each agent receives the latest input and processes it according to task requirements.

[0123] Data sharing: Intelligent agents exchange information by sending messages to each other; for example, the requirement understanding agent sends the structured requirement representation to the tracking chain generating agent, and the code parsing agent passes the parsing results of the code module to the tracking chain generating agent, which finally generates the input for consistency judgment;

[0124] Feedback mechanism: When the information obtained by a certain agent is not accurate enough, it can be fed back to the previous agent. The previous agent can then adjust its task based on the feedback received. For example, when the consistency judgment agent finds that the tracking chain is not complete, it provides corresponding suggestions to the tracking chain generating agent. The tracking chain generating agent adjusts based on the feedback and regenerates the tracking chain. The feedback mechanism between agents enables the system to continuously adjust and optimize the task processing strategy based on the actual results during execution.

[0125] In a multi-agent system, task allocation and workflow are crucial for ensuring efficient system execution. In this system, five agents are each responsible for specific tasks and collaborate with each other. Through reasonable task allocation and effective workflow, a tracing chain is ultimately generated, and consistency checks and repair suggestions are generated. The workflow of the multi-agent system is described in detail below, including the data preprocessing stage, the tracing chain generation stage, the consistency judgment stage, and the repair suggestion generation stage.

[0126] During the data preprocessing stage, the requirement understanding agent and the code parsing agent will handle their respective tasks, parsing the requirement document and the source code respectively. To ensure the efficiency and accuracy of the entire system, the tasks of the two agents are carried out in parallel in time, which can reduce waiting time and improve overall efficiency.

[0127] The requirement understanding agent uses a large language model to understand the functional requirements in the document, extracts the description of each functional module, including information such as input, output, and functional logic, and generates a structured requirement representation, providing input data for subsequent trace chain generation and consistency detection; the code parsing agent parses the functional modules in the source code, identifies the calling relationships between modules, and generates a structured description of code modules and functions, providing code-level input data for trace chain generation.

[0128] Once the requirement understanding agent and the code parsing agent have completed the data preprocessing tasks, they pass the generated structured requirement representation and code module information to the trace chain generation agent. The trace chain generation agent is responsible for generating the trace chain based on the mapping relationship between the requirements and the code, which is the core link of the entire system.

[0129] The trace chain generation agent first combines the outputs of the requirement understanding agent and the code parsing agent to analyze the correspondence between each requirement module and the code module. This process involves a large amount of semantic analysis and mapping generation to ensure that each requirement point can be matched one-to-one with the implementation part in the code. Next, through a large language model, the trace chain generation agent generates a trace chain between requirements and code. The generated trace chain will display the relationship between requirements and code in a structured form and indicate the code module corresponding to each functional requirement. The generated trace chain will serve as the input for the subsequent consistency judgment agent to ensure that consistency detection can be based on the accurate mapping between requirements and code.

[0130] During the consistency judgment phase, the consistency judgment agent is responsible for analyzing the tracing chain and determining whether there are any inconsistencies between the requirements and the code. The goal of this phase is to identify the differences between the requirements and the code and expose potential problems in the system.

[0131] The consistency judgment agent first receives the trace chain generated by the agent and analyzes the correspondence between requirements and code modules. Then, by comparing it with background knowledge in the knowledge base, the agent judges whether the requirements are reasonable and whether the code conforms to the specifications. Next, using a large language model, the consistency judgment agent determines whether the requirements and code match through reasoning and rule checking. The agent checks for missing functions, incorrect implementations, or code parts that deviate from the specifications. Finally, the consistency judgment agent marks the inconsistent parts between the requirements and the code, clarifies the differences between the code and the requirements, and provides input to the repair suggestion agent.

[0132] The analysis report generation phase is the final stage of the multi-agent system; in this phase, the analysis report agent generates an analysis report based on the inconsistent results provided by the consistency judgment agent.

[0133] The analysis report agent first analyzes the output provided by the consistency judgment agent to identify specific inconsistencies between requirements and code. The agent uses these inconsistencies as the basis for generating the analysis report. Based on the consistency judgment results, the analysis report agent uses a large language model, combined with common errors and solutions in the knowledge base, to generate the analysis report and remediation suggestions.

[0134] In an optional embodiment, a requirement parsing agent is used to parse the requirement document and generate a structured requirement representation, including:

[0135] The large language model is used to perform preliminary semantic analysis on the requirements document, and the preliminary semantic analysis results are obtained.

[0136] Based on the keywords and semantic features in the preliminary semantic analysis results, functional requirement recognition rules are set.

[0137] Based on the functional requirements identification rules, the preliminary semantic parsing results are traversed to identify paragraphs that meet the functional requirements of the rules.

[0138] The identified functional requirement-related paragraphs are combined to generate a functional requirement paragraph set.

[0139] For each paragraph in the set of functional requirement paragraphs, a large language model is used to perform deep semantic analysis to extract functional module description information, input and output identification information, functional logic description information, and boundary condition setting information.

[0140] Based on the preset structured requirements representation template, determine the corresponding positions of functional module descriptions, input / output identifiers, functional logic descriptions, and boundary condition settings in the template;

[0141] Fill the extracted functional module description information, input and output identification information, functional logic description information, and boundary condition setting information into the corresponding positions in the structured requirement representation template;

[0142] The format of the structured requirement representation template after the information is filled in is adjusted and the content is optimized to generate a structured requirement representation document. The structured requirement representation includes functional module descriptions, input and output identifiers, functional logic descriptions, and boundary condition settings.

[0143] Extract key information from the structured requirements document and generate a key information summary;

[0144] Output key information summaries to user terminals and receive feedback from user terminals on the key information summaries;

[0145] Based on user feedback, the structured requirements document was modified.

[0146] It should be noted that the requirements document is initially parsed using a large language model (such as GPT-3 / 4) to extract keywords and basic semantic information. For example, suppose a requirement document contains the description: "The system should allow users to register and manage their personal information." After initial parsing, the keywords "user registration" and "manage personal information" can be obtained. Functional requirement identification rule setting: Rules are set based on the initial parsing results to identify functional requirements. For example, functional requirement identification rules may include a "verb + noun phrase" structure, such as "allow + user registration" or "manage + personal information." Functional requirement related paragraph identification: The initial parsing results are traversed to identify paragraphs that conform to the functional requirement rules. For example, "The system should allow users to register and manage their personal information" is identified as conforming to the above rules. Functional requirement paragraph set generation: The identified paragraphs are combined to generate a functional requirement paragraph set. For example, the set may contain: "allow users to register" and "manage personal information." Deep semantic analysis: Each paragraph in the functional requirement paragraph set is analyzed in depth to extract more detailed information. For example, for "allow users to register," the following can be extracted: Functional module description: User registration module; Input / output labels. Information input: Input (username, password, email), output (registration confirmation information); Functional logic description information: After the user fills in the information and submits it, the system verifies the validity of the information; Boundary condition setting information: Usernames must be unique, and passwords must be at least 6 characters long; Determine the corresponding position in the structured requirements representation template: Determine the position of various types of information in the template according to the preset template; Example: Place the "User Registration Module" in the position of the functional module description, and fill in the corresponding fields with the input and output information; Fill the extracted information into the structured requirements representation template, and adjust the format and optimize the content to generate the final document; Example: The final document will clearly list the functional description and related information of the user registration module; Extract key information from the structured requirements representation document to generate a summary; Example: The summary may be "User Registration Module: Allows users to register using username, password, and email, and must ensure that the username is unique and the password is at least 6 characters long"; Output the summary to the user terminal and receive feedback; Example: After seeing the summary, the user may provide feedback: "Please add requirements regarding password strength"; Adjust the structured requirements representation document according to user feedback; Example: Update the document and add password strength requirements, such as "Passwords must contain letters and numbers".

[0147] In an optional embodiment, for each paragraph in the set of functional requirement paragraphs, deep semantic analysis is performed using a large language model to extract functional module description information, input / output identification information, functional logic description information, and boundary condition setting information, including:

[0148] For each paragraph in the set of paragraphs with functional requirements, the data is input into the large language model again. The large language model performs semantic role labeling and semantic relationship analysis on the paragraphs.

[0149] Based on the semantic role labeling and semantic relationship analysis results, functional module description information, input and output identification information, functional logic description information, and boundary condition setting information are identified.

[0150] The identified information is organized and extracted to obtain the corresponding functional module description information, input and output identification information, functional logic description information, and boundary condition setting information.

[0151] In an optional embodiment, a code parsing agent is used to parse the source code and generate a structured description of the code modules, including:

[0152] The target source code is parsed using an abstract syntax tree parser to obtain the abstract syntax tree structure corresponding to the source code;

[0153] Traverse the abstract syntax tree structure, identify code blocks with specific identifiers or that conform to specific structural characteristics, and determine these code blocks as functional modules;

[0154] The name of each functional module is determined based on the comments within the functional modules, the naming rules for functions and classes, and the functional logic of the code.

[0155] Extract the subtree structure corresponding to each functional module from the abstract syntax tree structure, and convert the subtree structure into the corresponding code snippet;

[0156] For each functional module's code snippet, the abstract syntax tree structure is further parsed to identify the functions and classes contained within the functional module, and to determine the name of each function and class;

[0157] Locate function and class call nodes within the abstract syntax tree structure;

[0158] Based on the module location of the calling node, determine whether it is a call between functional modules or a call between functions or classes within a functional module;

[0159] Record the names of the initiator and the callee to form a list of call relationships between functional modules, functions, and classes;

[0160] In the abstract syntax tree substructure corresponding to the functional module, find the condition judgment node, determine the expression of the condition judgment and the execution logic of different branches;

[0161] Locate the loop structure node to determine the loop condition, loop body, and loop termination condition;

[0162] Arrange conditional statements and loop structures according to their execution order in the code to form a description of the internal logical flow of the functional module;

[0163] Based on the name of the functional module, the extracted code snippets, the determined call relationships, and the sorted internal logic flow, a structured description of the code module is generated. The structured description of the code module includes the module name, module function, module call relationships, and module internal logic.

[0164] In an optional embodiment, a structured requirement representation and a structured description of code modules are input into a tracing chain generating agent, causing the tracing chain generating agent to output a tracing chain between the requirements and the code, including:

[0165] Natural language processing techniques are used to perform semantic parsing on each requirement module in the structured requirement representation, and the semantic feature vector of each requirement module is extracted.

[0166] Semantic parsing is performed on each code module in the structured description of the code modules to extract the semantic feature vector of each code module;

[0167] Input the semantic feature vectors of the requirement module and the code module into the large language model;

[0168] The similarity between the semantic feature vector of each requirement module and the semantic feature vector of each code module is calculated using a large language model.

[0169] Based on the similarity calculation results, the most matching code module for each requirement module is determined, and the correspondence between requirement modules and code modules is obtained;

[0170] Based on the correspondence, a tracing chain between requirements and code is generated through semantic analysis and mapping. The tracing chain displays the relationship between requirements and code in a structured form and indicates the code module corresponding to each functional requirement.

[0171] It should be noted that natural language processing techniques are used to perform semantic parsing on each requirement module in the structured requirement representation, extracting the semantic feature vector of each requirement module. These feature vectors are mathematical representations of the requirement modules, capturing their main semantic information. Example: Requirement module: Users can view order details; the feature vector obtained after semantic parsing might be represented as: [0.2, 0.8, 0.5, ...]. Semantic parsing of code modules: The same semantic parsing is performed on each code module in the structured description of the code modules, extracting the semantic feature vector of each code module. Example: Code module: getOrderDetails(); the feature vector obtained after semantic parsing might be represented as: [0.3, 0.9, 0.4, ...]. Calculating similarity: The semantic feature vectors of the requirement modules and the code modules are input into a large language model (such as BERT, GPT, etc.), and the cosine similarity or other similarity between them is calculated. Similarity metrics are used to assess the relevance between each requirement module and each code module. Example: Calculated similarity results: the similarity between "viewing order details" and `getOrderDetails()` is 0.95; the similarity between "modifying an order" and `updateOrder()` is 0.90. Determining the correspondence: Based on the similarity calculation results, the most matching code module for each requirement module is determined, forming a correspondence between requirement modules and code modules. Example: Requirement module: "viewing order details" -> Code module: `getOrderDetails()`; Requirement module: "modifying an order" -> Code module: `updateOrder()`. Based on the above correspondence, a tracing chain between requirements and code is generated through semantic analysis and mapping. This tracing chain displays the association between requirements and code in a structured form, indicating the code module corresponding to each functional requirement. Example: The tracing chain might look like this:

[0172] {

[0173] "Tracking Chain":[

[0174] {

[0175] "Requirement": "Users can view order details",

[0176] "Corresponding code module":"getOrderDetails()"

[0177] },

[0178] {

[0179] "Requirement": "Users can modify orders",

[0180] "Corresponding code module":"updateOrder()"

[0181] }

[0182] In an optional embodiment, based on the correspondence, a tracing chain between requirements and code is generated through semantic analysis and mapping generation, including:

[0183] Based on the correspondence between requirement modules and code modules, determine the code module corresponding to each requirement module;

[0184] For each requirement module, analyze the mapping relationship between its required functional points and the internal logic of the corresponding code module;

[0185] Based on the mapping relationship, the requirement module is associated with the corresponding code module, forming a tracing chain node between the requirement and the code;

[0186] Connect all trace chain nodes in the order of the requirement modules to obtain a complete trace chain between requirements and code.

[0187] It should be noted that, based on the previous semantic analysis, the corresponding code module for each requirement module is determined. For example, suppose there are the following requirements and their corresponding code modules: Requirement module: Users can view order details; Corresponding code module: getOrderDetails(); Requirement module: Users can modify orders; Corresponding code module: updateOrder(); Analyze the mapping relationship between requirement functionalities and the internal logic of the code modules: For each requirement module, analyze the mapping relationship between its core functionalities and the internal logic of the corresponding code module. This process requires understanding how the functions described by the requirement module are implemented in the code. Example: Requirement module: Users can view order details; Functionalities include: obtaining order information, displaying order status, and displaying order items; Corresponding code module: getOrderDetails(); The internal logic of the module may include: querying order information from the database. Format order data; return to the user interface; Requirement module: Users can modify orders; Functional points include: getting order information, modifying order content, and saving changes; Corresponding code module: updateOrder(); Internal logic of the module may include: validating user input; updating order information in the database; returning the update result; Forming a mapping relationship: Based on the above analysis, record the mapping relationship between the requirement module and the corresponding code module; Example: Mapping relationship: Users can view order details <-> getOrderDetails() contains the logic for getting and displaying order information; Users can modify orders <-> updateOrder() contains the logic for modifying and saving order information; Generating tracking chain nodes: Transform the mapping relationship into nodes of the tracking chain, each node containing the mapping information of the requirement module, the corresponding code module, and their functional points and logic; Example: Tracking chain node:

[0188] {

[0189] "Tracing chain nodes":[

[0190] {

[0191] "Requirement": "Users can view order details",

[0192] "Corresponding code module":"getOrderDetails()",

[0193] "Mapping relationship":[

[0194] "Get Order Information"

[0195] "Show order status",

[0196] "Show order items" ]

[0198] },

[0199] {

[0200] "Requirement": "Users can modify orders",

[0201] "Corresponding code module":"updateOrder()",

[0202] "Mapping relationship":[

[0203] "Get Order Information"

[0204] "Modify order details"

[0205] Save changes ]

[0207] }

[0208] ]};

[0209] Connect the trace chain nodes: Connect all trace chain nodes in the order of the requirement modules to form a complete trace chain between requirements and code;

[0210] Final tracing chain example: {

[0211] "Complete tracking chain":[

[0212] {

[0213] "Requirement": "Users can view order details",

[0214] "Corresponding code module":"getOrderDetails()",

[0215] "Mapping relationship":[

[0216] "Get Order Information"

[0217] "Show order status",

[0218] "Show order items" ]

[0220] },

[0221] {

[0222] "Requirement": "Users can modify orders",

[0223] "Corresponding code module":"updateOrder()",

[0224] "Mapping relationship":[

[0225] "Get Order Information"

[0226] "Modify order details"

[0227] Save changes ]

[0229] }

[0230] ]}.

[0231] In an optional embodiment, the tracing chain is input into a consistency-determining agent, causing the agent to output a consistency determination result between the requirements and the code, including:

[0232] Natural language processing technology is used to segment and semantically analyze the requirement descriptions in the tracking chain, extracting the core words and key semantics in the requirement descriptions to form the key information of the requirement descriptions;

[0233] The required functional points are analyzed one by one to determine the specific requirements and expected effects of each functional point, thus forming the key information of the required functional points.

[0234] The code module names are standardized to remove redundant information and extract the core module name identifiers;

[0235] Semantic analysis is performed on the code module functions to extract the main functions and key operations implemented by the code module, forming key information of the code module functions. The key information in the requirements section includes the requirement description and requirement function points, while the key information in the code section includes the code module name and code module functions.

[0236] Compare the key information in the requirement description with the reasonable range of requirements in the knowledge base to determine whether the requirement description is within a reasonable range;

[0237] The key information of the required functional points is initially matched with the common requirements and code correspondence patterns in the knowledge base to filter out possible corresponding code patterns.

[0238] Compare the key information of the code module name and code module function with the code style requirements in the knowledge base to determine whether the code module conforms to the style requirements;

[0239] A detailed comparison was made between the key information of the code module functions and the common requirements and code correspondence patterns initially matched, to further verify the correspondence between the code modules and the functional points of the requirements.

[0240] Based on the comparison results, a large language model is used to reason about whether the requirements are reasonable and whether the code complies with regulations;

[0241] Based on the results of reasoning and rule checks, determine whether the requirements match the code; if they match, proceed to the next step; if they do not match, mark the inconsistencies between the requirements and the code.

[0242] Based on the matching results and the marked inconsistencies, a consistency judgment result between requirements and code is generated.

[0243] In an optional embodiment, the knowledge base and the agent interact through a retrieval-enhanced generative technology framework. The agent generates a query based on task requirements and sends the query to the knowledge base for information retrieval. The knowledge base performs retrieval using a vector database and knowledge graph based on the vector representation of the query, and returns the documents, code snippets, and design specifications most relevant to the query semantics. The agent generates further reasoning results based on the retrieval results and its own knowledge.

[0244] In an optional embodiment, the knowledge base and the agent interact through a retrieval-enhanced generative technology framework. The agent generates a query based on task requirements and sends the query to the knowledge base for information retrieval. The knowledge base performs retrieval using a vector database and knowledge graph based on the vector representation of the query, returning documents, code snippets, and design specifications most relevant to the query semantics. The agent generates further reasoning results based on the retrieval results and its own knowledge, including:

[0245] The agent generates initial query content based on task requirements and sends the initial query content to the knowledge base;

[0246] After receiving the initial query content, the knowledge base uses a pre-defined semantic vectorization model to convert the initial query content into a vector representation to obtain the query vector.

[0247] The vector database stores a large number of vectors corresponding to documents, and each document vector is semantically related to the document content.

[0248] The knowledge base calculates the similarity between the query vector and the document vectors in the vector database, using a preset similarity calculation method;

[0249] Based on the similarity calculation results, several document vectors with similarity higher than the preset similarity threshold are selected as candidate document vectors.

[0250] The knowledge base starts with the semantic concept corresponding to the query vector in the preset knowledge graph, expands the retrieval according to the preset node association rules, obtains knowledge graph node information related to the query semantics, and locates the relevant documents, code segments and design specifications corresponding to these nodes.

[0251] The knowledge base integrates the documents corresponding to the candidate document vectors obtained from the initial retrieval of the vector database with the relevant documents, code segments, and design specifications obtained from the knowledge graph retrieval. After removing duplicate content, the documents are sorted according to semantic relevance, and the documents, code segments, and design specifications most relevant to the query semantics are returned to the agent as the retrieval results.

[0252] After receiving the search results, the intelligent agent combines its existing knowledge to conduct in-depth analysis and reasoning on the search results.

[0253] It should be noted that the agent generates an initial query based on the user's task requirements; for example, if the user wants to know "how to implement the user registration function", the agent might generate the initial query as: "implementation steps and code examples for the user registration function"; The agent then sends the initial query to the knowledge base; finally, the knowledge base receives the query and uses a pre-defined semantic vectorization model (such as BERT, Word2Vec, etc.) to convert the initial query into a vector representation; this vector representation can be understood as a semantic embedding of the query content, for example... For example: query vector = [0.23, -0.45, 0.67, ...]; similarity calculation: the vector database in the knowledge base stores a large number of document vectors, each document vector being semantically related to the document content; the knowledge base calculates the similarity between the query vector and these document vectors (e.g., using cosine similarity) and filters out document vectors with similarity higher than a preset threshold; for example, it may find document vectors related to the query, including: Document A: design document for user registration function (similarity 0.85); Document B: implementation code for user login and registration (similarity 0.80); document C: Security considerations for user registration function (similarity 0.75); Knowledge graph extended retrieval: The knowledge base expands its retrieval based on the semantic concepts corresponding to the query vectors in the preset knowledge graph, according to node association rules; assuming the knowledge graph contains the node "user registration", related knowledge graph nodes may include: "user input verification"; "password encrypted storage"; "user registration process"; from these nodes, the knowledge base obtains relevant documents, code snippets, and design specifications, such as: document corresponding to the node "user input verification": best practices for input verification; code snippet corresponding to the node "user registration process": implementation code example for user registration; Fusion retrieval results: The knowledge base merges the candidate documents obtained from the initial retrieval of the vector database with the relevant documents, code snippets, and design specifications obtained from the knowledge graph retrieval, removes duplicate content, and sorts them according to semantic relevance; the final retrieval results returned to the agent may include: Document A: Design document for user registration function; Document B: Implementation code for user login and registration; Document C: Security considerations for user registration function; Document D: Best practices for input verification; Document E: Implementation code example for user registration;

[0254] After receiving the search results, the agent combines its existing knowledge to perform in-depth analysis and reasoning. For example, the agent might summarize the implementation steps, key code snippets, and security considerations for the user registration function, and generate the following: To implement the user registration function, the following steps can be taken: 1. Receive user input data, including username, password, etc.; 2. Validate the user input to ensure the correct input format (see best practices for input validation); 3. Encrypt and store the user password to ensure user information security (see security considerations for user registration); 4. Save the registration information to the database and return a successful registration message; 5. Referring to the code example, the implementation code for user registration is as follows...

[0255] Example 2, please refer to Figure 2 This invention provides a technical solution: a software traceability system based on multi-agent collaborative decision-making, applicable to the aforementioned software traceability method based on multi-agent collaborative decision-making, comprising:

[0256] Data acquisition unit 1 is used to acquire the initial dataset, which includes the requirements document and source code;

[0257] Text parsing unit 2 is used to parse the requirement document using the requirement parsing agent to generate a structured requirement representation, and at the same time to parse the source code using the code parsing agent to generate a structured description of the code module.

[0258] The requirement tracing unit 3 is used to input the structured requirement representation and the structured description of the code module into the tracing chain generating agent, so that the tracing chain generating agent outputs the tracing chain between the requirement and the code, wherein the tracing chain is used to show the mapping relationship between the requirement and the code.

[0259] Consistency judgment unit 4 is used to input the tracing chain into the consistency judgment agent, so that the consistency judgment agent outputs the consistency judgment result between the requirements and the code. The consistency judgment result includes an identifier of whether there is inconsistency between the requirements and the code and a specific description of the inconsistency.

[0260] The report generation unit 5 is used to input the consistency judgment result into the analysis report agent, so that the analysis report agent outputs a software traceability analysis report, which includes a summary of the consistency between requirements and code and repair suggestions.

[0261] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited thereto. Various changes can be made within the scope of knowledge possessed by those skilled in the art without departing from the spirit of the present invention.

Claims

1. A software tracing method based on multi-agent collaborative decision-making, characterized in that, include: Obtain an initial dataset, which includes a requirements document and source code; The requirement document is parsed using a requirement parsing agent to generate a structured requirement representation. At the same time, the source code is parsed using a code parsing agent to generate a structured description of the code modules. The structured requirement representation and the structured description of the code module are input into the tracking chain generating agent, so that the tracking chain generating agent outputs the tracking chain between the requirement and the code, wherein the tracking chain is used to show the mapping relationship between the requirement and the code; The tracing chain is input into the consistency judgment agent, which outputs the consistency judgment result between the requirements and the code. The consistency judgment result includes an identifier of whether there is an inconsistency between the requirements and the code and a specific description of the inconsistency. The consistency judgment result is input into the analysis report agent, which then outputs a software traceability analysis report, which includes a summary of the consistency between requirements and code, as well as repair suggestions. Specifically, the tracking chain is input into the consistency judgment agent, causing the consistency judgment agent to output a consistency judgment result between the requirements and the code, including: Natural language processing technology is used to segment and semantically analyze the requirement descriptions in the tracking chain, extracting the core words and key semantics in the requirement descriptions to form the key information of the requirement descriptions; The required functional points are analyzed one by one to determine the specific requirements and expected effects of each functional point, thus forming the key information of the required functional points. The code module names are standardized to remove redundant information and extract the core module name identifiers; Semantic analysis is performed on the code module functions to extract the main functions and key operations implemented by the code module, forming key information of the code module functions. The key information in the requirements section includes the requirement description and requirement function points, while the key information in the code section includes the code module name and code module functions. Compare the key information in the requirement description with the reasonable range of requirements in the knowledge base to determine whether the requirement description is within a reasonable range; The key information of the required functional points is initially matched with the common requirements and code correspondence patterns in the knowledge base to filter out possible corresponding code patterns. Compare the key information of the code module name and code module function with the code style requirements in the knowledge base to determine whether the code module conforms to the style requirements; A detailed comparison was made between the key information of the code module functions and the common requirements and code correspondence patterns initially matched, to further verify the correspondence between the code modules and the functional points of the requirements. Based on the comparison results, a large language model is used to reason about whether the requirements are reasonable and whether the code complies with regulations; Based on the results of reasoning and rule checks, determine whether the requirements match the code; if they match, proceed to the next step; if they do not match, mark the inconsistencies between the requirements and the code. Based on the matching results and the marked inconsistencies, a consistency judgment result between requirements and code is generated.

2. The software tracing method based on multi-agent collaborative decision-making according to claim 1, characterized in that, The requirement document is parsed using a requirement parsing intelligent agent to generate a structured requirement representation, including: The large language model is used to perform preliminary semantic analysis on the requirements document, and the preliminary semantic analysis results are obtained. Based on the keywords and semantic features in the preliminary semantic analysis results, functional requirement recognition rules are set. Based on the functional requirements identification rules, the preliminary semantic parsing results are traversed to identify paragraphs that meet the functional requirements of the rules. The identified functional requirement-related paragraphs are combined to generate a functional requirement paragraph set. For each paragraph in the set of functional requirement paragraphs, a large language model is used to perform deep semantic analysis to extract functional module description information, input and output identification information, functional logic description information, and boundary condition setting information. Based on the preset structured requirements representation template, determine the corresponding positions of functional module descriptions, input / output identifiers, functional logic descriptions, and boundary condition settings in the template; Fill the extracted functional module description information, input and output identification information, functional logic description information, and boundary condition setting information into the corresponding positions in the structured requirement representation template; The format of the structured requirement representation template after the information is filled in is adjusted and the content is optimized to generate a structured requirement representation document. The structured requirement representation includes functional module descriptions, input and output identifiers, functional logic descriptions, and boundary condition settings. Extract key information from the structured requirements document and generate a key information summary; Output key information summaries to user terminals and receive feedback from user terminals on the key information summaries; Based on user feedback, the structured requirements document was modified.

3. The software tracing method based on multi-agent collaborative decision-making according to claim 2, characterized in that, For each paragraph in the set of functional requirement paragraphs, deep semantic analysis is performed using a large language model to extract functional module description information, input / output identification information, functional logic description information, and boundary condition setting information, including: For each paragraph in the set of paragraphs with functional requirements, the data is input into the large language model again. The large language model performs semantic role labeling and semantic relationship analysis on the paragraphs. Based on the semantic role labeling and semantic relationship analysis results, functional module description information, input and output identification information, functional logic description information, and boundary condition setting information are identified. The identified information is organized and extracted to obtain the corresponding functional module description information, input and output identification information, functional logic description information, and boundary condition setting information.

4. The software tracing method based on multi-agent cooperative decision-making according to claim 3, characterized in that, The source code is parsed using a code parsing agent to generate a structured description of the code modules, including: The target source code is parsed using an abstract syntax tree parser to obtain the abstract syntax tree structure corresponding to the source code; Traverse the abstract syntax tree structure, identify code blocks with specific identifiers or that conform to specific structural characteristics, and determine these code blocks as functional modules; The name of each functional module is determined based on the comments within the functional modules, the naming rules for functions and classes, and the functional logic of the code. Extract the subtree structure corresponding to each functional module from the abstract syntax tree structure, and convert the subtree structure into the corresponding code snippet; For each functional module's code snippet, the abstract syntax tree structure is further parsed to identify the functions and classes contained within the functional module, and to determine the name of each function and class; Locate function and class call nodes within the abstract syntax tree structure; Based on the module location of the calling node, determine whether it is a call between functional modules or a call between functions or classes within a functional module; Record the names of the initiator and the callee to form a list of call relationships between functional modules, functions, and classes; In the abstract syntax tree substructure corresponding to the functional module, find the condition judgment node, determine the expression of the condition judgment and the execution logic of different branches; Locate the loop structure node to determine the loop condition, loop body, and loop termination condition; The conditional statements and loop structures are arranged according to their execution order in the code to form a description of the internal logic flow of the functional module. Based on the name of the functional module, the extracted code snippets, the determined call relationships, and the sorted internal logic flow, a structured description of the code module is generated. The structured description of the code module includes the module name, module function, module call relationships, and module internal logic.

5. The software tracing method based on multi-agent cooperative decision-making according to claim 4, characterized in that, The structured requirement representation and the structured description of the code module are input into the tracing chain generating agent, which outputs the tracing chain between the requirement and the code, including: Natural language processing techniques are used to perform semantic parsing on each requirement module in the structured requirement representation, and the semantic feature vector of each requirement module is extracted. Semantic parsing is performed on each code module in the structured description of the code modules to extract the semantic feature vector of each code module; Input the semantic feature vectors of the requirement module and the code module into the large language model; The similarity between the semantic feature vector of each requirement module and the semantic feature vector of each code module is calculated using a large language model. Based on the similarity calculation results, the most matching code module for each requirement module is determined, and the correspondence between requirement modules and code modules is obtained; Based on the correspondence, a tracing chain between requirements and code is generated through semantic analysis and mapping. The tracing chain displays the relationship between requirements and code in a structured form and indicates the code module corresponding to each functional requirement.

6. The software tracing method based on multi-agent collaborative decision-making according to claim 5, characterized in that, Based on the correspondence, a tracing chain between requirements and code is generated through semantic analysis and mapping, including: Based on the correspondence between requirement modules and code modules, determine the code module corresponding to each requirement module; For each requirement module, analyze the mapping relationship between its required functional points and the internal logic of the corresponding code module; Based on the mapping relationship, the requirement module is associated with the corresponding code module, forming a tracing chain node between the requirement and the code; Connect all trace chain nodes in the order of the requirement modules to obtain a complete trace chain between requirements and code.

7. The software tracing method based on multi-agent cooperative decision-making according to claim 1, characterized in that, The knowledge base and the intelligent agent interact through a retrieval-enhanced generation technology framework. The intelligent agent generates a query based on task requirements and sends the query to the knowledge base for information retrieval. The knowledge base uses a vector database and knowledge graph to perform retrieval based on the vector representation of the query, returning the documents, code segments, and design specifications most relevant to the query semantics. The intelligent agent generates further reasoning results based on the retrieval results and its own knowledge. The intelligent agent includes a requirement analysis intelligent agent, a code analysis intelligent agent, a tracing chain generation intelligent agent, a consistency judgment intelligent agent, and an analysis report intelligent agent.

8. The software tracing method based on multi-agent cooperative decision-making according to claim 7, characterized in that, The knowledge base and the agent interact through a retrieval-enhanced generative technology framework. The agent generates queries based on task requirements and sends them to the knowledge base for information retrieval. The knowledge base uses vector databases and knowledge graphs to perform retrieval based on the vector representation of the query, returning documents, code snippets, and design specifications most relevant to the query semantics. The agent then uses the retrieval results and its own knowledge to generate further reasoning results, including: The intelligent agent generates initial query content based on task requirements and sends the initial query content to the knowledge base; After receiving the initial query content, the knowledge base uses a preset semantic vectorization model to transform the initial query content into a vector representation to obtain the query vector. The vector database stores a large number of vectors corresponding to documents, and each document vector is semantically related to the document content. The knowledge base calculates the similarity between the query vector and the document vectors in the vector database, using a preset similarity calculation method; Based on the similarity calculation results, several document vectors with similarity higher than the preset similarity threshold are selected as candidate document vectors. The knowledge base starts with the semantic concept corresponding to the query vector in the preset knowledge graph, expands the retrieval according to the preset node association rules, obtains knowledge graph node information related to the query semantics, and locates the relevant documents, code segments and design specifications corresponding to these nodes. The knowledge base integrates the documents corresponding to the candidate document vectors obtained from the initial retrieval of the vector database with the relevant documents, code segments, and design specifications obtained from the knowledge graph retrieval. After removing duplicate content, the documents are sorted according to semantic relevance, and the documents, code segments, and design specifications most relevant to the query semantics are returned to the agent as the retrieval results. After receiving the search results, the intelligent agent combines its existing knowledge to conduct in-depth analysis and reasoning on the search results.

9. A software traceability system based on multi-agent collaborative decision-making, applicable to the software traceability method based on multi-agent collaborative decision-making as described in any one of claims 1-8, characterized in that, include: A data acquisition unit is used to acquire an initial dataset, wherein the initial dataset includes a requirements document and source code; The text parsing unit is used to parse the requirement document using a requirement parsing agent to generate a structured requirement representation, and at the same time, to parse the source code using a code parsing agent to generate a structured description of the code modules. The requirement tracing unit is used to input the structured requirement representation and the structured description of the code module into the tracing chain generating agent, so that the tracing chain generating agent outputs the tracing chain between the requirement and the code, wherein the tracing chain is used to show the mapping relationship between the requirement and the code; A consistency judgment unit is used to input the tracing chain into a consistency judgment agent, so that the consistency judgment agent outputs a consistency judgment result between the requirements and the code, wherein the consistency judgment result includes an identifier of whether there is an inconsistency between the requirements and the code and a specific description of the inconsistency. The report generation unit is used to input the consistency judgment result into the analysis report agent, so that the analysis report agent outputs a software traceability analysis report, wherein the software traceability analysis report includes a summary of the consistency between requirements and code and repair suggestions.