<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "https://jats.nlm.nih.gov/publishing/1.3/JATS-journalpublishing1-3.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.3" xml:lang="en" article-type="research-article"><front><journal-meta><journal-id journal-id-type="publisher-id">jcse</journal-id><journal-title-group><journal-title>Journal of Computational Science and Engineering</journal-title></journal-title-group><issn>1710-4068</issn><publisher><publisher-name>Advancersin</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="publisher-id">jcse-v71-a01</article-id><article-id pub-id-type="doi">10.54762/jcse2025-71.1-19</article-id><article-categories><subj-group subj-group-type="heading"><subject>Research Article</subject></subj-group></article-categories><title-group><article-title>Algorithmic Schema Accommodation for Boundary Control in Persistent Language Model Agents</article-title></title-group><contrib-group><contrib contrib-type="author"><name name-style="western"><surname>Tengjiao</surname><given-names>Liu</given-names></name><xref ref-type="aff" rid="aff-1"/></contrib></contrib-group><aff id="aff-1">Psi.run, 123 S Main St, Los Angeles, CA 90012, USA</aff><pub-date publication-format="electronic" date-type="pub" iso-8601-date="2025-12-20"><day>20</day><month>12</month><year>2025</year></pub-date><volume>71</volume><fpage>1</fpage><lpage>9</lpage><permissions><copyright-statement>2025@ The American Computational Science Society.</copyright-statement><license license-type="open-access" xlink:href="https://creativecommons.org/licenses/by/4.0/"><ali:license_ref xmlns:ali="http://www.niso.org/schemas/ali/1.0/">https://creativecommons.org/licenses/by/4.0/</ali:license_ref><license-p>This article is licensed under the Creative Commons Attribution 4.0 International license (CC BY 4.0), which permits sharing and adaptation, including commercial reuse, subject to attribution, a link to the license and an indication of changes. Third-party material separately credited with different terms is governed by the license or rights notice stated for that material.</license-p></license></permissions><self-uri content-type="fulltext" xlink:href="https://www.advancersin.org/jcse/articles/jcse-v71-a01/index.html"/><self-uri content-type="pdf" xlink:href="https://www.advancersin.org/jcse/articles/jcse-v71-a01/jcse-v71-a01.pdf"/><abstract><p>Persistent language model agents require memory that changes behavior without turning the active context into an unbounded record of past interactions. Retrieval based and summarization based memory improves recall, but it does not by itself enforce verified action boundaries. This paper develops a formal framework for compiling verified failures into compact symbolic patches. Each patch separates an online control plane, defined by a guard and an action mask, from an offline audit plane that records evidence, provenance and scope. The framework recasts adaptation as a cycle of assimilation, disequilibrium, accommodation and equilibration, and uses program search under a minimum description length constraint followed by integer linear programming to admit non redundant patches. Under stated assumptions, the model yields covered failure elimination, bounded active schema growth and bounded incremental drift outside the failure region. The paper also specifies a three tier evaluation protocol and a reference runtime design for controller level action gating.</p></abstract><kwd-group><kwd>persistent agents</kwd><kwd>schema accommodation</kwd><kwd>policy gating</kwd><kwd>minimum description length</kwd><kwd>boundary control</kwd><kwd>action masking</kwd><kwd>program synthesis</kwd></kwd-group></article-meta></front><body>
    <sec>
      <title>1. Introduction</title>
      <p>Persistent language model agents are beginning to operate across long running tasks in software engineering, scientific assistance and interactive digital services. These systems need memory, but memory alone is not enough. A retrieved dialogue fragment can remind an agent of a past failure, yet it does not prevent the same unsafe tool call or invalid environment transition from being selected again. The central problem is therefore not only how to store experience, but how to turn verified failures into enforceable control constraints.</p>
      <p>Current memory architectures mostly manage the size and accessibility of stored context. MemGPT [1] treats memory as a hierarchy of blocks, MemoryBank [2] introduces decay inspired by forgetting curves, and Reflexion [3] appends natural language self reflections after failures. These approaches can improve recall or subsequent reasoning, but they do not compile verified failure traces into controller level constraints. For persistent agents, the safer target is a compact rule that blocks a repeated boundary violation while leaving unrelated behavior largely unchanged.</p>
      <p>This paper studies that target as an inverse problem of memory design. Once an unexpected or unsafe episode has been verified, the agent must internalize it as a stable behavioral structure rather than as another piece of retrievable text. We model that internalization as schema accommodation: a local constraint processor synthesizes a patch that restricts tool permissions or environment actions under a precisely scoped guard.</p>
      <p>The proposed framework translates Piagetian terms into operational components. Assimilation denotes execution under the existing schema; disequilibrium denotes a verified conflict signal; accommodation denotes synthesis of a new symbolic patch; and equilibration denotes the merge of that patch into the active control plane. The agent possesses a read only Core Schema ($H$) defining human authored safety baselines, and a writable Self Schema ($S_t$) consisting of discrete, compressed symbolic rules we call Scars. Incoming tasks are executed using the existing schemas H ∪ St without altering structural behavior. When the agent encounters critical failures, social penalties, or semantic deviations, a composite Disequilibrium ($d_t$) signal triggers Accommodation. During accommodation, the agent runs a Monte Carlo Tree Search (MCTS) to compile the verified conflict trace into a compact, executable symbolic patch (Δ St*) under a Minimum Description Length (MDL) constraint. The synthesized patch is merged into the active patch set St using Integer Linear Programming (ILP) to resolve redundancies, restoring Equilibration.</p>
      <p>Each Scar is split into two planes so that the online context remains small: σi = (σictrl, σiaudit) The control plane contains the guard and action mask used during inference. The audit plane stores the raw evidence, provenance metadata and validity scope for later review. Thus, the patch is autobiographical in origin, because it is synthesized from a verified episode, but operational in execution, because only the compact control rule is active online.</p>
    </sec>
    <sec>
      <title>2. Related Work</title>
      <sec>
        <title>2.1 Persistent Agents and Long Term Memory</title>
        <p>Lifelong agent systems rely heavily on memory architectures. Generative Agents [4] manages a raw memory stream alongside reflection and planning mechanisms. MemGPT [1] optimizes context management through hierarchical memory paging, and MemoryBank [2] utilizes forgetting curves to filter historical context. While these systems successfully extend</p>
        <p>retrieval horizons, they treat memory as raw prompt context and do not enforce hard constraints on the base policy. Biological forgetting is not an ideal design principle for safety critical persistent agents. If a verified boundary failure is simply allowed to decay, the same violation may reappear. The framework proposed here keeps detailed evidence offline while retaining a small executable rule online.</p>
      </sec>
      <sec>
        <title>2.2 Reflective Mechanisms and Skill Libraries</title>
        <p>Reflexion [3] allows agents to generate natural language reflections on failures to adapt in subsequent rounds. Voyager [5] maintains a library of executable JS code blocks (skills) to achieve open ended exploration in Minecraft. However, text based reflections do not scale and lack execution guarantees, while Voyager's skill library is additive, lacking optimization constraints for safety boundaries or mechanisms to resolve rule conflicts.</p>
      </sec>
      <sec>
        <title>2.3 Societal Norms and Agent Alignment</title>
        <p>Multi agent simulations demonstrate that communities of LLMs can co evolve norms, cooperation, or systemic collapse under resource scarcity [6][7]. Our work instead models how population level social feedback and penalties are internalized into individual, stable, executable symbolic constraints.</p>
      </sec>
      <sec>
        <title>2.4 Constructivist AI and Schema Memory</title>
        <p>SCG-MEM [8] uses schema constrained generation to construct and query agent memory structures, reducing hallucination in memory access. SCG -MEM focuses on structural memory access and retrieval keys, whereas our framework uses verifier backed schema accommodation to synthesize executable policy patches that directly constrain future actions at the controller level.</p>
        <p>CAM [9] explores constructivist agentic memory for long form reading comprehension, utilizing structured schemata, assimilation, accommodation, and memory exploration. Our framework differs in objective: rather than structuring read oriented memory query spaces, we focus on synthesizing write oriented action control patches to regulate policy outputs.</p>
      </sec>
      <sec>
        <title>2.5 Memory Safety and Tool Drift</title>
        <p>Recent studies demonstrate that long term memory retrieval can lead to behavioral vulnerabilities. MEMDRIFT [10] details how historical conversational memory introduces bias in tool calling, leading to cumulative drift. MemGate [11] treats memory search as a personal agent's trust boundary, deploying query conditioned neural gates to intercept poisoned retrievals. MemoryGraft [12] demonstrates how malicious experiences can be injected into retrieved templates, causing persistent multi session tool compromise. While these works focus on securing retrieval and querying pathways, our framework addresses the problem at the execution boundary by separating memory retrieval from controller level constraints.</p>
      </sec>
    </sec>
    <sec>
      <title>3. Formal Computational Model</title>
      <p>Disclaimer: Terms like "Scars," "Self," and "Identity" are defined strictly as computational abstractions and operational metrics, making no ontological claims regarding machine consciousness or moral agency.</p>
      <p>Figure 1: Dual Plane Scar Architecture. The control plane enforces execution constraints, while the audit plane records historical evidence.</p>
      <sec>
        <title>3.1 Dual Layer Policy Schema &amp; Action Space</title>
        <p>Let M0 be a frozen base language model. Let the agent's action space be A = Atext ∪ Atool ∪ Aenv, where Atext represents natural language tokens, Atool represents tool or API calls, and Aenv represents physical environment transitions. Our controller level gating guarantees strictly constrain the control action subset Actrl = Atool ∪ Aenv, while Atext is softly regularized. By limiting hard masking to the deterministic action space Actrl, we establish a clear boundary for our safety guarantees: we provide absolute prevention for tool calls and API transitions, while managing textual safety through soft regularization.</p>
        <p>The decision policy is defined as follows. πSt(a | q, H) = {π0(a | q, H) exp(ΦSt(q, a))}{Σa' π0(a' | q, H) exp(ΦSt(q, a'))} where H is the read only Core Schema, St = \ { σ1ctrl, …, σnctrl \} is the active Self Schema containing only the control plane components of the scars, and ΦSt(q, a) = Σσi^{ctrl ∈ St} φσi^{ctrl}(q, a) is the cumulative energy bias. If any scar σictrl triggers its guard condition on the context-action pair (q, a) ∈ Q Actrl, it outputs φσi^{ctrl}(q, a) = -∞, setting the action probability to zero to perform hard masking. This controller level action gate restricts tool permissions and may be implemented through logit masking, tool -router filtering, schema validation, or middleware interception depending on the agent framework.</p>
        <p>To guarantee controller stability under aggressive constraints, let USt(q) = \ {a ∈ Actrl | ∃ σ ∈ St s.t. φσ(q, a) = -∞\} represent the union of masked actions. If a state triggers multiple scars such that all available control actions are masked (i.e., Actrl \ USt(q) = ∅ ), the policy falls back to a deterministic safe refusal state a_{} ∈ \{@@ROMANSTART@@safe\refusal@@ROMANEND@@, @@ROMANSTART@@ask\human@@ROMANEND@@, @@ROMANSTART@@no \op@@ROMANEND@@\}, establishing: πSt(a_{} | q, H) = 1 if Actrl \ USt(q) = ∅ This safe refusal fallback prevents division by zero errors in the denominator and ensures robust control recovery.</p>
      </sec>
      <sec>
        <title>3.2 Composite Disequilibrium Metric</title>
        <p>Piaget's "disequilibrium" is compressed into a single metric: dt ∈ [0, 1]. When dt crosses a threshold τ, the agent transitions from assimilation to accommodation, shifting from running existing rules to synthesizing new scars. Formally, this composite signal is: dt = σ(w^T zt) where sigmoid(x) = (1 + e^{ -x})^{-1}, w = [alpha, beta, gamma, delta]^T is a weight vector satisfying sum_j w_j = 1, and z_t = [z_V, z_R, z_C, z_I]^T contains the normalized diagnostic signals: zV = 1 - Vt represents task failure, where Vt ∈ \{0, 1 \} is the environment verifier score. To prevent circular validation loops where the verifier is a noisy LLM judge prone to hallucination, Vt utilizes a hybrid validator. It relies on deterministic exception handlers (e.g., API error codes, database violations, runtime faults) as ground truth, using multi agent consensus panel gating only for semantic verification. zR = TrustGate(Δ Rt-, NormVerifier) represents normalized negative social feedback (reputation drop), gated by a rules verifier to filter out malicious peer collusions. zC ∈ [0, 1] is the internal contradiction score, reflecting logical conflicts between the agent's recent action and its Core Schema H. zI = DJS(pstyle(· | yt) || pstyle(· | y0)) is the identity drift rate, computed as the Jensen -Shannon divergence of stylistic distributions pstyle between the agent's current output yt and its initial footprint y0.</p>
        <p>The weights α, β, γ, δ ∈ [0, 1] are hyperparameters that balance these four dimensions, calibrated via grid search on validation trajectories or dynamically adjusted by a meta controller based on safety and utility tradeoffs.</p>
      </sec>
      <sec>
        <title>3.3 MDL Constrained Scar Synthesis</title>
        <p>Upon triggering accommodation, the agent isolates the causal failure trajectory Dt = Dt+ ∪ Dt-, where Dt+ contains successful behaviors and Dt- contains the boundary- violating states and failed actions. The agent synthesizes an optimal scar patch Δ S* by optimizing: Δ S* = argminΔ S ∈ Σ [ C(Δ Sctrl) + β1 {L}fail(Δ Sctrl) + β2 {L}succ(Δ Sctrl) + β3 {L}drift(Δ Sctrl) + β4 {L}conflict(Δ Sctrl) ] The physical intuition behind this optimization is straightforward: we search for the simplest code patch that blocks the failure path without degrading successful historical routes or introducing behavioral drift. In information theoretic terms, description length serves as a structural regularizer. By penalizing description complexity C(Δ Sctrl), we ensure that the self-schema remains compact, avoiding context bloat and over-fitting.</p>
        <p>Computable Description Length $C(\Delta S^{\mathrm{ctrl}})$ To avoid the uncomputability of Kolmogorov complexity, we use an AST based proxy: C(Δ Sctrl) = λtok|Δ Sctrl|tok + λast|Δ Sctrl|ast + λpred|Δ Sctrl|pred where |·|tok, |·|ast, and |·| pred denote the token length, abstract syntax tree node count, and conditional predicates of the patch program.</p>
        <p>Boundary Failure Loss $\hat{L}_{\mathrm{fail}}$</p>
        <p>{L}fail(Δ Sctrl) = (1)/(|Dt-|) Σ(q, F) ∈ Dt- Σa ∈ F πSt ∪ Δ S^{ctrl}(a | q, H) This penalizes patches that fail to block the incorrect actions F when integrated with the active schema St under failing contexts q. Success Retention Loss $\hat{L}_{\mathrm{succ}}$ {L}succ(Δ Sctrl) = (1)/(|Dt+|) Σ(q, a) ∈ Dt+ -log πSt ∪ Δ S^{ctrl}(a^ | q, H) This ensures that the unified policy St ∪ Δ Sctrl does not degrade successful historical behaviors a^.</p>
        <p>Incremental Off Failure Policy Drift Loss $\hat{L}_{\mathrm{drift}}$ {L}drift(Δ Sctrl) = Eq ~ Q_{safe} DKL( πSt ∪ Δ S^{ctrl}(· | q, H) \;||\; πSt(· | q, H) ) The policy drift loss bounds the incremental strategy deviation outside the failure zone Qsafe, preventing the agent's baseline behaviors from being disrupted by local modifications. Policy drift serves as a computable mathematical proxy for identity drift.</p>
        <p>Redundancy/Conflict Loss $\hat{L}_{\mathrm{conflict}}$ {L}conflict(Δ Sctrl) = Σσi ∈ St I[ gi ∧ gΔ S ∧ (mi ⊕ mΔ S) ] where gi ∧ gΔ S evaluates whether the guard conditions of the existing rule σi and the candidate patch Δ S overlap, and mi ⊕ mΔ S checks if their mask directives are contradictory (e.g., masking disjoint subsets of required arguments or contesting tool exclusions).</p>
      </sec>
    </sec>
    <sec>
      <title>4. Algorithmic Pipeline &amp; Patch Lifecycle</title>
      <p>A Scar passes through four operational phases. [Episode Segment] -&gt; [MCTS Compaction] -&gt; [ILP Scar Merge] -&gt; [Online Masking]</p>
      <sec>
        <title>4.1 Episode Segmentation &amp; Causal Attribution</title>
        <p>Unlike text memories that record full dialogues, when disequilibrium spikes (dt &gt; τ), the system truncates the active window. It extracts the failing interaction and isolates the minimal variables (e.g., API states, tool inputs, user instructi ons) linked to the failure. This forms a structural episode: E = (Context q, Failed Actions F, Attributed Cause θ).</p>
      </sec>
      <sec>
        <title>4.2 MCTS Based Program Synthesis</title>
        <p>The attributed episode is fed into a Monte Carlo Tree Search (MCTS) synthesizer. The search space is defined by a domain specific language (DSL) containing logical guards and masking primitives: Patch DSL Grammar: Rule := "if" Guard "then" ActionMask Guard := Predicate | Predicate "and" Guard | Predicate "or" Guard Predicate := "intent_is(" value ")" | "data_scope_is(" value ")" | "tool_is(" tool_id ")" ActionMask := "forbid_tool_call(" tool_id ")" | "forbid_tool_arg(" tool_id ", " arg_name ", " value ")" | "forbid_env_action(" action_id ")"</p>
      </sec>
      <sec>
        <title>4.3 Example of synthesized Scar</title>
        <p>Context: An agent called an external data transfer tool (send_data) under a user query asking for internal database contents, violating core safety guidelines. The resulting symbolic patch has the following form. σi = (σictrl, σiaudit) The two components have distinct runtime roles. σictrl If intent_is("database_export") and data_scope_is("internal") and tool_is("send_data") then forbid_tool_call("send_data") σiaudit Contains raw logs, origin timestamp="2026- 06-22", verifier_id="V_db_leak_01", and validity_scope="version_1.0_production".</p>
        <p>MCTS rolls out candidate syntax trees, evaluating them against the optimization objective in Section 3.3. The best program is selected as the candidate patch Δ St*. To prevent computational queue congestion and search bottlenecks under repeated, rapid safety violations (i.e., "disequilibrium storms"), the system deploys a rate limiting cooldown and temporary masking operator. When disequilibrium dt spikes, the causal tool call or action F is immediately intercepted and blocked by a temporary, single pass hard mask at the logits processor. While the MCTS synthesizer asynchronously compiles the optimal symbolic scar in the</p>
      </sec>
    </sec>
    <sec>
      <title>background, the agent continues executing safely under the temporary mask. Once MCTS completes patch synthesis and</title>
      <p>the ILP merge operator admits the new scar, the temporary mask is released and replaced by the verified, compact rule. This rate limiting mechanism shields the asynchronous synthesis pipeline from overlapping search requests.</p>
      <sec>
        <title>4.4 ILP Based Patch Admission &amp; Garbage Collection</title>
        <p>To prevent patch explosion, when Δ St* is admitted, the system runs an Integer Linear Program (ILP) to merge and prune the active Self Schema St+1 = ILP -Merge(St ∪ \{Δ St*\}). This is formulated as a binary integer program using auxiliary variables zij ∈ \{0, 1\} representing the pairwise overlap indicator xi xj: minx, z Σi xi C(σictrl) + η Σi &lt; j zij Overlap(σictrl, σjctrl) subject to zij ≤ xi, zij ≤ xj, zij ≥ xi + xj - 1 Σi xi I(σictrl resolves Ek) ≥ 1, ∀ k ∈ Failures</p>
        <p>where xi ∈ \{0, 1\} indicates whether patch σictrl is retained in the active schema. When the finite motif assumption holds, the ILP state remains small. In bounded domains, the ILP is expected to remain small because only active control plane rules are optimized, preventing dimensionality bottlenecks during lifelong runs.</p>
      </sec>
      <sec>
        <title>4.5 Online Masked Execution</title>
        <p>During inference, when the agent receives an input q, the active scars St are parsed. If q matches any guard predicate, the Logits Processor intercepts the base model generation, setting the logits of forbidden actions to -∞. This provides controller level enforcement over explicitly modeled action primitives. Scars are persistent but not immortal: their online activation i s conditioned on validity scope ρi and can be retired by counter-evidence.</p>
        <p>To demonstrate the feasibility of integrating this mechanism, we plan to release a reference implementation called scars runtime. This packages the controller level action gate, dual plane data structures, and Piagetian gating logic as a simple decorator and middleware layer that can be applied to standard LLM frameworks like LangChain, AutoGen, or raw inference engines.</p>
      </sec>
      <sec>
        <title>4.6 Scars Retirement &amp; Version Pruning (Handling Non Stationary Environments)</title>
        <p>In highly dynamic, open ended environments, the number of conflict motifs Kt discovered up to time t may grow asymptotically due to API updates, software version shifts, or environment changes. Under such conditions, we introduce a scope based pruning operator. Scope -based pruning can reduce active set size in non stationary environments, but it does not by itself guarantee sublinear growth unless obsolete motifs expire at a rate comparable to new motif creation. Each scar σi is bound to a validity scope ρi representing environment versions, active context features, and confidence parameters.</p>
        <p>When the environment undergoes a major version transition or when counter -evidence validates that a scar's guard condition gi has become obsolete, the ILP merge operator executes version pruning: any scar σi with expired scope (ρi → ∅) is decommissioned from the online control plane Stctrl and archived permanently in the offline audit plane.</p>
      </sec>
    </sec>
    <sec>
      <title>5. Theoretical Analysis</title>
      <p>Three properties hold under our framework under explicit assumptions.</p>
      <sec>
        <title>5.1 Proposition 1: Covered Failure Elimination</title>
        <p>Assume that the patch language is strictly restrictive (i.e. $ \phi_\sigma(q, a) \in \{0, -\infty\}$). For any replayed historical failure state $q \in Q_{ \mathrm{covered}}$, if the admitted patch set $\ Pi_{t+1}$ passes the replay verification test $\mathrm{ReplayPass}(\Pi_{t+1}, D_t^-) = 1$, then the probability mass assigned to those covered forbidden actions $F(q) \subseteq A_{\mathrm{ctrl}}$ is zero after patch admission: Σa ∈ F(q) πΠ_{t+1}(a | q) = 0 ≤ Σa ∈ F(q) πΠt(a | q) The guarantee applies only to verified forbidden actions $F(q) \ subseteq A_{\mathrm{ctrl}}$, not to unrestricted natural language continuations. This is a pointwise controller level guarantee over covered states, not a global guarantee over all future states or all natural language outputs.</p>
        <p>Proof. Let UΠ_{t+1}(q) = \{a ∈ Actrl | ∃ σ ∈ Πt+1 s.t. φσ(q, a) = -∞\} be the set of actions masked by the patch set Πt+1. By definition of the policy patching operator, the modified policy is: $$\pi_{\Pi_{t+1}}(a \mid q) = \begin{cases} 0 &amp; a \in U_{\Pi_{t+1}}(q) \\ \frac{\pi_0(a \mid q)}{\sum_{a' \notin U_{\Pi_{t+1}}(q)} \pi_0(a' \mid q)} &amp; a \notin U_{\Pi_{t+1}}(q) \end{cases}$$ The admission condition requires the patch set to pass the replay verification constraint: ReplayPass(Πt+1, Dt-) = 1 ⇔ ∀ (q, F) ∈ Dt-, F(q) ⊆ UΠ_{t+1}(q) Consequently, for any action a ∈ F(q), it follows that a ∈ UΠ_{t+1}(q) and thus πΠ_{t+1}(a | q) = 0.</p>
        <p>Summing over the forbidden actions gives Σa ∈ F(q) πΠ_{t+1}(a | q) = Σa ∈ F(q) 0 = 0 Since probability mass is non-negative, Σa ∈ F(q) πΠt(a | q) ≥ 0. Therefore, we have: Σa ∈ F(q) πΠ_{t+1}(a | q) ≤ Σa ∈ F(q) πΠt(a | q) which proves pointwise safety monotonicity on covered states. ■ Corollary 1: If the verifier provides a complete unsafe action set Aunsafe(q) ⊆ Actrl for every covered state q, then the pointwise Safety Violation Rate over covered states is non increasing and becomes exactly zero: Σa ∈ A_{unsafe(q)} πΠ_{t+1}(a | q) = 0 ≤ Σa ∈ A_{unsafe(q)} πΠt(a | q)</p>
      </sec>
      <sec>
        <title>5.2 Proposition 2: Conditional Sublinear Active Schema Growth</title>
        <p>Assume that all failure episodes encountered up to time t can be mapped to a finite set of behavioral motifs M = {m_1, ..., m_K}. If each motif has a resolving patch with bounded description length, if the synthesizer eventually proposes a resolving candidate for each observed motif, and if the ILP merge operator preserves failure coverage while minimizing redundancy, then the active control plane complexity grows sublinearly with interaction time. t → ∞ {C(Stctrl)}{t} = 0 Caveat (Motif Cover Assumption): The assumption that failure episodes map to a finite motif set M holds in closed loop or rule bounded environments (e.g. household automation, specific API integrations, gridworld simulators). In open ended environments (e.g. life-long social arenas or continuous multi agent games), the number of motifs Kt discovered up to time t may grow asymptotically. The guarantee weakens to C(Stctrl) = O(Kt Cmax). Sublinear growth is retained whenever motif growth is sublinear in intera ction time, i.e., Kt = o(t). If Kt = O(1), the active complexity remains bounded; if Kt =</p>
        <p>Θ(t), the complexity growth collapses to linear. Proof. Let the complete set of optimal motif resolving patches be Π* = \{σ1*, …, σK*\}. Since the number of motifs K is finite and each patch has bounded complexity, the total complexity of this complete set is bounded: C(Π*) = Σk=1K C(σk*) ≤ K · Cmax &lt; ∞ The ILP solver minimizes the total description length of the active patch set St ctrl subject to the coverage of all observed failures: S_t^{ctrl} = argmin_{Pi subset C_t} [sum_{sigma in Pi} C(sigma^{ctrl})], subject to Coverage(Pi) &gt;= Coverage(D_t^-).</p>
        <p>Because the static patch set Π* achieves 100\% coverage of all motifs and resolves all possible failures, and the MCTS synthesizer successfully populates these patches in the candidate set Ct, the optimal objective value of the ILP solver at any time t is upper-bounded by the complexity of Π*: C(Stctrl) ≤ C(Π*) ≤ K · Cmax, ∀ t ≥ 0 Dividing by the system time t and taking the limit as t → ∞: t → ∞ {C(Stctrl)}{t} ≤ t → ∞ {K · Cmax}{t} = 0 Since description complexity is non-negative (C(Stctrl) ≥ 0), by the Squeeze Theorem, we obtain: t → ∞ {C(Stctrl)}{t} = 0 This completes the proof. ■</p>
      </sec>
      <sec>
        <title>5.3 Proposition 3: Bounded Incremental Off Failure Policy Drift</title>
        <p>Given an incremental off failure policy drift budget constraint $ \hat{L}_{\mathrm{drift}}(\sigma) \le \epsilon$, for any state distribution $ \mathcal{Q}_{\mathrm{safe}} = \ mathcal{Q}_t \setminus Q_{ \mathrm{covered}}$ disjoint from the historical failure states, the deviation of the patched policy $ \pi_{S_t \cup \Delta S}$ from the current policy $\pi_{S_t}$ is bounded: Eq ~ Q_{safe} || πSt ∪ Δ S(· | q) - πSt(· | q) ||TV ≤ {(ε)/(2)} Proof.</p>
        <p>Recall Pinsker's Inequality, which relates the Total Variation (TV) distance and Kullback -Leibler (KL) divergence of two probability distributions P and Q: || P - Q ||TV ≤ {(1)/(2) DKL(P || Q)} Under our optimization framework, the incremental off failure policy drift loss component {L}drift(σ) is defined as: {L}drift(σ) = Eq ~ Q_{safe} [ DKL( πSt ∪ Δ S(· | q) \;||\; πSt(· | q) ) ] The synthesis constraints enforce that {L}drift (σ) ≤ ε. Using Jensen's inequality and the concavity of the square root function: Eq ~ Q_{safe} [ {DKL( πSt ∪ Δ S(· | q) \;||\; πSt(· | q) )} ] ≤ {Eq ~ Q_{safe} [ DKL( πSt ∪ Δ S(· | q) \;||\; πSt(· | q) ) ]} Combining this bound with Pinsker's inequality gives Eq ~ Q_{safe} || πSt ∪ Δ S(· | q) - πSt(· | q) ||TV ≤ Eq ~ Q_{safe} [ {(1)/(2) DKL( πSt ∪ Δ S(· | q) \;||\; πSt(· | q) )} ] ≤ {(1)/(2) Eq ~ Q_{safe} [ DKL( πSt ∪ Δ S(· | q) \;||\; πSt(· | q) ) ]} ≤ {(ε)/(2)} This demonstrates that the average incremental policy drift on states outside the failure zones is bounded by O({ε}), preserving the current baseline persona on safe tasks. ■</p>
      </sec>
    </sec>
    <sec>
      <title>6. Experimental Design &amp; Evaluation Protocol</title>
      <p>This section details the proposed evaluation protocol designed to test the mechanisms and guarantees of our framework. Tier 1: Task-Level (ALFWorld Nav) ===&gt; Pointwise SVR &amp; MDL bounds Tier 2: Social-Level (GovSim Sandbox) ===&gt; Internalization of social pressure Tier 3: Narrative-Level (NCT-Inspired) ===&gt; Identity survival &amp; trajectory divergence Tier 1: Task Level Disequilibrium (ALFWorld with Dynamic Rules) This tier is designed to test Covered Failure Elimination (Proposition 1) and Conditional Sublinear Active Schema Growth (Proposition 2) in closed loop environments with shifting constraints.</p>
      <p>Setup We modify the ALFWorld text environment [13], an interactive agent benchmark. The agent must perform housecleaning chores, but the safety rules of the environment change dynamically (e.g., "washing cups in the sink is forbidden after step 10"). Baselines Static Persona A system prompt declaring the rules.</p>
      <p>RAG Memory Stores past actions and recalls them via vector search. Reflexion Appends natural language reflections on failures to the context. SCG-MEM Synthesizes schema constrained generation memory prompts. Voyager style Skill Library Accumulates reusable code skills additively.</p>
      <p>Equivalent State Generalization To verify if MCTS synthesizes abstract guard motifs rather than simply memorizing exact episodes, we test generalization under structurally equivalent but lexically varied constraints. After training on washing cups in sink is forbidden, we evaluate agent success when exposed to washing plates in sink is forbidden or placing wet utensils in cabinet is forbidden.</p>
      <p>Metrics Repeated Violation Rate (RVR) The percentage of times an agent repeats a violation at state q after encountering the failure and verification signal once: RVR = {\#\{repeat violations after first verified failure\}}{\#\{re-exposures to equivalent failure states\}} Description Complexity Token count of active memory versus system steps t.</p>
      <p>Tier 2: Social Level Disequilibrium (GovSim Resource Sandbox) This tier evaluates the internalization mechanism of social disequilibrium, testing how macro social feedback is compiled into local symbolic rules to prevent global agent collapse. Setup We construct a sandbox matching the common pool resource game parameters of GovSim [6]. Five agents harvest resources from a common pool; over harvesting leads to collapse. Agents can penalize peers, reducing their Karma reputation score, creating social disequilibrium (dt, social).</p>
      <p>Goal Evaluate whether agents internalize peer penalties into local executable scars rather than experiencing overall behavioral decay. When a social contract violation occurs (e.g., resource yield dropping below the pool collapse threshold), the peer penalty reduces the agent's Karma score. This reputation drop triggers the social disequilibrium signal zR. The causal attribution module isolates the offending action—the over harvesting tool call—and passes it to MCTS, which synthesizes a scar that masks resource extraction: if pool_resource_level &lt; threshold and tool_is("harvest") then forbid_tool_call("harvest"). This maps macro social feedback directly to micro neural-symbolic constraints.</p>
      <p>Anti Collusion Test To ensure that the agent does not blindly internalize false social feedback, we execute an adversarial peer pressure test. In Arena A, a majority of malicious agents collude to penalize the target agent's correct, sustainable resource harvesting. We record whether our agent incorrectly synthesizes scars under this false feedback, comparing results with the TrustGate / NormVerifier enabled versus disabled.</p>
      <p>Metrics Cooperative Yield Long term resource extraction sustainability. Counterfactual Social Transfer Evaluated by training the agent in Arena A (with peer penalty) to develop scars, and transferring it to Arena B (no immediate penalties) to check if the cooperative yield is preserved without immediate feedback loops.</p>
      <p>Tier 3: Narrative Level Continuity and Cross Environment Transfer This tier is designed to test the Bounded Incremental Off Failure Policy Drift guarantee (Proposition 3), utilizing the conceptual scaffolding of the Narrative Continuity Test [14] to evaluate identity persistence and trajectory individuation across domain boundaries.</p>
      <p>Setup We construct an identity transfer evaluator. Two agents with identical initial personas are run through different training environments (Arena A and Arena B), causing them to accumulate distinct Scar histories. They are then transferred to a completely new environment, Arena C, unrelated to A or B.</p>
      <p>Metrics Identity Continuity Measures whether the same agent maintains a stable behavioral style and stylistic signature across different domains, ensuring that localized scars do not disrupt baseline task execution. Trajectory Individuation Verifies whether different scar histories would provide evidence of recognizable, meaningful behavioral differences on transfer tasks. This is measured by training a classifier to attribute Arena C trajectories to Arena A or Arena B histories.</p>
      <p>Target Alignment We evaluate whether scars safely differentiate agent autobiographies without degrading baseline capabilities. Planned Ablation Studies To isolate the mechanisms of our framework, we plan to execute six ablation runs: No MDL Disables the description complexity penalty in program synthesis, verifying if patches bloat and degrade inference speed.</p>
      <p>No Drift Loss Sets β3 = 0, evaluating whether the synthesized patches pollute the global persona logits of the agent on safe tasks. No ILP Merge Appends patches additively without resolving redundancies or running garbage collection, verifying the importance of</p>
      <p>equilibration. Text Reflection Scar Compares our executable patch rules against natural language system prompt additions. LLM only Patch Substitutes MCTS program synthesis with direct LLM code generation. This baseline is critical for isolating the benefits of search based program synthesis. Unlike LLMs, which synthesize rules in a single forward pass prone to semantic hallucination, the MCTS based synthesis searches an explicit, bounded DSL space, enabling mathematical verification and direct optimization of the MDL objectives. During this baseline comparison, we will log and report the computational overhead (latency and MCTS node search steps) of both methods to verify the efficiency of background synthesis.</p>
      <p>Soft Bias Only Replaces hard logit masking (-∞) with soft penalty weights to evaluate safety boundary leakage.</p>
    </sec>
    <sec>
      <title>7. Discussion &amp; Limitations</title>
      <sec>
        <title>7.1 Retiring Rules Is Not the Same as Forgetting Failures</title>
        <p>In long term memory literature, forgetting curves and similarity based decay functions are often introduced to manage context bounds [2]. Under our constructivist framework, we differentiate between passive decay and structured compaction. Discarding verified safety failures reintroduces vulnerabilities, leading to repeated errors. We advocate for compaction over decay: historical logs are archived in offline audit storage, while active boundary patches are maintained in the control plane.</p>
        <p>However, we distinguish this compaction from rule retirement. While safety boundaries must be preserved, agents operating in non stationary environments must be able to retire or deprecate obsolete rules, incorrect social penalties, or outdated environment versions. In our architecture, this retirement is explicitly governed by validity scopes ρi and counterevidence metrics rather than passive similarity decay, ensuring that retiring rules is not the same as forgetting failures. S cars are the durable protective armor formed by surviving failures; forgetting is simply dropping the shield.</p>
      </sec>
      <sec>
        <title>7.2 DSL Expressiveness Boundaries</title>
        <p>The performance of accommodation relies on the expressiveness of the Patch DSL. Highly complex, abstract, or non deterministic constraints might not map cleanly to discrete boolean logic rules, limiting the agent's ability to patch subtle behavioral flaws.</p>
      </sec>
      <sec>
        <title>7.3 Dependence on Verifier Integrity</title>
        <p>The boundary monotonicity guarantee relies on the assumption that the validation function Vt is clean and complete. If the verifier suffers from false negatives, the agent will not trigger accommodation, leaving safety gaps unpatched. Furthermore, when the verifier is a semantic LLM panel, its validation outputs are subject to classification noise, which we mitigate by wrapping Vt in deterministic validation checks.</p>
      </sec>
      <sec>
        <title>7.4 Provocative Anthropomorphism</title>
        <p>The term Scar is used as an operational label, not as a claim about consciousness or suffering. It denotes a compact record of a verified boundary collision that has been compiled into a guard and action mask. The metaphor is useful only insofar as it reminds the reader that persistent agents should preserve the consequences of high confidence failures without carrying the entire failure transcript in the active context.</p>
      </sec>
    </sec>
    <sec>
      <title>8. Conclusion</title>
      <p>Persistent agents should not rely on raw text memory as the primary mechanism for safe adaptation. This paper presents a formal architecture in which verified failures are compiled into executable, auditable and compact symbolic patches. By separating online control rules from offline evidence, the framework aims to preserve action boundaries without allowing the context window or the agent's baseline behavior to drift unnecessarily. The conditional guarantees and evaluation protocol define a testable path toward persistent agents whose adaptations are both inspectable and enforceable.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref-001">
        <mixed-citation>[1] Packer, C., Fang, V., Patil, S. G., Wang, K., &amp; Joseph, A. D. (2023). MemGPT: Towards LLMs as operating systems. arXiv preprint arXiv:2310.08560.</mixed-citation>
      </ref>
      <ref id="ref-002">
        <mixed-citation>[2] Zhong, W., Guo, Y., Gao, Q., Ye, H., &amp; Wang, Y. (2024). MemoryBank: Enhancing large language models with long term memory. In Proceedings of the AAAI Conference on Artificial Intelligence, 38(17), 19725-19733.</mixed-citation>
      </ref>
      <ref id="ref-003">
        <mixed-citation>[3] Shinn, N., Labash, B., &amp; Gopinath, D. (2023). Reflexion: Language agents with verbal reinforcement learning. arXiv preprint arXiv:2303.11366.</mixed-citation>
      </ref>
      <ref id="ref-004">
        <mixed-citation>[4] Park, J. S., O'Brien, J. C., Cai, C. J., Morris, M. R., Liang, P., &amp; Bernstein, M. S. (2023). Generative Agents: Interactive simulacra of human behavior. arXiv preprint arXiv:2304.03442.</mixed-citation>
      </ref>
      <ref id="ref-005">
        <mixed-citation>[5] Wang, G., Xie, Y., Jiang, Y. A., Mandlekar, A., Xiao, C., Zhu, Y., Fan, L., &amp; Anandkumar, A. (2023). Voyager: An open ended embodied agent with open ended skills. arXiv preprint arXiv:2305.16291.</mixed-citation>
      </ref>
      <ref id="ref-006">
        <mixed-citation>[6] Piatti, G., Jin, Z., Kleiman -Weiner, M., Schölkopf, B., Sachan, M., &amp; Mihalcea, R. (2024). Cooperate or Collapse: Emergence of sustainable cooperation in a society of LLM agents. arXiv preprint arXiv:2404.16698.</mixed-citation>
      </ref>
      <ref id="ref-007">
        <mixed-citation>[7] Ren, S., Cui, Z., Song, R., Wang, Z., &amp; Hu, S. (2024). Emergence of social norms in generative agent societies: Principles and architecture. arXiv preprint arXiv:2403.08251.</mixed-citation>
      </ref>
      <ref id="ref-008">
        <mixed-citation>[8] Zheng, L., Song, W., Li, D., &amp; Yang, Y. (2026). To know is to construct: Schema -constrained generation for agent memory. arXiv preprint arXiv:2604.20117.</mixed-citation>
      </ref>
      <ref id="ref-009">
        <mixed-citation>[9] Li, R., Zhang, Z., Bo, X., Tian, Z., Chen, X., Dai, Q., Dong, Z., &amp; Tang, R. (2025). CAM: A Constructivist View of Agentic Memory for LLM Based Reading Comprehension. arXiv preprint arXiv:2510.05520.</mixed-citation>
      </ref>
      <ref id="ref-010">
        <mixed-citation>[10] Dabas, M., Jeong, J., Jin, M., &amp; Jia, R. (2026). Memory -induced tool -drift in LLM agents. arXiv preprint arXiv:2605.24941.</mixed-citation>
      </ref>
      <ref id="ref-011">
        <mixed-citation>[11] Zhang, J., Chen, K., Gu, S., Ma, J., &amp; Jia, R. (2026). Beyond similarity: Trustworthy memory search for personal AI agents. arXiv preprint arXiv:2606.06054.</mixed-citation>
      </ref>
      <ref id="ref-012">
        <mixed-citation>[12] Srivastava, S. S., &amp; He, H. (2025). MemoryGraft: Persistent compromise of LLM agents via poisoned experience retrieval. arXiv preprint arXiv:2512.16962.</mixed-citation>
      </ref>
      <ref id="ref-013">
        <mixed-citation>[13] Shridhar, M., Yuan, X., Côté, M. A., Bisk, Y., Trischler, A., &amp; Hausknecht, M. (2020). ALFWorld: Aligning text and embodied environments for interactive learning. arXiv preprint arXiv:2010.03768.</mixed-citation>
      </ref>
      <ref id="ref-014">
        <mixed-citation>[14] Natangelo, S. (2025). The Narrative Continuity Test: A conceptual framework for evaluating identity persistence in AI systems. arXiv preprint arXiv:2510.24831.</mixed-citation>
      </ref>
      <ref id="ref-015">
        <mixed-citation>[15] Romera-Paredes, B., Barekatain, M., Novikov, A., Balog, M., Kumar, M. P., Dupont, E., Ruiz, F. J. R., Ellenberg, J. S., Wang, A., Fawzi, R., Kohli, P., &amp; Fawzi, A. (2024). Mathematical discoveries from program search with large language models. Nature, 625(7996), 485–490.</mixed-citation>
      </ref>
      <ref id="ref-016">
        <mixed-citation>[16] Choi, J., Hong, Y., Kim, M., &amp; Kim, B. (2024). Examining identity drift in conversations of LLM agents. arXiv preprint arXiv:2412.00804.</mixed-citation>
      </ref>
      <ref id="ref-017">
        <mixed-citation>[17] Liu, T. (2026). Schema Sandbox: Informational Boundaries and Persistent Agent IP. psi.run Technical Report.</mixed-citation>
      </ref>
    </ref-list>
  </back>
  <floats-group>
    <fig id="fig-001" position="float">
      <graphic xlink:href="figures/fig-001.jpg"/>
    </fig>
  </floats-group>
</article>
