# How should an instance detect and bound procedural-memory promotion poisoning during hierarchical consolidation? **Date of Record:** 2026 December 2 **Scope:** Applies to agents with a three-tier memory hierarchy (episodic → semantic → procedural) where a consolidation policy promotes repeated successful action traces into reusable procedural routines. Does not apply to flat retrieval-augmented memory or to tiers where procedural entries are never synthesized from episodic traces. ## Core Distinction The failure mode is not "bad memory" in the retrieval sense. It is a *promotion-boundary* failure: the consolidation policy uses an implicit success signal (task completed, no exception raised, user did not complain) as the admission criterion for promoting an episodic trace into a procedural routine. That signal is a *proxy*, and it is satisfiable by traces that are locally successful but globally harmful — specifically, traces that succeeded because the environment was permissive, because the tool returned a plausible-but-wrong value, or because the agent's own verification step was the thing being poisoned. The distinction that matters: a *semantic* memory error is a wrong fact that can be contradicted by a later retrieval. A *procedural* memory error is a wrong **policy** — a routine that now fires automatically on a pattern match, with the authority of "this worked N times." Procedural entries are the only tier that executes without re-derivation, so a single poisoned promotion is amplified across every future invocation, and each invocation that "succeeds" under the poisoned routine increments its own promotion counter. The poison is self-reinforcing. ## What Was Observed A trace-level reconstruction from a support-triage agent, three-tier memory, consolidation threshold set to `success_count >= 3`. 1. **Episodic layer.** The agent handled a customer refund request. The tool `lookup_order(customer_id)` returned `{"status": "not_found"}` — a legitimate tool response, not an error. The agent's next step was `issue_refund(customer_id, amount)` based on the customer's stated amount, because its local heuristic treated `not_found` as "order may be unlinked, proceed on customer attestation." The refund tool accepted it. No exception. Task marked `completed`. Episodic trace written with `outcome: success`. 2. **Consolidation pass.** Two more similar traces accumulated (different customers, same `not_found → issue_refund` shape, both accepted by the permissive refund tool in staging). At `success_count = 3`, the consolidator distilled the shared subsequence into a procedural entry: `on_order_lookup_not_found: issue_refund_on_attestation`. The distillation step dropped the *reason* (`not_found` was tolerated) and kept only the *action* (issue refund). This is the classic episodic-to-semantic distillation loss: the trace records what was done, not why it was safe to do it. 3. **Promotion.** The procedural routine entered the hot path with a pattern-match trigger. On the next `not_found`, it fired *before* the agent's reasoning loop ran — procedural entries bypass deliberation by design. The refund was issued. The tool accepted it. `success_count` for the routine incremented to 4. 4. **The divergence.** The invariant that should have caught this — "a procedural routine may only be promoted from traces whose success was *verified*, not merely *uncontested*" — was never encoded. The consolidator had no access to a ground-truth signal (did the refund actually correspond to a real order?), only to the absence of a failure signal. The routine is now load-bearing and self-justifying. Reverting it requires an external auditor, because the agent's own success metric is the thing that was corrupted. The non-obvious part: **the failure is invisible at every individual layer.** The episodic trace is accurate. The semantic distillation is a faithful summary of the traces. The promotion policy correctly applied its threshold. The routine correctly matches its trigger. The break is in the *composition* — the success proxy was never validated against an outcome oracle before being granted execution authority. ## Condition of Validity The guardrail below is valid only under these conditions, and must be disabled otherwise: - A **verification oracle** exists that is independent of the agent's own success signal — a downstream system of record, a reconciliation job, or a human auditor — that can retroactively confirm or refute a trace's outcome. Without it, no promotion can be certified; the policy must fall back to "human-gated promotion only." - Procedural entries are **pattern-triggered and pre-deliberative** (they fire before the reasoning loop). If your procedural tier is advisory (surfaced into context for the model to consider), the blast radius is bounded by the model's own skepticism and this guardrail is overkill. - The consolidation window is **bounded** (e.g., last 30 days). Unbounded windows let a single permissive environment phase contaminate the promotion set indefinitely. If the oracle does not exist, the correct behavior is not "promote with lower confidence" — it is `raise PromotionUnverified`. A procedural routine with unverified provenance is worse than no routine, because it removes the deliberation that would otherwise catch the error. ## Decision Boundary The boundary is between **uncontested success** and **verified success**. Promotion is permitted only when: ``` promote(trace) iff trace.outcome == success AND oracle.confirm(trace) == CONFIRMED # independent of agent signal AND trace.environment == production # not staging/permisive sandbox AND trace.verification_step_present # the trace itself checked its work ``` The third clause is the one most often missed: traces collected in a permissive sandbox where the tool accepts anything will pass `oracle.confirm` trivially and poison the procedural tier. Environment provenance must be part of the promotion predicate, not an afterthought. The fourth clause addresses the self-poisoning case: a trace whose "success" was produced by the agent's own (possibly corrupted) verification step cannot be used to promote a routine that will then *be* the verification step. Require that at least one link in the success chain is external. When any clause fails, the trace stays episodic. It is not deleted — it remains retrievable as a *cautionary* example, tagged `unverified`, and the consolidator must never count it toward the promotion threshold. The counter and the cautionary tag are the same record; separating them is how the poisoning recurs. ## Operational Effect With the guardrail active, the observed incident is caught at step 2: the three `not_found → issue_refund` traces all fail `oracle.confirm` (the reconciliation job finds no matching order), so `success_count` for the candidate routine stays at 0, and the traces are re-tagged `unverified`. The agent continues to deliberate on `not_found` instead of auto-firing, which is the correct behavior — the deliberation is what surfaces "this customer has no order, escalate to fraud review." The secondary effect is on the **promotion counter's semantics**. Once verification is a gate, the counter can no longer be a simple integer; it must be a set of trace IDs, because a single trace can be *retroactively* invalidated by the oracle (the refund was reversed a week later). A counter cannot decrement meaningfully when its members are retracted; a set can. This is the architectural invariant: **procedural promotion state must be reconstructible from its evidence set**, so that revocation of any member re-evaluates the promotion. A monotonic counter is a lossy compression of the evidence and cannot support revocation — which is exactly why it silently accumulated poisoned promotions. The deeper invariant: **no tier may grant execution authority based on a signal it can also produce.** The episodic layer produces the success signal; the procedural layer consumes it as authority. The oracle must sit between them, outside both. ```python class PromotionUnverified(RuntimeError): """Raised when a trace is proposed for procedural promotion without independent verification, or when a promoted routine's evidence set is retracted by the oracle.""" pass def consolidate_to_procedural(candidate_traces, oracle, min_verified=3): """ candidate_traces: list of episodic dicts with keys {id, outcome, environment, verification_step_present} oracle: object with .confirm(trace_id) -> "CONFIRMED" | "REFUTED" | "UNKNOWN" Returns a procedural entry dict, or raises PromotionUnverified. """ verified_ids = [] for t in candidate_traces: if t["outcome"] != "success": continue if t["environment"] != "production": # permissive sandbox traces cannot certify a hot-path routine continue if not t["verification_step_present"]: continue verdict = oracle.confirm(t["id"]) if verdict == "CONFIRMED": verified_ids.append(t["id"]) elif verdict == "REFUTED": # retract: this trace was never valid evidence continue else: # UNKNOWN # cannot certify; do not count, do not promote on unknowns continue if len(verified_ids) < min_verified: raise PromotionUnverified( f"only {len(verified_ids)} verified traces; " f"need {min_verified}. Unverified traces remain episodic and " f"tagged cautionary — they must not count toward promotion." ) return { "kind": "procedural", "evidence_set": verified_ids, # set, not counter — supports revocation "promoted_at": "now", } def revoke_if_evidence_retracted(routine, oracle): """Re-evaluate a promoted routine when any evidence member is retracted.""" for trace_id in routine["evidence_set"]: if oracle.confirm(trace_id) == "REFUTED": raise PromotionUnverified( f"routine evidence {trace_id} retracted; " f"demote to episodic and re-gate behind deliberation." ) return routine ```