Skill hot update methods, devices, electronic devices, storage media and program products

By using a three-sequence version coordination mechanism of invalid serial number and loading serial number, event change detection and skill snapshot reconstruction are decoupled, solving the problems of unstable response and resource waste caused by skill reconstruction method, and achieving more stable user interaction and resource saving.

CN122086843APending Publication Date: 2026-05-26UNIONTECH SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-24
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing technologies, skill reconstruction methods can affect response stability and lead to additional waste of computing resources, mainly including concurrency conflicts introduced by real-time immediate reconstruction and invalid overhead caused by timed polling.

Method used

A three-sequence version coordination mechanism using failure serial number and loading serial number is adopted, combined with failure marking and lazy reloading mechanism, to decouple event change detection and skill snapshot reconstruction. Snapshot reconstruction is only performed at preset trigger times to avoid concurrent conflicts and unnecessary overhead.

Benefits of technology

It improves the stability of the main interaction process and response stability, avoids the waste of computing resources, and ensures that the large language model responds stably to user input.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122086843A_ABST
    Figure CN122086843A_ABST
Patent Text Reader

Abstract

This disclosure relates to a method, apparatus, electronic device, storage medium, and program product for hot-updating skills. The method includes: during the execution of services by a large language model, when a preset triggering time is met, obtaining the current failure sequence number and the current loading sequence number, wherein the failure sequence number is used to statistically analyze changes in the skill system associated with the large language model, and the loading sequence number is used to statistically analyze the reconstruction status of skill snapshots of the skill system, the skill snapshot containing attribute information of skills under the skill system, and the preset triggering time being a time when the continuity of services provided by the large language model is not affected; if the current failure sequence number and the current loading sequence number are inconsistent, performing a skill snapshot reconstruction operation to obtain a reconstructed skill snapshot; and sending the reconstructed skill snapshot to the large language model so that the large language model continues to execute services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to methods, apparatuses, electronic devices, storage media, and program products for hot-updating skills. Background Technology

[0002] In the runtime environment of interactive intelligent agents such as AI-native shells, skills are the core mechanism for extending system capabilities. Skills can serve as the source of tool specifications for function calls by large language models, and as the injection source of context prompts to provide domain knowledge and operational guidance for dialogue. Furthermore, skill definition files are typically stored in a specific directory structure on disk as declarative configuration files (e.g., YAML, JSON). In actual operation and maintenance scenarios, the skill directory may change for various reasons, requiring skill reconstruction to meet actual business needs.

[0003] In related technologies, there are two main methods for skill reconstruction. The first method is real-time immediate reconstruction, which primarily uses file system listeners (e.g., inotify on Linux, FSEvents on macOS, and Read Directory ChangesW on Windows) to monitor the skill directory. Upon detecting a file change event, a full skill reconstruction can be performed immediately via an event callback function. However, this method introduces concurrency conflicts. Specifically, in this method, the reconstruction operation and the main interaction chain may execute concurrently, meaning that tool specifications might be modified during user input processing, which could affect response stability.

[0004] The second approach is a timed polling full scan. This method involves starting a background timer and scanning the entire skill catalog at fixed intervals (e.g., every 5 seconds). The current scan result is then compared to the previous snapshot. If a difference is found, a full rebuild and updated tool specifications can be performed. However, this method introduces significant unnecessary overhead. Specifically, even if the skill catalog remains unchanged, the system continues to scan and compare discrepancies, resulting in continuous I / O overhead and wasted computational resources. Summary of the Invention

[0005] This disclosure provides a method, apparatus, electronic device, storage medium, and program product for hot skill updates, to at least address the problems in the aforementioned related technologies where skill reconstruction affects response stability and leads to additional waste of computing resources.

[0006] According to a first aspect of the present disclosure, a skill hot update method is provided, comprising: during the execution of services by a large language model, when a preset triggering time is met, obtaining a current failure sequence number and a current loading sequence number, wherein the failure sequence number is used to statistically analyze changes in the skill system associated with the large language model, the loading sequence number is used to statistically analyze the reconstruction status of skill snapshots of the skill system, the skill snapshots include attribute information of skills under the skill system, and the preset triggering time is a time when the continuity of services provided by the large language model is not affected; when the current failure sequence number and the current loading sequence number are inconsistent, performing a reconstruction operation of the skill snapshot to obtain a reconstructed skill snapshot; and sending the reconstructed skill snapshot to the large language model so that the large language model continues to execute services.

[0007] Optionally, the skill hot update method further includes: during the execution of the service by the large language model, listening for change events of the skill system associated with the large language model; and in response to listening for a change event in the skill system, incrementing the failure sequence number.

[0008] Optionally, it further includes: for each root directory contained in the set of active skill root directories corresponding to the skill system, traversing the directory tree of the root directory and detecting whether the traversed subdirectory is a symbolic link directory, wherein the set of active skill root directories is the set of skill root nodes that are currently active; if it is detected that the traversed subdirectory is the symbolic link directory, resolving the real path of the symbolic link directory; the monitoring of change events of the skill system associated with the large language model includes: in response to a change in the real path, determining that a change event has occurred in the skill system.

[0009] Optionally, it further includes: finding an ancestor directory, wherein the ancestor directory is a parent directory of a skill root directory that is nested and yet to be monitored; establishing a non-recursive lightweight listener on the ancestor directory; the listening for change events of the skill system associated with the large language model includes: in response to the detection of a directory creation event in the ancestor directory that matches the name of the skill root directory to be monitored but yet to be created, determining that a change event has occurred in the skill system.

[0010] Optionally, after performing the skill snapshot reconstruction operation, the method further includes: aligning the loading serial number to match the invalid serial number.

[0011] Optionally, the process of reconstructing the skill snapshot includes: traversing each skill root directory corresponding to the skill system; parsing the skill name of each skill definition file in each skill root directory obtained through traversal; if the skill name has already been occupied by a skill definition file with the same name but higher source priority, prohibiting the reconstruction of the skill snapshot for that skill definition file; otherwise, reconstructing the skill snapshot for that skill definition file.

[0012] Optionally, the source priority of various types of skill definition files, from highest to lowest, is as follows: system built-in skill definition files, globally shared skill definition files, user personal skill definition files, and project local skill definition files.

[0013] Optionally, it further includes: when a change is detected in the set of active skill root directories corresponding to the skill system, canceling the monitoring task for the skill system, calculating a new set of active skill root directories based on the change, and monitoring the new set of active skill root directories.

[0014] Optionally, the change includes at least one of the following: the root directory is deleted, the symbolic link directory is created, and the root directory of the skill to be monitored but not yet created is created for the first time.

[0015] Optionally, the change events of the skill system include at least one of the following: creation of skill definition files, modification of skill definition files, deletion of skill definition files, and renaming of skill definition files.

[0016] Optionally, the preset triggering timing includes at least one of the following: the initial stage of processing a new round of user input to the large language model, before constructing the tool specification list to be sent to the large language model, before injecting skill-related contextual hints into the large language model, when explicitly refreshing the tool specification, and before the skill invocation tool has finished executing and reads the skill information again.

[0017] According to a second aspect of the present disclosure, a skill hot update apparatus is provided, comprising: a serial number acquisition module configured to acquire a current invalidation serial number and a current loading serial number when a preset triggering time is met during the execution of a service by a large language model, wherein the invalidation serial number is used to statistically analyze changes in the skill system associated with the large language model, the loading serial number is used to statistically analyze the reconstruction status of skill snapshots of the skill system, the skill snapshots include attribute information of skills under the skill system, and the preset triggering time is a time when the continuity of the service provided by the large language model is not affected; a snapshot reconstruction module configured to perform a skill snapshot reconstruction operation when the current invalidation serial number and the current loading serial number are inconsistent, and obtain a reconstructed skill snapshot; and a snapshot sending module configured to send the reconstructed skill snapshot to the large language model so that the large language model continues to execute the service.

[0018] Optionally, the skill hot update device further includes: a change event monitoring module, configured to monitor change events of the skill system associated with the large language model during the execution of the service; and an incrementing module, configured to increment the failure sequence number in response to the monitoring of a change event in the skill system.

[0019] Optionally, the skill hot update device further includes: a symbolic link detection module, configured to traverse the directory tree of each root directory contained in the active skill root directory set corresponding to the skill system, and detect whether the traversed subdirectories are symbolic link directories, wherein the active skill root directory set is the set of skill root nodes currently in an active state; a path parsing module, configured to parse the real path of the symbolic link directory when it is detected that the traversed subdirectory is the symbolic link directory; and a change event listening module, configured to determine that a change event has occurred in the skill system in response to a change in the real path.

[0020] Optionally, the skill hot update device further includes: a directory lookup module configured to look up ancestor directories, wherein the ancestor directory is a parent directory of a skill root directory that is to be monitored but has not yet been created; a listener establishment module configured to establish a non-recursive lightweight listener on the ancestor directory; and a change event listener module configured to: in response to listening to a directory creation event in the ancestor directory that matches the name of the skill root directory to be monitored but has not yet been created, determine that a change event has occurred in the skill system.

[0021] Optionally, the skill hot update device further includes: a aligning module configured to align the loading sequence number to match the invalidation sequence number.

[0022] Optionally, the snapshot reconstruction module is configured to: traverse each skill root directory corresponding to the skill system; for each skill definition file under each skill root directory obtained through traversal, parse the skill name of the skill definition file; if the skill name has already been occupied by a skill definition file with the same name but higher source priority, prohibit the skill snapshot reconstruction operation for that skill definition file; otherwise, perform the skill snapshot reconstruction operation for that skill definition file.

[0023] Optionally, the source priority of various types of skill definition files, from highest to lowest, is as follows: system built-in skill definition files, globally shared skill definition files, user personal skill definition files, and project local skill definition files.

[0024] Optionally, the skill hot update device further includes: a new directory calculation module, configured to cancel the monitoring task of the skill system and calculate a new set of active skill root directories based on the change when a change is detected in the set of active skill root directories corresponding to the skill system; and a directory monitoring module, configured to monitor the new set of active skill root directories.

[0025] Optionally, the change includes at least one of the following: the root directory is deleted, the symbolic link directory is created, and the root directory of the skill to be monitored but not yet created is created for the first time.

[0026] Optionally, the change events of the skill system include at least one of the following: creation of skill definition files, modification of skill definition files, deletion of skill definition files, and renaming of skill definition files.

[0027] Optionally, the preset triggering timing includes at least one of the following: the initial stage of processing a new round of user input to the large language model, before constructing the tool specification list to be sent to the large language model, before injecting skill-related contextual hints into the large language model, when explicitly refreshing the tool specification, and before the skill invocation tool has finished executing and reads the skill information again.

[0028] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement a skill hot-update method according to the present disclosure.

[0029] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform a skill hot update method according to the present disclosure.

[0030] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements a skill hot update method according to the present disclosure.

[0031] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects: In this disclosure, the event change detection and skill snapshot reconstruction are decoupled, thereby avoiding the direct impact of file event jitter on the main interaction process, thus avoiding the introduction of concurrent conflicts and improving the stability and response stability of the main interaction process.

[0032] Furthermore, compared to the timed polling scheme in related technologies, this disclosure can perform snapshot reconstruction only when a preset triggering time is met. Therefore, it can avoid the continuous I / O overhead caused by timed polling, that is, zero overhead when there are no change events, and thus avoid additional waste of computing resources.

[0033] According to exemplary embodiments of this disclosure, enhanced fault isolation can be achieved by decoupling the observation layer, snapshot layer, and consumption layer. For example, both observation layer exceptions and notification callback exceptions can be isolated, and snapshot layer reconstruction failures can not affect the availability of the current snapshot, thereby ensuring the normal operation of the main interaction loop.

[0034] According to exemplary embodiments of this disclosure, by stripping the snapshot reload operation from the event callback path to the consumer-side safety point, the response time of the large language model to user input can be made more stable and predictable, thereby avoiding file event jitter from directly impacting the main interaction process and improving interaction stability.

[0035] According to an exemplary embodiment of this disclosure, since the failure marking operation is extremely lightweight, its time complexity is O(1), that is, only one atomic integer increment operation, and its space complexity is also O(1), that is, only one integer variable is maintained. Therefore, the observation layer can run stably in high-frequency event scenarios without slowing down the main interaction path.

[0036] According to an exemplary embodiment of this disclosure, by setting a mechanism for discovering symbolic link targets, symbolic link targets can be dynamically incorporated into the monitoring chain. This ensures that when the skill catalog is organized through symbolic links, file changes within the target path can be captured in a timely manner, thereby significantly reducing the rate of missed changes and improving monitoring coverage.

[0037] According to exemplary embodiments of this disclosure, by setting up an ancestor directory proxy monitoring mechanism, directories that have not yet been created can be automatically discovered and monitored after creation, without manual intervention or restart, thus saving manpower costs. Furthermore, by including the ancestor directories of the root to be monitored in the monitoring chain, blind spots in traditional solutions are covered, improving monitoring coverage.

[0038] According to exemplary embodiments of this disclosure, by setting up a “signal-driven convergence reconstruction” mechanism, the problem of holding outdated listening sets for a long time can be avoided.

[0039] According to an exemplary embodiment of this disclosure, by performing deduplication of skills with the same name according to source priority during the snapshot construction phase, it can be guaranteed that the skill definition of the high-priority source takes effect first.

[0040] According to an exemplary embodiment of this disclosure, by setting the three-sequence version number to increment based on the actual situation, the failure flag, condition overload, and snapshot version number increment can form a closed loop, thereby making the state transitions determinable and traceable, thus ensuring that the snapshot accurately reflects all file changes that have occurred.

[0041] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0042] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0043] Figure 1 This is a schematic diagram illustrating a skill hot update architecture according to exemplary embodiments of the present disclosure; Figure 2 This is a flowchart illustrating a skill hot update method according to an exemplary embodiment of the present disclosure; Figure 3 This is a flowchart illustrating a specific implementation of a skill hot update method according to exemplary embodiments of the present disclosure; Figure 4 This is a block diagram illustrating a skill hot-update apparatus according to an exemplary embodiment of the present disclosure; Figure 5 This is a block diagram illustrating an electronic device according to exemplary embodiments of the present disclosure. Detailed Implementation

[0044] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0045] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following examples do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0046] It should be noted that the phrase "at least one of several items" in this disclosure refers to three parallel cases: "any one of the several items", "a combination of any number of the several items", and "all of the several items". For example, "including at least one of A and B" includes the following three parallel cases: (1) including A; (2) including B; (3) including A and B. Another example is "performing at least one of step one and step two", which means the following three parallel cases: (1) performing step one; (2) performing step two; (3) performing both step one and step two.

[0047] In real-world operations and maintenance scenarios, the skill catalog may continuously change for the following reasons: 1. Development Iteration: Engineers add, modify, or delete skill definition files.

[0048] 2. Version control operations: Git branch switching, pulling updates, and other batch file changes.

[0049] 3. Editor auto-save: The auto-save function of the integrated development environment (IDE) or text editor triggers high-frequency writing.

[0050] 4. Symbolic Link Management: Organize the skill directory structure through symbolic links, and the link targets may change dynamically.

[0051] 5. Delayed creation: The user's personal skills catalog may not have been created before the first use.

[0052] If the hot reload strategy is not designed properly, the following problems may occur: Interaction blocking: File change events trigger synchronous reload in the main interaction loop, causing delays in user input response.

[0053] Version drift: The tool specifications are out of sync with the skill snapshot, and the tools called by the Large Language Model (LLM) are inconsistent with the actual available tools.

[0054] Change missed: Changes to symbolic link targets or directories that have not yet been created cannot be captured by the listener.

[0055] Overload jitter: High-frequency file events (e.g., continuous auto-save by the editor) trigger continuous overload, wasting computing resources.

[0056] Among related technologies, there are two main methods for hot updating skills. The first method is real-time immediate reconstruction; the second method is periodic polling and full scanning.

[0057] For the first method, upon receiving a file change event, a full skill rebuild can be performed immediately within the event callback function. This rebuild process may include: traversing all skill directories, parsing configuration files, building skill snapshots, and updating tool specifications. Furthermore, the tool specification list for the LLM session can be synchronously refreshed after the rebuild is complete. This real-time immediate rebuild method mainly has the following problems: 1. Jitter issue: During periods of high-frequency file writing (e.g., Git batch operations, continuous saving in the editor), continuous reloads are triggered. Each reload requires a complete directory scan and configuration parsing, resulting in a waste of computing resources.

[0058] 2. Concurrency conflicts: Overloaded operations are executed concurrently with the main interaction chain, which may modify the tool specifications during user input processing, resulting in unstable response time or inconsistent states.

[0059] 3. Cost stacking: Reconstruction costs (e.g., disk I / O, configuration parsing) are directly stacked onto the event callback path, affecting the response performance of the file listener.

[0060] 4. No deduplication mechanism: Multiple changes within a short period of time (e.g., multiple saves of the same file) will trigger multiple identical rebuild operations.

[0061] The second method primarily involves starting a background timer to scan the entire skill catalog at fixed intervals (e.g., every 5 seconds). The current scan results can then be compared to the previous snapshot. If discrepancies are found, a full snapshot reconstruction can be performed, and the tool specifications updated. This timed polling full scan method has the following main drawbacks: 1. Poor real-time performance: The delay in the effect of changes is determined by the polling interval. After a user modifies a skill, they need to wait for a maximum of one polling cycle for the changes to take effect.

[0062] 2. Ineffective overhead: Even without any changes, the system continues to perform directory scans and difference comparisons, resulting in continuous I / O overhead.

[0063] 3. Temporary inconsistency: During the polling cycle window, there may be a temporary inconsistency between the tool specification and the actual document status.

[0064] 4. The dilemma of cycle selection: short cycles increase ineffective overhead, while long cycles reduce real-time performance, making it difficult to find the optimal balance.

[0065] To address the aforementioned issues in related technologies, the skill hot update method, apparatus, electronic device, storage medium, and program product provided in this disclosure decouple event change detection from skill snapshot reconstruction. This prevents file event jitter from directly impacting the main interaction flow, thus avoiding concurrent conflicts and improving the stability and response stability of the main interaction flow. Furthermore, compared to timed polling schemes in related technologies, this disclosure only performs snapshot reconstruction when a preset triggering time is met. Therefore, it avoids the continuous I / O overhead associated with timed polling, resulting in zero overhead when there are no change events, thereby preventing additional waste of computing resources.

[0066] Figure 1 This is a schematic diagram illustrating a skill hot update architecture according to exemplary embodiments of the present disclosure.

[0067] Reference Figure 1 This disclosure proposes a collaborative mechanism of failure marking and lazy reload, which can decompose skill hot updates into three decoupled collaborative layers: the Observer Layer, the Snapshot Layer, and the Consumer Layer. The Observer Layer is primarily responsible for file system event detection and failure marking, without performing actual snapshot reconstruction; the Snapshot Layer is mainly responsible for rebuilding skill snapshots on demand and advancing version numbers; the Consumer Layer only triggers conditional reloads at safepoints and can synchronize tool specifications with the large language model. This decomposition method achieves the effects of "fast detection, stable reload, and accurate consumption." The following sections will provide a detailed introduction to each type of layer.

[0068] For the observation layer, the following protocol conventions may be followed: 1. Responsibilities for Event Detection It can continuously monitor change events in the skill system, i.e., the file system, and can respond only to skill-related events. Furthermore, the observation layer supports change event types including, but not limited to: CREATE, MODIFY, DELETE, and RENAME.

[0069] 2. Responsibilities for Failure Marking The only action the observation layer can take to respond to changes in the skill system is to send a failure flag to the snapshot layer. The observation layer must not directly manipulate the snapshot data structure, nor trigger a directory scan or configuration file parsing.

[0070] 3. Responsibilities for monitoring and rebuilding A listener reconstruction signal can be triggered when a change in the listener root set structure is detected. Changes in the listener root set structure can include, but are not limited to: the deletion of the root directory, the creation of a new symbolic link, or the first appearance of the root to be listened to.

[0071] 4. Event filtering responsibilities The observation layer is also used to filter irrelevant events, such as changes to version control metadata, changes to temporary files, and changes to editor backup files. For example, filtering rules could include: ignoring all events in the .git / directory; ignoring files ending in .swp, .tmp, or ~; and ignoring hidden files starting with a dot (unless explicitly configured as skill files).

[0072] For the snapshot layer, the snapshot layer can provide four operations to the outside world: 1. Invalidation Marking Operation (mark_invalid)

[0073] 2. Conditional overloading operation (reload_if_dirty)

[0074] 3. Dirty status query operation (is_dirty)

[0075] 4. Version number lookup operation (get_version)

[0076] In this disclosure, by decoupling the observation layer, snapshot layer, and consumption layer, enhanced fault isolation can be achieved. For example, both observation layer exceptions and notification callback exceptions can be isolated, and snapshot layer reconstruction failures can not affect the availability of the current snapshot, thereby ensuring the normal operation of the main interaction loop.

[0077] For the consumer layer, the following agreement can be followed: 1. Safe point call constraints.

[0078] You can only call `reload_if_dirty()` at a safe point, and you must not actively trigger the rebuild at any time. The safe point can be a time when the service provided by the large language model is not affected, that is, a time when the call is made without affecting the continuity of user experience.

[0079] 2. Version synchronization constraints.

[0080] Whether or not synchronization of tool specifications is needed can be determined by observing `snapshot_version`. Furthermore, synchronization can occur when `reload_if_dirty()` returns `True`, or periodically by checking if `get_version()` has changed.

[0081] 3. Standardize and synchronize the tool process.

[0082] Function sync_tool_specs(): old_version = cached_version

[0083] If reload_if_dirty(): new_version = get_version()

[0084] If new_version != old_version: # Rebuild tool specifications tool_specs = build_tool_specs_from_snapshot()

[0085] # Update LLM session llm_session.update_tools(tool_specs)

[0086] # Update context hints context_prompts = build_context_from_snapshot() llm_session.update_context(context_prompts)

[0087] cached_version = new_version In this disclosure, by decoupling the snapshot reload operation from the event callback path to the consumer-side safety point, the response time of the large language model to user input can be made more stable and predictable. This avoids file event jitter directly impacting the main interaction flow and improves interaction stability.

[0088] Figure 2 This is a flowchart illustrating a skill hot update method according to an exemplary embodiment of the present disclosure.

[0089] Reference Figure 2In step 201, during the execution of the service in the large language model, the current failure sequence number and the current loading sequence number can be obtained when a preset triggering time is met. That is, this disclosure provides a Safe-Point Lazy Reload (SPLR) mechanism, where snapshot reload operations can be triggered at a safe point in the consumer layer.

[0090] The aforementioned failure sequence numbers can be used to track changes in the skill system associated with the large language model; the aforementioned loading sequence numbers can be used to track the reconstruction of skill snapshots within the skill system. Skill snapshots can contain attribute information about skills within the skill system, i.e., the meta-information of the skills. For example, this meta-information may include, but is not limited to, the skill name and function description, but not the specific tool implementation, nor participate in the tool invocation logic, nor store the skill execution code. In other words, skill snapshots are primarily used to declare to the large language model what skills are currently available and what capabilities each skill possesses. The aforementioned preset triggering timing can be a timing that does not affect the continuity of services provided by the large language model.

[0091] It should be noted that this disclosure provides a three-sequence versioning (TSV) mechanism, that is, this disclosure can use three collaborative sequence numbers to express the complete state of "failure-reload-synchronization".

[0092] 1. Invalidation Sequence Number (invalidation_seq) The failure sequence number can be incremented by the observation layer, accumulating by 1 with each failure marker sent, indicating the target sequence to which the snapshot should be updated. Furthermore, the failure sequence number can monotonically increase and never regress.

[0093] 2. Load the serial number (loaded_seq) The loading sequence number can be advanced by the snapshot layer, and the loading sequence number needs to catch up with the expired sequence number. For example, after each successful snapshot reconstruction, it can be updated to the target_seq value, which represents the sequence of events covered by the current snapshot.

[0094] 3. Snapshot version number (snapshot_version) The snapshot version number serves as an external version identifier for the consumer layer, primarily used by tool specifications and context hint modules to determine whether synchronization is necessary. Furthermore, the snapshot version number can only be incremented after a successful snapshot reload. For example, the dirty state determination formula for the snapshot version number can be: is_dirty = (invalidation_seq != loaded_seq).

[0095] An example of three-sequence version coordination can be as follows: Time T0: invalidation_seq=0, loaded_seq=0, snapshot_version=1 (Initial state, snapshot clean) Time T1: The file event arrives, and the observation layer marker becomes invalid. invalidation_seq=1, loaded_seq=0, snapshot_version=1 (Snapshot is dirty, waiting for reload) Time T2: The consumer layer triggers condition reload at the safepoint. Execute reconstruction... invalidation_seq=1, loaded_seq=1, snapshot_version=2 (Snapshot updated, version number incremented) At time T3: The consumer layer detects a change in the snapshot version and synchronizes the tool specification with the large language model.

[0096] In this disclosure, the above-mentioned three-sequence version coordination mechanism can separate "internal dirty state determination" and "consumer-side version synchronization" into independent concerns: the observation layer only advances the invalid sequence number, the snapshot layer only advances the loading sequence number, and the consumer layer only observes the snapshot version number. The three can each close their own doors and do not overstep their authority.

[0097] For example, the condition overloading logic can be as follows: Function reload_if_dirty(): Read the current failure sequence number as target_seq If loaded_seq == target_seq: Returns False # Snapshot not expired, idempotent return value

[0098] # Snapshot expired, perform rebuild Perform a full snapshot reconstruction: 1. Scan all skill root directories 2. Parse the skill definition file (YAML / JSON) 3. Perform priority-based deduplication (PDD). 4. Build a new snapshot

[0099] update loaded_seq = target_seq Increment snapshot_version++ Returns to True # Overloaded The conditional overload logic described above possesses the following characteristics: idempotency, meaning that multiple calls do not produce side effects when the snapshot is not dirty; eventual consistency, ensuring that the snapshot eventually reflects all file changes that have occurred; and jitter suppression, meaning that multiple file change events within a short period only trigger a single snapshot rebuild. Thus, since the conditional overload returns idempotently when there are no change events, repeated directory scans can be avoided; furthermore, in high-frequency event scenarios, multiple change events can trigger only one snapshot rebuild, effectively saving computational resources.

[0100] According to exemplary embodiments of this disclosure, the aforementioned preset triggering timing may include at least one of the following: The process includes the initial stage of processing a new round of input from the user to the large language model, before building the list of tool specifications to send to the large language model, before injecting skill-related contextual hints into the large language model, when explicitly refreshing the tool specifications, and before the skill invocation tool has finished executing and reads the skill information again.

[0101] 1. The initial stage of processing a new round of user input to the large language model. This preset triggering time could refer to whenever a user enters a new message and starts a new round of dialogue, the system needs to reread the skill information before sending the message to the LLM. For example, if a user enters "Help me diagnose network problems," the system will first check if any new skills have been installed (e.g., a network-diagnose skill might have just been installed) to ensure that the subsequently built tool list and prompts are up-to-date.

[0102] 2. Before building the list of tool specifications to send to the large language model This preset triggering time could refer to the need to reread the tool definition of a skill before assembling the tools list (tool spec for function calling) and sending it to the LLM API. For example, if a skill defines a search_docs tool, rereading the skill before building the tools_spec ensures that this tool appears in the list of available tools sent to the LLM, allowing the LLM to call it.

[0103] 3. Inject skill-related contextual cues into large language models beforehand. When constructing system messages, skill-related contextual information needs to be injected into the message template. Therefore, the preset triggering time could refer to rereading the skills before injection to ensure that the skill descriptions referenced in the message are up-to-date. For example, a system message might contain a template variable like "You can use the following skills: {skills_list}". Reading the skill information before injection is crucial to correctly populating this variable and informing the LLM which skills are currently available and their respective descriptions.

[0104] 4. When specifying the explicit refresh tool The preset triggering time can refer to a user or system actively triggering a refresh operation of the tool specification (rather than automatic triggering), at which point the skill metadata needs to be reread. For example, after a user installs a new skill file, they can execute a "refresh skills" command (or when the client restarts). At this time, the client can rescan the skill catalog and then synchronize the latest skill metadata to the server via the high-performance remote procedure call protocol (gRPC), so that the server updates the cached skill list.

[0105] 5. Before the skill invocation tool finishes executing and reads skill information again. This preset triggering time could refer to the need to reread skill information after the LLM calls and executes a tool, before proceeding to the next round of LLM requests. This is because tool execution may have changed the skill's state (e.g., installing / uninstalling the skill). For example, the LLM calls an `install_skill` tool to install a new "code review" skill. After the tool finishes execution and before sending another request to the LLM, the system can reread the skill information so that the next round of LLM requests can include the newly installed "code review" tool, which the LLM can use immediately.

[0106] According to an exemplary embodiment of this disclosure, during the execution of services by a large language model, change events of the skill system associated with the large language model can be monitored. In response to the monitoring of a change event in the skill system, an incrementing failure sequence number can be performed.

[0107] This disclosure provides an Invalidation-Only Marking (IOM) mechanism. The core semantic of the IOM operation is "mark as dirty, do not rebuild". Specifically, after the observation layer detects a file change, it can send an invalidation mark to the snapshot layer. Then, the snapshot layer can simply increment the invalidation sequence number by 1 under mutual exclusion protection and return immediately, without triggering directory scanning, parsing skill definition files, or refreshing tool specifications. In addition, the changed path can be passed as an optional diagnostic context parameter without affecting the idempotency of the operation.

[0108] Because the failure marking operation is extremely lightweight, its time complexity is O(1), which is only one atomic integer increment operation, and its space complexity is also O(1), which is only one integer variable. Therefore, the observation layer can run stably in high-frequency event scenarios without slowing down the main interaction path.

[0109] According to exemplary embodiments of this disclosure, the change event of the skill system described above may include at least one of the following: The creation, modification, deletion, and renaming of skill definition files.

[0110] According to an exemplary embodiment of this disclosure, for each root directory contained in the active skill root directory set (active_roots) corresponding to the skill system, the directory tree of that root directory can be traversed, and it can be detected whether the traversed subdirectory is a symbolic link directory. The active skill root directory set can be a set of skill root nodes currently in an active state. If a traversed subdirectory is detected to be a symbolic link directory, the actual path of the symbolic link directory can be resolved. Then, in response to a change in the actual path, a skill system change event can be determined.

[0111] It should be noted that common file listeners do not automatically recursively enter the target path of directory symbolic links when listening to the parent directory. To solve this problem, this disclosure can add a symbolic link target discovery algorithm when constructing the listening root set, that is, this disclosure can provide a symbolic link target augmentation (SLTA) mechanism.

[0112] For example, an algorithm for detecting symbolic link targets can be as follows: Input: active_roots (set of active skill root directories) Output: Attached listener collection symlink_targets 1. Initialize symlink_targets to an empty set. 2. For each root directory in active_roots: a. Traverse the root directory tree in non-following link mode. b. For each subdirectory (subdir) encountered during the traversal: i. Check if subdir is a directory symbolic link. ii. If so, parse its actual target path target_path iii. Add target_path to symlink_targets 3. Return symlink_targets The final set of root listeners = active_roots ∪ symlink_targets For example, a comparison between the ability to monitor symbolic link directories in this disclosure and the inability to monitor symbolic link directories in related technologies can be illustrated as follows: Skills Catalog Structure: / home / user / .config / ai-shell / skills / -- builtin / (regular directory) | `-- git.yaml `-- custom -> / opt / shared-skills / custom / (symbolic link)` -- deploy.yaml Traditional approach: Only listen to / home / user / .config / ai-shell / skills / Changes in / opt / shared-skills / custom / cannot be captured. The solution of this invention: The monitoring set includes: - / home / user / .config / ai-shell / skills / - / opt / shared-skills / custom / (symbolic link target) Changes in / opt / shared-skills / custom / can be captured.

[0113] As can be seen from the above example, in related technologies, changes to the symbolic link directory / opt / shared-skills / custom / cannot be captured; however, in this disclosure, changes to the symbolic link directory / opt / shared-skills / custom / can be captured.

[0114] By setting up a mechanism to discover symbolic link targets, symbolic link targets can be dynamically included in the monitoring chain. This ensures that when the skill directory is organized through symbolic links, file changes within the target path can be captured in a timely manner, thereby significantly reducing the rate of missed changes and improving monitoring coverage.

[0115] According to an exemplary embodiment of this disclosure, an ancestor directory can be located, which can be a parent directory of a nested skill root directory to be monitored but not yet created. A non-recursive lightweight listener can then be established on the ancestor directory. Next, in response to the detection of a directory creation event in the ancestor directory that matches the name of the skill root directory to be monitored but not yet created, a skill system change event can be determined.

[0116] This disclosure provides an Ancestor Proxy Directory Polling (APDP) mechanism. For skill root directories that are expected to exist but have not yet been created (e.g., personal skill configuration directories that users have not yet created), this disclosure can use the Ancestor Proxy Directory Polling strategy to monitor them without waiting for a system restart.

[0117] For example, the ancestor directory proxy listening strategy can be as follows: Input: pending_root directory to be monitored Output: proxy_dir (the directory the proxy is listening on) 1. Initialize current_path = pending_root 2. Loop: a. If current_path exists and is a directory, return current_path. b. Otherwise, current_path = the parent directory of current_path. c. If current_path is the root directory (" / ") and does not exist, return None. 3. Establish a non-recursive lightweight listener on proxy_dir 4. Focus only on events related to the pending_root name. 5. When the event is hit: a. Send failure flag b. Trigger the listening and reconstruction signal For example, assuming the skill root directory to be monitored but not yet created (i.e., the root to be monitored) is: / home / user / .config / ai-shell / skills / custom / , then the proxy monitoring strategy for the ancestor directories of this skill root directory to be monitored but not yet created can be as follows: Root to be monitored: / home / user / .config / ai-shell / skills / custom / Current status: / home / user / .config / exists, but the ai-shell / directory has not yet been created. Ancestor search: - / home / user / .config / ai-shell / skills / custom / does not exist - / home / user / .config / ai-shell / skills / does not exist - / home / user / .config / ai-shell / does not exist - / home / user / .config / exists ← Proxy listening directory Listening strategy: - Create a non-recursive listener on / home / user / .config / - Only focus on the creation event named "ai-shell" - When ai-shell / is created, trigger a listener rebuild. - After rebuilding, / home / user / .config / ai-shell / skills / custom / was added to the activity listener.

[0118] In this disclosure, by setting up an ancestor directory proxy monitoring mechanism, directories that have not yet been created can be automatically discovered and monitored after creation, without manual intervention or restart, thus saving manpower costs. Furthermore, by including the ancestor directories of the root to be monitored in the monitoring chain, the blind spots missed in traditional solutions are covered, improving the monitoring coverage rate.

[0119] According to an exemplary embodiment of this disclosure, when a change is detected in the set of active skill root directories corresponding to a skill system, the monitoring task for the skill system can be cancelled, and a new set of active skill root directories can be calculated based on the changes. Then, monitoring can be performed on the new set of active skill root directories.

[0120] This disclosure provides a Dynamic Root Reconvergence (DRRC) mechanism for listening to the root set. This mechanism can maintain a listening and reconstruction signal in the main loop of the observation layer and can run simultaneously as a concurrent task group.

[0121] 1. Activity Root Listening Task: Listen to all existing skill roots and their symbolic link targets.

[0122] 2. Listening Root Task: Listen to the ancestor directory of skill roots that have not yet been created.

[0123] When any task detects a "root set-level structural change" (e.g., the root directory is deleted, a new symbolic link is created, or the root to be monitored appears for the first time), it can trigger a monitoring reconstruction signal. Then, after receiving the monitoring reconstruction signal, the outer main loop can cancel all current monitoring tasks and recalculate the root set (including rediscovered symbolic link targets and roots to be monitored), thereby starting a new round of monitoring tasks.

[0124] For example, the pseudocode for the main loop can be as follows: loop: Calculate the current listening root set: active_roots = Existing skill root directories symlink_targets = Discover symbolic link targets (active_roots) proxy_dirs = Calculates ancestor proxy directories (pending_roots) watch_roots = active_roots ∪ symlink_targets ∪ proxy_dirs

[0125] Start the concurrent task group: task1 = Listen for file events in watch_roots task2 = Listen for root set structure change events

[0126] Waiting for any task to complete or for a rebuild signal to be received: If a file event is received: Send failure flag If a rebuild signal is received: Cancel all tasks continue loop # Recalculate the root set In this way, by setting up a "signal-driven convergence reconstruction" mechanism, the problem of holding outdated listening sets for a long time can be avoided.

[0127] According to exemplary embodiments of this disclosure, as previously described, changes to the aforementioned set of activity skill root directories may include at least one of the following: The root directory was deleted, the symbolic link directory was created, and the root directory of the skill to be monitored but not yet created was created for the first time.

[0128] For example, a sample of listening to the root set computation can be as follows: Skill root directory configuration: - / usr / share / ai-shell / skills / builtin / (Already exists) - / opt / shared-skills / (Already exists, contains symbolic links) - / home / user / .config / ai-shell / skills / (not yet created) Directory structure: / usr / share / ai-shell / skills / builtin / |-- git.yaml -- docker.yaml / opt / shared-skills / -- deploy.yaml `-- custom -> / mnt / nfs / team-skills / (symbolic link) -- monitoring.yaml / home / user / .config / (exists) The `-- ai-shell / ` directory has not yet been created. Listen to the root set calculation result:

[0129] In step 202, if the current failure sequence number is inconsistent with the current loading sequence number, a skill snapshot reconstruction operation can be performed to obtain a reconstructed skill snapshot.

[0130] According to an exemplary embodiment of this disclosure, each skill root directory corresponding to the skill system can be traversed. Then, for each skill definition file under each of the traversed skill root directories, the skill name of the skill definition file can be parsed. If the skill name is already occupied by a skill definition file with the same name but higher source priority, the skill snapshot reconstruction operation for that skill definition file can be prohibited; otherwise, the skill snapshot reconstruction operation can be performed for that skill definition file.

[0131] In this disclosure, priority-based deduplication (PDD) can be performed during the snapshot build phase. An example of performing priority-based deduplication during the snapshot build phase is as follows: Input: A list of skill root directories (sorted by priority) Output: Skill snapshot 1. Initialize snapshot = empty dictionary 2. Initialize seen_names = empty set 3. For each root directory in `roots` (listed in descending order of priority): a. Traverse all skill definition files under root: i. Parse the file and extract the skill name and skill definition. ii. If name is in seen_names: Skip (skills with the same name from lower priority sources are ignored) iii. Otherwise: snapshot[name] = definition seen_names.add(name) 4. Return to snapshot In this disclosure, by performing deduplication of skills with the same name according to source priority during the snapshot construction phase, it can be ensured that the skill definitions of high-priority sources take effect first.

[0132] According to exemplary embodiments of this disclosure, the source priority of the various types of skill definition files described above, from highest to lowest, can be as follows: The system includes built-in skill definition files, globally shared skill definition files, user-specific skill definition files, and project-local skill definition files.

[0133] For example, the result of performing source priority deduplication during the snapshot building phase in this disclosure can be exemplified as follows: Skill root directory (by priority): 1. / usr / share / ai-shell / skills / builtin / (System built-in) -- git.yaml (defines git skills) 2. / home / user / .config / ai-shell / skills / (User's personal settings) -- git.yaml (Defines enhanced Git skills) Build result: - Git skills are from / usr / share / ai-shell / skills / builtin / git.yaml - User-specific git.yaml files are ignored (due to name conflicts or low priority). As shown in the example above, the git skill comes from ` / usr / share / ai-shell / skills / builtin / git.yaml`, while the user's personal `git.yaml` is ignored. This is because there is a name conflict between the system's built-in skills and the user's personal skills; in this case, the user's personal skill, which has lower priority, is ignored.

[0134] According to an exemplary embodiment of this disclosure, after performing the skill snapshot reconstruction operation, the loading serial number can also be aligned to match the expired serial number.

[0135] For example, Table 1 is a three-sequence version cooperative state transition table:

[0136] Table 1 Referring to Table 1, during the initialization phase, the failure sequence number can be 0, the loading sequence number can be 0, and the snapshot version number can be 1. At this time, the snapshot state is clean. Then, upon listening to change event 1, the observation layer marks the snapshot as invalid. The failure sequence number can be increased to 1, the loading sequence number can remain at 0, and the snapshot version number can remain at 1, resulting in a dirty snapshot state. Next, upon listening to change event 2, the observation layer marks the snapshot as invalid again. The failure sequence number can be increased to 2, the loading sequence number can remain at 0, and the snapshot version number can remain at 1, resulting in a dirty snapshot state. Then, when a safety point is triggered on the consumer layer side, i.e., when the current environmental conditions meet the preset trigger timing, the current failure sequence number and the current loading sequence number can be read and compared. Since the current failure sequence number is 2 and the current loading sequence number is 0, they are inconsistent. Therefore, the skill snapshot reconstruction operation can be performed. Accordingly, after the skill snapshot is reconstructed, the loading sequence number can be aligned with the failure sequence number, i.e., the loading sequence number can be modified to 2, and the snapshot version number can be increased to 2. In this way, the snapshot state can change from dirty to clean.

[0137] Similarly, assuming that after the skill snapshot reconstruction described above, change event 3 is detected again, the observation layer marks it as invalid again. The invalidation sequence number can be increased to 3, the loading sequence number can remain at 2, the snapshot version number can remain at 2, and the snapshot state is dirty. Next, when a safepoint is triggered on the consumer layer side, that is, when the current environmental conditions meet the preset trigger timing, the current invalidation sequence number and the current loading sequence number can be read and compared. Since the current invalidation sequence number is 3 and the current loading sequence number is 2, they are inconsistent, so the skill snapshot reconstruction operation can be performed. Accordingly, after the skill snapshot reconstruction, the loading sequence number can be aligned with the invalidation sequence number, that is, the loading sequence number can be modified to 3, and the snapshot version number can be increased to 3. In this way, the snapshot state can change from dirty to clean.

[0138] In this way, by setting the three-sequence version number to increment based on the actual situation, the failure flag, conditional overload, and snapshot version number increment can form a closed loop, thereby making the state transitions determinable and traceable, and thus ensuring that the snapshot accurately reflects all file changes that have occurred.

[0139] In step 203, the reconstructed skill snapshot can be sent to the large language model to enable it to continue providing services. For example, the reconstructed skill snapshot can record metadata about the skills currently available, such as the skill name, function description, etc. This allows the large language model to understand which skills are currently available based on the reconstructed skill snapshot, facilitating timely adjustments to its inference strategy and ultimately leading to better task performance.

[0140] The skill hot update method disclosed herein, compared to the timed polling scheme in related technologies, can achieve zero overhead when there are no change events, effectively saving computing resources. Compared to the real-time reload scheme in related technologies, the computational load is significantly reduced when facing high-frequency change events. Furthermore, since only three integer sequence numbers need to be maintained, memory usage is stable. In addition, the skill hot update method provided herein can be extended to various hot update scenarios; for example, it can support any number of skill root directories, directory tree structures of arbitrary depth, and recursive organization of symbolic links, thus exhibiting greater scalability.

[0141] Figure 3 This is a flowchart illustrating a specific implementation of a skill hot update method according to an exemplary embodiment of the present disclosure.

[0142] Reference Figure 3When the observation layer detects a change in the skill system, i.e., the file system (e.g., a change in skill definition files / directories / symbolic links), it can send an invalidation flag to the snapshot layer. The snapshot layer can then increment the invalidation serial number by 1 based on the received invalidation flag, and can choose not to rebuild the snapshot. Next, the consumer layer reads the current invalidation serial number and load sequence number at a safe point.

[0143] If the current failure serial number and loading serial number are inconsistent, it indicates that a change event occurred between the current moment and the last time the failure serial number and loading serial number were read, i.e., a skill change occurred. Therefore, it can be determined that the current snapshot has expired, i.e., the current snapshot state is dirty. At this point, a full snapshot reconstruction can be performed by the snapshot layer. Furthermore, after the snapshot reconstruction is performed, the loading serial number can be aligned with the failure serial number, and the snapshot version number can be incremented by 1.

[0144] If the current failure serial number and loading serial number are consistent, it means that no change event occurred during the current moment and the last time the failure serial number and loading serial number were read, that is, no skill change occurred. Therefore, it can be determined that the current snapshot has not expired, that is, the current snapshot status is a clean state, and there is no need to perform snapshot reconstruction at this time.

[0145] Figure 4 This is a block diagram illustrating a skill hot update device 400 according to an exemplary embodiment of the present disclosure.

[0146] Reference Figure 4 The skill hot update device 400 may include a serial number acquisition module 401, a snapshot reconstruction module 402, and a snapshot sending module 403.

[0147] During the execution of services in the large language model, when a preset triggering time is met, the sequence number acquisition module 401 can obtain the current expired sequence number and the current loaded sequence number. That is, this disclosure provides a safepoint lazy reloading mechanism, where snapshot reloading operations can be triggered at a safepoint in the consumer layer.

[0148] The aforementioned failure sequence numbers can be used to track changes in the skill system associated with the large language model; the aforementioned loading sequence numbers can be used to track the reconstruction of skill snapshots within the skill system. Skill snapshots can contain attribute information about skills within the skill system, i.e., the meta-information of the skills. For example, this meta-information may include, but is not limited to, the skill name and function description, but not the specific tool implementation, nor participate in the tool invocation logic, nor store the skill execution code. In other words, skill snapshots are primarily used to declare to the large language model what skills are currently available and what capabilities each skill possesses. The aforementioned preset triggering timing can be a timing that does not affect the continuity of services provided by the large language model.

[0149] According to exemplary embodiments of this disclosure, the aforementioned preset triggering timing may include at least one of the following: The process includes the initial stage of processing a new round of input from the user to the large language model, before building the list of tool specifications to send to the large language model, before injecting skill-related contextual hints into the large language model, when explicitly refreshing the tool specifications, and before the skill invocation tool has finished executing and reads the skill information again.

[0150] According to an exemplary embodiment of this disclosure, the skill hot update device 400 may further include a change event listening module and an incrementing module.

[0151] During the execution of services by the large language model, the change event listening module can monitor change events of the skill system associated with the large language model. In response to the detection of a change event in the skill system, the increment module can increment the failure sequence number.

[0152] According to exemplary embodiments of this disclosure, the change event of the skill system described above may include at least one of the following: The creation, modification, deletion, and renaming of skill definition files.

[0153] According to an exemplary embodiment of this disclosure, the skill hot update device 400 may further include a symbolic link detection module and a path resolution module.

[0154] For each root directory contained in the active_roots set corresponding to the skill system, the symbolic link detection module can traverse the directory tree of that root directory and detect whether the traversed subdirectories are symbolic link directories. The active_roots set can be the set of currently active skill root nodes. If a traversed subdirectory is detected as a symbolic link directory, the path resolution module can resolve the actual path of the symbolic link directory. Then, the change event listening module responds to changes in the actual path and can determine that a change event has occurred in the skill system.

[0155] According to an exemplary embodiment of this disclosure, the skill hot update device 400 may further include a directory lookup module and a monitoring establishment module.

[0156] The directory lookup module can locate ancestor directories, which can be parent directories of nested skill root directories that are to be monitored but not yet created. Then, the listener creation module can establish non-recursive lightweight listeners on the ancestor directories. Next, the change event listener module, in response to a directory creation event in an ancestor directory that matches the name of the skill root directory to be monitored but not yet created, can determine that a change event has occurred in the skill system.

[0157] According to an exemplary embodiment of this disclosure, the skill hot update device 400 may further include a new directory calculation module and a directory monitoring module.

[0158] If a change is detected in the set of active skill root directories corresponding to the skill system, the new directory calculation module can cancel the monitoring task for the skill system and calculate a new set of active skill root directories based on the changes. Then, the directory monitoring module can monitor the new set of active skill root directories.

[0159] According to exemplary embodiments of this disclosure, as previously described, changes to the aforementioned set of activity skill root directories may include at least one of the following: The root directory was deleted, the symbolic link directory was created, and the root directory of the skill to be monitored but not yet created was created for the first time.

[0160] If the current failure serial number is inconsistent with the current loading serial number, the snapshot reconstruction module 402 can perform a skill snapshot reconstruction operation to obtain a reconstructed skill snapshot.

[0161] According to an exemplary embodiment of this disclosure, the snapshot reconstruction module 402 can traverse each skill root directory corresponding to the skill system. Then, for each skill definition file under each of the traversed skill root directories, the snapshot reconstruction module 402 can parse the skill name of the skill definition file. If the skill name is already occupied by a skill definition file with the same name and higher source priority, the snapshot reconstruction module 402 can prohibit the reconstruction operation of the skill snapshot for that skill definition file; otherwise, the snapshot reconstruction module 402 can perform the reconstruction operation of the skill snapshot for that skill definition file.

[0162] According to exemplary embodiments of this disclosure, the source priority of the various types of skill definition files described above, from highest to lowest, can be as follows: The system includes built-in skill definition files, globally shared skill definition files, user-specific skill definition files, and project-local skill definition files.

[0163] According to an exemplary embodiment of this disclosure, the skill hot update apparatus 400 may further include a aligning module. After performing the skill snapshot reconstruction operation, the aligning module may further align the loaded serial number to match the expired serial number.

[0164] The snapshot sending module 403 can send the reconstructed skill snapshot to the large language model so that the large language model can continue to perform services.

[0165] Figure 5 This is a block diagram illustrating an electronic device 500 according to an exemplary embodiment of the present disclosure.

[0166] Reference Figure 5 The electronic device 500 includes at least one memory 501 and at least one processor 502, wherein the at least one memory 501 stores instructions that, when executed by the at least one processor 502, perform a skill hot update method according to an exemplary embodiment of the present disclosure.

[0167] As an example, electronic device 500 may be a PC, tablet, personal digital assistant, smartphone, or other device capable of executing the aforementioned instructions. Here, electronic device 500 is not necessarily a single electronic device, but may be a collection of any devices or circuits capable of executing the aforementioned instructions (or instruction sets) individually or in combination. Electronic device 500 may also be part of an integrated control system or system manager, or may be configured to interconnect with a portable electronic device locally or remotely (e.g., via wireless transmission) through an interface.

[0168] In electronic device 500, processor 502 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. By way of example and not limitation, processor may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, etc.

[0169] The processor 502 can execute instructions or code stored in the memory 501, which can also store data. Instructions and data can also be sent and received over a network via a network interface device, which can employ any known transmission protocol.

[0170] The memory 501 may be integrated with the processor 502, for example, by arranging RAM or flash memory within an integrated circuit microprocessor. Alternatively, the memory 501 may include a separate device, such as an external disk drive, a storage array, or other storage device usable by any database system. The memory 501 and the processor 502 may be operatively coupled, or may communicate with each other, for example, via I / O ports, network connections, etc., enabling the processor 502 to read files stored in the memory.

[0171] In addition, electronic device 500 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of electronic device 500 can be interconnected via a bus and / or network.

[0172] According to exemplary embodiments of this disclosure, a computer-readable storage medium may also be provided, which, when executed by a processor of an electronic device, enables the electronic device to perform the aforementioned skill hot update method. Examples of computer-readable storage media include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disc storage, hard disk drive (HDD), solid-state drive (SSD), card storage (such as multimedia cards, secure digital (SD) cards, or ultra-fast digital (XD) cards), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, and any other device configured to store a computer program and any associated data, data files, and data structures in a non-transitory manner and to provide the computer program and any associated data, data files, and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the aforementioned computer-readable storage medium can run in an environment deployed in computer devices such as clients, hosts, agent devices, servers, etc. Furthermore, in one example, the computer program and any associated data, data files, and data structures are distributed across a networked computer system, such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed manner through one or more processors or computers.

[0173] According to exemplary embodiments of the present disclosure, a computer program product may also be provided, including a computer program that, when executed by a processor, implements the skill hot update method according to the present disclosure.

[0174] The skill hot update method, apparatus, electronic device, storage medium, and program product disclosed herein decouple event change detection from skill snapshot reconstruction, thereby avoiding file event jitter from directly impacting the main interaction process, thus avoiding the introduction of concurrent conflicts and improving the stability and response stability of the main interaction process.

[0175] Furthermore, compared to the timed polling scheme in related technologies, this disclosure can perform snapshot reconstruction only when a preset triggering time is met. Therefore, it can avoid the continuous I / O overhead caused by timed polling, that is, zero overhead when there are no change events, and thus avoid additional waste of computing resources.

[0176] According to exemplary embodiments of this disclosure, enhanced fault isolation can be achieved by decoupling the observation layer, snapshot layer, and consumption layer. For example, both observation layer exceptions and notification callback exceptions can be isolated, and snapshot layer reconstruction failures can not affect the availability of the current snapshot, thereby ensuring the normal operation of the main interaction loop.

[0177] According to exemplary embodiments of this disclosure, by stripping the snapshot reload operation from the event callback path to the consumer-side safety point, the response time of the large language model to user input can be made more stable and predictable, thereby avoiding file event jitter from directly impacting the main interaction process and improving interaction stability.

[0178] According to an exemplary embodiment of this disclosure, since the failure marking operation is extremely lightweight, its time complexity is O(1), that is, only one atomic integer increment operation, and its space complexity is also O(1), that is, only one integer variable is maintained. Therefore, the observation layer can run stably in high-frequency event scenarios without slowing down the main interaction path.

[0179] According to an exemplary embodiment of this disclosure, by setting a mechanism for discovering symbolic link targets, symbolic link targets can be dynamically incorporated into the monitoring chain. This ensures that when the skill catalog is organized through symbolic links, file changes within the target path can be captured in a timely manner, thereby significantly reducing the rate of missed changes and improving monitoring coverage.

[0180] According to exemplary embodiments of this disclosure, by setting up an ancestor directory proxy monitoring mechanism, directories that have not yet been created can be automatically discovered and monitored after creation, without manual intervention or restart, thus saving manpower costs. Furthermore, by including the ancestor directories of the root to be monitored in the monitoring chain, blind spots in traditional solutions are covered, improving monitoring coverage.

[0181] According to exemplary embodiments of this disclosure, by setting up a “signal-driven convergence reconstruction” mechanism, the problem of holding outdated listening sets for a long time can be avoided.

[0182] According to an exemplary embodiment of this disclosure, by performing deduplication of skills with the same name according to source priority during the snapshot construction phase, it can be guaranteed that the skill definition of the high-priority source takes effect first.

[0183] According to an exemplary embodiment of this disclosure, by setting the three-sequence version number to increment based on the actual situation, the failure flag, condition overload, and snapshot version number increment can form a closed loop, thereby making the state transitions determinable and traceable, thus ensuring that the snapshot accurately reflects all file changes that have occurred.

[0184] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0185] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A method for hot-updating skills, characterized in that, include: During the execution of services by the large language model, when a preset triggering time is met, the current failure sequence number and the current loading sequence number are obtained. The failure sequence number is used to count the changes in the skill system associated with the large language model, and the loading sequence number is used to count the reconstruction of the skill snapshot of the skill system. The skill snapshot contains the attribute information of the skills under the skill system. The preset triggering time is a time when the continuity of services provided by the large language model is not affected. If the current failure sequence number is inconsistent with the current loading sequence number, perform the skill snapshot reconstruction operation to obtain the reconstructed skill snapshot; The reconstructed skill snapshot is sent to the large language model so that the large language model can continue to perform services.

2. The skill hot update method as described in claim 1, characterized in that, The skill hot update method also includes: During the execution of the large language model service, change events of the skill system associated with the large language model are monitored; In response to the detection of a change event in the skill system, the failure sequence number is incremented.

3. The skill hot update method as described in claim 2, characterized in that, Also includes: For each root directory contained in the set of active skill root directories corresponding to the skill system, traverse the directory tree of the root directory and check whether the traversed subdirectories are symbolic link directories, wherein the set of active skill root directories is the set of skill root nodes that are currently active. If the traversed subdirectory is detected to be the symbolic link directory, the actual path of the symbolic link directory is parsed. The monitoring of change events in the skill system associated with the large language model includes: In response to a change in the actual path, a change event is determined in the skill system.

4. The skill hot update method as described in claim 2, characterized in that, Also includes: Locate the ancestor directory, where the ancestor directory is the parent directory of the root directory of the skill to be monitored but not yet created; Establish a non-recursive lightweight listener on the ancestor directory; The monitoring of change events in the skill system associated with the large language model includes: In response to the detection of a directory creation event in the ancestor directory that matches the name of the skill root directory to be monitored but not yet created, a change event in the skill system is determined.

5. The skill hot update method as described in claim 1, characterized in that, After performing the skill snapshot reconstruction operation, the following is also included: Align the loading serial number with the invalid serial number.

6. The skill hot update method as described in claim 1, characterized in that, The process of reconstructing the skill snapshot includes: Traverse the root directories of each skill corresponding to the skill system; For each skill definition file in the root directory of each skill obtained through traversal, parse the skill name in the skill definition file; If the skill name is already occupied by a skill definition file with the same name but higher source priority, the skill snapshot reconstruction operation is prohibited for that skill definition file; Otherwise, perform a skill snapshot reconstruction operation on the skill definition file.

7. The skill hot update method as described in claim 6, characterized in that, The source priority of various types of skill definition files, from highest to lowest, is as follows: The system includes built-in skill definition files, globally shared skill definition files, user-specific skill definition files, and project-local skill definition files.

8. The skill hot update method as described in claim 3, characterized in that, Also includes: If a change is detected in the set of active skill root directories corresponding to the skill system, the monitoring task for the skill system is cancelled, and a new set of active skill root directories is calculated based on the change. Monitor the new set of activity skill root directories.

9. The skill hot update method as described in claim 8, characterized in that, The change includes at least one of the following: The root directory was deleted, the symbolic link directory was created, and the root directory of the skill to be monitored but not yet created was created for the first time.

10. The skill hot update method as described in claim 1, characterized in that, The skill system change event includes at least one of the following: The creation, modification, deletion, and renaming of skill definition files.

11. The skill hot update method as described in claim 1, characterized in that, The preset trigger timing includes at least one of the following: The process includes the initial stage of processing a new round of input from the user to the large language model, before constructing the list of tool specifications to be sent to the large language model, before injecting skill-related contextual hints into the large language model, when explicitly refreshing the tool specifications, and before the skill invocation tool has finished executing and the skill information is read again.

12. A skill hot update device, characterized in that, include: The serial number acquisition module is configured to acquire the current failure serial number and the current loading serial number when a preset triggering time is met during the execution of the large language model service. The failure serial number is used to count the changes of the skill system associated with the large language model, and the loading serial number is used to count the reconstruction of the skill snapshot of the skill system. The skill snapshot contains the attribute information of the skills under the skill system. The preset triggering time is a time when the continuity of the service provided by the large language model is not affected. The snapshot reconstruction module is configured to perform the skill snapshot reconstruction operation when the current failure sequence number is inconsistent with the current loading sequence number, and obtain the reconstructed skill snapshot. The snapshot sending module is configured to send the reconstructed skill snapshot to the large language model so that the large language model can continue to perform services.

13. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the skill hot update method as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the skill hot update method as described in any one of claims 1 to 11.

15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the skill hot update method as described in any one of claims 1 to 11.