A hierarchical command processing and directory synchronization method and system
Patent Information
- Application Number
- CN202610984871.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-03
- Publication Date
- 2026-10-27
AI Technical Summary
[0008]本申请实施例的目的是提供一种分层命令处理与目录同步方法和系统,以解决现有技术缺乏统一分层管理的缺陷
[0011]本申请实施例通过分层命令处理、云端与本地Agent协同执行、目录状态增量同步及动态命令重构,实现命令执行与目录状态的闭环联动,能够提高复杂任务环境下的执行效率、目录一致性及资源访问安全性,增强系统对动态环境的自适应能力和多Agent协同能力。
Smart Images

Figure CN122994318A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, specifically relating to a hierarchical command processing and directory synchronization method and system. Background Technology
[0002] In recent years, with the development of large language model technology, intelligent agent systems based on large models have gradually become an important research direction in the field of artificial intelligence. Agent systems can complete task planning, tool invocation, file operation, code execution, and multi-step reasoning based on natural language commands, and have wide application value in scenarios such as intelligent office, software development, automated operation and maintenance, knowledge management, and terminal intelligent assistants.
[0003] Currently, the deployment mode of large-scale model agents is gradually evolving from a single cloud-based inference architecture to a collaborative architecture of "cloud inference + local execution". In this type of architecture, the cloud is typically responsible for large-scale model inference, task decomposition, multi-round context management, tool invocation decisions, and agent orchestration and scheduling; while the local side is responsible for file system access, local directory management, system command execution, local tool invocation, privacy data processing, and terminal resource control. By coordinating cloud and local operations, cloud resource consumption can be effectively reduced, and the agent's ability to operate in the local environment and its real-time response capabilities can be improved.
[0004] Meanwhile, with the development of multi-agent collaboration models, a complex task often requires the joint participation of multiple agents. For example, a cloud-based planning agent is responsible for task breakdown, a local execution agent is responsible for system operations, a file analysis agent is responsible for directory parsing, a synchronization agent is responsible for status updates, and a security agent is responsible for access control. Different agents need to share directory structure, file status, context information, and task execution status to form a continuous inference and execution chain.
[0005] Furthermore, in agent systems targeting terminal devices, the local directory environment is in a state of dynamic change, including: file addition, deletion, and modification; directory structure changes; cache status updates; local resource migration; multi-terminal synchronous changes; and new resources generated by tool execution. These changes all affect the agent's subsequent inference and execution results. Therefore, agent systems need to possess real-time awareness of the local directory status, incremental synchronization capabilities for directory changes, dynamic management of command execution status, context sharing capabilities for multi-agent collaborative processes, and unified scheduling capabilities for cloud and local execution links.
[0006] Currently, some systems in the industry have attempted to achieve cloud-edge collaboration through RPC calls, remote command execution, file synchronization tools, or task queue mechanisms. However, most solutions remain at the level of simple command forwarding or file synchronization, and a unified hierarchical command processing and directory synchronization mechanism suitable for large-scale model agent scenarios has not yet been formed. Significant shortcomings remain, particularly in the following scenarios: lack of unified hierarchical management for multiple command types; inability to provide real-time feedback on local directory changes to the cloud; inconsistent perception of directory status among multiple agents; low efficiency of incremental synchronization; lack of contextual association in command execution; lack of permission isolation for high-risk commands; discrepancies between cloud inference results and local resource status; and difficulty in resolving directory conflicts in multi-terminal environments.
[0007] Therefore, there is an urgent need for a layered command processing and directory synchronization method for cloud-local agent architecture to achieve cloud-edge collaborative execution, layered command routing, real-time synchronization of local directory status, multi-agent context sharing, dynamic permission control, incremental directory awareness, and efficient and stable task execution chain, thereby improving the execution efficiency, security, and system reliability of large model agent systems in complex scenarios. Summary of the Invention
[0008] The purpose of this application is to provide a hierarchical command processing and directory synchronization method and system to address the shortcomings of existing technologies that lack unified hierarchical management.
[0009] To solve the above-mentioned technical problems, this application is implemented as follows: Firstly, a hierarchical command processing and directory synchronization method is provided, including the following steps: The system receives a task request input by the user, performs semantic parsing on the task request, identifies the task intent, resource access requirements, tool call requirements and task dependencies, and generates a command execution chain based on the parsing results, which is formed by associating multiple commands in the order of execution. The functional attributes, execution location, permission level, risk level, and contextual dependencies of each command in the command execution chain are analyzed to generate hierarchical command data including control commands, execution commands, and feedback commands. Permission verification and dynamic routing are performed based on the attributes of each layer of commands to obtain the corresponding target execution path. Based on the target execution path, the cloud agent and local agent are controlled to collaboratively execute the layered command data, obtain the local resource operation results, and monitor the directory status involved in the execution process in real time, generating directory status data containing directory tree index, file identification information and directory version information. Based on the directory status data, identify the directory changes, extract the difference information corresponding to the changed files, construct incremental synchronization data, and use the incremental synchronization data to update the cloud directory status, task context, and shared context status.
[0010] Secondly, a hierarchical command processing and directory synchronization system is provided, including: The parsing module is used to receive task requests input by the user, perform semantic parsing on the task requests, identify task intent, resource access requirements, tool call requirements and task dependencies, and generate a command execution chain formed by multiple commands associated in the execution order based on the parsing results; The generation module is used to analyze the functional attributes, execution position, permission level, risk level and context dependency of each command in the command execution chain, generate hierarchical command data including control commands, execution commands and feedback commands, and perform permission verification and dynamic routing according to the attributes of each layer of commands to obtain the corresponding target execution path. The acquisition module is used to control the cloud agent and the local agent to collaboratively execute the hierarchical command data according to the target execution path, acquire the local resource operation results, and monitor the directory status involved in the execution process in real time, and generate directory status data containing directory tree index, file identification information and directory version information. The update module is used to identify changes in the directory based on the directory status data, extract the difference information corresponding to the changed files, construct incremental synchronization data, and use the incremental synchronization data to update the cloud directory status, task context, and shared context status.
[0011] This application embodiment achieves closed-loop linkage between command execution and directory status through layered command processing, collaborative execution between cloud and local agents, incremental synchronization of directory status, and dynamic command reconstruction. This can improve execution efficiency, directory consistency, and resource access security in complex task environments, and enhance the system's adaptability to dynamic environments and multi-agent collaboration capabilities. Attached Figure Description
[0012] Figure 1 This is a flowchart of a hierarchical command processing and directory synchronization method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a hierarchical command processing and directory synchronization system provided in an embodiment of this application. Detailed Implementation
[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0014] Currently, the solutions in existing technologies mainly include the following categories: (1) Centralized Agent Execution Architecture Based on Cloud-based Large Model Existing large-scale model agent systems typically employ an architecture of "centralized cloud-based inference + remote tool invocation." Examples include tool calling frameworks based on large models, function calling scheduling systems, cloud-based workflow orchestration agents, RPC remote command execution systems, and intelligent assistant systems based on plug-in mechanisms. In these solutions, the cloud-based large model typically handles user intent understanding, task decomposition, tool selection, command generation, and execution flow control. Subsequently, local tools or remote execution modules are invoked via API, RPC, or Shell commands to complete the actual operations. While this approach enables basic task automation, its main characteristics are: command processing is centralized in the cloud, the local execution end lacks autonomous scheduling capabilities, the cloud has limited awareness of local directory status, there is a lack of continuous directory synchronization mechanisms, and insufficient state sharing capabilities among multiple agents. Therefore, in scenarios involving complex file system operations, multi-terminal collaboration, and dynamic directory management, issues such as broken execution chains, invalid directory states, and inconsistent contexts can easily arise.
[0015] (2) Directory synchronization scheme based on file synchronization tools Existing technologies include numerous solutions for directory and file synchronization, such as rsync incremental synchronization mechanisms, cloud disk synchronization systems, distributed file synchronization systems, Git-based version synchronization mechanisms, and NAS file monitoring and synchronization systems. These solutions primarily achieve directory synchronization between different devices through file hash comparison, timestamp detection, file monitoring, incremental transfer, and differential updates.
[0016] However, such technical solutions are primarily designed for "file data synchronization" and are not suitable for command context synchronization, agent execution state synchronization, inference link synchronization, directory semantic awareness, command-level resource mapping, and multi-agent collaborative scheduling in large-scale model agent scenarios. Furthermore, existing directory synchronization solutions typically lack command association mechanisms, context inheritance capabilities, agent access control, and task-level directory mapping capabilities, making it difficult to meet the dynamic execution requirements of cloud-local agent collaborative scenarios.
[0017] (3) Terminal execution scheme based on local agent Some existing systems employ a "resident local agent" approach to achieve intelligent terminal control. Examples include local AI assistants, automation script agents, IDE intelligent coding agents, local command execution agents, and operating system automation frameworks. These solutions typically achieve a certain level of intelligent automation through local file monitoring, shell command execution, local cache management, and plugin scheduling.
[0018] However, such solutions generally suffer from drawbacks such as independent operation of local resources, lack of unified cloud-based inference capabilities, inability to unify the status of multiple devices, lack of hierarchical command management, inability to orchestrate complex tasks, and weak context sharing capabilities, making it difficult to support large-scale model collaboration scenarios involving cross-device, multiple agents, and continuous inference.
[0019] (4) Multi-Agent Collaborative System Based on Workflow Orchestration Currently, some multi-agent systems attempt to achieve task orchestration through workflow engines, such as DAG workflow scheduling, multi-agent task chains, message queue-driven collaboration, Planner-Executor patterns, and multi-role agent collaboration frameworks. These systems typically achieve collaborative execution of multiple agents through task queues, state machines, message buses, and shared caches. However, most existing solutions focus on "task flow" while lacking file directory-level state awareness, real-time local resource mapping, cloud-edge directory synchronization, command-level context binding, dynamic directory indexing, and local execution permission isolation. This leads to problems such as path invalidation, state drift, multi-agent file conflicts, invisible local resources, and lost execution context when dealing with real terminal file environments.
[0020] In summary, although existing technologies have made some progress in areas such as large-scale model agents, file synchronization, multi-terminal collaboration, and automated execution, the following significant shortcomings still exist in practical application scenarios for cloud-local agent collaborative architectures: (1) Lack of a unified hierarchical command processing mechanism Most existing agent systems employ a single-layer command execution model, where commands are generated centrally in the cloud and then directly distributed to the local execution endpoint. This approach suffers from the following problems: lack of command categorization and management, inability to isolate commands of different risk levels, easy unauthorized execution of high-privilege commands, lack of context verification during local execution, lack of state inheritance between multi-step commands, and inability to dynamically manage command dependencies. Especially in complex task scenarios, the simultaneous execution of a large number of commands can easily lead to execution order conflicts, local resource contention, task chain breaks, and untraceable execution results. Therefore, existing technologies struggle to achieve stable and highly reliable large-scale agent collaborative execution.
[0021] (2) It is difficult to keep the cloud and local directory status consistent. Existing directory synchronization solutions primarily focus on file content synchronization, lacking directory state management capabilities for agent execution scenarios. In actual operation, local directory structures change frequently, with numerous file additions, deletions, and moves. The directory states across multiple terminals are constantly changing, local caches are dynamically updated, and intermediate files are continuously generated during agent execution. Therefore, existing technologies generally suffer from high synchronization latency, untimely state updates, low incremental synchronization efficiency, weak conflict detection capabilities, and the inability to update directory indexes in real time. This leads to outdated directory information obtained by cloud agents, invalid command execution paths, incorrect file references, abnormal tool calls, and inconsistent states among multiple agents, severely impacting system stability.
[0022] (3) Lack of context sharing capability for multiple agents Existing multi-agent systems primarily rely on task flow for collaboration, but lack a unified mechanism for sharing directory state and inheriting context. Therefore, during collaborative execution by multiple agents, issues such as duplicate processing of the same resource, differing state perceptions among agents, inability to share intermediate execution results, loss of inference chain context, file lock conflicts, and directory cache overwriting can easily arise. This is especially problematic in long task chains, where it is difficult to establish a consistently consistent execution environment among different agents.
[0023] (4) Lack of security isolation mechanism for local resource access Currently, many agent systems access local resources directly through shell calls, system APIs, local script execution, and tool plugin interfaces. However, they typically lack command-level permission control, isolation of high-risk operations, protection of sensitive local directories, dynamic authorization mechanisms, and auditing capabilities for execution behavior. This leads to risks such as local data leakage, accidental execution of system commands, accidental file deletion, malicious command injection, and unauthorized access by agents, making it difficult to meet enterprise-level or endpoint-level security requirements.
[0024] (5) The efficiency of cloud-edge collaborative execution is relatively low. Existing cloud-to-local collaboration methods typically rely on full directory uploads, frequent remote requests, polling-based state synchronization, single-threaded command scheduling, and blocking task execution. This approach suffers from drawbacks such as high network overhead, low synchronization efficiency, insufficient real-time performance, low local resource utilization, and poor multi-task concurrency capabilities. Especially in complex directory environments or large-scale file scenarios, it significantly increases agent response latency, inference waiting time, command execution time, and overall system load.
[0025] (6) Lack of a real-time awareness mechanism for dynamic directory environments Existing systems typically read the directory state once before a task begins, lacking continuous awareness of directory changes during subsequent execution. Therefore, when the local environment changes, the Agent cannot update the directory index in a timely manner, cached paths are prone to becoming invalid, file references may be incorrect, and subsequent commands may be executed based on the old state, resulting in poor stability for complex tasks.
[0026] To address the problems in existing technologies, such as insufficient collaboration between cloud and local agents, inconsistent directory state synchronization, low command processing efficiency, difficulty in multi-agent context sharing, and insufficient local resource security, this application proposes a layered command processing and directory synchronization method for a cloud-local agent architecture. The aim is to establish a unified layered command processing system, directory state synchronization system, and context sharing system by constructing a collaborative execution mechanism between cloud and local agents. This enables layered command processing, directory state synchronization, context sharing, and local resource security control, thereby achieving efficient, secure, and stable agent collaborative execution capabilities in complex task scenarios.
[0027] Specifically, the embodiments of this application can achieve the following objectives: (1) Enable collaborative command processing between cloud and local agents. This application embodiment establishes a hierarchical command parsing and scheduling mechanism to classify and manage commands of different types, different permission levels, and different execution environments. This enables decoupling of cloud inference and local execution, dynamic command routing, multi-level command distribution, local autonomous execution, and context-related execution, thereby improving command processing efficiency and execution stability in complex task scenarios.
[0028] (2) Real-time synchronization and consistency maintenance of directory status. This application embodiment establishes a directory status awareness mechanism and an incremental synchronization mechanism to achieve real-time detection of local directory changes, dynamic updating of file status, incremental synchronization of directory structure, synchronization of cache status, and maintenance of directory consistency across multiple terminals, thereby avoiding problems such as path invalidation, file reference errors, command execution anomalies, and Agent state drift caused by inconsistent directory status.
[0029] (3) Achieve context sharing and collaborative execution among multiple agents This application embodiment establishes a unified context state management mechanism, enabling multiple agents to share directory index state, file reference relationships, command execution results, intermediate task states, and resource access records. This achieves multi-agent collaborative reasoning, continuous task chain execution, avoidance of repetitive operations, and improved complex task processing capabilities.
[0030] (4) Improve the security and controllability of local resource access. This application embodiment establishes a hierarchical command permission mechanism and a local resource isolation mechanism to achieve high-risk command identification, dynamic permission control, sensitive directory isolation, command execution auditing, and local resource access restrictions, thereby reducing the risks of unauthorized access, file misoperation, local privacy leakage, and malicious command injection.
[0031] (5) Improve the efficiency of cloud-edge collaborative execution and system real-time performance This application's embodiments reduce communication overhead between the cloud and local systems by introducing incremental directory synchronization, event-driven directory updates, command caching mechanisms, local pre-execution mechanisms, and multi-threaded task scheduling mechanisms, thereby improving Agent response speed, directory synchronization efficiency, command execution real-time performance, and overall system throughput.
[0032] (6) Improve the stable execution capability of agents in complex and dynamic environments. This application's embodiments establish a dynamic directory awareness mechanism, a state conflict detection mechanism, an execution chain recovery mechanism, and a task context persistence mechanism for dynamic directory environments, multi-task concurrent environments, and multi-terminal collaborative environments, thereby improving the Agent system's stability, robustness, scalability, and long-term task continuous execution capability in complex environments.
[0033] To achieve the above objectives, the embodiments of this application adopt a collaborative architecture of "cloud inference scheduling + local execution control + directory state synchronization", which mainly includes a cloud agent scheduling layer, a layered command processing layer, a local agent execution layer, a directory state synchronization layer, a context sharing management layer, and a security control layer. The modules communicate and coordinate with each other through a unified command protocol, directory state protocol, and context synchronization mechanism.
[0034] Specifically, the overall system architecture of this application embodiment includes: 1. Cloud Agent Scheduling Module It is used to receive user task requests and complete user intent parsing, task planning, command generation, tool invocation decision, agent task decomposition, command priority analysis and command type identification based on a large model.
[0035] The cloud-based agent scheduling module categorizes tasks into cloud inference commands, local execution commands, directory synchronization commands, status query commands, permission verification commands, and multi-agent collaboration commands based on command type, and then generates a hierarchical command data package with a unified structure.
[0036] 2. Layered command processing module Used for hierarchical parsing and dynamic routing of commands generated in the cloud.
[0037] This module includes a command classification unit, a command priority management unit, a command dependency analysis unit, a command permission verification unit, a command execution queue unit, and a command context binding unit. Based on command characteristics, the system classifies commands into: (1) Level 1 commands (core control commands), including Agent scheduling, directory synchronization control, permission management, session state management and multi-Agent collaborative control. Level 1 commands are managed uniformly by the cloud control center.
[0038] (2) Second-level commands (local resource operation commands), including file reading and writing, directory creation, file retrieval, local tool invocation, shell execution, and cache update. Second-level commands are executed by the local agent.
[0039] (3) Level 3 commands (real-time status feedback commands), including file change notifications, execution status feedback, directory index updates, error status feedback, and incremental synchronization triggering. Level 3 commands are used to maintain consistency between the cloud and local states.
[0040] The directory synchronization technology solution in this application includes: 1. Directory status awareness mechanism The local agent continuously monitors changes in the local directory status, including file additions, deletions, modifications, path migrations, cache changes, and tool-generated files. The system generates a corresponding directory status index, file hash, timestamp, directory tree structure, and resource mapping relationships for each directory.
[0041] 2. Incremental directory synchronization mechanism When the directory changes, the local agent does not perform a full synchronization. Instead, it extracts the changes, builds incremental synchronization data, generates directory change events, uploads the change index, and updates the cloud directory cache, thereby reducing network bandwidth consumption, synchronization latency, and duplicate data transmission.
[0042] 3. Directory consistency maintenance mechanism The system ensures consistency between cloud and local directories, unified directory status across multiple agents, and controllable concurrent modifications through version number management, directory status snapshots, conflict detection algorithms, file locking mechanisms, and status rollback mechanisms.
[0043] In the context sharing technical solution of this application embodiment, a unified context state pool is established to maintain Agent execution history, file reference relationships, directory status, command dependency chains, tool call results, and session status. Multiple Agents can share task status based on the unified context pool, thereby achieving continuous reasoning, collaborative execution, state inheritance, and reuse of intermediate results.
[0044] In the local security control solution of this application embodiment, a command permission isolation mechanism is established to achieve high-risk command identification, sensitive directory isolation, dynamic authorization verification, local sandbox execution, and command execution auditing. The system dynamically determines automatic execution, user confirmation, sandbox execution, and execution prohibition based on the command risk level, thereby improving the security of local resources.
[0045] The overall execution flow in this application embodiment includes: Step S1: The cloud agent receives the user's input task.
[0046] Step S2: Cloud-based large model parsing task and generation of hierarchical commands.
[0047] Step S3: The hierarchical command processing module classifies and verifies the permissions of commands.
[0048] Step S4: The local agent receives the corresponding command and executes local resource operations.
[0049] Step S5: The directory monitoring module detects directory changes in real time.
[0050] Step S6: The directory synchronization module generates incremental synchronization data and updates the cloud status.
[0051] Step S7: The context sharing module synchronizes the execution status and task context.
[0052] In step S8, the cloud-based Agent continues subsequent inference and task orchestration based on the latest directory status.
[0053] Compared with the prior art, the embodiments of this application have at least the following innovative points: 1. A layered command processing mechanism for cloud-local agents is proposed; 2. A directory-state-aware incremental synchronization mechanism is proposed; 3. Propose a unified context sharing mechanism to support multi-agent collaboration; 4. Propose a command-level permission isolation and security control mechanism; 5. Propose a real-time synchronization method suitable for dynamic directory environments; 6. Implement a decoupled and collaborative architecture between cloud-based inference and local execution; 7. Improve the stability and real-time performance of Agent execution in complex task scenarios.
[0054] The hierarchical command processing and directory synchronization method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0055] like Figure 1 The diagram shown is a flowchart of a hierarchical command processing and directory synchronization method provided in an embodiment of this application. The method includes the following steps: Step 101: Receive a task request input by the user, perform semantic parsing on the task request, identify the task intent, resource access requirements, tool call requirements and task dependencies, and generate a command execution chain based on the parsing results, which is formed by multiple commands associated in the order of execution.
[0056] Step 102: Analyze the functional attributes, execution location, permission level, risk level, and contextual dependencies of each command in the command execution chain to generate hierarchical command data including control commands, execution commands, and feedback commands. Perform permission verification and dynamic routing based on the attributes of each layer of commands to obtain the corresponding target execution path.
[0057] Specifically, based on the functional attributes, execution location, and permission level of each command in the command execution chain, commands used for task scheduling, session control, permission verification, directory synchronization control, and multi-agent collaboration can be classified as control commands; based on the functional attributes, execution location, and resource access requirements of each command in the command execution chain, commands used for file reading and writing, directory creation, file retrieval, local tool invocation, shell execution, and cache updating can be classified as execution commands, and a resource mapping relationship between execution commands and their corresponding local resources can be established; based on the functional attributes and context dependencies of each command in the command execution chain, commands used for file change notification, execution status feedback, directory index update, error status feedback, incremental synchronization triggering, and context update can be classified as feedback commands, and an association relationship between feedback commands and their corresponding control commands and execution commands can be established; a hierarchical command association model can be constructed based on the resource mapping relationship and the association relationship, so that the control commands drive the execution commands to execute, and the execution status of the control commands and the execution commands can be synchronously updated according to the execution status returned by the feedback commands.
[0058] Furthermore, the system can obtain the command type, execution location, risk level, resource access permissions, and context dependencies corresponding to each layer of commands; determine the corresponding target execution module based on the command type, where inference commands correspond to a cloud agent, file operation commands correspond to a local agent, directory synchronization commands correspond to a directory synchronization module, state sharing commands correspond to a context management module, and high-risk commands correspond to a security control module; verify the execution permissions of each layer of commands based on the risk level, resource access permissions, directory sensitivity level, and user authorization status, and determine the corresponding execution strategy based on the permission verification results, whereby the execution strategy includes at least one of automatic execution, user-confirmed execution, sandbox isolation execution, permission upgrade verification, and command blocking; dynamically route commands at each layer based on the target execution module, the execution strategy, and context dependencies, generating a target execution path including a cloud execution path, a local execution path, a security control path, and a status feedback path; and establish execution associations between commands at each layer based on the target execution path to drive control commands, execution commands, and feedback commands to execute collaboratively according to a preset dependency order.
[0059] Step 103: Based on the target execution path, control the cloud agent and the local agent to collaboratively execute the layered command data, obtain the local resource operation results, and monitor the directory status involved in the execution process in real time to generate directory status data containing directory tree index, file identification information and directory version information.
[0060] Step 104: Identify directory changes based on the directory status data, extract the difference information corresponding to the changed files, construct incremental synchronization data, and use the incremental synchronization data to update the cloud directory status, task context, and shared context status.
[0061] In this embodiment, after identifying directory changes based on the directory status data, extracting the difference information corresponding to the changed files, and constructing incremental synchronization data, a corresponding directory status snapshot can be generated based on the directory status data, and the corresponding directory version number can be recorded. The directory status snapshot is compared with the cloud directory status snapshot to identify the location of directory conflicts. When a directory conflict is detected, conflict detection is performed based on file identification information, file version information, and timestamp, and file locking, version rollback, or conflict merging is performed according to a preset conflict handling strategy to generate a target directory status. The cloud directory status and shared context status are updated based on the target directory status.
[0062] Furthermore, after updating the cloud directory status, task context, and shared context status using the incremental synchronization data, the current task completion status, directory change status, resource occupancy status, and command execution status can be extracted based on the updated task context, shared context status, and local resource operation results. Based on the task completion status, directory change status, resource occupancy status, and command execution status, the dependencies and execution order between commands in the command execution chain are re-analyzed to identify target commands affected by environmental changes. According to the resource access requirements, tool invocation requirements, and context dependencies corresponding to the target commands, the target commands are reordered, replaced, inserted, or deleted to generate an updated command execution chain. Each command in the updated command execution chain undergoes a new layered processing to generate subsequent layered command data, and the cloud agent and local agent continue to execute subsequent tasks based on this subsequent layered command data.
[0063] This application embodiment achieves closed-loop linkage between command execution and directory status through layered command processing, collaborative execution between cloud and local agents, incremental synchronization of directory status, and dynamic command reconstruction. This can improve execution efficiency, directory consistency, and resource access security in complex task environments, and enhance the system's adaptability to dynamic environments and multi-agent collaboration capabilities.
[0064] In the embodiments of this application, the implementation process mainly includes steps such as task reception, command generation, hierarchical scheduling, local execution, directory synchronization, context sharing, and status feedback.
[0065] Specifically, the overall process of this application embodiment includes the following steps: Step 201: Receive user task request.
[0066] Specifically, the cloud-based Agent service receives task requests input by the user. These requests can include natural language tasks, file processing requests, local directory operation requests, multi-step automation tasks, tool invocation requests, and multi-Agent collaborative tasks. Examples include tasks such as "organizing PDF files in the local download directory," "analyzing code projects in a specified directory," "synchronizing local projects to the cloud workspace," and "executing local tests and returning results." The cloud-based Agent writes the user request to the task context pool and generates a corresponding task session identifier.
[0067] Step 202: The cloud-based large model performs task analysis.
[0068] Specifically, the cloud-based big data model performs semantic understanding of user requests and completes user intent recognition, task decomposition, subtask generation, tool selection, file dependency analysis, local resource requirement analysis, and command risk analysis, and then generates the corresponding command execution chain.
[0069] Step 203: Construct a hierarchical command structure.
[0070] The system categorizes commands into multiple levels based on command type, execution location, and permission level, specifically including: (1) Level 1 control commands are used for Agent scheduling, session control, permission verification, directory synchronization control, and multi-Agent collaboration. Level 1 commands are managed uniformly by the cloud control center.
[0071] (2) Second-level execution commands are used for file reading and writing, local directory access, tool invocation, shell execution, cache update, and data processing. Second-level commands are executed by the local agent.
[0072] (3) Level 3 feedback commands are used for status feedback, file change notification, error feedback, synchronization confirmation, and context update. Level 3 commands are used to maintain consistency between cloud and edge status.
[0073] Step 204: Command permission verification and dynamic routing.
[0074] The system performs permission level verification, local resource access verification, risk level assessment, and contextual validity verification on commands. Then, it performs dynamic routing based on the command characteristics shown in Table 1. For high-risk commands, the system can trigger user confirmation, sandbox execution, command blocking, and permission escalation verification.
[0075] Table 1 Command Characteristics Table Reasoning commands Cloud Agent File operation commands Local Agent Directory synchronization command Synchronization module State sharing command Context module High-risk commands Safety control module Step 205: The local agent receives and executes the command.
[0076] The local agent receives secondary execution commands from the cloud and establishes a corresponding local execution context. Based on the command content, the local agent invokes file system interfaces, local tools, system commands, caching services, third-party plugins, and development environment tools.
[0077] Step 206: Perform local resource operations.
[0078] The local agent performs the corresponding resource operations, including file reading, file writing, file moving, directory creation, file searching, shell execution, and local script execution. During execution, the system continuously records the execution status, file reference relationships, command execution results, intermediate cached data, and error logs.
[0079] Step 207, directory status monitoring.
[0080] The local directory monitoring module tracks changes to the local directory in real time. This monitoring includes file additions, deletions, modifications, directory migrations, cache changes, and temporary file creation. The system generates a directory tree index, file hashes, timestamps, version numbers, and status snapshots for each directory.
[0081] Step 208: Generate incremental synchronization data.
[0082] When a directory changes, the system does not perform a full synchronization. Instead, it identifies the changed files, calculates the differences, extracts the incremental index, constructs synchronization events, and generates a directory change data package. The incremental synchronization data includes file path, file status, change type, file version, timestamp, and file summary.
[0083] Step 209: Update the cloud directory status.
[0084] The synchronization module synchronizes incremental directory data to the cloud, and the cloud updates the directory state cache, file reference index, agent context state, and multi-agent shared directory pool, thereby ensuring that the cloud inference state is updated in real time, subsequent commands are executed based on the latest directory, and multiple agents maintain a consistent understanding of the directory state.
[0085] Step 210, Shared Context Synchronization.
[0086] The context management module synchronizes the Agent execution history, file dependencies, command status, intermediate execution results, and current directory status, allowing multiple Agents to share the same task context.
[0087] Step 211: Multi-Agent collaborative execution.
[0088] Multiple agents execute different subtasks based on a shared context, as shown in Table 2. Different agents synchronize their states through a unified context pool.
[0089] Table 2 Agent Function Table Planner Agent Task planning Executor Agent Execute locally Sync Agent Directory synchronization Security Agent Access Control Memory Agent Context maintenance Step 212: Execution result is returned.
[0090] The local agent returns the execution results, file change status, error logs, and intermediate output to the cloud.
[0091] Step 213, cloud-based inference closed-loop update.
[0092] The cloud-based agent continues to perform subsequent inference or task orchestration based on the latest directory status, local execution results, and multi-agent status. Upon completion of a task, it updates the task status, writes it to the execution history, archives the context, and clears the temporary cache.
[0093] Through the above implementation process, the embodiments of this application can realize collaborative execution between cloud and local agents, hierarchical command dynamic scheduling, real-time directory status synchronization, multi-agent context sharing, incremental directory synchronization, local resource security control, and stable execution of long task chains, thereby significantly improving the execution efficiency, real-time performance, security, and consistency of large model agent systems in complex dynamic environments.
[0094] The technical solution of this application embodiment can be deployed in a computing environment including a cloud server, local terminal devices, and a multi-agent collaborative system. The cloud environment includes a large model inference server, agent scheduling service, task orchestration service, context management service, directory state caching service, and access control service. The cloud environment is mainly responsible for user task parsing, multi-step task planning, command generation, agent scheduling, context inference, and state synchronization management. The local environment includes a local agent service, a file system monitoring module, a local command execution module, a local caching module, a tool call interface, and a security isolation module. The local environment is mainly responsible for file system operations, local directory management, tool calls, system command execution, directory state monitoring, and incremental synchronization data generation. Continuous communication is established between the cloud and local environments through WebSocket, RPC, HTTPAPI, message queues, and long-connection synchronization channels. The system uses a unified command protocol and directory synchronization protocol to complete data interaction.
[0095] The implementation method for local directory analysis tasks, taking "analyzing the local code directory" as an example, includes the following steps: Step 301: The user initiates the task.
[0096] Specifically, the user inputs the task into the cloud agent: "Analyze the Python project structure in the local project directory and generate a module dependency report." After receiving the user's request, the cloud agent creates a task session, generates a task ID, and initializes the context state pool.
[0097] Step 302, Cloud Task Analysis.
[0098] Specifically, the cloud-based big data model analyzes the tasks, identifies the target directory analysis requirements, Python file scanning requirements, module dependency analysis requirements, and report generation requirements, and then generates the corresponding command chains, as shown in Table 3.
[0099] Table 3 Command Chain CMD-01 Get directory structure local CMD-02 Scan Python files local CMD-03 Extract import relationships local CMD-04 Generate dependency graph cloud CMD-05 Output analysis report cloud Step 303, construct the layer command.
[0100] The system divides commands into first-level commands (task scheduling, status synchronization, and access control), second-level commands (local file scanning, directory reading, and Python file parsing), and third-level commands (status feedback, file change synchronization, and execution result feedback).
[0101] Step 304, execute the local agent.
[0102] After receiving the secondary command, the local agent reads the directory structure, generates a directory tree, file index, file hash and file timestamp, scans Python files, extracts import statements, module dependencies, file reference relationships and function definition information, and performs status logging.
[0103] The local agent records the execution progress, scanned files, intermediate results, and error logs, and continuously synchronizes them to the cloud.
[0104] Step 305: Synchronize directory status.
[0105] During the scanning process, the local monitoring module detects file additions, deletions, and modifications in real time. The system only uploads the changed parts, as shown in Table 4, and then generates incremental synchronization data packets.
[0106] Table 4 Upload Information Table utils.py Revise new_api.py New Step 306, cloud context update.
[0107] The latest directory structure, file dependencies, current execution status, and Agent context are synchronized to the cloud. Multiple Agents can share this state; for example, the Analysis Agent analyzes dependencies, the Report Agent generates documentation, and the Memory Agent stores the context.
[0108] Step 307: Generate the final result.
[0109] Based on the synchronized data, the cloud-based agent generates a module dependency graph, constructs an engineering structure report, outputs analysis results, and finally returns them to the user.
[0110] The local automated execution method, taking "automatically organizing the download directory" as an example, includes the following steps: Step 401, user inputs task.
[0111] For example, a user might enter: "Automatically organize PDFs, images, and compressed files in the download directory."
[0112] Step 402: Generate classification commands in the cloud.
[0113] Specifically, the system generates classification commands as shown in Table 5.
[0114] Table 5 Classification Commands Directory scanning command Scan download directory File categorization command Identify file types File move command Categorize and move files State synchronization command Update directory status Step 403, Permission verification.
[0115] The system checks whether sensitive directories are involved, whether write permissions are available, and whether user confirmation is required. If the command is considered high-risk, it triggers user authorization, sandbox execution, and access restrictions.
[0116] Step 404: Organize local executable files.
[0117] Specifically, the local agent performs file type identification, creates categorized directories, moves files, detects duplicate files, and updates the cache, as shown in Table 6.
[0118] Table 6. Correspondence between file types and directories PDF Documents PNG / JPG Images ZIP / RAR Archives Step 405: Directory synchronization and status update.
[0119] Specifically, the system synchronizes the new directory structure, file location changes, file index status, and execution results, and updates the directory cache in real time on the cloud.
[0120] It should be noted that the key technical mechanisms in the embodiments of this application include: (1) Dynamic directory monitoring mechanism The local monitoring module uses file system event monitoring, hash comparison, timestamp detection, and incremental directory tree updates to achieve real-time directory awareness.
[0121] Incremental synchronization mechanism The system only synchronizes the changed parts, including file paths, change types, file summaries, and version information, avoiding full directory transfers.
[0122] Command layering mechanism The system dynamically categorizes commands based on risk level, execution location, resource type, and contextual dependencies.
[0123] Context sharing mechanism Multiple agents share file status, execution history, directory index, inference results, and intermediate cache through a unified context pool.
[0124] Through the above implementation methods, the embodiments of this application can realize cloud inference and local execution collaboration, hierarchical command dynamic scheduling, real-time directory status synchronization, multi-Agent context sharing, dynamic permission isolation, efficient incremental synchronization, and stable execution of long tasks, which significantly improves agent execution efficiency, multi-terminal collaboration capabilities, system real-time performance, local resource security, dynamic environment adaptability, and large model task execution stability.
[0125] This application proposes a layered command processing and directory synchronization method for the scenario of "cloud-local agent collaborative execution". Its core key points are mainly reflected in the following aspects: Hierarchical command processing mechanism This application proposes a layered command processing mechanism for an agent-oriented architecture. The system divides commands into multiple layers based on their functional type, execution location, risk level, contextual dependencies, and resource access permissions: Level 1 commands (control and scheduling layer), Level 2 commands (local execution layer), and Level 3 commands (feedback and synchronization layer). This layered command structure enables decoupling of cloud inference from local execution, dynamic command routing, isolation of high-risk commands, concurrent scheduling of multiple tasks, and stable execution of long task chains.
[0126] Cloud-local collaborative execution mechanism This application embodiment establishes a collaborative execution system between cloud-based agents and local agents. The cloud is responsible for large-scale model inference, task planning, agent orchestration, contextual inference, command generation, and state management, while the local agent is responsible for file system operations, local resource access, tool execution, directory monitoring, and state feedback. The system achieves cloud-edge collaborative execution, real-time local feedback, multi-round continuous inference, and dynamic task adjustment through a unified command and contextual protocol. Compared to traditional monolithic agent architectures, this application embodiment offers higher scalability and real-time performance.
[0127] Real-time directory status awareness and incremental synchronization mechanism This application proposes a real-time synchronization mechanism for dynamic directory environments. A local agent continuously monitors file additions, deletions, modifications, directory migrations, cache changes, and tool-generated files. The system constructs a directory state model based on file hashes, timestamps, directory tree indexes, and file version numbers. When a directory change is detected, only the changed portion is synchronized, not the entire directory. The synchronized content includes file paths, change types, file summaries, file states, and version information, thereby achieving incremental synchronization, reducing network overhead, improving synchronization real-time performance, and maintaining cloud-edge directory consistency.
[0128] Multi-Agent Context Sharing Mechanism This application establishes a unified context state pool, allowing multiple agents to share directory states, file reference relationships, execution history, inference states, tool call results, and intermediate cache data. Different agents form a continuous task chain by sharing the context. This context-sharing mechanism avoids state drift, duplicate execution, file conflicts, and inference chain breaks, improving the efficiency of multi-agent collaboration.
[0129] Command permission isolation and security control mechanism This application proposes a command-level permission control mechanism. The system dynamically determines the command execution strategy based on the command's risk level, access directory type, local resource permissions, and user authorization status. This strategy includes automatic execution, user confirmation, sandbox execution, permission escalation, and prohibition of execution. Simultaneously, the system supports sensitive directory protection, high-risk command interception, local execution auditing, and command line logging, thereby improving local resource security, agent controllability, and system reliability.
[0130] Dynamic task closed-loop reasoning mechanism This application's embodiments support real-time local execution result feedback, dynamic cloud context updates, automatic adjustment of subsequent tasks, and continuous evolution of the inference chain. That is, changes in the local environment can affect subsequent cloud inference results in real time. The system forms a dynamic closed-loop execution system of "inference → execution → state synchronization → re-inference," making it suitable for long-running tasks, dynamic file environments, multi-step automated tasks, and multi-agent collaborative inference tasks.
[0131] Scalable architecture for complex terminal environments This application's embodiments support multi-terminal devices, multi-directory environments, multi-tool systems, multi-Agent collaboration, and concurrent execution of multiple tasks. It also supports plugin extensions, dynamic tool registration, local capability hot updates, and distributed agent access, demonstrating strong engineering scalability.
[0132] Through the aforementioned key technologies, the embodiments of this application can achieve efficient collaboration between cloud and local agents, dynamic management of hierarchical commands, real-time synchronization of dynamic directories, sharing of multi-agent contexts, secure isolation of local resources, stable execution of long task chains, and high real-time performance with low synchronization overhead. This can significantly improve the execution efficiency, stability, security, collaboration capabilities, and scalability of large-model agent systems in complex dynamic environments.
[0133] Compared with existing large-scale agent systems, directory synchronization systems, and multi-agent collaborative solutions, the "layered command processing and directory synchronization method for cloud-local agent architecture" proposed in this application has the following advantages: Achieve efficient decoupling and collaboration between cloud-based inference and local execution. Existing technologies typically employ a single cloud execution mode, a simple remote command invocation mode, and a passive local execution mode, lacking a unified collaborative scheduling mechanism. In contrast, this application's embodiments construct a cloud-based agent scheduling system, a local agent execution system, and a hierarchical command routing mechanism. This enables the cloud to handle inference and planning, the local agent to handle resource operations and execution, real-time status feedback, and dynamic closed-loop collaboration, thereby effectively improving agent execution efficiency, local resource utilization, cloud-edge collaboration capabilities, and long-term task stability.
[0134] Improve command processing capabilities in complex task scenarios Existing command execution technologies typically employ a single-layer command structure, sequential execution mode, and lack a context binding mechanism, which can easily lead to multi-task conflicts, command dependency errors, broken inference chains, and uncontrollable execution. In contrast, this application proposes a hierarchical command system consisting of a first-level control command, a second-level execution command, and a third-level feedback command. This system enables dynamic command classification, risk isolation, priority scheduling, context association, and dynamic routing, thereby significantly improving command management capabilities in complex task environments.
[0135] Significantly improves the real-time performance and consistency of directory synchronization. Existing directory synchronization solutions mostly employ full directory synchronization, timed polling synchronization, and passive state updates, which suffer from high synchronization latency, high network consumption, expired directory states, and inconsistencies across multiple terminals. In contrast, this application's embodiment utilizes file event monitoring, hash difference detection, incremental synchronization mechanisms, and a directory state model to synchronize only the changed portions, thereby achieving real-time directory state updates, reducing network bandwidth consumption, improving synchronization efficiency, and maintaining cloud-edge directory consistency. This approach is particularly suitable for dynamic file environments.
[0136] Enhance multi-agent collaboration capabilities Most existing multi-agent systems only share task results, lacking directory state sharing, context sharing, file reference relationship sharing, and intermediate state synchronization. Therefore, they are prone to duplicate execution, file conflicts, state drift, and discontinuous inference. This application's embodiment, however, achieves multi-agent sharing of directory state, command execution history, intermediate results, and inference chain inheritance through a unified context pool mechanism, thereby significantly improving multi-agent collaboration efficiency, long task chain stability, and multi-step inference capabilities.
[0137] Improve the security of local resource access In existing technologies, many agent systems directly call shell commands, local tools, and file system interfaces, lacking effective access control. This can easily lead to unauthorized access, leakage of sensitive files, accidental execution of high-risk commands, and injection of malicious instructions. In contrast, the embodiments of this application, through command permission layering, dynamic authorization mechanisms, high-risk command identification, sandboxed execution isolation, and sensitive directory protection, can achieve secure access to local resources, controllable high-risk operations, and auditable agent execution behavior, thereby significantly improving system security.
[0138] Support continuous closed-loop inference in dynamic environments Existing agent systems typically employ a static execution model of "task planning → execution → termination." When the directory state changes, subsequent tasks cannot be adjusted in real time. However, this application's embodiment establishes a dynamic closed-loop mechanism of "reasoning → execution → state synchronization → re-reasoning," enabling real-time feedback of local state, dynamic adjustment of subsequent commands, continuous evolution of long tasks, and dynamic environment adaptation. This is particularly suitable for scenarios such as automated operation and maintenance, intelligent development, file management, and multi-step task collaboration.
[0139] (7) Possesses stronger system scalability This application's embodiments support multi-terminal access, multi-Agent extension, plug-in tool system, distributed local execution nodes, and dynamic capability registration. It can be adapted to PC terminals, servers, IDE environments, enterprise knowledge systems, automated operation and maintenance platforms, and intelligent office systems, and has strong engineering implementation capabilities.
[0140] Reduce system resource consumption and network overhead Because the embodiments of this application employ incremental synchronization, local preprocessing, hierarchical command execution, and state caching mechanisms, they can reduce full directory transfers, lower cloud load, reduce repetitive inference, and reduce network communication frequency, thereby improving the overall operating efficiency of the system.
[0141] In summary, the embodiments of this application, by constructing a hierarchical command parsing mechanism, a directory state incremental synchronization mechanism, a cloud-edge collaborative scheduling mechanism, and a context-aware execution mechanism, achieve efficient collaboration between cloud and local agents, secure isolation of the command execution process, consistent maintenance of directory state, context sharing among multiple agents, and stable inference and execution of complex tasks. This significantly improves the execution efficiency, resource utilization, stability, security, collaborative capabilities, scalability, and engineering implementation capabilities of large model agent systems in complex task scenarios.
[0142] like Figure 2 The diagram shown is a structural schematic of a hierarchical command processing and directory synchronization system provided in an embodiment of this application, including: The parsing module 210 is used to receive task requests input by the user, perform semantic parsing on the task requests, identify task intent, resource access requirements, tool call requirements and task dependencies, and generate a command execution chain formed by multiple commands associated in the order of execution based on the parsing results.
[0143] The generation module 220 is used to analyze the functional attributes, execution position, permission level, risk level and context dependency of each command in the command execution chain, generate hierarchical command data including control commands, execution commands and feedback commands, and perform permission verification and dynamic routing according to the attributes of each layer of commands to obtain the corresponding target execution path.
[0144] Specifically, the generation module 220 is used to classify commands used for task scheduling, session control, permission verification, directory synchronization control, and multi-agent collaboration into control commands based on the functional attributes, execution location, and permission level of each command in the command execution chain; to classify commands used for file reading and writing, directory creation, file retrieval, local tool invocation, Shell execution, and cache update into execution commands based on the functional attributes, execution location, and resource access requirements of each command in the command execution chain, and to establish a resource mapping relationship between the execution commands and their corresponding local resources; to classify commands used for file change notification, execution status feedback, directory index update, error status feedback, incremental synchronization triggering, and context update into feedback commands based on the functional attributes and context dependencies of each command in the command execution chain, and to establish an association relationship between the feedback commands and their corresponding control commands and execution commands; and to construct a hierarchical command association model based on the resource mapping relationship and the association relationship, so that the control commands drive the execution commands to execute, and to synchronously update the execution status of the control commands and the execution commands based on the execution status returned by the feedback commands.
[0145] Furthermore, the generation module 220 is specifically used to obtain the command type, execution location, risk level, resource access permission, and context dependency relationship corresponding to each layer of commands; determine the corresponding target execution module according to the command type, wherein inference commands correspond to the cloud agent, file operation commands correspond to the local agent, directory synchronization commands correspond to the directory synchronization module, state sharing commands correspond to the context management module, and high-risk commands correspond to the security control module; verify the execution permission of each layer of commands according to the risk level, the resource access permission, the directory sensitivity level, and the user authorization status, and determine the corresponding execution strategy based on the permission verification result, wherein the execution strategy includes at least one of automatic execution, user confirmation execution, sandbox isolation execution, permission upgrade verification, and command blocking; dynamically route each layer of commands according to the target execution module, the execution strategy, and the context dependency relationship, and generate a target execution path including a cloud execution path, a local execution path, a security control path, and a status feedback path; establish the execution association relationship between each layer of commands according to the target execution path, so as to drive the control command, execution command, and feedback command to be executed collaboratively according to a preset dependency order.
[0146] The acquisition module 230 is used to control the cloud agent and the local agent to jointly execute the hierarchical command data according to the target execution path, acquire the local resource operation results, and monitor the directory status involved in the execution process in real time, and generate directory status data containing directory tree index, file identification information and directory version information.
[0147] The update module 240 is used to identify directory changes based on the directory status data, extract the difference information corresponding to the changed files, construct incremental synchronization data, and use the incremental synchronization data to update the cloud directory status, task context, and shared context status.
[0148] Furthermore, the aforementioned system also includes: The extraction module is used to extract the current task completion status, directory change status, resource usage status, and command execution status based on the updated task context, shared context state, and local resource operation results. Based on the task completion status, directory change status, resource usage status, and command execution status, it re-analyzes the dependencies and execution order between commands in the command execution chain to identify target commands affected by environmental changes. According to the resource access requirements, tool invocation requirements, and context dependencies corresponding to the target commands, it performs reordering, replacement, insertion, or deletion processing on the target commands to generate an updated command execution chain. It then re-performs hierarchical processing on each command in the updated command execution chain to generate subsequent hierarchical command data, and controls the cloud agent and local agent to continue executing subsequent tasks based on this subsequent hierarchical command data.
[0149] The recording module is used to generate a corresponding directory status snapshot based on the directory status data and record the corresponding directory version number; compare the directory status snapshot with the cloud directory status snapshot to identify the directory conflict location; when a directory conflict is detected, perform conflict detection based on file identification information, file version information and timestamp, and perform file locking, version rollback or conflict merging processing according to a preset conflict handling strategy to generate the target directory status; update the cloud directory status and shared context status based on the target directory status.
[0150] This application embodiment achieves closed-loop linkage between command execution and directory status through layered command processing, collaborative execution between cloud and local agents, incremental synchronization of directory status, and dynamic command reconstruction. This can improve execution efficiency, directory consistency, and resource access security in complex task environments, and enhance the system's adaptability to dynamic environments and multi-agent collaboration capabilities.
[0151] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the above-described hierarchical command processing and directory synchronization method embodiments, achieving the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0152] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0153] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0154] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A hierarchical command processing and directory synchronization method, characterized in that, Includes the following steps: The system receives a task request input by the user, performs semantic parsing on the task request, identifies the task intent, resource access requirements, tool call requirements and task dependencies, and generates a command execution chain based on the parsing results, which is formed by associating multiple commands in the order of execution. The functional attributes, execution location, permission level, risk level, and contextual dependencies of each command in the command execution chain are analyzed to generate hierarchical command data including control commands, execution commands, and feedback commands. Permission verification and dynamic routing are performed based on the attributes of each layer of commands to obtain the corresponding target execution path. Based on the target execution path, the cloud agent and local agent are controlled to collaboratively execute the layered command data, obtain the local resource operation results, and monitor the directory status involved in the execution process in real time, generating directory status data containing directory tree index, file identification information and directory version information. Based on the directory status data, identify the directory changes, extract the difference information corresponding to the changed files, construct incremental synchronization data, and use the incremental synchronization data to update the cloud directory status, task context, and shared context status.
2. The method according to claim 1, characterized in that, After updating the cloud directory status, task context, and shared context status using the incremental synchronization data, the process further includes: Based on the updated task context, shared context status, and local resource operation results, extract the current task completion status, directory change status, resource usage status, and command execution status. Based on the task completion status, the directory change status, the resource usage status, and the command execution status, the dependencies and execution order between commands in the command execution chain are re-analyzed to identify target commands affected by environmental changes. Based on the resource access requirements, tool invocation requirements, and context dependencies corresponding to the target command, the target command is reordered, replaced, inserted, or deleted to generate an updated command execution chain. The hierarchical processing is re-executed for each command in the updated command execution chain to generate subsequent hierarchical command data, and the cloud agent and local agent are controlled to continue to execute subsequent tasks based on the subsequent hierarchical command data.
3. The method according to claim 1, characterized in that, The analysis of the functional attributes, execution location, permission level, risk level, and contextual dependencies of each command in the command execution chain generates hierarchical command data including control commands, execution commands, and feedback commands, specifically including: Based on the functional attributes, execution location, and permission level of each command in the command execution chain, commands used for task scheduling, session control, permission verification, directory synchronization control, and multi-Agent collaboration are classified as control commands. Based on the functional attributes, execution location, and resource access requirements of each command in the command execution chain, commands used for file reading and writing, directory creation, file retrieval, local tool invocation, shell execution, and cache update are divided into execution commands, and a resource mapping relationship between the execution commands and their corresponding local resources is established. Based on the functional attributes and context dependencies of each command in the command execution chain, commands used for file change notification, execution status feedback, directory index update, error status feedback, incremental synchronization triggering, and context update are classified as feedback commands, and the association between feedback commands and corresponding control commands and execution commands is established. A hierarchical command association model is constructed based on the resource mapping relationship and the association relationship, so that the control command drives the execution command to execute, and the execution status of the control command and the execution command are updated synchronously according to the execution status returned by the feedback command.
4. The method according to claim 1, characterized in that, After identifying directory changes based on the directory status data, extracting the difference information corresponding to the changed files, and constructing incremental synchronization data, the process further includes: Generate a corresponding directory status snapshot based on the directory status data, and record the corresponding directory version number; The directory status snapshot is compared with the cloud directory status snapshot to identify directory conflict locations; When a directory conflict is detected, conflict detection is performed based on file identification information, file version information and timestamp, and file locking, version rollback or conflict merging is performed according to the preset conflict handling strategy to generate the target directory status. Update the cloud directory status and shared context status based on the target directory status.
5. The method according to claim 1, characterized in that, The step of performing permission verification and dynamic routing based on the attributes of commands at each level to obtain the corresponding target execution path specifically includes: Obtain the command type, execution location, risk level, resource access permissions, and context dependencies corresponding to each layer of commands; The corresponding target execution module is determined according to the command type, wherein inference commands correspond to the cloud agent, file operation commands correspond to the local agent, directory synchronization commands correspond to the directory synchronization module, state sharing commands correspond to the context management module, and high-risk commands correspond to the security control module. Based on the risk level, resource access permissions, directory sensitivity level, and user authorization status, the execution permissions of commands at each level are verified, and the corresponding execution strategy is determined based on the permission verification results. The execution strategy includes at least one of automatic execution, user confirmation execution, sandbox isolation execution, permission upgrade verification, and command blocking. Based on the target execution module, the execution strategy, and the context dependency, commands at each layer are dynamically routed to generate a target execution path that includes a cloud execution path, a local execution path, a security control path, and a status feedback path. Based on the target execution path, the execution relationship between commands at each layer is established to drive control commands, execution commands, and feedback commands to be executed collaboratively in a preset dependency order.
6. A hierarchical command processing and directory synchronization system, characterized in that, include: The parsing module is used to receive task requests input by the user, perform semantic parsing on the task requests, identify task intent, resource access requirements, tool call requirements and task dependencies, and generate a command execution chain formed by multiple commands associated in the execution order based on the parsing results; The generation module is used to analyze the functional attributes, execution position, permission level, risk level and context dependency of each command in the command execution chain, generate hierarchical command data including control commands, execution commands and feedback commands, and perform permission verification and dynamic routing according to the attributes of each layer of commands to obtain the corresponding target execution path. The acquisition module is used to control the cloud agent and the local agent to collaboratively execute the hierarchical command data according to the target execution path, acquire the local resource operation results, and monitor the directory status involved in the execution process in real time, and generate directory status data containing directory tree index, file identification information and directory version information. The update module is used to identify changes in the directory based on the directory status data, extract the difference information corresponding to the changed files, construct incremental synchronization data, and use the incremental synchronization data to update the cloud directory status, task context, and shared context status.
7. The system according to claim 6, characterized in that, Also includes: The extraction module is used to extract the current task completion status, directory change status, resource usage status, and command execution status based on the updated task context, shared context status, and local resource operation results. Based on the task completion status, directory change status, resource usage status, and command execution status, the dependencies and execution order between commands in the command execution chain are re-analyzed to identify target commands affected by environmental changes. According to the resource access requirements, tool invocation requirements, and context dependencies corresponding to the target commands, the target commands are reordered, replaced, inserted, or deleted to generate an updated command execution chain. Each command in the updated command execution chain undergoes a new layered processing to generate subsequent layered command data, and the cloud agent and local agent are controlled to continue executing subsequent tasks based on this subsequent layered command data.
8. The system according to claim 6, characterized in that, The generation module is specifically used to classify commands used for task scheduling, session control, permission verification, directory synchronization control, and multi-agent collaboration into control commands based on the functional attributes, execution location, and permission level of each command in the command execution chain; to classify commands used for file reading and writing, directory creation, file retrieval, local tool invocation, shell execution, and cache update into execution commands based on the functional attributes, execution location, and resource access requirements of each command in the command execution chain, and to establish a resource mapping relationship between execution commands and their corresponding local resources; to classify commands used for file change notification, execution status feedback, directory index update, error status feedback, incremental synchronization triggering, and context update into feedback commands based on the functional attributes and context dependencies of each command in the command execution chain, and to establish an association relationship between feedback commands and their corresponding control commands and execution commands; and to construct a hierarchical command association model based on the resource mapping relationship and the association relationship, so that the control commands drive the execution commands to execute, and to synchronously update the execution status of the control commands and the execution commands based on the execution status returned by the feedback commands.
9. The system according to claim 6, characterized in that, Also includes: The recording module is used to generate a corresponding directory status snapshot based on the directory status data and record the corresponding directory version number; The directory status snapshot is compared with the cloud directory status snapshot to identify the location of directory conflict; when a directory conflict is detected, conflict detection is performed based on file identification information, file version information and timestamp, and file locking, version rollback or conflict merging is performed according to the preset conflict handling strategy to generate the target directory status. Update the cloud directory status and shared context status based on the target directory status.
10. The system according to claim 6, characterized in that, The generation module is specifically used to obtain the command type, execution location, risk level, resource access permission, and context dependency relationship corresponding to each layer of commands; determine the corresponding target execution module according to the command type, wherein inference commands correspond to the cloud agent, file operation commands correspond to the local agent, directory synchronization commands correspond to the directory synchronization module, state sharing commands correspond to the context management module, and high-risk commands correspond to the security control module; verify the execution permission of each layer of commands according to the risk level, the resource access permission, the directory sensitivity level, and the user authorization status, and determine the corresponding execution strategy based on the permission verification result, wherein the execution strategy includes at least one of automatic execution, user confirmation execution, sandbox isolation execution, permission upgrade verification, and command blocking; dynamically route each layer of commands according to the target execution module, the execution strategy, and the context dependency relationship, generating a target execution path including a cloud execution path, a local execution path, a security control path, and a status feedback path; establish the execution association relationship between each layer of commands according to the target execution path, so as to drive the control command, execution command, and feedback command to be executed collaboratively according to a preset dependency order.