MemGuard: Persisting Verifier Signals for LLM-Agent Memory Governance¶
Conference: EMNLP 2026
Paper: ACL Anthology
Code: https://github.com/whyyyyy123/MemGuard
Area: LLM Agent
Keywords: LLM Agent, Memory Governance, Trajectory Verifier, Quality-Aware Retrieval, Failure Guards
TL;DR¶
MemGuard shifts trajectory verification from a one-shot admission filter to persistent lifecycle metadata, attaching reward, confidence, label, and uncertainty descriptors to govern candidate admission, conflict resolution, quality-aware retrieval, and archival across continuous agent streams.
Background & Motivation¶
As large language model (LLM) agents transition from single-prompt executions to extended, continuous task streams, reusable experience memory has become an indispensable mechanism for command-line operations, software repository debugging, and interactive web navigation. Experience memory systems such as Synapse, AWM, and ReasoningBank distill prior trajectories, reflections, or workflows into external banks to assist downstream planning. However, long-running agent deployments consistently encounter two fatal failure modes: unreliable admission and memory drift. Interactive environments routinely yield accidental successes, misleading partial observations, and unexecutable patches that appear superficially relevant; once admitted, they misguide subsequent decisions. Furthermore, as the memory bank grows over hundreds of tasks, it accumulates duplicates, obsolete API hints, and contradictory guidelines that standard semantic retrieval cannot filter or repair.
The core tension underlying these failures is that semantic relevance does not imply factual correctness or operational transferability. A corrupted or accidental action sequence often matches a user query with high embedding cosine similarity. Even when contemporary systems introduce LLM-based verifiers, they treat verification strictly as a one-time gate: candidates are either accepted into an append-only index or permanently discarded, wiping out all nuanced verification signals. Consequently, the memory bank remains an uncurated static store unable to track decaying utility, resolve emergent logical conflicts, or leverage the diagnostic evidence captured during trajectory verification.
This paper's angle of attack is to elevate verifier signals into first-class, persistent metadata across the memory lifecycle. Core idea: decompose trajectory verification into multi-criterion distributions and persistent governance descriptors that continuously direct memory admission, conflict deduplication, quality-aware retrieval weighting, failure-guard constraints, and budgeted archival throughout the agent's task stream.
Method¶
Overall Architecture¶
MemGuard operates over a continuous task stream \(X = \{x_1, \dots, x_T\}\). At task \(x_t\), the system retrieves positive procedural/tool memories and negative failure guards from the existing bank \(M_{t-1}\) to construct a concise context block for the agent. Upon task completion, MemGuard captures the full trajectory \(\tau_t\), final answer \(y_t\), and environment-visible runtime status \(e_t\) (strictly excluding gold evaluator labels). The verifier computes multi-criterion score distributions and triggers multi-view re-verification when uncertainty is high, emitting a persistent descriptor \(d_m = (R_m, c_m, \ell_m, \nu_m)\). The memory induction module extracts structured candidates, which the governance engine then admits, merges, resolves, or archives under a finite budget to yield \(M_t\).
%%{init: {'flowchart': {'rankSpacing': 24, 'nodeSpacing': 28, 'padding': 6, 'wrappingWidth': 400}}}%%
flowchart TD
A["Task Execution and Logged Trajectory"] --> B["Multi-Criterion Scoring and Distribution Estimation"]
B --> C["Boundary Uncertainty and Multi-View Re-Verification"]
C --> D["Persistent Governance Descriptor Binding"]
D --> E["Dual-Path Quality-Aware Retrieval and Failure Guards"]
E --> F["Structured Lifecycle Governance and Budgeted Archival"]
F --> G["Updated Memory Bank"]
Key Designs¶
1. Multi-Criterion Scoring and Distribution Estimation: Decoupling Dimensions over Discrete Token Likelihoods
Standard binary pass/fail verification fails to isolate localized flaws or identify fragile shortcuts in multi-step trajectories. MemGuard decomposes trajectory judgment into four orthogonal criteria: task completion, evidence consistency, execution validity, and generalizability. Crucially, the verifier inspects only the agent's logged actions and visible execution feedback (exit codes, public unit test outputs, console errors, or web alerts), strictly banning hidden gold labels. For each criterion \(j \in \{1, \dots, C\}\) and view \(\rho \in R_t\), the verifier generates discrete score tokens from \(V_{score} = \{1, 2, 3, 4, 5\}\) mapped via \(\phi(v) = (v-1)/4 \in [0, 1]\). By calculating the softmax distribution \(p_\theta(v \mid x_t, j, \tau_t, \rho)\), MemGuard computes the expected reward:
$\(R_t = \sum_{j=1}^C \frac{w_j}{|R_t|} \sum_{\rho \in R_t} \mathbb{E}_{v \sim p_\theta(\cdot \mid x_t, j, \tau_t, \rho)}[\phi(v)]\)$
Modeling verification as an expectation over token distributions captures fine-grained reward boundaries and provides an explicit statistical foundation for downstream uncertainty detection.
2. Boundary Uncertainty and Multi-View Re-Verification: Triggering Targeted Audit Views
Single-view verification often suffers from model hallucinations when inspecting ambiguous web states or complex terminal traces. MemGuard quantifies uncertainty \(u_t = \alpha b_t + (1 - \alpha) s_t\), combining boundary proximity \(b_t\) (evaluating whether reward falls near the band \([\gamma_{low}, \gamma_{high}] = [0.45, 0.65]\)) and dispersion \(s_t\) (criterion and view standard deviations \(d_t^{crit}, d_t^{view}\)). Whenever \(u_t > \eta_{verify} = 0.55\), the trajectory is re-verified under specialized prompt views: an "Evidence View" that strips irrelevant exploration to isolate causal support for the final output, and a "Risk View" that explicitly audits fragile shortcuts, stale DOM states, or invalid commands. This targeted re-verification drastically cuts false accepts before candidate activation.
3. Persistent Governance Descriptor Binding: Unifying Quality Signals across Memory Lifecycles
Prior verification methods discard verifier outputs immediately after filtering, leaving the memory store unaware of historical reliability. MemGuard attaches a persistent governance descriptor \(d_m = (R_m, c_m, \ell_m, \nu_m)\) to each induced record, containing continuous reward \(R_m\), confidence \(c_m\), verifier label \(\ell_m \in \{verified\_success, verified\_fail, uncertain\}\), and verification timestamp \(\nu_m\). Only candidates exceeding activation thresholds (\(R_m \ge 0.70\) and \(c_m \ge 0.60\)) enter active positive retrieval. Low-confidence or failed trajectories are not deleted blindly; instead, they are held in a provisional state or converted into negative failure-guard memories with explicit condition checks, ensuring that verification evidence remains an active steering signal throughout the record's life.
4. Dual-Path Quality-Aware Retrieval and Failure Guards: Disentangling Positive Recipes from Negative Constraints
During context retrieval, standard semantic vector matching frequently recalls irrelevant or risky historical actions. MemGuard constructs two dedicated retrieval paths. The positive path scores procedural and tool memories using \(S^+(x_t, m)\), balancing relevance \(\tilde{r}\), quality \(\tilde{q}\), applicability \(\tilde{p}\), recency \(\tilde{b}_{rec}\), and successful reuse \(\tilde{b}_{use}\), while subtracting penalties for conflict \(\tilde{h}_{cf}\), staleness \(\tilde{h}_{stale}\), and verifier risk \(\tilde{h}_{ver}\). Conversely, the negative path ranks failure guards via \(S^-(x_t, m)\) under strict confidence criteria, penalizing over-generalized rules \(\tilde{h}_{ovr}\). These negative records are injected exclusively as defensive constraints (e.g., "verify row identifier before submitting updates") rather than operational plans, eliminating the risk of imitating prior failures.
5. Structured Lifecycle Governance and Budgeted Archival: Resolving Conflicts and Compacting Memory
As thousands of interactions accumulate, static memory banks degrade through drift and redundancy. MemGuard extracts structured signatures (task pattern, action category, environment scope, applicability condition) to identify logical conflicts between active records:
$\(conflict(m_i, m_j) = \mathbb{I}[sim_{ij} > \tau_{cf}] \cdot \mathbb{I}[act_i \neq act_j \lor \ell_i \neq \ell_j]\)$
When signature similarity exceeds \(\tau_{cf} = 0.72\) but actions or labels diverge, the system applies lexicographic resolution based on verifier labels, reward, confidence, recency, and historical reuse. Furthermore, under finite active budgets (512 for web agents, 384 for coding/terminal agents), repeatedly verified experiences are merged into compressed summaries, while superseded or low-quality items are transitioned to long-term archives.
Memory Governance and Verification Criteria¶
The governance module enforces strict operational boundaries:
1. Pristine Positive Promotion: Records achieve active positive status only when task completion and evidence consistency criteria are simultaneously validated without execution errors.
2. Constraint Formulation for Failures: Negative lessons are strictly classified as failure_avoidance constraints, stripping executable commands to prevent deceptive imitation.
3. Lexicographic Conflict Resolution: In instances of contradictory advice, records with higher verifier confidence, superior evidence backing, and recent successful reuse supersede older or contested entries, guaranteeing clean context injection.
A Worked Example¶
Consider an administrator task in WebArena requiring an agent to update a specific order after filtering a customer table:
1. Erroneous Trajectory Generation: The agent searches for the customer name, immediately clicks the first visible row, and submits modifications. Although the web interface displays an "update saved" banner, the table was actually sorted by recent activity rather than match relevance, modifying an unintended record.
2. Verifier Flagging: The multi-criterion verifier notes that evidence consistency and generalizability are low (scores 3 and 2). It triggers the risk view, which identifies an unvalidated row identity assumption, emitting an uncertain label with an attached guard condition.
3. Memory Induction and Descriptors: The induction engine creates a failure_avoidance record with descriptor \(d_m = (R=0.42, c=0.58, \ell=uncertain)\), placing it in provisional status.
4. Governed Safe Retrieval: In a subsequent task involving order modification, the positive retriever ignores the provisional record, while the failure-guard path injects a defensive constraint: "Do not assume the first row matches search criteria; verify persistent record identifiers prior to submitting updates." The agent verifies the unique order ID before editing, completing the task successfully.
Key Experimental Results¶
Main Results¶
MemGuard was evaluated across four challenging agent benchmarks and four leading model backbones under matched task orders, retrieval limits, and decoding budgets (5 seeds, reported as mean ± standard deviation).
| Model / Method | Terminal-Bench 2.0 (SR ↑ / AS ↓) | SWE-Bench Verified (Resolve Rate ↑ / AS ↓) | WebArena (SR ↑ / AS ↓) | Mind2Web (SSR ↑ / AS ↓) |
|---|---|---|---|---|
| Qwen-3.5-Plus | ||||
| No Memory | 60.8±1.0 / 34.2±1.9 | 76.6±1.3 / 35.0±0.8 | 44.2±0.9 / 9.8±0.4 | 42.3±0.8 / 16.4±0.5 |
| Synapse | 61.4±1.7 / 34.9±2.4 | 77.4±0.7 / 35.6±1.6 | 45.0±1.3 / 9.9±0.5 | 42.9±0.4 / 16.1±0.6 |
| AWM | 60.6±0.8 / 34.6±3.1 | 78.2±1.5 / 34.3±1.1 | 46.5±1.0 / 9.2±0.6 | 43.4±0.9 / 15.9±0.4 |
| ReasoningBank | 64.6±2.1 / 32.1±1.4 | 80.1±0.9 / 32.7±1.5 | 50.5±1.2 / 8.5±0.4 | 46.2±0.7 / 14.8±0.6 |
| Verifier-only Filter | 64.8±1.4 / 32.4±2.8 | 81.9±1.1 / 31.6±0.9 | 52.0±1.5 / 8.4±0.5 | 50.0±1.0 / 11.9±0.5 |
| MemGuard (Ours) | 67.4±1.9 / 30.4±1.7 | 83.6±1.6 / 30.6±1.2 | 58.4±0.8 / 6.9±0.3 | 51.8±0.5 / 11.5±0.4 |
| Gemini-3.1-Pro | ||||
| No Memory | 68.4±0.8 / 30.7±2.7 | 78.2±1.3 / 28.5±1.2 | 56.4±1.0 / 8.1±0.4 | 46.4±0.9 / 14.9±0.6 |
| Synapse | 69.2±1.4 / 31.2±1.6 | 77.8±0.7 / 29.3±1.5 | 57.5±0.8 / 8.0±0.5 | 47.1±0.6 / 14.6±0.4 |
| AWM | 70.1±2.1 / 30.1±2.0 | 79.9±1.1 / 28.0±0.8 | 59.5±1.4 / 7.5±0.3 | 47.6±1.1 / 14.3±0.5 |
| ReasoningBank | 73.0±1.0 / 28.8±1.3 | 82.2±1.6 / 26.8±1.7 | 63.1±0.9 / 7.0±0.4 | 50.2±0.7 / 13.2±0.6 |
| Verifier-only Filter | 73.2±1.8 / 28.9±3.1 | 83.3±0.9 / 26.2±1.0 | 67.8±1.2 / 6.1±0.6 | 51.0±0.5 / 11.0±0.4 |
| MemGuard (Ours) | 75.7±1.3 / 27.3±2.5 | 85.3±1.2 / 25.4±1.4 | 69.1±1.5 / 5.9±0.3 | 55.5±1.0 / 10.4±0.5 |
Ablation Study¶
Component-level ablations on Qwen-3.5-Plus across all four benchmark environments (reported as Primary Success Metric / Average Steps AS):
| Variant | Terminal-Bench 2.0 (SR / AS) | SWE-Bench Verified (Resolve Rate / AS) | WebArena (SR / AS) | Mind2Web (SSR / AS) | Impact Summary |
|---|---|---|---|---|---|
| Full MemGuard | 67.4 / 30.4 | 83.6 / 30.6 | 58.4 / 6.9 | 51.8 / 11.5 | Complete proposed framework |
| w/o Adm. (No Admission) | 64.4 / 32.0 | 80.9 / 32.5 | 52.8 / 8.0 | 48.0 / 13.1 | Unchecked entry of unverified noise drops success rate |
| w/o Rep. (No Multi-View) | 65.3 / 31.5 | 81.5 / 31.7 | 55.6 / 7.4 | 50.0 / 12.2 | False accepts leak past single-perspective checks |
| w/o Gov. (No Governance) | 63.7 / 32.6 | 79.8 / 33.0 | 52.0 / 8.5 | 46.8 / 13.8 | Largest single drop; unmitigated memory drift and conflicts |
| w/o Fail. (No Failure Guards) | 66.1 / 31.4 | 82.2 / 31.5 | 56.5 / 7.8 | 50.7 / 12.8 | Eliminating negative checks spikes exploration steps (AS) |
| Sem. Ret. (Semantic-Only) | 63.4 / 32.9 | 79.4 / 33.2 | 50.1 / 8.8 | 45.8 / 14.1 | Standard dense retrieval fails to filter low-quality memories |
Key Findings¶
- Lifecycle Governance Drives the Largest Gains: Removing lifecycle governance (w/o Gov.) results in the most severe degradation across all benchmarks (a 6.4 point drop on WebArena and 5.0 points on Mind2Web), outstripping the loss from disabling admission filtering alone. This demonstrates that continuous reconciliation of conflicts, merging of duplicates, and pruning stale records is more critical for long streams than initial gatekeeping.
- Lower Deployment Cost through Action Reduction: Although verifier scoring and governance calls introduce 4.0k–5.8k extra tokens per task, MemGuard reduces overall task latency by 6.5s–19.0s and total tokens by 3.0k–8.4k compared to ReasoningBank. High-precision memory retrieval eliminates agent missteps, shrinking average interaction steps (AS) across every tested environment.
- Robustness Against Label Noise: Under simulated 30% random verifier label corruption, MemGuard experiences 0.3–2.6 fewer points of metric drop compared to the Verifier-only Filter. Confidence-weighted retrieval, provisional states, and structured conflict resolution buffer the memory store against corrupt verification signals.
Highlights & Insights¶
- From Disposable Gates to Enduring Meta-Assets: Prior methods discard verifier outputs immediately after candidate filtering. MemGuard transforms these evaluations into persistent descriptors that continue to guide conflict resolution and retrieval ranking across thousands of steps.
- Constrained Representation of Negative Experience: Rather than distilling failed trajectories into misleading procedural recipes, MemGuard formats them as explicit verification pre-conditions, mitigating repeated mistakes while preventing erroneous imitation.
- Cross-Family Verification Portability: Evaluations pairing Qwen agents with Gemini verifiers (and vice versa) preserve the full performance advantage over prior memory baselines, proving that governance benefits are model-agnostic and robust to architectural shifts.
Limitations & Future Work¶
- Author-Acknowledged Limitations: The framework focuses on operational correctness and does not incorporate automated detection, redacting, or auditing mechanisms for sensitive user data, credentials, or privacy leaks. Furthermore, fixed admission and conflict thresholds, while robust across the evaluated benchmarks, may require recalibration in unconstrained production environments.
- Deeper Critical Reflection: MemGuard manages an external non-parametric store; it cannot repair fundamental gaps in an agent's base reasoning or tool competencies. Additionally, during massive task streams exceeding several thousand tasks, automated summarization may induce lossy compression errors that warrant further investigation.
- Future Directions: Key extensions include adapting governance descriptors to embodied multimodal (VLM) agents, deploying adaptive forgetting schedules, and designing shared memory governance frameworks for heterogeneous multi-agent swarms.
Related Work & Insights¶
- vs ReasoningBank (Ouyang et al., 2025): ReasoningBank abstracts trajectories into reasoning memories with minimal consolidation. MemGuard introduces multi-criterion distribution modeling, persistent metadata, active conflict resolution, and budgeted lifecycle pruning, effectively preventing memory drift over extended streams.
- vs Verifier-only Filter (Kwok et al., 2026): LLM-as-a-Verifier applies multi-view verification as an isolated, single-turn ranking tool. MemGuard establishes that persisting these verification outputs across long-term storage yields substantial additional gains (e.g., +6.4 SR on WebArena).
- vs Synapse & AWM (Zheng et al., 2024; Wang et al., 2025b): Synapse and AWM employ append-only trajectory indexing or workflow-level induction without systematic conflict resolution or negative constraint extraction. MemGuard outperforms both baselines across all 16 benchmark-backbone configurations.
Rating¶
- Novelty: ⭐⭐⭐⭐⭐ Pioneering framework establishing trajectory verification as persistent lifecycle metadata for agent memory governance.
- Experimental Thoroughness: ⭐⭐⭐⭐⭐ Rigorous evaluation over 4 benchmarks, 4 backbones, 5 random seeds, and a 2,294-issue SWE-bench stream with comprehensive noise stress-tests.
- Writing Quality: ⭐⭐⭐⭐⭐ Impeccable mathematical formulation, clear conceptual taxonomy, and precise alignment between pipeline diagrams and algorithmic designs.
- Value: ⭐⭐⭐⭐⭐ Delivers an essential, production-ready blueprint for maintaining reliable long-term memory in autonomous LLM agents.