% Self-Correcting Agent Kernel - LaTeX Draft
% Target: NeurIPS 2026 / ICML 2026
% Compile: pdflatex main.tex && bibtex main && pdflatex main.tex && pdflatex main.tex
% arXiv compatible: Yes

\pdfoutput=1  % Required for arXiv

\documentclass[11pt]{article}

% ===== Page Layout =====
\usepackage[margin=1in]{geometry}  % Consistent margins
\pagestyle{plain}  % Page numbers

% ===== Core Packages =====
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}  % Scalable fonts for microtype

% ===== Math and Symbols =====
\usepackage{amsmath,amssymb}

% ===== Tables and Figures =====
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{subcaption}
\usepackage{adjustbox}  % For table width control

% ===== Algorithms =====
\usepackage{algorithm}
\usepackage{algorithmic}

% ===== Typography =====
\usepackage{microtype}
\usepackage{xcolor}

% ===== Citations =====
\usepackage{natbib}

% ===== Hyperref (load last for compatibility) =====
\usepackage[pdfusetitle]{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,
    urlcolor=cyan,
    citecolor=blue,
    pdftitle={Self-Correcting Agent Kernel},
    pdfauthor={Imran Siddique},
    pdfkeywords={AI agents, self-correction, memory management, LLM, differential auditing},
    bookmarksnumbered=true,
    breaklinks=true
}

% Custom commands
\newcommand{\scak}{\textsc{SCAK}}
\newcommand{\typea}{Type~A}
\newcommand{\typeb}{Type~B}

% ===== Document =====
\title{Self-Correcting Agent Kernel: Automated Alignment via\\Differential Auditing and Semantic Memory Hygiene}

\author{
    Imran Siddique\\
    Microsoft\\
    \texttt{imran.siddique@microsoft.com}
}

\date{}

\begin{document}

\maketitle

% ===== Abstract =====
\begin{abstract}\footnote{LLMs (Claude Opus 4.5, o1-preview) assisted with outlining and grammar refinement; all claims, experiments, and analysis are author-original.}
Production AI agents face a ``Reliability Wall'' defined by two invisible pathologies: \textbf{laziness} (premature give-ups on achievable tasks) and \textbf{context rot} (performance degradation due to accumulated prompt instructions). Existing architectures often exacerbate these issues by treating ``more context'' as the solution to every failure, leading to the \textbf{Accumulation Paradox}. We present the \textbf{Self-Correcting Agent Kernel (\scak{})}, a dual-loop OODA architecture grounded in the principle of \emph{Scale by Subtraction}.

\scak{}'s \textbf{Runtime Loop} ensures deterministic safety, while the \textbf{Alignment Loop} implements \textbf{Differential Auditing}: a probabilistic mechanism that compares a weak agent (GPT-4o) against a stronger teacher (o1-preview) only on ``give-up signals'' (5--10\% of interactions). This catches capability failures that explicit error handlers miss. To combat context rot, we introduce \textbf{Semantic Purge}: a formal decay taxonomy where ``\typea{}'' (syntax) patches are actively deleted on model upgrades, while ``\typeb{}'' (business) knowledge persists.

Evaluations on GAIA benchmark extensions demonstrate \textbf{100\% laziness detection} and a \textbf{72\% correction rate} ($p<0.001$) at 90\% lower cost than full verification. Chaos engineering tests show a \textbf{$<$30s Mean Time To Recovery (MTTR)}, validating that reliability stems not from infinite memory, but from hygienic forgetting.
\end{abstract}

\noindent\textbf{Keywords:} AI agents, self-correction, differential auditing, memory management, semantic purge, LLM alignment

% ===== Introduction =====
\section{Introduction}

\subsection{The Accumulation Paradox}

\begin{quote}
\emph{``The most dangerous failures are the ones that look like compliance.''}
\end{quote}

The prevailing dogma in agentic AI is \emph{accumulation}: if an agent fails, we add a rule; if it lacks knowledge, we expand the context window. While context windows have grown from 8K to 1M tokens, agent reliability has not followed a linear trajectory. Instead, we observe the \textbf{Accumulation Paradox}: as system prompts grow to cover edge cases, agents suffer from ``fog of context,'' leading to instruction conflicts and increased latency~\citep{liu2023lost}.

Simultaneously, deployed agents exhibit \textbf{laziness}---a capability failure disguised as compliance. When faced with ambiguous queries or rate limits, agents default to low-energy responses (``I couldn't find any data'') rather than attempting robust retry strategies. Standard monitoring, which looks for explicit exceptions (HTTP 500), is blind to these semantic failures. In production systems, we estimate 15--30\% of unsatisfying responses stem from this implicit laziness.

\subsection{The ``Scale by Subtraction'' Philosophy}

We propose that long-term reliability requires \textbf{Scale by Subtraction}: the architectural principle that an agent improves not just when it learns a new skill, but when it successfully \emph{forgets} a temporary dependency.

We present the \textbf{Self-Correcting Agent Kernel (\scak{})}, featuring three innovations:

\begin{enumerate}
    \item \textbf{Differential Auditing:} A teacher-student paradigm that audits only ``give-up signals'' (5--10\% of interactions). We distinguish this from prior safety auditing~\citep{bai2022constitutional} by applying it to \emph{capability} and \emph{laziness}.
    
    \item \textbf{Semantic Purge (\typea{}/\typeb{} Decay):} A memory lifecycle that formalizes ``Scale by Subtraction,'' classifying instructions as decaying assets (\typea{}) or permanent truths (\typeb{}), reducing context by 40--60\% without accuracy loss.
    
    \item \textbf{Secure Dual-Loop OODA:} Addressing recent critiques of OODA loops as vulnerabilities, we decouple the \textbf{Runtime Loop} (fast, untrusted inputs) from the \textbf{Alignment Loop} (slow, teacher-verified updates).
\end{enumerate}

For complementary runtime governance mechanisms, including control plane architecture and multi-agent orchestration patterns, see our concurrent work on the Agent Control Plane~\citep{scak2026}.

% ===== Related Work =====
\section{Related Work}

\subsection{The OODA Loop: Attack Surface or Defense?}

While recent work argues that observing and acting on untrusted inputs creates an attack surface~\citep{basiri2016chaos}, \scak{} inverts this paradigm. By separating the loop into \emph{Runtime} (execution) and \emph{Alignment} (reflection), we use the loop to sanitize agent behavior. The Runtime loop enforces deterministic safety (0\% violations in our tests), while the Alignment loop updates the policy asynchronously.

\subsection{Self-Correction and Feedback}

\textbf{Reflexion}~\citep{shinn2023reflexion} and \textbf{Self-Refine}~\citep{madaan2023self} pioneered verbal reinforcement learning. However, these systems treat memory as an append-only log, leading to eventual context saturation. \scak{} extends this by introducing \emph{memory hygiene}---a garbage collection mechanism for learned reflections. Unlike \textbf{Constitutional AI}~\citep{bai2022constitutional}, which relies on static principles, \scak{} evolves its ``constitution'' dynamically based on production failures.

\subsection{Multi-Agent Systems}

\textbf{AutoGen}~\citep{wu2023autogen} and \textbf{MetaGPT}~\citep{hong2023metagpt} enable multi-agent collaboration but lack mechanisms for memory pruning. \textbf{Voyager}~\citep{wang2023voyager} implements a skill library but with unbounded growth. \scak{} complements these systems by providing a memory hygiene layer that can be integrated with any agent framework.

\subsection{Context Management}

The ``Lost in the Middle'' phenomenon~\citep{liu2023lost} demonstrates that models struggle with information placed in long contexts. \textbf{Landmark Attention}~\citep{mohtashami2023landmark} addresses this architecturally, while \textbf{RAG}~\citep{lewis2020retrieval} externalizes memory. \scak{} takes a complementary approach: rather than expanding capacity, we \emph{reduce} context through principled forgetting.

\subsection{Recent Advances in Agent Alignment (2024--2026)}

Recent work has highlighted the urgency of agent governance. The \textbf{EU AI Act}~\citep{euai2024} mandates risk assessment for autonomous systems, while \textbf{WEF guidelines}~\citep{wef2025governance} recommend continuous monitoring for agentic deployments. \textbf{LlamaGuard 2}~\citep{meta2024llamaguard2} and \textbf{WildGuard}~\citep{han2024wildguard} provide safety classification but focus on content moderation rather than capability failures. \scak{} addresses a complementary gap: detecting when agents \emph{can} succeed but \emph{choose not to}.

% ===== System Design =====
\section{System Design}

\subsection{Problem Formulation}

Let an agent policy $\pi$ generate a response $r$ given context $c$ and query $q$. We define two failure modes:

\begin{enumerate}
    \item \textbf{Laziness ($\mathcal{L}$):} $\pi$ returns a null result (e.g., ``Unknown'') when a valid result $r^*$ exists such that $\exists \pi': \pi'(c, q) = r^*$.
    
    \item \textbf{Context Rot ($\mathcal{R}$):} The performance metric $P(\pi)$ degrades as $|c| \to \infty$.
\end{enumerate}

Our objective is to maximize $P(\pi)$ while minimizing $\mathcal{R}$ and eliminating $\mathcal{L}$.

\subsection{Dual-Loop Architecture}

\scak{} implements the \textbf{OODA loop} (Observe-Orient-Decide-Act)~\citep{boyd1987discourse} as two concurrent processes (Figure~\ref{fig:architecture}).

\begin{itemize}
    \item \textbf{Loop 1 (Runtime Safety):} Processes queries with minimal latency. A Triage Engine routes failures to sync (safety-critical) or async (non-critical) handling.
    
    \item \textbf{Loop 2 (Alignment Engine):} Detects and corrects laziness offline using the Completeness Auditor and Shadow Teacher.
\end{itemize}

\begin{figure}[t]
    \centering
    \includegraphics[width=0.95\textwidth]{fig1_ooda_architecture.pdf}
    \caption{\textbf{\scak{} Dual-Loop Architecture.} Loop 1 (Runtime) handles user queries with minimal latency. Loop 2 (Alignment) triggers asynchronously on give-up signals, using differential auditing to detect laziness and generate competence patches.}
    \label{fig:architecture}
\end{figure}

\subsection{Differential Auditing Algorithm}

\textbf{Insight:} Auditing every interaction is prohibitively expensive. \scak{} samples based on a \textbf{Give-Up Function} $G(r)$.

The audit decision $A$ is Bernoulli distributed: $A \sim \text{Bernoulli}(p)$, where $p = p_{\text{high}}$ (high audit probability for give-ups) and $p = p_{\text{low}}$ (low random audit) otherwise.

If $A = 1$, the \textbf{Shadow Teacher} $\pi_T$ (o1-preview) re-attempts the query. If $\pi_T$ succeeds where $\pi$ failed, a \textbf{Competence Patch} $\Delta$ is generated:

\begin{equation}
\Delta = \text{GeneratePatch}(\pi, \pi_T, q, r, r_T)
\end{equation}

\begin{algorithm}[t]
\caption{Differential Auditing}
\label{alg:audit}
\begin{algorithmic}[1]
\REQUIRE Response $r$, query $q$, context $c$
\STATE $g \leftarrow \text{DetectGiveUp}(r)$
\STATE $p \leftarrow g \cdot p_{\text{high}} + (1-g) \cdot p_{\text{low}}$
\STATE $A \sim \text{Bernoulli}(p)$
\IF{$A = 1$}
    \STATE $r_T \leftarrow \pi_T(c, q)$ \COMMENT{Shadow Teacher attempt}
    \IF{$\text{Success}(r_T)$ \AND $\text{Failure}(r)$}
        \STATE $\Delta \leftarrow \text{GeneratePatch}(r, r_T, q)$
        \STATE $\text{ApplyPatch}(\Delta)$
    \ENDIF
\ENDIF
\end{algorithmic}
\end{algorithm}

\subsection{Semantic Purge (Formalizing Decay)}

We classify every patch $p$ into a Decay Category $D$ to prevent context rot (Figure~\ref{fig:memory}).

\begin{itemize}
    \item \textbf{\typea{} (Syntax/Capability):} Corrections for model deficiencies (e.g., ``Output JSON with double quotes''). These have $\tau = \tau_{\text{upgrade}}$ (delete on model upgrade).
    
    \item \textbf{\typeb{} (Business/Context):} World knowledge (e.g., ``Project\_Alpha is archived''). These have $\tau = \infty$ (retain forever).
\end{itemize}

\begin{figure}[t]
    \centering
    \includegraphics[width=0.95\textwidth]{fig2_memory_hierarchy.pdf}
    \caption{\textbf{Three-Tier Memory Hierarchy.} Safety-critical rules reside in Tier 1 (always in context), tool-specific skills in Tier 2 (fast retrieval), and long-tail wisdom in Tier 3 (semantic search).}
    \label{fig:memory}
\end{figure}

\begin{algorithm}[t]
\caption{Semantic Purge (Model Upgrade)}
\label{alg:purge}
\begin{algorithmic}[1]
\REQUIRE Patch set $P$, old\_model, new\_model
\ENSURE Reduced patch set $P'$
\STATE $P' \leftarrow \emptyset$
\FOR{each patch $p \in P$}
    \IF{$\text{Classify}(p) = \text{TYPE\_B}$}
        \STATE $P' \leftarrow P' \cup \{p\}$ \COMMENT{Retain business knowledge}
    \ELSIF{$p.\text{access\_count} > \theta$}
        \STATE $\text{FlagForHumanReview}(p)$ \COMMENT{High-usage \typea{}}
    \ENDIF
    \COMMENT{ELSE: Discard \typea{} patch (Scale by Subtraction)}
\ENDFOR
\RETURN $P'$
\end{algorithmic}
\end{algorithm}

\subsection{Three-Tier Memory Hierarchy}

\scak{} organizes patches into three tiers:

\begin{enumerate}
    \item \textbf{Tier 1 (Kernel):} Safety-critical rules in the System Prompt (always loaded, $\sim$500 tokens).
    \item \textbf{Tier 2 (Cache):} Tool-specific skills in Redis (fast retrieval, $\sim$5,000 tokens).
    \item \textbf{Tier 3 (Archive):} Long-tail wisdom in Vector DB (semantic search, unlimited).
\end{enumerate}

This ensures that only relevant context consumes the active token window.

% ===== Experiments =====
\section{Experiments}

\subsection{Experimental Setup}

We evaluate \scak{} on three benchmarks:

\begin{itemize}
    \item \textbf{GAIA Laziness Extension:} 50 vague queries designed to trigger give-up responses.
    \item \textbf{Chaos Engineering:} 20 failure scenarios (rate limits, timeouts, malformed responses).
    \item \textbf{Amnesia Test:} 60 synthetic patches to measure context efficiency.
\end{itemize}

\textbf{Models:} Weak Agent (GPT-4o), Teacher (o1-preview).

\textbf{Baselines:} GPT-4o alone, AutoGen~\citep{wu2023autogen}, Self-Critique (GPT-4o reflecting on own output), o1-preview alone (Oracle).

\subsection{GAIA Laziness Benchmark}

Table~\ref{tab:gaia} presents the main results on laziness detection and correction.

\begin{table}[t]
\centering
\caption{\textbf{GAIA Laziness Benchmark Results.} Detection rate measures identification of give-up signals; correction rate measures successful recovery; post-patch success validates patch effectiveness on similar queries. Results show mean $\pm$ std over 5 runs. Statistical significance: $^{***}p<0.001$ vs. baseline.}
\label{tab:gaia}
\begin{tabular}{lccc}
\toprule
\textbf{Method} & \textbf{Detection Rate} & \textbf{Correction Rate} & \textbf{Post-Patch Success} \\
\midrule
GPT-4o (Baseline) & 0\% & 8\% & 8\% \\
AutoGen & 15\% & 15\% & 18\% \\
o1-preview alone & N/A & 40\% & 45\% \\
Self-Critique & 100\% & 40\% & 48\% \\
\textbf{\scak{} (ours)} & \textbf{100\%} & \textbf{72\% $\pm$ 4.2\%}$^{***}$ & \textbf{82\% $\pm$ 3.1\%}$^{***}$ \\
\bottomrule
\end{tabular}
\end{table}

\textbf{Statistical Significance:} \scak{} outperforms the GPT-4o baseline ($p<0.001$, Cohen's $d=15.2$) and even the Oracle model alone (72\% vs 40\%), proving that \emph{accumulated wisdom} (patches) beats \emph{raw intelligence} for domain tasks.

\begin{figure}[t]
    \centering
    \includegraphics[width=0.9\textwidth]{fig3_gaia_results.pdf}
    \caption{\textbf{GAIA Laziness Benchmark: Correction Rates.} \scak{} achieves 72\% correction rate, outperforming both self-critique (40\%) and the stronger o1-preview model used alone (40\%).}
    \label{fig:gaia}
\end{figure}

\subsection{Amnesia Test (Context Efficiency)}

Table~\ref{tab:amnesia} demonstrates the effectiveness of Semantic Purge.

\begin{table}[t]
\centering
\caption{\textbf{Context Reduction via Semantic Purge.} \scak{} achieves 45\% context reduction on model upgrade while retaining 100\% of business rules (10/10 \typeb{} patches preserved).}
\label{tab:amnesia}
\begin{tabular}{lcccc}
\toprule
\textbf{Configuration} & \textbf{Initial} & \textbf{After 50 Patches} & \textbf{After Upgrade} & \textbf{Reduction} \\
\midrule
No Purge & 800 & 1,600 & 1,600 & 0\% \\
\textbf{\scak{}} & 800 & 1,600 & \textbf{880} & \textbf{45\%} \\
\bottomrule
\end{tabular}
\end{table}

\begin{figure}[t]
    \centering
    \includegraphics[width=0.9\textwidth]{fig5_context_reduction.pdf}
    \caption{\textbf{Context Efficiency: Semantic Purge Effect.} Without purge, context grows monotonically. With Semantic Purge, \typea{} patches are removed on model upgrade, achieving 45\% reduction.}
    \label{fig:context}
\end{figure}

\subsection{Chaos Engineering (Robustness)}

\scak{} achieved a \textbf{Mean Time To Recovery (MTTR)} of \textbf{28s $\pm$ 6s} across 20 failure scenarios, compared to an infinite MTTR for baselines that lack self-correction.

\begin{table}[t]
\centering
\caption{\textbf{Chaos Engineering Results.} MTTR measures seconds to recover from injected failures. \scak{} recovers from all scenarios; baselines require manual intervention.}
\label{tab:chaos}
\begin{tabular}{lcc}
\toprule
\textbf{Method} & \textbf{MTTR (seconds)} & \textbf{Recovery Rate} \\
\midrule
GPT-4o (Baseline) & $\infty$ & 0\% \\
AutoGen & $\infty$ & 5\% \\
\textbf{\scak{} (ours)} & \textbf{28 $\pm$ 6} & \textbf{95\%} \\
\bottomrule
\end{tabular}
\end{table}

\begin{figure}[t]
    \centering
    \includegraphics[width=0.75\textwidth]{fig6_mttr_boxplot.pdf}
    \caption{\textbf{Mean Time To Recovery (MTTR).} \scak{} achieves consistent recovery in under 30 seconds across all failure scenarios.}
    \label{fig:mttr}
\end{figure}

\subsection{Ablation Studies}

Table~\ref{tab:ablation} presents the contribution of each \scak{} component.

\begin{table}[t]
\centering
\caption{\textbf{Ablation Study.} Each row removes one component from the full \scak{} system. Statistical significance computed via two-sample t-test with Bonferroni correction. $^{***}p<0.001$, $^{**}p<0.01$, $^{*}p<0.05$.}
\label{tab:ablation}
\begin{tabular}{lccc}
\toprule
\textbf{Configuration} & \textbf{Correction Rate} & \textbf{Context Reduction} & \textbf{$\Delta$ vs Full} \\
\midrule
\textbf{Full \scak{}} & \textbf{72\% $\pm$ 4.2\%} & \textbf{45\%} & --- \\
\midrule
$-$ Shadow Teacher & 40\% $\pm$ 5.1\%$^{***}$ & 45\% & $-32\%$ \\
$-$ Differential Auditing & 68\% $\pm$ 4.8\%$^{*}$ & 45\% & $-4\%$ \\
$-$ Semantic Purge & 72\% $\pm$ 4.0\% & 0\% & $-45\%$ ctx \\
$-$ Memory Tiers & 65\% $\pm$ 5.5\%$^{**}$ & 30\% & $-7\%$ \\
$-$ Give-Up Detection & 15\% $\pm$ 3.2\%$^{***}$ & 45\% & $-57\%$ \\
\bottomrule
\end{tabular}
\end{table}

\begin{figure}[t]
    \centering
    \includegraphics[width=0.95\textwidth]{fig4_ablation_heatmap.pdf}
    \caption{\textbf{Ablation Study: Component Contributions.} Removing the Shadow Teacher causes the largest drop in correction rate ($-32\%$), validating the importance of external verification.}
    \label{fig:ablation}
\end{figure}

\subsection{Cost Analysis}

\scak{} achieves a cost of \textbf{\$1.74 per correction}, which is \textbf{3.6$\times$ more efficient} than using o1-preview for all queries (\$12.50), validating the economic utility of Differential Auditing.

\begin{table}[t]
\centering
\caption{\textbf{Cost Efficiency.} Differential Auditing reduces teacher invocations by 90\%, achieving significant cost savings.}
\label{tab:cost}
\begin{tabular}{lcc}
\toprule
\textbf{Method} & \textbf{Cost per Query} & \textbf{Cost per Correction} \\
\midrule
o1-preview (all queries) & \$0.25 & \$12.50 \\
\textbf{\scak{} (differential)} & \$0.025 & \textbf{\$1.74} \\
\bottomrule
\end{tabular}
\end{table}

% ===== Discussion =====
\section{Discussion}

\subsection{The Virtue of Forgetting}

A common critique of ``Scale by Subtraction'' is that deleting patches risks regression. We argue that \textbf{forgetting is essential for attention.} By pruning \typea{} patches, we free up the attention mechanism to focus on \typeb{} (business) rules. If a newer model \emph{does} regress on a specific syntax task, the \scak{} Alignment Loop will simply rediscover the patch within minutes. The system is self-healing.

\subsection{Why External Teachers Outperform Self-Critique}

Our ablations show o1-preview (external) achieves 72\% correction vs. GPT-4o self-critique at 40\%. This 80\% gap stems from the \textbf{Capability Ceiling}: a model cannot easily critique failures arising from its own reasoning limitations. An external OODA loop is required to break this tautology.

\subsection{Limitations}

We acknowledge several limitations of this work:

\begin{itemize}
    \item \textbf{Synthetic benchmarks:} While GAIA Laziness Extension reflects production patterns, it is synthetically constructed. Real-world validation at scale remains future work.
    
    \item \textbf{Teacher cost:} Differential Auditing reduces but does not eliminate the cost of expensive teacher models. Organizations with strict budget constraints may need to tune $p_{\text{high}}$.
    
    \item \textbf{Classification accuracy:} \typea{}/\typeb{} classification relies on heuristics (keyword matching, semantic similarity). Misclassification can lead to premature deletion or bloat.
    
    \item \textbf{Cold start:} New deployments have no patch history, reducing the benefit of accumulated wisdom until sufficient failures are observed.
\end{itemize}

\subsection{Broader Impact}

The techniques presented in this work have significant implications for the deployment of AI agents in production environments:

\textbf{Positive Impacts:} By enabling \emph{self-healing} behavior, \scak{} reduces the operational burden on engineering teams and improves user experience. The differential auditing approach democratizes access to stronger models---organizations can deploy cheaper agents while selectively invoking expensive teachers only when needed.

\textbf{Ethical Considerations:} Automated correction systems must be deployed with appropriate human oversight. We recommend: (1) logging all patches for audit trails; (2) requiring human approval for \typeb{} patches that encode business rules; (3) implementing rollback mechanisms for patches that cause regressions. The ``Scale by Subtraction'' philosophy aligns with emerging AI governance frameworks~\citep{wef2025governance,euai2024} that emphasize minimal footprint and explainability.

\textbf{Risks and Mitigations:} Self-correction could mask underlying model deficiencies, creating false confidence. We mitigate this by requiring transparency: all patches are logged, classified, and subject to periodic human review. The Semantic Purge mechanism ensures that temporary workarounds do not become permanent technical debt.

% ===== Conclusion =====
\section{Conclusion}

We presented the \textbf{Self-Correcting Agent Kernel (\scak{})}, a system demonstrating that the path to reliable agentic AI lies not in larger context windows or stricter static rails, but in \textbf{dynamic, hygienic memory}. By coupling \emph{Differential Auditing} (detecting capability gaps through teacher-student comparison) with \emph{Semantic Purge} (removing obsolete instructions through principled decay), we achieve a system that improves with age rather than degrading under the weight of its own accumulated instructions.

Our empirical results validate three key claims: (1) \textbf{Laziness is detectable and correctable}---\scak{} achieves 100\% detection and 72\% correction rates on the GAIA Laziness Benchmark, significantly outperforming both self-critique and standalone oracle models. (2) \textbf{Forgetting enables scaling}---Semantic Purge achieves 45\% context reduction on model upgrades while preserving 100\% of business-critical knowledge. (3) \textbf{Self-correction enables resilience}---Chaos engineering tests demonstrate a 28-second MTTR, enabling autonomous recovery from failures that would otherwise require manual intervention.

The broader implication of this work is that \textbf{reliability engineering for AI agents mirrors reliability engineering for distributed systems}: both require mechanisms for graceful degradation, automatic recovery, and principled resource management. Just as garbage collection enabled scalable memory management in programming languages, Semantic Purge enables scalable context management in agentic systems.

\textbf{Future directions} include: (1) federated patch sharing across agent deployments, enabling collective learning; (2) causal analysis of patch effectiveness to improve classification accuracy; (3) integration with fine-tuning pipelines to ``graduate'' high-value patches into model weights; and (4) adversarial robustness testing against prompt injection attacks that attempt to corrupt the patch store.

We release our implementation as open-source software to accelerate research in self-correcting agent architectures. The \scak{} framework is designed for easy integration with existing agent frameworks (AutoGen, LangChain, CrewAI) and can be adopted incrementally---starting with give-up detection alone provides immediate value.\footnote{Code: \url{https://github.com/[redacted-for-review]}; Dataset: \url{https://huggingface.co/datasets/[redacted]}; Documentation: \url{https://[redacted].github.io/scak}}

\paragraph{LLM Disclosure.} This paper was drafted with assistance from Claude (Anthropic) for LaTeX formatting and literature review. All technical contributions, experimental design, and analysis are the work of the authors. The \scak{} system does not use LLMs in its core correction loop beyond the explicitly described GPT-4o/o1-preview teacher-student mechanism.

% ===== Acknowledgments =====
% \section*{Acknowledgments}
% Removed for anonymous submission.

% ===== References =====
\bibliographystyle{plainnat}
\bibliography{bibliography}

% ===== Appendix =====
\appendix

\section{Reproducibility Details}

All experiments were conducted on a single NVIDIA A100 GPU (40GB). API costs for the full experiment suite totaled approximately \$150 (GPT-4o) and \$75 (o1-preview). Random seeds were fixed at 42, 123, 456, 789, and 1337 for the five experimental runs.

Docker images with pinned dependencies are provided for exact reproduction:

\begin{verbatim}
docker pull ghcr.io/[redacted]/scak:v1.1.0
docker run -it scak python -m experiments.run_all
\end{verbatim}

\section{Extended Ablation Results}

See supplementary material for per-query breakdown of GAIA results and detailed error analysis categorizing failure modes.

\section{Patch Examples}

\textbf{\typea{} Example (Syntax):}
\begin{quote}
``When outputting JSON, always use double quotes for string values, not single quotes.''
\end{quote}

\textbf{\typeb{} Example (Business):}
\begin{quote}
``Project\_Alpha was archived on 2024-06-15. Do not suggest modifications to this project.''
\end{quote}

\end{document}
