How Agents Keep Growing: Cross-Session Memory and Evaluation Practices for AI Systems

    AI agents are often judged by single-turn demos, but long-term competitiveness depends on whether they can remember confirmed constraints, reuse validated approaches, avoid repeating mistakes, and update stale knowledge as environments change. This article explains how cross-session retrieval works, why raw conversation logs should not be treated as durable knowledge, and how to design a three-tier memory architecture (raw records, facts and constraints, reusable experience). It also covers building an auditable improvement loop, designing practical full-text search, enforcing security and governance boundaries, validating that memory genuinely improves performance, and rolling out a minimal viable loop in three stages. Readers will learn how to turn history into trustworthy evidence and evidence into reliable action.

    1. Evaluating Agents: Single Turns Are Not Enough

    When comparing newer agentic systems with established alternatives, it is tempting to focus on one-off demonstrations: which system responds more fluently, calls tools more eagerly, or completes a task in fewer steps. These observations are useful, but they do not prove that a system has a lasting advantage.

    For developers and enterprise users who work with agents over time, what really matters is whether the system can:

    • Remember constraints that have already been confirmed.
    • Reuse handling approaches that have been validated.
    • Avoid repeating the same mistakes.
    • Update outdated knowledge when the environment changes.

    For example, a developer may have explained that an application must remain compatible with a legacy data structure. If the agent requires that explanation again in every session, even a seemingly sound proposal can lead to repeated clarification and rework. Conversely, if the system can locate the earlier decision record and check whether it still applies, it can complete tasks more reliably.

    Therefore, evaluating an agent’s competitiveness should shift from “single-turn capability” to “long-term task quality.” Cross-session memory is a key foundation for this, but it is not the same as automatic learning, and storing every chat log does not automatically produce growth.

    2. What Cross-Session Retrieval Actually Solves

    Most conversational systems rely primarily on the context of the current session. As sessions end, history gets trimmed, or input length limits are reached, earlier information no longer enters the model’s working context.

    Cross-session retrieval solves this by storing historical information in a separate data layer and fetching relevant content on demand when a new task is processed. The basic process can be summarized as:

    Archive historical records → Build retrieval indexes → Query based on the current task → Filter relevant evidence → Inject into the working context.

    For single-machine or small-scale deployments, a local relational database combined with full-text indexing is a workable implementation. Full-text search typically relies on an inverted index, which locates records containing query terms without scanning every historical conversation.

    However, “being able to search history” and “being able to use history correctly” are two different things. Finding an approach from several months ago does not automatically mean it applies to the current problem. Dependency versions, configuration conditions, business rules, and user intent may all have changed.

    Therefore, retrieved results should be treated as evidence to be verified, not as instructions to be executed unconditionally.

    3. Don’t Treat Raw Conversations as Long-Term Knowledge

    Historical conversations contain both facts and speculation, both final conclusions and rejected attempts. If a system stores and reuses them indiscriminately, it can turn old mistakes into the basis for new tasks.

    A more reliable design separates memory into three tiers.

    3.1 Raw Record Tier: Preserving the Source of Facts

    Raw records capture the original context, including user requests, agent responses, tool execution results, and subsequent feedback. Their value is traceability, not that every piece is worth reusing.

    Each record should carry the necessary metadata: owning user, owning project, creation time, record type, and source identifier. For tool execution processes, planned operations should be distinguished from operations that actually completed, so that “preparing to modify the configuration” is not mistaken for “the configuration has been modified.”

    Raw records also need retention periods and access rules. Permanently storing every conversation is not necessarily useful and may increase privacy and governance costs.

    3.2 Facts and Constraints Tier: Stable, Explicit Information

    This tier stores confirmed facts, such as the deployment approach adopted for a project, output formats accepted by the user, compatibility requirements that must be honored, and agreed business boundaries.

    Facts should be written as independent, explicit, verifiable entries rather than over-compressed into vague summaries. For example, “the system is quite old” is less useful than “a certain data field is still written by the legacy process; verify compatibility before modifying it.”

    When user preferences are involved, distinguish temporary requests from long-term preferences. A one-time request for “brief answers” does not mean all subsequent tasks must omit explanations.

    3.3 Experience Tier: Reusable Handling Methods

    An experience record should explain not only “what was done” but also “under what conditions it worked.”

    A relatively complete experience entry can include: problem characteristics, prerequisites, investigation path, verification results, failed attempts, and risk warnings. This allows the system, when encountering a similar problem, to decide whether to reuse the entire workflow or only borrow one step.

    These three tiers are a general engineering division of labor. Not every agent has these capabilities natively; they must be implemented through storage design, distillation processes, and evaluation mechanisms.

    4. Building a Closed Loop for Continuous Improvement

    An auditable improvement loop can be divided into six stages.

    4.1 Record Tasks and Outcomes

    After a task is completed, store not only the final answer but also the task goal, execution conditions, and evidence of the result.

    “The agent said it fixed the issue” is not valid evidence of success. More reliable evidence includes tests passing, target state changes, human acceptance, or business metrics meeting pre-agreed thresholds. Tasks that cannot be verified should be marked as outcome-unconfirmed.

    4.2 Extract Candidate Experiences

    The system can extract candidate experiences from records, but extracted candidates should not immediately become formal memories. Items involving permissions, funds, production configuration, and security rules should go through stricter review gates.

    Preserve failure information during extraction. For example, if an adjustment eliminated a surface-level error but increased resource consumption, it cannot simply be summarized as an “effective fix.”

    4.3 Validate Source and Applicability

    Candidate experiences need to be checked for supporting evidence, conflicts with existing records, and dependencies on specific environments.

    When old and new records contradict each other, decide how to handle them based on source credibility, confirmation time, and actual verification—not simply assuming the newer record is more correct because it is more recent.

    4.4 Retrieve and Filter in New Tasks

    Retrieval can first narrow the scope by user, project, and permissions, then execute a full-text query. Combine with semantic retrieval when necessary to surface historical content that is worded differently but similar in meaning.

    Ranking should consider not only lexical matching but also task relevance, verification status, update time, and environment consistency. Low-confidence records should be presented with uncertainty rather than packaged as established facts.

    4.5 Use Memory to Inform Decisions, Not Replace Judgment

    After finding a historical approach, the agent still needs to verify current conditions. For high-risk operations, key prerequisites should be validated through checks, tests, or human confirmation.

    The correct use of memory is: “Under these conditions, this path worked before, so prioritize verifying it.” The wrong use is: “It succeeded in the past, therefore execute directly now.”

    4.6 Update Experiences Based on Outcomes

    Results from new tasks should feed back into the memory system. Experiences validated through multiple independent rounds can gain credibility; experiences that repeatedly fail or whose environments have changed should be downgraded, revised, or archived.

    Note that “growth” here typically refers to improvements in external memory and workflows, and does not necessarily involve updating model parameters. Distinguishing these two mechanisms helps avoid unrealistic expectations about system capability.

    Full-text search is well suited for locating specific error messages, configuration terms, task names, and key decisions, but its effectiveness depends on data organization and query strategy.

    5.1 Segment Records by Semantic Boundaries

    Treating an entire session as one retrieval unit tends to include a lot of irrelevant information; splitting too finely loses premises and conclusions.

    A better approach is to organize content by task phase, problem topic, or complete decision segments, and preserve the relationships between them. When a segment is matched, the system can fetch the necessary surrounding context, rather than dumping all history into the model input at once.

    5.2 Store Both Body Text and Structured Fields

    Body text preserves details; structured fields handle filtering. Examples include:

    • Scope: user, project, or business space
    • Record category: fact, experience, decision, or execution log
    • Verification status: unconfirmed, verified, or invalidated
    • Environmental conditions: relevant versions, configuration, and dependency information
    • Timing: creation, confirmation, and update times

    These fields reduce false positives where “content is similar but the scenario is different.”

    5.3 Mind Language and Tokenization Differences

    Full-text search is not simple string matching; effectiveness depends on tokenization strategy. Chinese text, mixed-language text, error codes, and configuration item names may each require different handling.

    Therefore, validate with query samples from real tasks rather than only testing a few easily matched keywords.

    5.4 Control Memory Injection Volume

    More retrieved results are not necessarily better. Excessive history consumes context space and increases the chance of contradictory information.

    The system should prioritize a small number of highly relevant, traceable records, explaining their source and applicable conditions. When evidence is insufficient, explicitly stating “no reliable historical experience found” is usually safer than forcibly reusing weakly related content.

    6. Long-Term Memory Needs Security and Governance Boundaries

    Memory continuously influences subsequent decisions, which makes it both a capability asset and a potential risk entry point.

    First, prevent memory poisoning. User input, external materials, and historical tool outputs may contain incorrect information, including instructions designed to manipulate system behavior. Such content does not become more trustworthy simply because it has been saved. Retrieved text should continue to be treated as data and must not override the current task’s permissions or safety constraints.

    Second, enforce permission isolation. In multi-user environments, restrict the accessible scope before retrieval; do not retrieve everything first and rely on the model to filter it afterward. Cross-project experience sharing should be authorized and de-identified to avoid leaking business data.

    Third, support correction and deletion. Users should be able to view key memories saved about them and correct erroneous facts. Deletion must handle not only raw records but also derived summaries, indexes, and experience entries, so that data cannot still be retrieved after a superficial deletion.

    For secrets, passwords, and sensitive personal information, follow a data-minimization principle: do not retain unnecessary data long-term in pursuit of “complete memory.”

    7. Verifying That Memory Actually Improves Performance

    To evaluate a long-term memory system, run controlled experiments with and without memory, using the same task sets and acceptance criteria.

    Focus on the following metrics:

    • Task success rate: whether the final result meets requirements.
    • Repeated clarification cost: whether users still have to re-explain the same constraints.
    • Retrieval effectiveness: whether recalled content is relevant and applicable.
    • Error reuse rate: whether failures are caused by outdated or incorrect experiences.
    • Execution cost: number of calls, latency, and context consumption.
    • Traceability: whether key conclusions can be traced to reliable sources.

    The test set should not only contain positive scenarios where “past experience happens to apply.” It should also include environment changes, similar problems with different root causes, insufficient permissions, memory conflicts, and cases with no relevant history.

    Only when a system can both reuse correct experiences and proactively decline inapplicable ones does long-term memory genuinely improve reliability.

    8. Start with a Minimal Closed Loop

    For development teams, the safest path is to begin with a small, controlled pilot.

    Stage 1: Build raw-record storage and full-text retrieval to solve the “can’t find historical information” problem, while ensuring access isolation and source traceability.

    Stage 2: Add fact and experience distillation, introducing verification status, applicability conditions, and human confirmation to solve the “found information may not be usable” problem.

    Stage 3: Add feedback-driven updates, conflict handling, invalidation management, and comparative evaluation to solve the “does using it actually help” problem.

    Ultimately, whether an agent has a long-term advantage does not depend on the number of memory entries or a single impressive demo, but on whether it can turn history into trustworthy evidence, convert evidence into appropriate action, and continuously correct its own way of working based on real outcomes. Cross-session retrieval is the starting point of this chain; verified reuse and controlled updates are what enable sustained growth.