Source verification and admission control method and device for long-term memory of intelligent agent
By introducing source verification and admission control into the agent's long-term memory system, the problem of the lack of binding relationship between memory and source is solved, ensuring source survival and version consistency, reducing erroneous answers caused by stale memories, and improving the reliability and compliance of the answers.
Patent Information
- Application Number
- CN202611382343.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-08
- Publication Date
- 2026-11-27
AI Technical Summary
Existing long-term memory systems for intelligent agents lack source constraints, resulting in a lack of traceable binding between memories and the original documents, knowledge base pages, and database records upon which they are based. This makes it impossible to effectively determine the survival status and version consistency of the source, leading to outdated memories being cited indiscriminately as the final factual basis, resulting in incorrect answers.
During the memory writing phase, the source object of the fact statement is obtained, a memory record is generated, and source liveness verification and version verification are performed before recall to determine the admission level of the memory. Differentiation processing is performed before injection context through the source verification module and admission arbitration module to ensure that a traceable binding relationship is established between the memory and the source.
It achieves a traceable link between memory and its source, preventing the contamination of outdated memories, reducing the probability of incorrect answers, improving the reliability of answers and user trust, and meeting the requirements of corporate compliance audits and post-event accountability.
Smart Images

Figure CN123178557A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and intelligent agents, specifically to a method and apparatus for source verification and access control of long-term memory of intelligent agents. Background Technology
[0002] With the rapid evolution of large language model technology, artificial intelligence agents have evolved from early single-turn question-answering systems into software forms capable of long-term operation, cross-conversation learning, autonomous invocation of external tools, and handling of real business tasks.
[0003] In enterprise application scenarios such as R&D document assistants, customer service knowledge assistants, pre-sales quotation assistants, compliance policy Q&A, and operation and maintenance RunbookAgents, users often expect intelligent agents to remember previous interactions, project agreements, and environmental facts to avoid repeating background information in each conversation. Therefore, long-term memory mechanisms are gradually becoming one of the fundamental capabilities of intelligent agent systems.
[0004] Intelligent agent systems, exemplified by Hermes Agent, typically provide multi-layered memory capabilities. Firstly, there are built-in memory tools that can write long-term facts to MEMORY.md and user preferences to USER.md, injecting these as frozen snapshots into the system prompts at the start of a session to maintain prompt stability and protect the prompt caching effect. Secondly, there are external memory services (MemoryProviders), such as Supermemory, Mem0, and Honcho, which can prefetch semantically relevant historical memories based on the current user message before each round of dialogue and inject them as additional context into the current request. Thirdly, there are background review mechanisms; for example, background_review.py can derive an independent review agent after the dialogue ends to determine whether any facts or experiences worth preserving were generated in the current interaction, and automatically write them into the memory bank or update skills. These mechanisms work together to enable the agent to maintain the continuity of behavior and cognition over a long period.
[0005] Another technical approach parallel to long-term memory is Retrieval-Enhanced Generation (RAG). These systems retrieve relevant document fragments from an enterprise knowledge base before providing an answer, which alleviates the timeliness issue of model parameter knowledge to some extent. Furthermore, some systems introduce Time-to-Live (TTL) expiration strategies to set a fixed validity period for the memory, or rely on users to manually clean and update the memory bank.
[0006] However, in the real-world environment where enterprise knowledge is constantly changing, the above solutions still have significant shortcomings.
[0007] First, memories lack source constraints. Existing long-term memories typically only store normalized factual text (claims) without simultaneously storing metadata such as source uri, source locator, source fingerprint, and validity type. This results in a lack of traceable binding between the memory and the original documents, knowledge base pages, database records, or tool observations on which it is based.
[0008] What the user sees on the interface: The assistant gave a definitive conclusion, but there was no source link, document name, paragraph position, or time stamp, and it was impossible to click to go back; The user asked, "Where did this message come from? What day was it from?" -- The assistant couldn't answer and could only vaguely say, "This is content that was recorded before" or "You mentioned it before." If the same question is asked again a few days later, the answer changes (30 days → 14 days). The system neither prompts "the policy has been updated" nor explains "the previous version was based on the old version". The assistant said, "According to your project agreement...", but the user had no recollection of saying this at all -- in fact, it was automatically accumulated by the Agent in the background review, and the source was untraceable; The conclusions that colleague A accumulated using high-privilege documents appeared in colleague B's conversation without any permission or scope of application indicators; After the user corrected the statement, the assistant immediately changed their tune, but the old statement resurfaced in the next conversation because they had no memory of "which statement was wrong or which document to follow".
[0009] Examples are given below: Customer service asked, "How long is our refund window?" Assistant: "30 days." The customer service representative pressed further, "Which document stipulates this?" Assistant: "This is the information we recorded earlier." (-- Missing source_uri, unable to answer the source) A week later, the policy had changed to 14 days. When customer service asked again, the assistant still answered "30 days" and did not mention that the document might have changed (-- missing source_fingerprint, unable to compare versions). Customer service responded to the customer based on this, which led to a complaint; upon review, the log only contained the sentence "30 days", and no source or version could be found (-- lacking validity_type and binding relationship, unable to be audited).
[0010] Second, it lacks source-based expiration determination. When the original document is modified, the knowledge base page is taken offline, the database record is deleted, or the source becomes inaccessible due to permission changes, existing memories are still used as current facts. Vector retrieval can only measure the semantic similarity between candidate memories and the current question, and cannot answer key questions such as "Does the source corresponding to this memory still exist?", "Is it still the same version?", and "Has the content changed?"
[0011] What the user sees on the interface: The assistant provides a conclusion but does not include a "valid until a certain time" label, leaving users unsure whether it is today's policy or a policy from three months ago; The interface parameters and price list in the knowledge base have been updated, but the assistant is still outputting the old values, and the tone is as confident as ever. That SOP had long been taken offline and archived, but the assistant continued to guide the operation step by step according to the obsolete process; When the source system crashes or document permissions are revoked, the assistant does not prompt "I am temporarily unable to verify," but instead directly uses historical memory as a fallback answer; The same problem was found to be 14 days in the current document, but 30 days were stored in my memory. The assistant might say 14 or 30 at different times, or even combine the two numbers into the same paragraph. The webpage gives answer A, while the API gives answer B, because one uses real-time retrieval while the other uses memory as a fallback.
[0012] Examples are given below: The development team asked, "What is the maximum number of pagination parameters for the order creation interface?" Assistant: "Maximum 200 entries." (This is based on my memory of reading the API documentation v1.4 three months ago.) In fact, the document was upgraded to v2.0 two weeks ago, and the limit was changed to 100 entries. If it exceeds this limit, a 400 error will be reported.
[0013] The developers followed the instructions exactly, but the small amount of data in the test environment prevented the issue from triggering. However, after deployment, a large number of customers made batch calls and all of them encountered errors. (--There's a memory and a source for this, but I've never compared the version fingerprint.) The R&D team asked their assistant, "Isn't this parameter 200?" The assistant searched their memory and replied, "Yes, it's always been 200," because it never performed the action of "checking the current document." (--No matter how high the similarity, it can't answer "has the content changed?").
[0014] Third, there is a lack of arbitration before the response. Recalled candidate memories are usually directly entered into system prompts or current user messages. The model has difficulty distinguishing between "currently verifiable sources of facts" and "historical memory cues," and thus uses them indiscriminately during the generation stage. Traditional RAGs also only cover the current documents in the knowledge base, neither processing historical facts that have been deposited into the agent's long-term memory, nor controlling the eligibility of long-term memories to enter the response context, resulting in a governance vacuum between the memory layer and the retrieval layer.
[0015] What the user sees on the interface: The assistant keeps saying "It's currently 14 days" and then adding "But you previously confirmed it was 30 days," with both numbers appearing at the same time, leaving the user unsure which to believe. The knowledge base clearly states the new policy, but the assistant first uses the old version from memory, only saying "Oh right, the document says it's new" when pressed further. When multiple sources conflict (official documentation vs. memory vs. the user's previous sentence), the assistant does not make a choice but directly lists them side by side, shifting the burden of judgment to the user. When a user asks, "What if we execute it over 30 days?", the assistant will then treat 30 days as a given fact in the next round, because it receives the same treatment as the actual document. Even though the latest knowledge base fragment was retrieved, the assistant still answered with the old value because it remembered the one with a higher similarity. The interface does not display "This sentence comes from the current document / This sentence comes from an unverified memory / This sentence comes from your history conversations", and everything looks equally believable.
[0016] Examples are given below: The salesperson asked, "What is the annual renewal discount for Customer A?" The system received two things at the same time: Current CRM / price list record: 15% (Just updated, retrieved by RAG) A memory from three months ago: "Customer A gets a 20% discount on renewal" (the wording and question are almost identical, with an even higher degree of similarity). The assistant replied, "Customer A's renewal discount is 20%, but according to the latest price list, it might be 15%. We suggest you confirm." (--The conflict was smoothed over without arbitration.) The salesperson quoted 20% to the client because it was what the assistant had suggested first, and it felt more like a "familiar, past relationship." As a result, the quote fell below the approval threshold, and the contract was rejected. (--Memory overshadows current facts due to high similarity) During the review, it was discovered that there was no "currently verifiable source takes precedence over long-term memory" gate in the system; whoever had the highest similarity was selected.
[0017] Fourth, outdated memories pose a high risk of misleading information. In scenarios that are highly time-sensitive, such as price lists, refund policies, API documentation, compliance SOPs, and operation and maintenance runbooks, outdated memories can directly lead to incorrect pricing, incorrect development guidance, and even incorrect production operation suggestions. The business consequences of this are far more serious than simply "answering the wrong question."
[0018] Fifth, insufficient auditing and accountability capabilities. Existing responses typically fail to clarify whether the conclusions are based on current documents, verified memories, or unverified outdated memories, making it difficult to meet the requirements of corporate compliance audits and post-event accountability.
[0019] Furthermore, the TTL expiration policy is a coarse-grained inference based on time, which cannot distinguish between user preferences, stable project agreements and variable facts such as prices, policies, terms, and interface parameters. It also cannot identify source changes that occur within the validity period, nor can it distinguish between "source is temporarily inaccessible" and "source has been deleted." Manual cleanup relies entirely on users to actively discover problems and cannot automatically prevent the misleading effects of outdated memories before an answer is generated.
[0020] The technical root of the above problem lies not in the model's own knowledge update capability, but in the fact that long-term memory records do not preserve the relationship between "fact statement - source object - source version - usage permission". As long as the memory still participates in vector retrieval in plain text form, even if the retrieval result is highly similar to the current problem, the system has no way of judging the survival status and version consistency of its source, let alone restricting its usage permission.
[0021] Therefore, there is an urgent need for a lightweight and pluggable mechanism for long-term memory of intelligent agents: to complete source binding when writing memory, to perform source liveness verification and version fingerprint verification before injecting memory into the answer context, and to determine whether the memory is qualified as the final factual basis based on the verification results, so as to preserve the continuity value of long-term memory while avoiding the misleading of enterprise question and answer results by outdated memory. Summary of the Invention
[0022] In view of this, the purpose of the present invention is to provide a source verification and admission control method and apparatus for long-term memory of an intelligent agent, so as to solve the problem that in the prior art, the long-term memory of an intelligent agent lacks survival and version verification based on the source object before injecting the answer context, which leads to the indiscriminate use of outdated memories whose source has been changed, deleted or is no longer accessible as the final factual basis, thereby causing the intelligent agent to generate incorrect answers based on invalid facts.
[0023] According to a first aspect of the present invention, a source verification and admission control method for long-term memory of an intelligent agent is provided, comprising: During the memory writing phase, the factual statement to be precipitated is obtained, the source object on which the factual statement is based is determined, a memory record is generated, and the memory record is written into the long-term memory bank. The long-term memory bank is used to store memory records that can be reused across sessions. The memory record includes at least the text content of the factual statement, source identifier, source location information, source version fingerprint, and validity type. The source identifier is used to uniquely identify the source object, the source location information is used to locate the content corresponding to the factual statement within the source object, the source version fingerprint is used to characterize the content state or version state of the source object at the time of writing, and the validity type is used to characterize the timeliness attribute of the factual statement. During the memory retrieval phase, in response to the current query, a set of candidate memories related to the current query is retrieved from the long-term memory bank; Before injecting candidate memories from the candidate memory set into the answer context, source verification is performed on at least one candidate memory in the candidate memory set. The source verification includes source liveness verification and source version verification: the source liveness verification is performed by accessing the source object based on the source identifier and the source location information to determine the liveness status of the source object; the source version verification is performed by generating a current fingerprint based on the current content status or current version status of the source object, and comparing the current fingerprint with the source version fingerprint to determine whether the content of the source object has changed. Based on the survival status, comparison results, and validity type of the candidate memory, the admission level of the candidate memory is determined; the admission level is used to characterize whether the candidate memory qualifies as the final fact on which the answer is based. The candidate memories are differentiated according to the admission level to obtain the injection context, and an answer for the current query is generated based on the injection context.
[0024] According to a second aspect of the present invention, a source verification and admission control device for long-term memory of an intelligent agent is provided, comprising: The memory writing module is used to acquire the factual statement to be stored, determine the source object on which the factual statement is based, generate a memory record, and write the memory record into a long-term memory bank. The long-term memory bank is used to store memory records that can be reused across sessions. The memory record includes at least the text content of the factual statement, source identifier, source location information, source version fingerprint, and validity type. The source identifier is used to uniquely identify the source object, the source location information is used to locate the content corresponding to the factual statement within the source object, the source version fingerprint is used to characterize the content state or version state of the source object at the time of writing, and the validity type is used to characterize the timeliness attribute of the factual statement. The memory retrieval module is used to retrieve a set of candidate memories related to the current query from the long-term memory bank in response to the current query. The source verification module is used to perform source verification on at least one candidate memory in the candidate memory set before injecting the candidate memory from the candidate memory set into the answer context. The source verification includes source liveness verification and source version verification: the source liveness verification is to access the source object based on the source identifier and the source location information to determine the liveness status of the source object; the source version verification is to generate a current fingerprint based on the current content status or current version status of the source object, and compare the current fingerprint with the source version fingerprint to determine whether the content of the source object has changed. An admission arbitration module is used to determine the admission level of a candidate memory based on its survival status, comparison results, and the validity type of the candidate memory; the admission level is used to characterize whether the candidate memory is qualified as the final fact on which the answer is based; The answer generation module is used to differentiate the candidate memories according to the admission level to obtain the injection context; and to generate an answer for the current query based on the injection context.
[0025] According to a third aspect of the present invention, an electronic device is provided, including a processor and a memory, the memory being used to store a computer program, and the processor being used to invoke and run the computer program stored in the memory to perform the method as described above.
[0026] According to a fourth aspect of the present invention, a computer-readable storage medium is provided for storing a computer program that causes a computer to perform the methods described above.
[0027] The technical solution provided by the embodiments of the present invention forms a closed loop in the five stages of memory writing, recall, verification, arbitration, and injection. Compared with the existing implementation method of recall as injection, it can achieve the following beneficial effects: Firstly, it establishes a traceable link between memory and its source.
[0028] By simultaneously saving the text content of the factual statement, source identifier, source location information, and source version fingerprint for each memory record during the memory writing stage (step S11), the memory is no longer an isolated text fragment, but a structured record carrying a clear source and version coordinates. Therefore, any recalled memory can be traced back to its origin, providing a data foundation for subsequent verification, error correction, and auditing, and solving the problem of the lack of binding relationship between memories and original documents, knowledge base pages, and database records.
[0029] Secondly, it blocks the contamination of old memories before an answer is generated.
[0030] Because source viability verification and source version verification are set before the candidate memory is injected into the response context (step S13), the system can determine whether the source still exists and whether the content has changed before the model comes into contact with the memory, and decide whether it can serve as the final factual basis. This prevents memories whose sources have been deleted, modified, or are no longer accessible from being silently used as current facts, eliminating the possibility of stale memories entering the generation stage from a process perspective, thereby significantly reducing the probability of the agent outputting incorrect conclusions.
[0031] Third, differentiated rulings should be implemented based on the type of validity.
[0032] This embodiment introduces validity type as one of the adjudication criteria in the access level arbitration process (step S14), employing different judgment strategies for time-sensitive and stable facts. For time-sensitive facts such as prices, policies, deadlines, and interface parameters, they are only qualified as final factual evidence if the source is still alive and the version has not changed; for stable facts such as project agreements, they are only downgraded if the comparison results show that they have changed. This differentiated strategy avoids a one-size-fits-all approach, allowing limited verification resources to be concentrated on the fact categories that are most prone to failure and have the most severe consequences of failure.
[0033] Fourth, the admission decision will be transformed into a practical constraint on the model generation behavior.
[0034] This embodiment does not simply add explanatory text to the prompts, but rather differentiates candidate memories according to their admission levels, constructing a structurally partitioned injection context (step S15): memories that pass verification enter the verified fact area and are allowed to be cited as final factual evidence; memories that fail version verification enter the historical clue area and are marked as invalid or pending confirmation; memories that fail liveness verification are blocked from injection or marked as unverified. Because the "qualification" information is solidified into the structure and marking of the context, the model can clearly distinguish between verifiable facts and historical clues during the generation stage, thereby reducing the possibility of indiscriminately citing outdated memories and ensuring that admission decisions are not merely a formality.
[0035] Fifth, reduce the trust costs and verification burden on the user side.
[0036] Because the answers generated in this embodiment can clearly distinguish between current valid facts and changed historical records, users do not need to go through the original documents one by one to determine whether the conclusion is outdated, nor do they need to perform an additional manual verification after receiving the conclusion. This improves the reliability of the answers and reduces the extra operations that users need to perform to build trust.
[0037] 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 the invention. Attached Figure Description
[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0039] Figure 1 This is a flowchart illustrating a source verification and admission control method for long-term memory of an intelligent agent, according to an exemplary embodiment. Figure 2 This is a schematic block diagram illustrating a source verification and admission control device for long-term memory of an intelligent agent, according to an exemplary embodiment. Detailed Implementation
[0040] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims.
[0041] Example 1
[0042] Figure 1 This is a flowchart illustrating a source verification and admission control method for long-term memory of an intelligent agent, according to an exemplary embodiment. See also... Figure 1 The method includes: Step S11: In the memory writing stage, obtain the factual statement to be deposited, determine the source object on which the factual statement is based, generate a memory record, and write the memory record into the long-term memory bank; the long-term memory bank is used to store memory records that can be reused across sessions, and the memory record includes at least the text content of the factual statement, source identifier, source location information, source version fingerprint, and validity type; the source identifier is used to uniquely identify the source object, the source location information is used to locate the content corresponding to the factual statement within the source object, the source version fingerprint is used to characterize the content state or version state of the source object at the time of writing, and the validity type is used to characterize the timeliness attribute of the factual statement; Step S12: In the memory retrieval phase, in response to the current query, a set of candidate memories related to the current query is retrieved from the long-term memory bank; Step S13: Before injecting the candidate memories in the candidate memory set into the answer context, perform source verification on at least one candidate memory in the candidate memory set. The source verification includes source liveness verification and source version verification: the source liveness verification is to access the source object based on the source identifier and the source location information to determine the liveness status of the source object; the source version verification is to generate a current fingerprint based on the current content status or current version status of the source object, and compare the current fingerprint with the source version fingerprint to determine whether the content of the source object has changed. Step S14: Determine the admission level of the candidate memory based on the survival status, comparison results, and validity type of the candidate memory; the admission level is used to characterize whether the candidate memory is qualified as the final fact on which the answer is based; Step S15: Differentiate the candidate memories according to the admission level to obtain the injection context, and generate an answer for the current query based on the injection context.
[0043] It should be noted that, in one application scenario, this method can be deployed in an intelligent agent system represented by Hermes.
[0044] The system includes three types of memory writing entry points: the memory tools built into the Hermes main agent, the background replay process, and external memory service providers. To ensure compatibility between the source verification and access control method provided in this invention and existing systems, the following access method is adopted: First, a source liveness guard wrapper is added to the memory write interface.
[0045] A source viability guard wrapper is added to the "Write" interface of the memory tool. When the validity type of the memory to be written is a mutable document fact, an external real-time fact, or a tool observation, this wrapper requires the caller to provide both the source identifier and the source version fingerprint. If either field is missing, the memory record is written in an unverified state, and the reason for the missing information is recorded to the audit module. When the background replay process generates a memory, the tool call, retrieval result, or file read context that generated the memory is used as the source binding item to prevent the loss of source information during the background replay process.
[0046] Second, a verification and arbitration process is inserted during the memory recall and injection phases.
[0047] After the candidate memory from the external memory service provider is returned and before the answer context is injected, the source verification module and the arbitration module are called sequentially. Only records with true final fact permissions are injected into the current user message; invalid records are only passed as structured verification prompts or audit events and do not enter the final answer. For session snapshots formed from session snapshot files, migration parsing and source filtering are performed first after reading the file before generating the snapshot, thus ensuring compatibility with the prompt word caching mechanism.
[0048] Third, historical data should be migrated in one go.
[0049] For historical session snapshot files that do not support a source field, the file path, Uniform Resource Locator (URL), title, and version clue are identified through a one-time migration task. Records whose source can be uniquely located are added with a source identifier and entered into the migration memory in an unverified state. They must undergo initial source verification before being converted to a valid state. Records whose source cannot be located are retained in an unverified state and cannot be directly inferred to be valid from the migration task.
[0050] Through the above access method, the source constraint mechanism provided by this invention can be integrated into the memory read and write link of the existing intelligent agent system in a minimally invasive manner, ensuring that both new memory and historical memory are subject to unified source verification and access control constraints.
[0051] The system's memory write requests may originate from three types of entry points: the Hermes main agent's built-in memory tools, the background_review background review agent, and external MemoryProviders. Regardless of which type of entry point the write request originates from, the system uniformly executes the following source binding process when the request is about to be written to the long-term memory: First, identify the source of the memory.
[0052] Determine whether the factual statement to be archived originates from a document, knowledge base page, database record, tool return result, or explicit user preference, and accordingly determine the source identifier and type of the source object. For factual statements supported by multiple sources, each source is saved separately, and they are not compressed into a single, untraceable source identifier.
[0053] Second, generate the source fingerprint.
[0054] Select the source adapter based on the type of the source object: For file or webpage sources, calculate the content hash after reading the normalized text; for sources that support version interfaces, prioritize reading the entity tag ETag, update time, Git commit identifier, or database record version number, and can also save the content hash; for tool observation sources, save the observation ID, event version, or response hash. If the source identifier is incomplete, the fingerprint cannot be generated, or the initial verification fails, the status of the memory record can only be set to unverified, and cannot be directly set to verified.
[0055] Third, label the validity type.
[0056] The validity type of this fact statement is labeled, with values including user_preference, project_convention, mutable_document_fact, external_realtime_fact, and tool_observation. User_preference and project_convention correspond to the stable type, mutable_document_fact and external_realtime_fact correspond to the time-sensitive type, and tool_observation corresponds to either the time-sensitive type or the one-off type depending on whether it is reproducible.
[0057] Fourth, storage enhances memory.
[0058] Fact statements, along with source identifiers, source version fingerprints, validity types, and verification status, are written to the long-term memory and synchronously written to the initial audit event via atomic transactions. For mutable document facts, external real-time facts, and tool observations, fact-responding permissions are only granted after source binding exists and initial verification passes; records that fail to write or fail to complete source binding are only saved as unverified records to be supplemented and cannot be used as the sole basis for mutable facts.
[0059] For write requests initiated by external memory service providers, this system connects to the write interface of the external memory service provider through a write adapter, and persists the data after executing the aforementioned source binding process. If the external memory service provider has already completed the write, this system generates source binding items based on the source information it returns and re-executes source verification, so that the externally written memory is also subject to the source constraints of this method.
[0060] It should be emphasized that the above initial verification is only used to determine the initial state of the memory record and does not replace the source verification performed in the recall phase before injecting the response context. Regardless of the writing entry point, each time a candidate memory is recalled and prepared for injection, the source liveness verification and source version verification must be re-executed according to step S13.
[0061] It should be noted that the source object includes at least one of the following: documents, knowledge base pages, database records, application interface responses, tool call logs, and conversation records.
[0062] In the case of explicit user statements, the source object is the dialog record containing the explicit user statement. The source identifier includes the session identifier of the session to which the dialog record belongs, and the source location information includes the message sequence number or round identifier of the explicit user statement in the dialog record. In the case of tool call observation results, the source object is the call log that records the tool call. The source identifier includes the call identifier of the tool call, and the source location information includes the location identifier of the call in the call log. Since dialog records and call logs usually do not change once generated, the source version verification result for candidate memories with these two as source objects is usually unchanged. The source liveness verification is used to determine whether the dialog record or call log is no longer accessible due to data retention policy expiration, archiving, or cleanup.
[0063] It should be noted that for operation-type tool calls that produce side effects, including at least one of creating an order, sending a message, or modifying a configuration, the source verification should not be performed by re-executing the tool call. Instead, the source liveness verification and source version verification should only be performed based on the call log.
[0064] The factual statements to be settled are obtained through at least one of the following methods: The background review process reviews the completed dialogue rounds to determine whether there are any factual statements worth recording in the dialogue rounds. If so, the factual statement is extracted and the source object on which it is based is determined, and the memory record is automatically generated. In response to a user’s explicit memory instruction, the statement pointed to by the explicit memory instruction is taken as the factual statement, and the memory record is generated using the dialogue record where the explicit memory instruction is located as the source object. After the tool call is completed, the fact statement is generated based on the observation results of the tool call, and the memory record is generated using the call log of the tool call as the source object.
[0065] The background review process determines the source object upon which the factual statement is based, including: obtaining source metadata returned by the retrieval or invocation tool during the dialogue round, the source metadata including source identifier, source location information, and source version fingerprint; associating the factual statement with each source metadata returned during the dialogue round, and determining the source object corresponding to the source metadata matching the factual statement as the source object upon which the factual statement is based. If no source metadata matching the factual statement exists during the dialogue round, the memory record is marked as unbound from a source, and its access level is determined to be ineligible as final factual evidence in subsequent verification.
[0066] In one implementation, the determination of whether there is a factual statement worth retaining in the dialogue round is based on at least one of the following: whether the dialogue round contains explicit numerical values, rules, time limits, or agreements; whether the statement is acknowledged by the user with a confirmatory statement; whether the statement conflicts with existing memory records in the long-term memory bank; and whether the statement is repeatedly cited in the dialogue round.
[0067] A specific implementation of the above steps S12 (recalling candidate memories) and S13 (source verification) includes the following sub-steps S121 to S124: S121, Receive user questions and form a query representation.
[0068] The query module obtains the user's question, session identifier, tenant identifier, current user permissions, business scenario, and time conditions. Through entity recognition, intent recognition, and variable fact recognition, it determines whether the user's question involves price, timeframe, policy, version, parameters, or other facts requiring support from the current source, and forms a query vector and structured query conditions. The variable fact recognition distinguishes between stable and time-sensitive facts, enabling subsequent determination of validation strategies based on validity types.
[0069] S122, Retrieve candidate memories.
[0070] The memory retrieval module retrieves candidate records from the long-term memory based on the query vector, keywords, entities, and validity types. Each candidate record returns a memory identifier, factual statement, source binding item, binding fingerprint, historical state, and similarity. It is important to emphasize that the candidate retrieval is only responsible for retrieval and does not grant eligibility for responses; multiple candidates with the same source identifier can be merged and validated within the same request to avoid duplicate access to the source object.
[0071] S123, Source liveness check.
[0072] The source verification module reads the source identifier and source type, calls the corresponding source adapter, and accesses the source object under the current user and tenant permissions. The adapter returns whether the source exists, whether the source is readable, the current fingerprint, the access time, the error category, and optional current content. For files, it first checks whether the path or object key exists, and then reads the normalized content; for HTTP or knowledge base pages, it uses HEAD or GET to read entity tags, version numbers, or body text; for databases, it queries the existence of records and reads the record version number or last update time; for code repositories, it reads the commit identifier, data object hash, and path existence.
[0073] The source adapter categorizes errors as follows: Explicit non-existence or 404 / 410 errors, file non-existence, database record non-existence are classified as deleted; timeouts, network failures, 5xx errors, and repository unreachable errors are classified as unreachable; 401 / 403 errors or database permission denied errors are classified as insufficient permissions and, according to the verification policy, as source unreachable; successful access and the current fingerprint matches the bound fingerprint are classified as unchanged; successful access but a different fingerprint is classified as changed. Insufficient permissions cannot be directly determined as deleted.
[0074] To reduce validation overhead, the validation module establishes a cache from the source identifier to the validation result within a single request; cross-request caches must simultaneously bind the validation time, tenant, and permission scope, and set a maximum cache duration. A cache hit can only reuse the validation result; it cannot skip the status and response permission checks.
[0075] S124, Memory state determination.
[0076] The state management module compares the verification result of S123 with the bound fingerprint, validity type, last verification time, and policy parameters, and updates the state using a version-based conditional write method to prevent old results from overwriting new results during concurrent verification. The state determination rules are as follows: 1) If the source exists and the current fingerprint is equal to the bound fingerprint, the status is valid and it can be used as factual evidence; 2) If the source exists but the current fingerprint is inconsistent, the status is "source has changed". Old fact statements are prohibited from being used as final facts, and the current source content is read first. 3) If the source is clearly non-existent or has been deleted, and the status is "source deleted," then old factual statements are prohibited from being presented as current facts; 4) The source is temporarily inaccessible or lacks sufficient permissions. The status is "Source Unavailable". You can retry or downgrade to "Unable to confirm". 5) If the source identifier or source version fingerprint is missing and the status is unverified, it cannot be used as the sole basis for variable facts.
[0077] For ease of understanding, Table 1 below shows the correspondence between the five status judgment conditions and the answering permissions:
[0078] Table 1 The status update simultaneously records the current fingerprint, the last verification error, the current verification time, the number of verification attempts, and the audit event. It should be noted that this status is not a deletion marker; the old memory and historical version relationships are retained for re-verification, conflict identification, and audit tracing.
[0079] It is understood that the technical solution provided in this embodiment forms a closed loop in the five stages of memory writing, recall, verification, arbitration, and injection. Compared with the existing implementation method of recall as injection, it can achieve the following beneficial effects: Firstly, it establishes a traceable link between memory and its source.
[0080] By simultaneously saving the text content of the factual statement, source identifier, source location information, and source version fingerprint for each memory record during the memory writing stage (step S11), the memory is no longer an isolated text fragment, but a structured record carrying a clear source and version coordinates. Therefore, any recalled memory can be traced back to its origin, providing a data foundation for subsequent verification, error correction, and auditing, and solving the problem of the lack of binding relationship between memories and original documents, knowledge base pages, and database records.
[0081] Secondly, it blocks the contamination of old memories before an answer is generated.
[0082] Because source viability verification and source version verification are set before the candidate memory is injected into the response context (step S13), the system can determine whether the source still exists and whether the content has changed before the model comes into contact with the memory, and decide whether it can serve as the final factual basis. This prevents memories whose sources have been deleted, modified, or are no longer accessible from being silently used as current facts, eliminating the possibility of stale memories entering the generation stage from a process perspective, thereby significantly reducing the probability of the agent outputting incorrect conclusions.
[0083] Third, differentiated rulings should be implemented based on the type of validity.
[0084] This embodiment introduces validity type as one of the adjudication criteria in the access level arbitration process (step S14), employing different judgment strategies for time-sensitive and stable facts. For time-sensitive facts such as prices, policies, deadlines, and interface parameters, they are only qualified as final factual evidence if the source is still alive and the version has not changed; for stable facts such as project agreements, they are only downgraded if the comparison results show that they have changed. This differentiated strategy avoids a one-size-fits-all approach, allowing limited verification resources to be concentrated on the fact categories that are most prone to failure and have the most severe consequences of failure.
[0085] Fourth, the admission decision will be transformed into a practical constraint on the model generation behavior.
[0086] This embodiment does not simply add explanatory text to the prompts, but rather differentiates candidate memories according to their admission levels, constructing a structurally partitioned injection context (step S15): memories that pass verification enter the verified fact area and are allowed to be cited as final factual evidence; memories that fail version verification enter the historical clue area and are marked as invalid or pending confirmation; memories that fail liveness verification are blocked from injection or marked as unverified. Because the "qualification" information is solidified into the structure and marking of the context, the model can clearly distinguish between verifiable facts and historical clues during the generation stage, thereby reducing the possibility of indiscriminately citing outdated memories and ensuring that admission decisions are not merely a formality.
[0087] Fifth, reduce the trust costs and verification burden on the user side.
[0088] Because the answers generated in this embodiment can clearly distinguish between current valid facts and changed historical records, users do not need to go through the original documents one by one to determine whether the conclusion is outdated, nor do they need to perform an additional manual verification after receiving the conclusion. This improves the reliability of the answers and reduces the extra operations that users need to perform to build trust.
[0089] It should be noted that this solution is essentially an improvement on the internal performance of the information processing system. The aforementioned effects are not derived from human agreement or subjective judgment, but are achieved through specific data processing methods such as adding source and version fields to the memory records, performing access and comparison operations before injection, and constructing differentiated contexts based on the comparison results. The result is a reduction in the false response rate of the intelligent agent system and an improvement in the reliability and traceability of the output results during long-term operation, which constitutes an improvement on the reliability and accuracy of the computer information processing system.
[0090] In practice, the liveness status of the source object includes at least two of the following: the source object exists and the current subject can access it; the source object does not exist; the source object exists but the current subject does not have access rights; the source object is temporarily inaccessible. The method further includes: distinguishing between two liveness states, namely, the absence of the source object and the temporary inaccessibility of the source object, and assigning different access levels to the two; Specifically, in cases where the source object is temporarily inaccessible, the candidate memory is marked as unverified and restricted from being used as the sole factual basis; in cases where the source object does not exist, its injection into the injection context is blocked.
[0091] Understandably, compared to existing implementations that broadly categorize source access results into two states—accessible and inaccessible—this embodiment: Firstly, it avoids permanently discarding still-valid memories due to temporary malfunctions.
[0092] In existing implementations, access failures to a source object are typically uniformly classified as "the memory is unavailable," leading to deletion or permanent degradation. However, access failures caused by network jitter, service timeouts, source system rate limiting, or temporary maintenance are fundamentally different from the deletion of the source object: the former allows the memory to remain valid after the fault is recovered, while the latter signifies the loss of the factual basis upon which the memory is based. This embodiment distinguishes between two survival states: "source object does not exist" and "source object is temporarily inaccessible," and assigns them different access levels. This ensures that memories that fail verification due to temporary faults are merely marked as unverified, rather than discarded. Once the source system recovers, the memory can be re-verified to regain its eligibility as the final factual basis, thus avoiding unnecessary loss of memory resources and preventing users from repeatedly re-accumulating the same facts.
[0093] Secondly, it prevents expired memories from being referenced again, thus eliminating the risk of them being misleading.
[0094] In cases where the source object no longer exists, this embodiment directly blocks the injection context of the candidate memory. Since the deletion or decommissioning of the source object means the factual basis upon which the memory is based has completely disappeared and cannot be recovered through waiting or retries, outputting it as factual basis would lead to a definitive erroneous conclusion. By blocking injection, this embodiment eliminates the possibility of such memories entering the generation stage from the data flow path, preventing them from contaminating the answer content.
[0095] Third, maintain availability and control risks in cases where the source cannot be verified.
[0096] In cases where the source object is temporarily inaccessible, this embodiment does not simply reject all use. Instead, it marks the candidate memory as unverified and restricts it from being used as the sole factual basis. The advantages of this approach are twofold: firstly, the historical information carried by the memory can still serve as clues in answer generation, maintaining the continuity and availability of the agent's services during source system failures and preventing the entire question-and-answer capability from becoming unavailable due to a single point of failure in the verification process; secondly, by restricting it as the sole factual basis, it avoids relying solely on the memory to support a definitive conclusion when the source cannot be verified, thus achieving a balance between availability and reliability.
[0097] Fourth, it enables the system to truthfully declare the verification status of the answer to the user.
[0098] Because this embodiment explicitly distinguishes and records different survival states, the system can determine whether the answer has been verified by the source, and output a message indicating that the answer has not been verified when the source is inaccessible. This avoids the system silently relying on outdated memories to provide an answer in abnormal situations, allowing users to assess the credibility of the conclusion with full knowledge and decide whether to conduct a manual review. Compared to implementations that do not distinguish the cause of failure and output a definitive answer in all cases, this embodiment significantly reduces the possibility of users bearing the risk of judgment without their knowledge.
[0099] Fifth, incorporate permission boundaries into the constraints of memory reuse.
[0100] This embodiment further distinguishes the state of "the source object exists but the current subject does not have access rights" from "the source object does not exist" and "the source object is temporarily inaccessible". Therefore, this embodiment can identify situations where the source object itself is still valid, but cannot be verified only because the current session subject lacks sufficient permissions. This distinction prevents the system from mistakenly judging restricted permissions as source invalidity and incorrectly discarding memories. It also prevents the indiscriminate provision of facts requiring specific permissions to be verified to subjects without the corresponding permissions, thus ensuring that the scope of memory reuse matches the permission attributes of its source.
[0101] Sixth, improve the predictability and maintainability of anomaly handling.
[0102] Because different survival states correspond to different processing strategies and are recorded separately, the system's behavior is predictable when facing various anomalies such as large-scale failures of source systems, adjustments to permission policies, and batch shutdowns of the knowledge base: temporary failures will not cause batch memory invalidation, permission adjustments will only affect memories within a limited scope, and only actual deletion will trigger blocking. This feature allows operations and maintenance personnel to quickly locate the source of the anomaly based on the statistical distribution of survival states (for example, a sudden increase in the proportion of "temporarily inaccessible" records from a certain source system indicates that the system may be faulty), without having to check memory records one by one, thereby reducing the system's operation and maintenance costs.
[0103] Example 2
[0104] This embodiment includes the solution of Embodiment 1 above, except that the current fingerprint is determined by any of the following methods: Calculate a hash value for the entire content of the source object, and use the calculated hash value as the current fingerprint; or, Calculate the hash value of the content segment located by the source location information in the source object, and use the calculated hash value as the current fingerprint; or, Obtain at least one of the version number, entity tag ETag, last update time or change sequence number of the source object, and use the obtained information as the current fingerprint; or combine the source identifier of the source object with the information to calculate a hash value, and use the calculated hash value as the current fingerprint. Before calculating the hash value, normalization processing is performed on the entire content of the source object or the content fragment. The normalization processing includes at least one of the following: removing whitespace characters and invisible characters, unifying character encoding and newline characters, removing metadata fields unrelated to the content, and sorting the content according to preset rules. The source version fingerprint is determined using the same determination method as the current fingerprint; The source verification is performed in any of the following ways: synchronously after the candidate memory is recalled and before it is injected; pre-verify memory records with a recall frequency higher than a preset threshold, and cache the verification results and the current fingerprint, wherein the cache has an expiration period; in response to a change event of the source object, perform batch verification on memory records based on the source object and update their status.
[0105] It is understood that, compared with existing implementations that only use a single fingerprint generation method and only use a fixed verification timing, the above-described solution in this embodiment can achieve the following beneficial effects: Firstly, it matches the fingerprint granularity with the factual granularity, significantly reducing excessive failures.
[0106] This embodiment provides three fingerprint determination methods. The second method calculates the hash value only for the content fragment located by the source location information in the source object. Since the source location information in the memory record already points to the specific location of the fact statement in the source object, using fragment-level fingerprints can reduce the granularity of the comparison from "the entire source object" to "the fragment where the fact is located". Therefore, when other parts of the source object change but the fragment remains unchanged, the comparison result is still unchanged, and the memory will not be erroneously downgraded. This effectively solves the problem of excessive invalidation when using the overall content hash as a fingerprint, where "any change to the document will cause all the memories carried by the document to become invalid", allowing still valid historical memories to be preserved and reducing the waste of memory resources and the overhead of repeated accumulating.
[0107] Secondly, it is compatible with source systems that do not have the conditions for hash calculation.
[0108] The third fingerprint determination method in this embodiment directly obtains the version number, entity tag ETag, last update time, or change sequence number of the source object as a fingerprint. This method is suitable for source objects for which complete content cannot be directly obtained, or where obtaining complete content is too costly (e.g., large binary documents, extremely long pages requiring pagination, or third-party systems that only provide metadata interfaces). Therefore, this embodiment does not rely on a complete reading of the source object's content to complete version verification, expanding the applicability of the solution. Simultaneously, this method also provides a path to combine the source identifier with this information before calculating the hash value. This retains the low-cost advantage of readily available version fields while obtaining a fixed-length, uniformly formatted fingerprint value that is easy to compare and store, avoiding the comparison difficulties caused by different version field formats across different source systems.
[0109] Third, eliminate pseudo-failures caused by non-content changes.
[0110] This embodiment performs normalization processing on the entire content or content fragments of the source object before calculating the hash value. This includes removing whitespace and invisible characters, standardizing character encoding and line breaks, removing metadata fields unrelated to the content, and sorting the content according to preset rules. Therefore, changes that do not fundamentally alter the content, such as adding or deleting spaces during editing, differences in Windows and Unix line breaks, differences in UTF-8 and UTF-16 encoding, and changes in accompanying timestamps or statistical fields, will no longer cause fingerprint changes. This avoids the memory being mistakenly judged as invalid due to layout adjustments, format conversions, or system re-saving, further reducing the proportion of false changes and ensuring that the version verification results truly reflect whether the content has undergone substantial changes.
[0111] Fourth, synchronous verification ensures the freshness of the judgment results.
[0112] The first execution method provided in this embodiment performs source verification synchronously after the candidate memory is recalled and before injection. Since the verification action is adjacent to the injection action, it is based on the latest state of the source object at the time of this question and answer, thus ensuring that the admission level is determined based on the latest liveness and version status, avoiding the misjudgment of a recently changed source as unchanged due to the use of expired cache. This method is suitable for scenarios with high timeliness requirements and fast source system response, such as price queries, inventory queries, and risk control strategy queries.
[0113] Fifth, reduce the latency of a single question and answer session by pre-verifying the cache.
[0114] The second execution method provided in this embodiment pre-verifies memory records with a recall frequency exceeding a preset threshold and caches the verification results along with the current fingerprint. Since frequently recalled memory records are often concentrated in a few hotspots, pre-verifying and caching these records eliminates the overhead of repeated source access and hash calculations for subsequent large-scale question-and-answer sessions, significantly reducing the average response latency per question and answer session and the access pressure on the source system. Simultaneously, by setting an expiration period for this cache, the freshness of the cache is matched to the likelihood of source changes: a shorter expiration period is set for frequently changing sources, and a longer expiration period is set for stable sources, thus achieving a configurable balance between latency and freshness.
[0115] Sixth, event-driven verification enables timeliness and batch processing.
[0116] The third execution method provided in this embodiment responds to changes in the source object by performing batch verifications and updating the status of memory records based on that source object. Therefore, when the source system pushes page update notifications, database change capture events, or document version release events, the status of the relevant memories can be updated immediately without waiting for the next recall to trigger verification. This allows the invalidation status of memories to be identified and marked in advance before they are actually used, so that arbitration can be completed directly based on the cached verification results when a user initiates a query, further reducing the latency of the question-and-answer process. At the same time, the batch processing method avoids the request storm caused by triggering verification item by item when a large-scale change occurs in the source system, reducing the instantaneous pressure on the source system.
[0117] Seventh, the three execution methods can be combined to adapt to different sources and different loads.
[0118] Since the three execution methods described above are applicable to different scenarios, this embodiment supports their combined use: pre-verification caching combined with event-driven updates is used for high-frequency and frequently changing hotspot memories, while synchronous verification is used for low-frequency or highly time-sensitive memories. Thus, the system can adopt differentiated verification strategies based on the access cost, change frequency, and timeliness requirements of different source objects, achieving comprehensive optimization across the three dimensions of overall latency, source system load, and freshness determination, without having to make a single trade-off between "full synchronous verification" and "full caching".
[0119] Example 3
[0120] This embodiment includes the scheme of Embodiment 1 above. The difference between this embodiment and Embodiment 1 is that the validity type includes at least two of the following categories: stable type, used to characterize factual statements that are stable in the long term and do not become invalid with changes in the source object; time-sensitive type, used to characterize factual statements that are easily invalidated with changes in the source object, including at least one of price, policy, term, and interface parameters; and one-time type, used to characterize factual statements that are only valid in a specific context or within a specific time period. The determination of the admission level of the candidate memory includes at least the following: for time-sensitive candidate memories, they are only qualified as final factual evidence if the survival status is existing and accessible and the comparison result is unchanged; for stable candidate memories, they are downgraded to not being qualified as final factual evidence if the comparison result is changed. The admission levels include at least: a first level, indicating that the candidate memory passes both the source survival verification and the source version verification, and is qualified as the final factual basis; a second level, indicating that the candidate memory passes the source survival verification but fails the source version verification, and is only qualified as a historical clue; and a third level, indicating that the candidate memory fails the source survival verification and is not qualified as the final factual basis. The differential processing of candidate memories according to the admission level includes: for candidate memories of the first level, injecting them into the verified fact area of the injection context and allowing the model to cite them as the final factual basis; for candidate memories of the second level, injecting them into the historical clue area of the injection context and attaching an invalidation mark or a pending confirmation mark, the invalidation mark or pending confirmation mark being used to restrict the model from using them alone as the final factual basis; for candidate memories of the third level, blocking their injection into the injection context, or attaching an unverified mark during injection and restricting them from being the sole factual basis.
[0121] In practice, the memory record also includes a source permission scope identifier, which is used to characterize the subject scope in which the factual statement can be reused, including at least one of tenant, role, and security level; The method further includes: comparing the source permission range identifier with the permission attributes of the current session subject; if the comparison result indicates that the current session subject is not within the subject range, then blocking the injection of the candidate memory, or desensitizing the candidate memory before injection.
[0122] It is understood that, compared with the existing implementation that applies a uniform verification strength to all memories and indiscriminately injects the recall results into the response context, the above-described solution in this embodiment can achieve the following beneficial effects: First, the verification strength should be matched with the actual risk of failure, avoiding a one-size-fits-all approach.
[0123] This embodiment categorizes validity types into stable, time-sensitive, and one-off types, and employs different adjudication strategies for each type: For time-sensitive facts such as prices, policies, deadlines, and interface parameters, they are only granted eligibility as final factual evidence if their existence and accessibility are confirmed and the version comparison result shows no change; for stable facts such as project agreements, they are only downgraded if the comparison result indicates a change. Since changes to time-sensitive facts directly lead to fact invalidation, while stable facts are generally unaffected by substantial changes to the source object, this differentiated strategy applies strict verification to the fact categories most prone to invalidation and with the most severe consequences, while maintaining necessary leniency for stable facts. This ensures accuracy while avoiding unnecessary downgrading, and also concentrates limited source access and computational resources on the memory that truly needs verification.
[0124] Secondly, identify and constrain facts that hold true only under specific conditions.
[0125] By introducing a single-use validity type, this embodiment can identify factual statements that are valid only within a specific context or time period, such as time-limited promotional rules, temporary change windows, and one-time operation instructions. Such facts lose their validity once their applicable conditions cease, and using a uniform timeliness standard makes it difficult to accurately characterize their validity period. By classifying them separately, the system can determine whether a fact is still valid based on its associated context identifier or valid time period, thereby preventing such facts from being reused when the conditions are no longer met.
[0126] Third, the admission decision is transformed into a structured constraint that can be recognized by the model.
[0127] This embodiment does not retain the decision results through internal marking or logging. Instead, it constructs an injection context with partitions based on access levels: first-level memories that pass double verification enter the verified fact area and are allowed to be cited as final factual evidence; second-level memories that fail version verification enter the historical clue area and are marked as invalid or pending confirmation; third-level memories that fail liveness verification are blocked from injection, or are marked as unverified during injection and restricted from being used as the sole factual evidence. Because the decision result of "whether it qualifies as final factual evidence" is solidified into the partitioned structure and binding marks of the context, the model can clearly distinguish between verifiable facts and historical clues during the generation phase, thus ensuring that access decisions are not merely formalities and effectively reducing the possibility of the model indiscriminately citing outdated memories.
[0128] Fourth, while blocking pollution, we can preserve the historical value of our work.
[0129] For candidate memories at the second level, this embodiment does not simply discard them, but injects them into the historical clue area and attaches an invalidation mark. The advantage of this approach is that the change information carried by the memory itself has value; it can be used to explain the evolution of conclusions, respond to user questions about historical statements, or serve as a reference clue when the current source is unavailable. Simultaneously, the invalidation mark or pending confirmation mark constrains the model to prevent it from being used alone as the final factual basis, ensuring that it functions without misleading the conclusion. Thus, this embodiment achieves a balance between "blocking invalid memories" and "preserving the value of historical information."
[0130] Fifth, it provides optional processing strategies for businesses with different levels of rigor.
[0131] For candidate memories at the third level, this embodiment provides two processing methods: blocking injection and attaching a tag to restrict them. The former completely eliminates the possibility of them entering the injection context from the data flow path, which is suitable for situations where the source has been determined to be invalid. The latter, when it is necessary to prompt the user that "there is an unverified clue," retains a controllable information channel, while restricting it as the sole factual basis to prevent the memory from supporting a definitive conclusion. The two processing methods can be selected and configured according to the severity of the business, enabling the solution to adapt to scenarios with different reliability requirements.
[0132] Sixth, the boundaries of memory reuse should be matched with the permission attributes of its source to avoid unauthorized reuse.
[0133] This embodiment introduces a source permission scope identifier into the memory record and compares it with the permission attributes of the current session subject during access arbitration. Therefore, facts accumulated by high-privilege sessions based on highly confidential documents will not be indiscriminately reused in low-privilege sessions or sessions of different tenants. For cases where the comparison result indicates that the current session subject is not within the permitted scope, this embodiment provides two processing methods: blocking injection and de-identifying injection. The former is suitable for situations where the facts themselves should not be disclosed, while the latter is suitable for situations where the facts can be partially disclosed, requiring only the concealment of sensitive details. This approach satisfies permission control requirements while preserving the usability of the memory as much as possible.
[0134] Seventh, the memory layer is subject to the same strict governance constraints as the retrieval layer.
[0135] In existing retrieval enhancement generation solutions, documents on the knowledge base side are typically constrained by permissions, version, and lifecycle governance. However, historical facts accumulated by the agent in long-term memory often bypass these governance mechanisms and directly enter the answer context, creating a governance vacuum. This embodiment addresses this by carrying validity type and source permission scope identifiers in the memory records and performing access arbitration based on these two factors before injection. This ensures that facts in the memory layer and documents in the retrieval layer are subject to the same set of source verification and permission control logic. As a result, the governance strategy expected by administrators—"based on currently verifiable sources, and unverified content should not be used as the sole basis"—is consistently implemented in both the memory and retrieval layers, preventing existing safeguards from becoming ineffective due to memory bypassing governance.
[0136] It should be noted that the above effects are achieved through specific data processing methods such as adding validity type and source permission range identifiers to memory records, performing comparison and classification based on the identifiers, and constructing differentiated contexts according to the classification results. The result is a reduction in the false response rate of the intelligent agent system and an improvement in the reliability and permission compliance of the output results, which is an improvement on the internal performance and reliability of the computer information processing system.
[0137] Example 4
[0138] This embodiment includes the solution of Embodiment 1 above, but differs from Embodiment 1 in that the method further includes: Obtain the current source content related to the current query; if the current source content conflicts with the factual statement in the candidate memory and the candidate memory fails the source version verification, generate the answer based on the current source content, and update the candidate memory according to the current source content. The update includes at least one of the following: rewriting the text content of the factual statement, regenerating the source version fingerprint, and updating the source location information. When the current fingerprint is inconsistent with the source version fingerprint, the current content in the source object is further obtained based on the source location information, and the current content is compared with the text content of the fact statement. If the comparison result indicates that the two are consistent, the fact statement is determined to be valid, the admission level of the candidate memory is determined to be qualified as the final factual basis, and the source version fingerprint in the candidate memory is updated using the current fingerprint. If the comparison result indicates that the two are inconsistent, the fact statement is determined to be invalid, the admission level of the candidate memory is determined to be qualified only as a historical clue, and the text content of the fact statement is updated based on the current content.
[0139] In practice, after generating the answer to the current query based on the injection context, the process further includes: For at least one conclusion in the answer, associate auditable metadata, which includes the source identifier, source location information, source version fingerprint, verification time, liveness status, comparison result, and access level on which the conclusion is based; The auditable metadata is written to the audit log, which is used to support the retrospective tracing and playback of the basis for the generation of the answer.
[0140] To facilitate understanding, the following example, a Q&A scenario regarding a company's refund policy, illustrates the specific implementation process of the source verification and access control method provided by this invention.
[0141] In this scenario, there is a historical record in the long-term memory about the refund policy, which states that "customers can get a refund within 30 days of purchase". The source binding items include: the source identifier pointing to the document "refund_policy.md" and the source version fingerprint being the fingerprint value generated when reading the document.
[0142] Scenario 1: The source exists, but the content has been changed. The document was later updated to state that "customers can get a refund within 14 days of purchase." When a user inquires about the refund again, the system retrieves the aforementioned historical record from the long-term memory and performs source verification before injecting it into the response context.
[0143] The source verification module accesses the document based on the source identifier, obtains the current content, and calculates the current fingerprint. Upon comparison, the current fingerprint is inconsistent with the source version fingerprint in the memory record, meaning the source exists but the content has changed. The arbitration module determines the status of the memory record as "source changed," prohibiting the use of old factual statements as final factual evidence. Simultaneously, it rereads the current content of the document, generates an answer based on the current content, and outputs "Refund window is 14 days" to the user.
[0144] Scenario 2: The source has been deleted. The document was subsequently deleted or taken offline. When the user inquired about the refund again, the system retrieved the aforementioned historical record and performed a source verification.
[0145] The source verification module accesses the document based on the source identifier and finds that the document no longer exists, meaning the source viability verification fails. The arbitration module determines the status of the memory record as "source deleted," prohibiting the use of old factual statements as current factual basis. It also generates a response prompting the user: the source of the old memory has been deleted, the current policy cannot be confirmed, and it avoids directly outputting the old factual statement "30 days." This old memory record is retained only as a historical clue or audit record for tracing and conflict identification.
[0146] As can be seen from the above scenarios, the present invention can prevent memories based on outdated or invalid sources from directly entering the final answer when the source object is changed or deleted, thereby effectively avoiding the agent from outputting incorrect information.
[0147] It is understood that, compared with existing implementations that only determine memory failure without correction and leave no trace after the answer is generated, the above-described solution in this embodiment can achieve the following beneficial effects: Firstly, memory self-healing is performed simultaneously with the generation of the answer, preventing the recurrence of the same error. When the obtained current source content conflicts with the factual statement in the candidate memory, and the candidate memory fails the source version verification, this embodiment generates an answer based on the current source content and updates the candidate memory accordingly. The updates include rewriting the text content of the factual statement, regenerating the source version fingerprint, and updating the source location information. Thus, outdated memories are not only temporarily avoided in the current question and answer session, but are corrected on-site within the same interaction: when the memory is recalled in a subsequent session, its text content and fingerprint are consistent with the current state of the source, eliminating the need to re-trigger the invalidation determination. This solves the problem of repeated misleading in existing solutions where correction is only effective within the current session and the old statement reappears in the next session, making error correction persistent and preventing the same fact from being repeatedly deposited into multiple contradictory memory records.
[0148] Secondly, it eliminates the need for manual cleaning and scheduled full scans to maintain the memory bank.
[0149] Because memory updates are automatically triggered by a routine question-and-answer process, the system does not need to perform periodic full-scale verification tasks to maintain memory timeliness, nor does it need to rely on users actively discovering and reporting erroneous conclusions before cleanup. This significantly reduces the operational costs of the memory bank and the pressure of batch access to the source system, and ensures that the timeliness of the memory bank matches the actual usage frequency: frequently recalled memories will be corrected first, while memories that have not been used for a long time will not incur unnecessary verification overhead.
[0150] Third, ensure that users obtain the currently valid conclusion in conflict situations.
[0151] This embodiment explicitly generates an answer based on the current source content when a conflict is detected, rather than presenting old statements from memory alongside newly retrieved statements for the user to choose from. Therefore, the user does not need to act as a judge to determine which is the most recent fact, avoiding the decision-making difficulties caused by conflicting conclusions being presented to the user simultaneously, and also avoiding the counterintuitive result that remembered wording, being closer to the current question or having a higher degree of similarity, may in fact override the currently retrieved document.
[0152] Fourth, the excessive failure caused by the overall change of the source is resolved through a two-level judgment.
[0153] In this embodiment, when the current fingerprint differs from the fingerprint of the source version, it does not directly determine that the factual statement is invalid. Instead, it further obtains the current content of the source object based on the source location information and compares this current content with the text content of the factual statement, forming a two-level judgment of "fingerprint coarse screening + content fine judgment": fingerprint comparison is used to quickly filter out the vast majority of unchanged memories at extremely low cost, while content comparison is used to accurately determine whether the specific fact has truly changed when the fingerprint has changed. Thus, when the source object undergoes overall changes due to layout adjustments, updates of irrelevant chapters, re-saving, index reconstruction, etc., but the specific fact it carries has not changed, the memory is still retained as the final factual basis after the second judgment, avoiding the excessive invalidation problem of "all memories it carries becoming invalid when the document is changed", reducing the waste of memory resources and the overhead of repeated accumulation.
[0154] Fifth, fingerprint refresh is completed simultaneously during the second determination to suppress duplicate verification.
[0155] For memories that have been confirmed as valid after a second check, this embodiment updates the source version fingerprint in the candidate memory using the current fingerprint. Thus, the fingerprint of the memory is refreshed to a value consistent with the current state of the source. When subsequently recalled, it can be directly retrieved via fingerprint comparison, without repeatedly entering the more expensive content comparison process. This significantly reduces the frequency of content comparison triggers and the amount of access to the source system, especially in scenarios where the source object undergoes frequent, non-substantial changes.
[0156] Sixth, it establishes traceable evidence for answering the conclusions, supporting post-audit and accountability.
[0157] This embodiment associates auditable metadata with at least one conclusion in the answer and writes it to the audit log. This auditable metadata includes the source identifier, source location information, source version fingerprint, verification time, liveness status, comparison results, and access level on which the conclusion is based. Because these fields comprehensively depict the entire chain of "which source the conclusion is based on, where that source is located, what version it was at the time, when it was verified, what the verification conclusion was, and what qualifications it ultimately gained entry into the answer," the basis for any conclusion can be reconstructed afterward to determine whether the conclusion had sufficient factual basis at the time of its generation. This solves the problem in existing solutions where logs only retain factual text, cannot find the source and version, and therefore cannot complete compliance audits and accountability. For example, when a user questions a historical quote or maintenance suggestion, the audit log can locate the specific document version and verification results at the time, thereby determining whether the conclusion was credible at that time, rather than simply knowing "what the system said."
[0158] Seventh, it enables the credibility of the conclusions to be quantified and statistically presented.
[0159] Because the access level, survival status, and comparison results associated with each conclusion are all recorded in a structured manner, the system can statistically analyze and present the overall credibility of the responses. For example, it can indicate the percentage of conclusions from verified fact areas, the number of unconfirmed clues, and the number of memories in an unverified state due to inaccessible sources. This allows users and administrators to assess the reliability of the agent's output in a measurable way, and also provides data for subsequent optimization of source access quality, adjustment of verification strategies, and cache expiration.
[0160] Furthermore, the aforementioned effects are achieved through specific data processing methods such as acquiring the current source content and performing conflict comparison, updating the text content and fingerprint in the memory record based on the comparison results, re-acquiring the content according to the location information and performing secondary judgment, and writing structured metadata into the audit log. The result is a reduction in the false response rate of the intelligent agent system, a reduction in the repeated misleading of invalid memories, and an improvement in the reliability and traceability of the output results.
[0161] Example 5
[0162] Figure 2 This is a schematic block diagram illustrating a source verification and admission control device 100 for long-term memory of an intelligent agent according to an exemplary embodiment. See also... Figure 2 The device 100 includes: The memory writing module 101 is used to acquire the factual statement to be deposited, determine the source object on which the factual statement is based, generate a memory record, and write the memory record into a long-term memory bank. The long-term memory bank is used to store memory records that can be reused across sessions. The memory record includes at least the text content of the factual statement, source identifier, source location information, source version fingerprint, and validity type. The source identifier is used to uniquely identify the source object, the source location information is used to locate the content corresponding to the factual statement within the source object, the source version fingerprint is used to characterize the content state or version state of the source object at the time of writing, and the validity type is used to characterize the timeliness attribute of the factual statement. The memory retrieval module 102 is used to retrieve a set of candidate memories related to the current query from the long-term memory bank in response to the current query. Source verification module 103 is used to perform source verification on at least one candidate memory in the candidate memory set before injecting the candidate memory in the candidate memory set into the answer context. The source verification includes source liveness verification and source version verification: the source liveness verification is to access the source object based on the source identifier and the source location information to determine the liveness status of the source object; the source version verification is to generate a current fingerprint based on the current content status or current version status of the source object, and compare the current fingerprint with the source version fingerprint to determine whether the content of the source object has changed. The admission arbitration module 104 is used to determine the admission level of the candidate memory based on the survival status, comparison results, and the validity type of the candidate memory; the admission level is used to characterize whether the candidate memory is qualified as the final fact on which the answer is based; The answer generation module 105 is used to differentiate the candidate memory according to the admission level to obtain the injection context; and to generate an answer for the current query based on the injection context.
[0163] It should be noted that the implementation methods of each module in the technical solution provided in this embodiment are described in the relevant descriptions of the foregoing embodiments, and will not be repeated in this embodiment.
[0164] It is understood that the technical solution provided in this embodiment forms a closed loop in the five stages of memory writing, recall, verification, arbitration, and injection. Compared with the existing implementation method of recall as injection, it can achieve the following beneficial effects: Firstly, it establishes a traceable link between memory and its source.
[0165] By simultaneously saving the text content of the factual statement, source identifier, source location information, and source version fingerprint for each memory record during the memory writing stage (step S11), the memory is no longer an isolated text fragment, but a structured record carrying a clear source and version coordinates. Therefore, any recalled memory can be traced back to its origin, providing a data foundation for subsequent verification, error correction, and auditing, and solving the problem of the lack of binding relationship between memories and original documents, knowledge base pages, and database records.
[0166] Secondly, it blocks the contamination of old memories before an answer is generated.
[0167] Because source viability verification and source version verification are set before the candidate memory is injected into the response context (step S13), the system can determine whether the source still exists and whether the content has changed before the model comes into contact with the memory, and decide whether it can serve as the final factual basis. This prevents memories whose sources have been deleted, modified, or are no longer accessible from being silently used as current facts, eliminating the possibility of stale memories entering the generation stage from a process perspective, thereby significantly reducing the probability of the agent outputting incorrect conclusions.
[0168] Third, differentiated rulings should be implemented based on the type of validity.
[0169] This embodiment introduces validity type as one of the adjudication criteria in the access level arbitration process (step S14), employing different judgment strategies for time-sensitive and stable facts. For time-sensitive facts such as prices, policies, deadlines, and interface parameters, they are only qualified as final factual evidence if the source is still alive and the version has not changed; for stable facts such as project agreements, they are only downgraded if the comparison results show that they have changed. This differentiated strategy avoids a one-size-fits-all approach, allowing limited verification resources to be concentrated on the fact categories that are most prone to failure and have the most severe consequences of failure.
[0170] Fourth, the admission decision will be transformed into a practical constraint on the model generation behavior.
[0171] This embodiment does not simply add explanatory text to the prompts, but rather differentiates candidate memories according to their admission levels, constructing a structurally partitioned injection context (step S15): memories that pass verification enter the verified fact area and are allowed to be cited as final factual evidence; memories that fail version verification enter the historical clue area and are marked as invalid or pending confirmation; memories that fail liveness verification are blocked from injection or marked as unverified. Because the "qualification" information is solidified into the structure and marking of the context, the model can clearly distinguish between verifiable facts and historical clues during the generation stage, thereby reducing the possibility of indiscriminately citing outdated memories and ensuring that admission decisions are not merely a formality.
[0172] Fifth, reduce the trust costs and verification burden on the user side.
[0173] Because the answers generated in this embodiment can clearly distinguish between current valid facts and changed historical records, users do not need to go through the original documents one by one to determine whether the conclusion is outdated, nor do they need to perform an additional manual verification after receiving the conclusion. This improves the reliability of the answers and reduces the extra operations that users need to perform to build trust.
[0174] Example 6
[0175] An electronic device according to an exemplary embodiment includes a processor and a memory, the memory being used to store a computer program, and the processor being used to invoke and run the computer program stored in the memory to perform the method described above.
[0176] It is understood that this embodiment has the same technical effects as the aforementioned method embodiments.
[0177] When running the aforementioned method, this electronic device can also: perform source viability verification and version fingerprint verification before injecting memories into the response context, preventing obsolete memories whose sources have changed, been deleted, or are no longer accessible from being cited as final factual evidence; differentiate candidate memories according to admission levels, ensuring that memories that fail verification cannot serve as final factual evidence; and generate auditable metadata when necessary to support post-event traceability. Thus, this electronic device physically functions as a general-purpose computing device, while functionally implementing source verification and admission control for the agent's long-term memories, reducing the false response rate of the agent system and improving the reliability and traceability of the output results.
[0178] Example 7
[0179] A computer-readable storage medium is illustrated according to an exemplary embodiment for storing a computer program that causes a computer to perform the methods described above.
[0180] It is understood that this embodiment has the same technical effects as the aforementioned method embodiments.
[0181] When executed by a computer, the computer program can also perform the following: perform source viability verification and version fingerprint verification before injecting memories into the response context, preventing obsolete memories whose sources have changed, been deleted, or are no longer accessible from being cited as final factual evidence; determine the admission level based on the viability status, comparison results, and validity type, and differentiate candidate memories according to the admission level, so that memories that fail verification cannot serve as final factual evidence; and generate auditable metadata when necessary to support post-event traceability. Thus, while the storage medium physically functions as a general information carrier, when the computer program stored within it is executed by a computer, it achieves source verification and admission control of the agent's long-term memories, reducing the false response rate of the agent system and improving the reliability and traceability of the output results.
[0182] It should be noted that in the description of this invention, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means at least two.
[0183] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.
[0184] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0185] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0186] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0187] The storage media mentioned above can be read-only memory, disk, or optical disk, etc.
[0188] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0189] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A source verification and admission control method for long-term memory of intelligent agents, characterized in that, include: During the memory writing phase, the factual statement to be precipitated is obtained, the source object on which the factual statement is based is determined, a memory record is generated, and the memory record is written into the long-term memory bank. The long-term memory bank is used to store memory records that can be reused across sessions. The memory record includes at least the text content of the factual statement, source identifier, source location information, source version fingerprint, and validity type. The source identifier is used to uniquely identify the source object, the source location information is used to locate the content corresponding to the factual statement within the source object, the source version fingerprint is used to characterize the content state or version state of the source object at the time of writing, and the validity type is used to characterize the timeliness attribute of the factual statement. During the memory retrieval phase, in response to the current query, a set of candidate memories related to the current query is retrieved from the long-term memory bank; Before injecting candidate memories from the candidate memory set into the answer context, source verification is performed on at least one candidate memory in the candidate memory set. The source verification includes source liveness verification and source version verification: the source liveness verification is performed by accessing the source object based on the source identifier and the source location information to determine the liveness status of the source object; the source version verification is performed by generating a current fingerprint based on the current content status or current version status of the source object, and comparing the current fingerprint with the source version fingerprint to determine whether the content of the source object has changed. The admission level of the candidate memory is determined based on the survival status, comparison results, and validity type of the candidate memory. The admission level is used to characterize whether the candidate memory qualifies as the final fact upon which the generated answer is based; The candidate memories are differentiated according to the admission level to obtain the injection context, and an answer for the current query is generated based on the injection context.
2. The method according to claim 1, characterized in that, The liveness status of the source object includes at least two of the following: the source object exists and the current subject can access it; the source object does not exist; the source object exists but the current subject does not have access rights; the source object is temporarily inaccessible. The method further includes: distinguishing between two liveness states, namely, the absence of the source object and the temporary inaccessibility of the source object, and assigning different access levels to the two; Specifically, in cases where the source object is temporarily inaccessible, the candidate memory is marked as unverified and restricted from being used as the sole factual basis; in cases where the source object does not exist, its injection into the injection context is blocked.
3. The method according to claim 1, characterized in that, The current fingerprint is determined by any of the following methods: Calculate a hash value for the entire content of the source object, and use the calculated hash value as the current fingerprint; or, Calculate the hash value of the content segment located by the source location information in the source object, and use the calculated hash value as the current fingerprint; or, Obtain at least one of the version number, entity tag ETag, last update time or change sequence number of the source object, and use the obtained information as the current fingerprint; or combine the source identifier of the source object with the information to calculate a hash value, and use the calculated hash value as the current fingerprint. Before calculating the hash value, normalization processing is performed on the entire content of the source object or the content fragment. The normalization processing includes at least one of the following: removing whitespace characters and invisible characters, unifying character encoding and newline characters, removing metadata fields unrelated to the content, and sorting the content according to preset rules. The source version fingerprint is determined using the same determination method as the current fingerprint; The source verification is performed in any of the following ways: synchronously after the candidate memory is recalled and before it is injected; pre-verify memory records with a recall frequency higher than a preset threshold, and cache the verification results and the current fingerprint, wherein the cache has an expiration period; in response to a change event of the source object, perform batch verification on memory records based on the source object and update their status.
4. The method according to claim 1, characterized in that, The validity type includes at least two of the following: stable type, used to characterize factual statements that are stable in the long term and do not become invalid with changes in the source object; and time-sensitive type, used to characterize factual statements that are easily invalidated with changes in the source object, including at least one of price, policy, term, and interface parameters. Single-time type is used to characterize factual statements that are valid only in a specific context or within a specific time period; The determination of the admission level of the candidate memory includes at least the following: for time-sensitive candidate memories, they are only qualified as final factual evidence if the survival status is existing and accessible and the comparison result is unchanged; for stable candidate memories, they are downgraded to not being qualified as final factual evidence if the comparison result is changed. The admission levels include at least: a first level, indicating that the candidate memory passes both the source survival verification and the source version verification, and is qualified as the final factual basis; a second level, indicating that the candidate memory passes the source survival verification but fails the source version verification, and is only qualified as a historical clue; and a third level, indicating that the candidate memory fails the source survival verification and is not qualified as the final factual basis. The differential processing of candidate memories according to the admission level includes: for candidate memories of the first level, injecting them into the verified fact area of the injection context and allowing the model to cite them as the final factual basis; for candidate memories of the second level, injecting them into the historical clue area of the injection context and attaching an invalidation mark or a pending confirmation mark, the invalidation mark or pending confirmation mark being used to restrict the model from using them alone as the final factual basis; for candidate memories of the third level, blocking their injection into the injection context, or attaching an unverified mark during injection and restricting them from being the sole factual basis.
5. The method according to claim 1, characterized in that, The memory record also includes a source permission scope identifier, which is used to characterize the subject scope in which the factual statement can be reused, including at least one of tenant, role, and security level; The method further includes: comparing the source permission range identifier with the permission attributes of the current session subject; if the comparison result indicates that the current session subject is not within the subject range, then blocking the injection of the candidate memory, or desensitizing the candidate memory before injection.
6. The method according to claim 1, characterized in that, The method further includes: Obtain the current source content related to the current query; if the current source content conflicts with the factual statement in the candidate memory and the candidate memory fails the source version verification, generate the answer based on the current source content, and update the candidate memory according to the current source content. The update includes at least one of the following: rewriting the text content of the factual statement, regenerating the source version fingerprint, and updating the source location information. When the current fingerprint is inconsistent with the source version fingerprint, the current content in the source object is further obtained based on the source location information, and the current content is compared with the text content of the fact statement. If the comparison result indicates that the two are consistent, the fact statement is determined to be valid, the admission level of the candidate memory is determined to be qualified as the final factual basis, and the source version fingerprint in the candidate memory is updated using the current fingerprint. If the comparison result indicates that the two are inconsistent, the fact statement is determined to be invalid, the admission level of the candidate memory is determined to be qualified only as a historical clue, and the text content of the fact statement is updated based on the current content.
7. The method according to claim 1, characterized in that, After generating the answer to the current query based on the injection context, the method further includes: For at least one conclusion in the answer, associate auditable metadata, which includes the source identifier, source location information, source version fingerprint, verification time, liveness status, comparison result, and access level on which the conclusion is based; The auditable metadata is written to the audit log, which is used to support the retrospective tracing and playback of the basis for the generation of the answer.
8. A source verification and admission control device for long-term memory of intelligent agents, characterized in that, include: The memory writing module is used to acquire the factual statement to be stored, determine the source object on which the factual statement is based, generate a memory record, and write the memory record into a long-term memory bank. The long-term memory bank is used to store memory records that can be reused across sessions. The memory record includes at least the text content of the factual statement, source identifier, source location information, source version fingerprint, and validity type. The source identifier is used to uniquely identify the source object, the source location information is used to locate the content corresponding to the factual statement within the source object, the source version fingerprint is used to characterize the content state or version state of the source object at the time of writing, and the validity type is used to characterize the timeliness attribute of the factual statement. The memory retrieval module is used to retrieve a set of candidate memories related to the current query from the long-term memory bank in response to the current query. The source verification module is used to perform source verification on at least one candidate memory in the candidate memory set before injecting the candidate memory from the candidate memory set into the answer context. The source verification includes source liveness verification and source version verification: the source liveness verification is to access the source object based on the source identifier and the source location information to determine the liveness status of the source object; the source version verification is to generate a current fingerprint based on the current content status or current version status of the source object, and compare the current fingerprint with the source version fingerprint to determine whether the content of the source object has changed. The admission arbitration module is used to determine the admission level of the candidate memory based on the survival status, comparison results, and the validity type of the candidate memory. The admission level is used to characterize whether the candidate memory qualifies as the final fact upon which the generated answer is based; The answer generation module is used to differentiate the candidate memories according to the admission level to obtain the injection context; and to generate an answer for the current query based on the injection context.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory being used to store a computer program, and the processor being used to invoke and run the computer program stored in the memory to perform the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program that causes a computer to perform the method as described in any one of claims 1 to 7.
