A method and system for intelligent government writing based on multi-agent collaboration and long memory technology

By leveraging multi-agent collaboration and long memory technology, the system analyzes user sketches and dynamically plans writing tasks, solving the problems of rigid interaction and memory loss in existing intelligent writing systems in government affairs scenarios, and achieving efficient and personalized government document generation.

CN121327156BActive Publication Date: 2026-04-03ZHEJIANG YANJI NETWORK TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing intelligent writing systems suffer from rigid interaction methods, static task planning, weak sketch comprehension, and a lack of historical memory collaboration in government scenarios, resulting in low writing efficiency and difficulty in maintaining content consistency.

Method used

Employing multi-agent collaboration and long memory technology, the system parses user sketches and keywords through a multimodal intent input acquisition module, constructs a structured intent graph, dynamically plans writing tasks, and executes them collaboratively by heterogeneous intelligent agents, while optimizing content generation in conjunction with a long memory module.

Benefits of technology

It enables dynamic, adaptive, and personalized generation of structured documents from unstructured intents, improving writing efficiency and the professionalism, logical rigor, and personal consistency of the content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121327156B_ABST
    Figure CN121327156B_ABST
Patent Text Reader

Abstract

This application relates to the field of intelligent writing technology, and discloses a method and system for intelligent government writing based on multi-agent collaboration and long memory technology. It aims to solve the problems of rigid interaction, static task planning, weak sketch understanding, and lack of historical memory collaboration in existing technologies. The method includes: acquiring multimodal intent input containing hand-drawn sketches and keywords; constructing a structured intent graph; generating and dynamically rescheduling atomic writing subtasks; having a heterogeneous agent cluster collaboratively perform analysis, drafting, polishing, and verification; combining a long-term memory module to invoke user preferences and conversation context; and finally synthesizing government documents in real time according to the graph structure. The system includes modules for multimodal input, intent graph construction, dynamic task planning, heterogeneous agent clusters, long-term memory management, and document synthesis. This application realizes the dynamic, accurate, and personalized generation of government documents from unstructured intents.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent writing, specifically relating to a government affairs intelligent writing method and system based on multi-agent collaboration and long memory technology. Background Technology

[0002] With the deepening of digital government construction, the demand for intelligent writing tools in government office work is becoming increasingly urgent. Traditional official document writing relies heavily on manual completion, which is not only inefficient and prone to formatting or logical errors, but also struggles to maintain structural rigor and content consistency when writing complex documents such as policy analyses and economic reports of tens of thousands of words. In recent years, intelligent writing systems based on large language models have been gradually applied to government scenarios, initially achieving automatic text generation, but multiple structural defects have still been exposed in practical applications.

[0003] Existing intelligent writing systems generally employ a single-turn "instruction-output" interaction paradigm, failing to support users in dynamically expressing their writing intentions through natural methods such as hand-drawn sketches, keyword clouds, or non-standard flowcharts. When users adjust their thinking, add or delete analytical dimensions, or modify the logical structure during the writing process, the system lacks the ability to perceive and respond to the evolution of intent, leading to fragmented interactions and repeated rewriting. Even when some systems introduce multi-agent collaborative architectures, their task allocation mechanisms are usually statically fixed in the initial stage, unable to replan local task flows based on subsequent user interactions. Once the intent changes, a full generation is triggered, severely restricting writing efficiency. Furthermore, although visual-language models have made progress in image recognition, they lack deep semantic analysis capabilities for non-standard elements commonly found in government drafts, such as hasty arrows, blurred diagrams, and keyword stacking. This makes it difficult to transform them into structured writing tasks with logical dependencies, resulting in a severe disconnect between "images" and "text." In addition, existing systems generally lack long-term memory mechanisms, failing to accumulate and reuse users' historical writing trajectories, style preferences, or sketch parsing patterns in multiple interactions. This leads to the repeated parsing of the same type of sketches and the repeated ignoring of clearly defined constraints.

[0004] In view of this, this application proposes a government affairs intelligent writing method and system based on multi-agent collaboration and long memory technology. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a government affairs intelligent writing method and system based on multi-agent collaboration and long memory technology, so as to overcome the technical defects of rigid interaction form, static task planning, weak sketch understanding ability and lack of historical memory collaboration in the existing technology.

[0006] To address the aforementioned technical problems, this invention provides a government affairs intelligent writing method based on multi-agent collaboration and long memory technology. The method involves a multimodal intent input acquisition module receiving user input containing unstructured hand-drawn sketches and keywords. Next, a structured intent graph construction module parses the sketches, transforming the hand-drawn primitives and keywords into a structured intent graph containing hierarchy and logical relationships. Then, a dynamic task planning and rescheduling module generates a writing task dependency graph based on the intent graph and decomposes it into a series of atomic writing sub-tasks. A heterogeneous intelligent agent collaborative execution cluster receives and executes these sub-tasks, respectively performing data analysis, content drafting, text polishing, and logical verification. A long-term memory and context management module records and invokes session-level evolution trajectories and user-level preference knowledge throughout the process to assist in intent understanding and content generation. Finally, a real-time document content synthesis and presentation module assembles the content fragments generated by each agent according to the structure of the intent graph and presents them to the user in real time. This method achieves dynamic, adaptive, and personalized generation from unstructured intents to structured documents.

[0007] According to one aspect of the present invention, a method for intelligent government writing based on multi-agent collaboration and long memory technology is provided, comprising the following steps:

[0008] Acquire multimodal writing intent input, which includes a hand-drawn sketch drawn by the user on the canvas interface and text keywords attached to the hand-drawn sketch; the hand-drawn sketch includes graphic primitives, connecting lines, and direction indicators;

[0009] The multimodal writing intent input is parsed to construct a structured intent graph, which is a directed acyclic graph. Its nodes represent writing content units, the attributes of the nodes contain the core theme extracted from the text keywords, and the edges represent the logical dependencies between the writing content units.

[0010] Based on the structured intent graph, a writing task dependency graph is generated, and the writing task dependency graph is decomposed into a set of atomic writing subtasks with pre-dependent relationships.

[0011] The atomic writing subtask is scheduled to a heterogeneous intelligent agent collaborative execution cluster. The heterogeneous intelligent agent collaborative execution cluster assigns a corresponding analytical intelligent agent, drafting intelligent agent, polishing intelligent agent or verification intelligent agent to process each atomic writing subtask according to its type, so as to generate the corresponding text content fragment.

[0012] The text content fragments generated by the heterogeneous intelligent agents collaborative execution cluster are spliced ​​and integrated in real time according to the hierarchical and sequential relationships defined by the structured intent graph to generate a structured target government document, which is then presented on the user interface.

[0013] Furthermore, the step of constructing the structured intent graph specifically includes:

[0014] The hand-drawn sketch is segmented and its features are extracted using a primitive recognition unit based on a hybrid model of convolutional neural network and visual transformer, which identifies the set of graphic primitives, the set of connecting lines, and the set of text keywords. The graphic primitives are closed or semi-closed hand-drawn shapes, the connecting lines are lines that connect two graphic primitives, and the text keywords are strings extracted from the hand-drawn text using optical character recognition technology.

[0015] Using a logical relationship parsing unit based on a graph attention network, the graph primitives are used as initial nodes of the graph, and the connecting lines are used as initial edges to construct an initial geometric topology graph; and the spatial positional relationship features between any two primitive nodes are calculated, including relative distance, azimuth angle, inclusion relationship and intersection relationship.

[0016] The logical relationship parsing unit determines the parent-child hierarchical relationship, parallel relationship, sequential relationship or causal relationship between nodes based on the direction indicator of the connecting line, the endpoint connection relationship and the spatial position relationship characteristics, thereby transforming the initial geometric topology graph into a structured graph with logical relationship attributes;

[0017] By using a semantic embedding unit based on a pre-trained language model, the text keywords attached to each graph primitive are transformed into high-dimensional semantic vectors, and these semantic vectors are used as attributes of the corresponding nodes, thereby completing the construction of the structured intent graph.

[0018] Furthermore, the method also includes a dynamic intent update and task rescheduling mechanism, the specific steps of which are as follows:

[0019] Through an intent graph differential state monitoring unit, the user's modification operations on the hand-drawn sketch or generated document are monitored in real time at a preset time frequency. The modification operations include adding graphic primitives, deleting graphic primitives, modifying connecting lines, or editing text keywords.

[0020] When a modification operation is detected, the intent graph differential state monitoring unit generates a change event and triggers the structured intent graph construction module to perform local re-analysis of the changed area and generate an updated structured intent graph.

[0021] The updated structured intent graph is compared with the original structured intent graph to identify the differences in nodes and edges. Only the differences are addressed by regenerating or adjusting the corresponding atomic writing subtasks, while keeping the task state of the unchanged parts unchanged.

[0022] The newly added or adjusted atomic writing subtasks are redistributed to the heterogeneous intelligent agent collaborative execution cluster, and, as needed, re-execution instructions are issued to completed but affected related tasks, thereby achieving incremental response to the user's dynamic intent.

[0023] Furthermore, the specific workflow of the heterogeneous intelligent agent collaborative execution cluster includes:

[0024] The analytical agent receives an atomized writing subtask containing data analysis or background research instructions. By calling an external knowledge base application programming interface or an internal government database interface, it retrieves, filters, and integrates relevant policy documents, statistical data, or historical cases to generate a structured data summary or background analysis report as output.

[0025] The drafting agent receives an atomized writing subtask containing instructions for generating text paragraphs. Based on the writing topic and core viewpoints specified in the task, and combined with the data summary output by the analytical agent, it generates a first draft text fragment that conforms to the norms and logical requirements of government documents.

[0026] The polishing agent receives an atomic writing subtask containing text optimization instructions, processes the first draft text fragments generated by the drafting agent, and performs grammar correction, sentence optimization, vocabulary replacement, and style unification operations to ensure the accuracy and formality of the manuscript language.

[0027] The verification agent receives an atomic writing subtask containing consistency verification instructions, cross-compares multiple related text content fragments, checks for factual errors, logical contradictions, or inconsistencies in viewpoints, and generates a verification report.

[0028] Furthermore, the method also includes a personalized assistance enhancement step based on a long-term memory and contextual management module. This step is executed in parallel during the construction of the structured intent graph and the scheduling of atomic writing subtasks, specifically including:

[0029] When constructing a structured intent graph, a personal writing habit model associated with the current user identity is retrieved from a user-level preference knowledge graph. The model includes the user's commonly used sketch layout patterns, terminology preferences, and writing style vectors. The model is then used to disambiguate fuzzy connections or unclear keywords that appear during the parsing of hand-drawn sketches, thereby improving the accuracy of intent understanding.

[0030] When heterogeneous agents collaborate to execute cluster processing tasks, the structured intent graphs and generated text content of all historical versions in the current document writing session are retrieved from a session-level evolutionary trajectory memory bank to provide the agents with a complete context and ensure that the newly generated content is consistent with the existing content in logic and style.

[0031] After each writing session, the final structured intent graph, user modification records, and final draft of the session are analyzed to extract new writing patterns and preference features. These are then updated into the user-level preference knowledge graph in the form of triples, enabling continuous learning and adaptive evolution of the memory model.

[0032] According to another aspect of the present invention, a government affairs intelligent writing system based on multi-agent collaboration and long memory technology is provided, comprising:

[0033] The multimodal intent input acquisition module is used to receive and process hand-drawn sketches and text keywords input by users through touch or mouse devices;

[0034] The structured intent graph construction module is connected to the multimodal intent input acquisition module and is used to convert the received unstructured input into a structured intent graph containing nodes and edges.

[0035] The dynamic task planning and rescheduling module is connected to the structured intent graph construction module and is used to generate, decompose and dynamically adjust atomic writing subtasks based on the structured intent graph.

[0036] A heterogeneous intelligent agent collaborative execution cluster, connected to the dynamic task planning and rescheduling module, is used to receive and execute the atomic writing subtasks to generate text content fragments;

[0037] The long-term memory and context management module, in collaboration with the structured intent graph construction module and the heterogeneous intelligent agent, performs a bidirectional connection to the cluster and is used to store and provide user preferences and session history context information.

[0038] The document content real-time synthesis and presentation module is connected to the heterogeneous intelligent agent collaborative execution cluster and the structured intent graph construction module, and is used to assemble text content fragments and display them on the user interface according to the latest intent graph structure.

[0039] Furthermore, the structured intent graph construction module includes:

[0040] The primitive recognition unit integrates a hybrid model of convolutional neural network and visual transformer to identify and separate graphic primitives, connecting lines and text keywords from hand-drawn sketch images.

[0041] The logical relationship parsing unit integrates a graph attention network to analyze the spatial and connection relationships between identified primitives, determine their hierarchical, sequential, or causal logic, and construct the graph's topology.

[0042] The semantic embedding unit integrates a pre-trained language model to convert text keywords into semantic vectors and assign them to the corresponding nodes in the graph as core attributes.

[0043] Furthermore, the dynamic task planning and rescheduling module includes:

[0044] The intent graph differential state monitoring unit is used to continuously monitor changes in user input and generate change events;

[0045] The writing task dependency parsing unit is used to compare the old and new intent maps after receiving a change event, locate the differences, and generate an incremental task update plan.

[0046] The heterogeneous intelligent agent task allocation unit is used to issue new, modified, or canceled task instructions to the heterogeneous intelligent agent collaborative execution cluster according to the task update plan.

[0047] Furthermore, the heterogeneous intelligent agent cooperative execution cluster includes:

[0048] At least one analytical agent is configured with interfaces to access external knowledge bases and internal databases, and is dedicated to performing information retrieval and data analysis tasks;

[0049] At least one drafting agent, whose core is a large language model fine-tuned from government document corpus, is dedicated to generating initial drafts of text based on instructions;

[0050] At least one editing agent is equipped with a grammar rule base and a government document style model, which is dedicated to optimizing text at the language level.

[0051] At least one verification agent, whose core is a natural language reasoning model, is dedicated to verifying the logical consistency and factual accuracy of text content.

[0052] Furthermore, the long-term memory and context management module includes:

[0053] A session-level evolutionary trajectory memory library, which adopts a temporal database structure, is used to store all versions of structured intent maps and generated text fragments in a single writing task in chronological order;

[0054] A user-level preference knowledge graph, which adopts a graph database structure, is used to store a specific user's writing style vector, commonly used terms, and preferred document structure templates in the form of triples for a long time. The knowledge graph is associated with the user's identity identifier.

[0055] Compared with the prior art, the advantages and positive effects of the present invention are as follows:

[0056] By introducing a structured intent graph construction module, this invention can deeply analyze the inherent logical structure of a user's hand-drawn sketches, transforming unstructured and vague creative intents into machine-understandable and precise task instructions, thus solving the technical problem that existing technologies cannot effectively understand natural interactive input.

[0057] By setting up a dynamic task planning and rescheduling module, this invention achieves real-time, incremental response to changes in the user's writing intent. When the user modifies the sketch, the system only needs to replan the affected part of the task, avoiding the inefficiency of global rewriting and solving the technical problems of static and poor adaptability of task planning in the prior art.

[0058] By constructing a heterogeneous intelligent agent collaborative execution cluster, the complex writing task is decomposed into professional sub-tasks such as analysis, drafting, polishing, and verification, and dedicated intelligent agents work together to improve the professionalism, accuracy, and logical rigor of the generated manuscript, thus solving the limitation that a single model cannot meet multiple writing needs.

[0059] By integrating a long-term memory and context management module, this invention can accumulate and utilize the user's historical writing preferences and the complete context of the current conversation, making intent understanding more accurate and content generation more personalized and coherent, thus solving the technical problems of existing technologies lacking memory capabilities and being unable to achieve personalized adaptation. Attached Figure Description

[0060] Figure 1 This is a schematic diagram of the overall technical architecture of the government affairs intelligent writing system based on multi-agent collaboration and long memory technology proposed in this invention;

[0061] Figure 2 This is a schematic diagram illustrating the core principle framework of the collaborative mechanism for structured intent graph construction and dynamic task rescheduling in this invention;

[0062] Figure 3 This is a flowchart illustrating the logical flow of multimodal intent input parsing and structured intent graph generation in this invention.

[0063] Figure 4 This is a flowchart illustrating the task division and content generation process of the heterogeneous intelligent agent collaborative execution cluster in this invention.

[0064] Figure 5 This is a schematic diagram of the multi-level interaction relationship and data flow of the long-term memory and context management module in this invention; Detailed Implementation

[0065] Example: See Figure 1 This invention provides a method and system for intelligent government writing based on multi-agent collaboration and long memory technology. Its core lies in transforming the unstructured writing intent input by the user through natural interaction into a structured task graph with logical dependencies. Based on this, a closed-loop writing process is achieved, incorporating dynamic task planning, heterogeneous intelligent agent collaborative execution, and long-term memory assistance. The specific implementation of this invention is described in detail below, combining the method steps and system modules.

[0066] See Figure 3 The method begins at S1, acquiring multimodal writing intent input. This step is executed by a multimodal intent input acquisition module, which receives hand-drawn sketches created by the user in the graphical user interface canvas area using a stylus, mouse, or finger, as well as text keywords entered by the user within or near the sketch area. The hand-drawn sketch consists of several graphic primitives, which are closed or semi-closed geometric shapes drawn by the user, including but not limited to rectangles, circles, ellipses, polygons, or irregular closed outlines; connecting lines are lines connecting any two graphic primitives, and their shapes include straight lines, polylines, or directed line segments with arrows; direction indicators are arrow symbols attached to the ends of the connecting lines to indicate the logical flow. Text keywords are text content written by the user inside or near the graphic primitives, and their character shapes may be messy, slanted, or connected. The multimodal intent input acquisition module encodes all the above input content into a composite data structure containing pixel coordinates, stroke trajectories, text area bounding boxes, and original image data, and then passes it to the subsequent processing unit.

[0067] Step S2 parses the multimodal writing intent input to construct a structured intent graph. This structured intent graph is a directed acyclic graph, where nodes correspond to writing content units, and edges represent logical dependencies between content units. This step is completed by the structured intent graph construction module, which contains three sequentially connected processing units: a primitive recognition unit, a logical relationship parsing unit, and a semantic embedding unit.

[0068] The primitive recognition unit first preprocesses the input sketch image, including grayscale conversion, binarization, and noise filtering, and then inputs it into a deep learning architecture based on a hybrid model of convolutional neural networks and a visual transformer. The front end of this hybrid model uses a multi-layer convolutional neural network to extract local spatial features, while the back end incorporates a visual transformer module to capture global contextual dependencies. The model outputs three parallel segmentation masks: a graph primitive mask, a connectivity mask, and a text region mask. Based on the masks, the system extracts the set of graph primitives G={g1, g2, ..., g...} through connected component analysis. n}, each g iIt includes its pixel coordinate set and minimum bounding rectangle; the set of connecting lines L={l1, l2, ..., l m}, each l j Includes a Boolean flag indicating the start and end coordinates and whether a direction indicator is included; Text keyword set K = {k1, k2, ..., k} p}, each k k The integrated optical character recognition engine extracts the corresponding text region into a string. All recognition results are accompanied by a confidence score; results below a preset threshold are marked as requiring manual confirmation, but this does not affect the automatic progress of subsequent processes.

[0069] The logical relationship parsing unit receives the above recognition results and first constructs an initial geometric topology graph. This graph uses each element in the set of graphical primitives G as a node and each line segment in the set of connecting lines L that connects two primitives as an edge. For primitive pairs not directly connected by connecting lines, the system calculates their spatial positional relationship characteristics, including the Euclidean distance d. ij Azimuth θ ij (Calculated clockwise with true north as zero degrees), inclusion relationship (if g) i The bounding rectangle completely contains g j If the intersection ratio of the areas of the two bounding rectangles is greater than 0.3, then it is marked as true. Subsequently, the unit infers the logical relationship type between nodes based on the direction indicators of the connecting lines, the endpoint connection relationships, and the aforementioned spatial characteristics. The specific rules are as follows: If there exists a connection from g... i Pointing to g j If the directed connection line is g, then g i As the parent node, g j As child nodes, they form a parent-child hierarchical relationship. If two primitives are connected by an undirected line and are near the same horizontal line (absolute azimuth angle less than 15 degrees), they are considered parallel. If multiple primitives are arranged sequentially along a single direction with uniform spacing, they are considered sequential. If one primitive is downstream of another and has causal keywords (such as "cause" or "therefore") attached, it is considered causal. The logical relationship parsing unit injects the above relationships as attributes of edges into the initial geometric topology graph, forming a structured graph with logical semantics.

[0070] The semantic embedding unit then intervenes, invoking an encoder based on a pre-trained language model to embed each text keyword k. k Transformed into a 768-dimensional semantic vector v k For the graph primitive g iThe system generates a comprehensive semantic vector for each node using either vector averaging or attention-weighted aggregation, based on the set of keywords. This vector, as the core attribute of the node, together with the node ID, logical relationship type, and spatial coordinates, constitutes a complete node description of the structured intent graph. The final output structured intent graph is denoted as G_intent=(V, E), where V is the set of nodes and E is the set of directed edges with attributes.

[0071] Step S3, based on the structured intent graph, generates a writing task dependency graph and decomposes it into a set of atomic writing subtasks. This step is executed by the writing task dependency parsing unit in the dynamic task planning and rescheduling module. This unit traverses all nodes in G_intent and assigns one or more writing subtasks to each node based on the node type and semantic vector content. Task types include background analysis, data retrieval, paragraph drafting, language polishing, and logic verification. Each subtask is assigned a unique task ID, a list of pre-dependent tasks, an expected output format, and an execution priority. For example, a node containing the keyword "economic indicator analysis" will generate a "background analysis" subtask with no pre-dependents; while a downstream "policy recommendation" node will generate a "paragraph drafting" subtask with the aforementioned analysis task as a pre-dependent. All subtasks and their dependencies constitute a directed acyclic task dependency graph T=(T_nodes, T_edges). This graph is then decomposed into a queue of atomic tasks that can be executed in parallel or sequentially and passed to a heterogeneous intelligent agent collaborative execution cluster.

[0072] S4, see below Figure 4, in step S5, the atomized writing subtasks are scheduled to a heterogeneous agent collaborative execution cluster for processing. This cluster consists of four types of dedicated agents: analysis agents, drafting agents, polishing agents, and verification agents. The task assignment unit assigns tasks according to the subtask type. After receiving a data analysis task, the analysis agent first analyzes the keywords in the task instruction, constructs a structured query statement, and then calls the external knowledge base application programming interface or the internal government affairs database interface through a secure authentication channel. The retrieval scope includes the public data of the National Bureau of Statistics, local government work reports, industry white papers, and historical official document archives. After deduplication, sorting, and summary generation of the retrieval results, a structured data summary is output, including key indicators, trend descriptions, and relevant cases. The drafting agent receives a text generation task, and its core is a large language model fine-tuned on a corpus of tens of millions of government official documents. This model takes the task theme, core idea, pre-analysis summary, and the current conversation context as inputs, and generates a draft text fragment that conforms to the national standard of the "Format of Official Documents of Party and Government Organs", ensuring standard language use, clear logic, and correct stance. The polishing agent performs post-processing on the draft. Its built-in grammar rule library covers rules such as subject-verb agreement, punctuation norms, and common phrases in official documents, and combines a government affairs writing style model to perform formal replacement of vocabulary (such as replacing "do" with "carry out"), and splitting and optimizing long sentences, and finally outputs a text with accurate language and unified style. The verification agent cross-verifies multiple related text fragments. It calculates the semantic consistency score using a model based on natural language inference, identifies factual conflicts (such as inconsistent data before and after), logical breaks (such as causal breaks), or stance deviations, and generates a structured verification report for system decision-making.

[0073] In step S6, the text content fragments generated by each agent are spliced and integrated in real time according to the hierarchical and sequential relationships of the structured intent graph to generate a structured target government official document, which is presented on the user interface. The document content real-time synthesis and presentation module maintains a document tree synchronized with the G_intent structure. Whenever a subtask is completed, its output text is inserted into the corresponding node position of the document tree. The system automatically adds chapter titles, numbers, and transition sentences according to the parent-child and sequential relationships between nodes. The synthesized document is rendered in real time in rich text format on the right side of the canvas, and the user can view, edit, or export it at any time. This module also listens for the user's modification operations on the generated text and feeds back the edited content to the intent graph differential state monitoring unit to trigger the subsequent dynamic rescheduling process.

[0074] Outside the above main process, see Figure 2This invention also includes a dynamic intent update and task rescheduling mechanism. This mechanism involves an intent graph differential state monitoring unit polling user operation logs five times per second. When events such as adding graph primitives, deleting nodes, modifying connectors, or editing keywords are detected, this unit immediately generates a change event object, including the change type, target node ID, and old and new values. The structured intent graph construction module then performs local re-parsing of the changed area, updating only the affected subgraphs, rather than reconstructing the entire graph. The writing task dependency parsing unit performs graph isomorphism comparison between the old and new graphs, identifying nodes with added nodes, deleted edges, or changed attributes, and generates an incremental task plan accordingly: added nodes correspond to newly created subtasks, deleted nodes trigger task cancellation instructions, and nodes with changed attributes may trigger the re-execution of related tasks. The heterogeneous intelligent agent task allocation unit receives this plan and issues precise instructions to the cluster, ensuring that the system only recalculates the changed parts, greatly improving response efficiency.

[0075] In addition, see Figure 5 This invention also integrates a personalized assistance enhancement mechanism based on long-term memory and context management modules. This module comprises two core components: a session-level evolutionary trajectory memory library and a user-level preference knowledge graph. When constructing the intent graph in S2, the system retrieves the user's personal writing habit model from the user-level preference knowledge graph based on the current user's identifier. This model is stored in triples, such as (User A, common sketch layout, center-radial type), (User A, terminology preference, high-quality development), (User A, writing style vector, [0.82, -0.31, ..., 0.67]). When encountering fuzzy connections (such as lines without arrows) or ambiguous keywords (such as "strengthen" which can refer to intensity or range) during parsing, the system uses this model for disambiguation, for example, preferentially interpreting undirected connections as parallel relationships if the user's historical preferences are in a parallel structure. When the agent in S4 performs tasks, the session-level evolutionary trajectory memory library provides complete context. This library adopts a temporal database structure, recording each intent graph version, task state change, and generated text by timestamp. When generating new paragraphs, the drafting agent can call upon historical text to ensure consistent terminology and coherent viewpoints. After each session, the system automatically analyzes the final adopted graph structure and text content, extracts new preference features (such as the user's frequent use of "digital transformation" as a keyword), and writes them into the user-level preference knowledge graph in the form of new triples, thus enabling the continuous evolution of the memory model.

[0076] At the system level, the multimodal intent input acquisition module is deployed on the client frontend, responsible for capturing user input and performing preliminary encoding. The structured intent graph construction module runs on the server side; its primitive recognition unit uses a hybrid deep learning model, the logical relationship parsing unit uses a graph attention network for relationship reasoning, and the semantic embedding unit calls a pre-trained language model API. The dynamic task planning and rescheduling module acts as a central scheduler, coordinating intent changes and task flows. The heterogeneous intelligent agent collaborative execution cluster is deployed in a microservice architecture, with four types of intelligent agents running independently, receiving tasks and returning results through a message queue. The long-term memory and context management module adopts a hybrid storage strategy: session-level memory uses a time-series database such as InfluxDB, and user-level preference knowledge graph uses a graph database such as Neo4j, ensuring efficient querying and relationship reasoning. The real-time document content synthesis and presentation module maintains a document tree model on the frontend and maintains a WebSocket long connection with the backend to achieve millisecond-level content synchronization.

[0077] Throughout the system's operation, data flow strictly adheres to temporal and dependency constraints. User input triggers intent parsing, intent graphs drive task generation, task scheduling activates agents, agent outputs are integrated into document synthesis, a memory module provides context enhancement throughout, and a dynamic rescheduling mechanism ensures smooth interaction. All modules communicate through well-defined interfaces, ensuring the system's scalability and stability. This method, together with the system, achieves intelligent, dynamic, and personalized generation from unstructured sketches to structured government documents, effectively addressing the core shortcomings of existing technologies such as rigid interaction, static planning, weak understanding, and memory deficiencies.

[0078] The above are merely specific embodiments of the present invention, but the technical features of the present invention are not limited thereto. Any simple changes, equivalent substitutions, or modifications made based on the present invention to solve essentially the same technical problems and achieve essentially the same technical effects are all covered within the protection scope of the present invention.

Claims

1. A government affairs intelligent writing method based on multi-agent collaboration and long memory technology, characterized in that, include: Acquire multimodal writing intent input, which includes a hand-drawn sketch drawn by the user on the canvas interface and text keywords attached to the hand-drawn sketch. The hand-drawn sketch includes graphic primitives, connecting lines, and direction indicators. The multimodal writing intent input is parsed to construct a structured intent graph, which is a directed acyclic graph. Its nodes represent writing content units, the attributes of the nodes contain the core theme extracted from the text keywords, and the edges represent the logical dependencies between the writing content units. Based on the structured intent graph, a writing task dependency graph is generated, and the writing task dependency graph is decomposed into a set of atomic writing subtasks with prior dependencies. The atomic writing subtask is scheduled to a heterogeneous intelligent agent collaborative execution cluster. The heterogeneous intelligent agent collaborative execution cluster assigns a corresponding analytical intelligent agent, drafting intelligent agent, polishing intelligent agent or verification intelligent agent to process each atomic writing subtask according to its type, so as to generate the corresponding text content fragment. The text content fragments generated by the heterogeneous intelligent agents collaborative execution cluster are spliced ​​and integrated in real time according to the hierarchical and sequential relationships defined by the structured intent graph to generate a structured target government document, which is then presented on the user interface. The method also includes a dynamic intent update and task rescheduling mechanism, specifically including: Through an intent graph differential state monitoring unit, the user's modification operations on the hand-drawn sketch or generated document are monitored in real time at a preset time frequency. When a modification operation is detected, the intent graph differential state monitoring unit generates a change event and triggers the structured intent graph construction module to perform local re-analysis of the changed area and generate an updated structured intent graph. The updated structured intent graph is compared with the original structured intent graph to identify the differences in nodes and edges. Only the differences are addressed by regenerating or adjusting the corresponding atomic writing subtasks, while keeping the task state of the unchanged parts unchanged. The newly added or adjusted atomic writing subtasks are redistributed to the heterogeneous intelligent agent collaborative execution cluster, and re-execution instructions are issued for the related tasks that have been completed but affected.

2. The government affairs intelligent writing method based on multi-agent collaboration and long memory technology according to claim 1, characterized in that, The multimodal writing intent input is parsed to construct a structured intent graph, including: The hand-drawn sketch is segmented and its features are extracted using a primitive recognition unit based on a hybrid model of convolutional neural network and visual transformer. The set of graphic primitives, the set of connecting lines, and the set of text keywords are identified. The graphic primitives are closed or semi-closed hand-drawn shapes, the connecting lines are lines that connect two graphic primitives, and the text keywords are strings extracted from the hand-drawn text using optical character recognition technology. Through a logical relationship parsing unit based on graph attention network, the graph primitives are used as the initial nodes of the graph, and the connecting lines are used as the initial edges to construct an initial geometric topology graph. The spatial positional relationship features between any two primitive nodes are calculated, including relative distance, azimuth angle, inclusion relationship and intersection relationship. The logical relationship parsing unit determines the parent-child hierarchical relationship, parallel relationship, sequential relationship or causal relationship between nodes based on the direction indicator of the connecting line, the endpoint connection relationship and the spatial position relationship characteristics, thereby transforming the initial geometric topology graph into a structured graph with logical relationship attributes; By using a semantic embedding unit based on a pre-trained language model, the text keywords attached to each graph primitive are transformed into high-dimensional semantic vectors, and these semantic vectors are used as attributes of the corresponding nodes, thereby completing the construction of the structured intent graph.

3. The government affairs intelligent writing method based on multi-agent collaboration and long memory technology according to claim 2, characterized in that, The specific workflow of the heterogeneous intelligent agent collaborative execution cluster includes: The analytical agent receives an atomized writing subtask containing data analysis or background research instructions. By calling an external knowledge base application programming interface or an internal government database interface, it retrieves, filters, and integrates relevant policy documents, statistical data, or historical cases to generate a structured data summary or background analysis report as output. The drafting agent receives an atomized writing subtask containing instructions for generating text paragraphs. Based on the writing topic and core viewpoints specified in the task, and combined with the data summary output by the analytical agent, it generates a first draft text fragment that conforms to the norms and logical requirements of government documents. The polishing agent receives an atomic writing subtask containing text optimization instructions, processes the first draft text fragments generated by the drafting agent, and performs grammar correction, sentence optimization, vocabulary replacement, and style unification operations. The verification agent receives an atomic writing subtask containing consistency verification instructions, cross-compares multiple related text content fragments, checks for factual errors, logical contradictions, or inconsistencies in viewpoints, and generates a verification report.

4. The government affairs intelligent writing method based on multi-agent collaboration and long memory technology according to claim 3, characterized in that, The method also includes a personalized assistance enhancement step based on long-term memory and contextual management modules. This step is executed in parallel during the construction of structured intent maps and the scheduling of atomic writing subtasks, specifically including: When constructing a structured intent graph, a personal writing habit model associated with the current user identity is retrieved from a user-level preference knowledge graph. The model includes the user's commonly used sketch layout patterns, terminology preferences, and writing style vectors. The model is used to disambiguate fuzzy connections or unclear keywords that appear during the parsing of hand-drawn sketches. When heterogeneous agents collaborate to execute cluster processing tasks, they retrieve the structured intent maps and generated text content of all historical versions in the current document writing session from a session-level evolutionary trajectory memory, providing the agents with a complete contextual situation. After each writing session, the final structured intent graph, user modification records, and final draft of the session are analyzed to extract new writing patterns and preference features, which are then updated to the user-level preference knowledge graph in the form of triples.

5. The government affairs intelligent writing method based on multi-agent collaboration and long memory technology according to claim 4, characterized in that, The primitive recognition unit performs image segmentation and feature extraction on the hand-drawn sketch, including: After preprocessing the input sketch image by grayscale conversion, binarization, and noise filtering, it is input into a hybrid deep learning architecture with a multi-layer convolutional neural network at the front end and a visual transformer module at the back end. The hybrid deep learning architecture outputs a graphic primitive mask, a connector mask, and a text region mask, and extracts a set of graphic primitives, a set of connectors, and a set of text keywords based on the masks through connected component analysis.

6. The government affairs intelligent writing method based on multi-agent collaboration and long memory technology according to claim 5, characterized in that, The logical relationship parsing unit determines the type of logical relationship between nodes, including: If there exists a directed connection line from the first graphic primitive to the second graphic primitive, then the first graphic primitive is the parent node and the second graphic primitive is the child node, and the two form a parent-child hierarchical relationship. If two graphic primitives are connected by an undirected connector and are located near the same horizontal line, they are considered to be in a parallel relationship. If multiple graphic primitives are arranged sequentially along a single direction with uniform spacing, they are determined to be in a sequential relationship. If a graphical primitive is located downstream of another graphical primitive and there is a causal keyword attached, then a causal relationship is determined.

7. The government affairs intelligent writing method based on multi-agent collaboration and long memory technology according to claim 6, characterized in that, The drafting agent generates initial text fragments, including: It calls a large language model finely tuned on a corpus of tens of millions of government documents, and receives the task topic, core viewpoints, pre-analysis summary and current conversation context as input; Generate a standard draft text snippet to ensure that the language is grammatically correct, the logic is clear, and the stance is correct.

8. A government affairs intelligent writing system based on multi-agent collaboration and long memory technology, characterized in that, The method described in claim 1 includes: The multimodal intent input acquisition module is used to receive and process hand-drawn sketches and text keywords input by users through touch or mouse devices; The structured intent graph construction module is connected to the multimodal intent input acquisition module and is used to convert the received unstructured input into a structured intent graph containing nodes and edges. The dynamic task planning and rescheduling module is connected to the structured intent graph construction module and is used to generate, decompose and dynamically adjust atomic writing subtasks based on the structured intent graph. The dynamic task planning and rescheduling module includes: The intent graph differential state monitoring unit is used to continuously monitor changes in user input and generate change events; The writing task dependency parsing unit is used to compare the old and new intent maps after receiving a change event, locate the differences, and generate an incremental task update plan. The heterogeneous intelligent agent task allocation unit is used to issue new, modified or canceled task instructions to the heterogeneous intelligent agent collaborative execution cluster according to the task update plan. A heterogeneous intelligent agent collaborative execution cluster, connected to the dynamic task planning and rescheduling module, is used to receive and execute the atomic writing subtasks to generate text content fragments; The long-term memory and context management module, in collaboration with the structured intent graph construction module and the heterogeneous intelligent agent, performs a bidirectional connection to the cluster and is used to store and provide user preferences and session history context information. The document content real-time synthesis and presentation module is connected to the heterogeneous intelligent agent collaborative execution cluster and the structured intent graph construction module, and is used to assemble text content fragments and display them on the user interface according to the latest intent graph structure.

9. The government affairs intelligent writing system based on multi-agent collaboration and long memory technology according to claim 8, characterized in that, The structured intent graph construction module includes: The primitive recognition unit integrates a hybrid model of convolutional neural network and visual transformer to identify and separate graphic primitives, connecting lines and text keywords from hand-drawn sketch images. The logical relationship parsing unit integrates a graph attention network to analyze the spatial and connection relationships between identified primitives, determine their hierarchical, sequential, or causal logic, and construct the graph's topology. The semantic embedding unit integrates a pre-trained language model to convert text keywords into semantic vectors and assign them to the corresponding nodes in the graph as core attributes.

Citation Information

Patent Citations

  • Automatic modeling agent system based on MCP protocol and large model

    CN120259557A

  • Content generation method and device, equipment and storage medium

    CN120994367A

  • Document generation method based on agent collaboration

    CN121009869A