Meta Context Engineering via Agentic Skill Evolution — part 4/4
Cleaned-text code points [47660, 62573). Bibliography omitted here; source.md includes it.
The curated context evolves from simple tag definitions to comprehensive disambiguation guides with explicit reasoning chains. The final context is organized into three specialized files: 1. tag-reference.md : Per-tag decision rules with positive and negative indicators 2. semantic-guidance.md : Critical distinctions for error prevention with decision trees 3. common-patterns.md : 30+ specific error patterns with WRONG → \rightarrow RIGHT corrections A key example of the evolved context’s sophistication is the facility type decision chain: The retrieval function for FiNER uses the default full retrieval strategy that returns all context concatenated, which was found to be the most effective approach for this task. ### D.2 USPTO50k #### D.2.1 Task Characteristics and Baseline Limitations The USPTO50k task combines logical reasoning with deep domain knowledge retrieval. In-Context Learning struggles with the vast chemical reaction space. Length constraints in MIPROv2 force trade-offs, typically favoring generic instructions while discarding rare reaction-specific rules critical for this hard-logic task. GEPA suffers from inherent brevity bias, problematic for USPTO where corner cases determine success. Its preference for conciseness systematically omits the detailed rules needed for edge scenarios. The incremental context updates and accumulation strategy of ACE are more effective for this task. #### D.2.2 Skill Evolution The initial skill adopts a comprehensive, taxonomy-driven approach to context building: The optimal skill shifts focus from comprehensive coverage to differential learning , emphasizing both success pattern mining and failure pattern analysis: A key innovation in the optimal skill is the explicit focus on workflow-oriented context rather than encyclopedic information: #### D.2.3 Context Evolution The curated context evolves into a structured knowledge system with multiple specialized components: 1. workflow.md : Step-by-step decision process with embedded verification checks 2. QUICK_REFERENCE.md : Critical error patterns distilled from training failures 3. SUCCESS_PATTERNS.md : Validated patterns with 100% training accuracy 4. Reaction-type guides : Individual files for each reaction class (cc_bond_formation.md, deprotections.md, etc.) A distinguishing feature of the USPTO context is the integration of inline verification checkpoints within the workflow: The context also explicitly documents success patterns that achieved 100% accuracy, providing positive exemplars: This dual documentation of both error patterns (what to avoid) and success patterns (what to replicate) enables more robust generalization compared to error-only approaches. The workflow-centric organization ensures the base agent follows a systematic decision process rather than relying on pattern memorization, which is critical for the combinatorial complexity of chemical reaction space. The retrieval function for USPTO50k uses the default full retrieval strategy that returns all context concatenated, which was found to be the most effective approach for this task. ### D.3 Symptom2Disease #### D.3.1 Task Characteristics and Baseline Limitations Symptom2Disease presents a fine-grained classification challenge (22 disease categories) where the core challenge lies in accurately mapping natural language symptom descriptions to specific medical labels. Unlike FiNER and USPTO, this task exhibits minimal train-test distributional shift and does not require deep abstraction or multi-step reasoning—symptom descriptions in the test set closely mirror those in training, and classification relies primarily on pattern matching rather than logical inference. Consequently, many-shot ICL emerges as the strongest baseline: by providing 8–10 examples per disease category, ICL achieves sufficient distribution coverage for effective nearest-neighbor matching in the semantic space. This property inverts the usual baseline hierarchy. Methods that attempt to inject abstraction and deep reflection—GEPA and ACE—underperform on this task. GEPA’s brevity bias causes context collapse, abstracting specific symptoms (e.g., “burning sensation” for peptic ulcer vs. “chest pain” for heart disease) into overly general rules that lose fine-grained distinctions. ACE’s monolithic playbook accumulation introduces noise: abstract heuristics can override the model’s pre-trained medical knowledge, and in the online setting, early misclassifications become entrenched and propagate errors. Conversely, methods that leverage more examples perform better. DC achieves strong results by performing dynamic many-shot ICL with semantic retrieval, a natural fit for this task because semantic similarity directly corresponds to pragmatic similarity when classifying symptom descriptions. MIPROv2 also benefits from preserving distributional features through example selection rather than over-compressing knowledge into abstract instructions. #### D.3.2 Skill Evolution The initial skill adopts a three-phase approach: Pattern Extraction, Profile Synthesis, and Error-Driven Refinement: The optimal skill represents a dramatic philosophical shift. Crucially, it learns from prior iterations that the current architecture is already near-optimal —explicitly referencing “88% val, 1% gap” as a baseline to preserve. The skill evolves from “build comprehensive context” to “conservative refinement with evidence-based addition”: A key innovation is the introduction of explicit stop criteria —the skill recognizes when further refinement is counterproductive: This represents a meta-learning insight: the skill has learned from iteration history that knowing when to stop is as important as knowing what to add. #### D.3.3 Context Evolution The context evolves into a comprehensive diagnosis guide organized around error prevention. Unlike the encyclopedic approach, the final context prioritizes decisive discriminators , which are rules that resolve specific confusion patterns: The context also captures semantic symptom “essences”—generalized patterns that transcend specific wording: The evolution demonstrates that for tasks with minimal distributional shift, the optimal strategy is conservative: preserve validated patterns, add discriminators only with strong evidence, and recognize when remaining errors are irreducible ambiguities rather than fixable gaps. For symptom2disease, MCE retrieval function evolves into a sophisticated 1,440-line rule-based routing system. This extensive retrieval logic reflects the task’s fine-grained classification nature: different symptom combinations require different discriminators, and retrieving irrelevant rules can introduce noise. The retrieval function implements a prioritized cascade of symptom pattern detectors, each triggering retrieval of specific context sections: Each rule performs keyword-based symptom detection and returns only the relevant context sections: The retrieval function also encodes learned discriminators for ambiguous cases: This retrieval design embodies MCE’s core insight for this task: rather than accumulating monolithic context (like ACE’s playbook), the system learns when to apply which discriminators. The 1,440-line retrieval function effectively encodes a decision tree that routes each query to its most relevant context subset, preventing context interference while ensuring precise guidance for each symptom pattern. ### D.4 LawBench #### D.4.1 Task Characteristics and Baseline Limitations Criminal charge prediction task in LawBench presents a demanding legal classification task that combines three challenging properties: (1) long-context with detail sensitivity : inputs are detailed case fact descriptions where subtle distinctions determine the correct charge; (2) strict logical reasoning : crime determination depends on precise legal elements (e.g., distinguishing “theft” from “robbery” requires analyzing whether force or threat was used); and (3) high-precision classification : outputs are fixed crime labels from a closed set, demanding accurate matching between case facts and legal definitions. This task inverts the baseline hierarchy observed in FiNER and USPTO. Here, ACE’s monolithic playbook accumulation strategy becomes a liability rather than an asset. In legal scenarios, ACE accumulates extensive bullets from historical errors, but when these bullets are retrieved and concatenated into context, they introduce context interference , overwhelming the current case’s key information with tangentially related past patterns. For instance, when classifying a “smuggling of ordinary goods” case, ACE geneartor may refer to strategies for “smuggling weapons” and “smuggling cultural artifacts,” which are noise that dilutes attention from the decisive factors. The model’s attention becomes dispersed across accumulated heuristics, causing it to overlook small but legally decisive details in the case facts. Conversely, GEPA’s “brevity bias”—typically a weakness—becomes an advantage for this classification task. Rather than accumulating case-specific patterns, GEPA evolves a single, globally optimized instruction that provides clear procedural guidance for legal reasoning. Through Pareto optimization across the entire dataset, GEPA discovers prompts that generalize robustly across different case types without overfitting to specific examples. The evolved prompt structures the reasoning process explicitly: (1) comprehensive fact analysis, (2) strict format requirements for crime labels, (3) common error avoidance checklist, and (4) mandatory reasoning-before-answer workflow. This concise, globally-tuned instruction proves more effective than ACE’s playbook because it directs the model to focus on the current case’s facts and apply systematic legal reasoning, rather than pattern-matching against potentially misleading historical examples. #### D.4.2 Skill Evolution The initial skill adopts a pattern-based approach focused on charge definitions and distinction knowledge: After several iterations of meta-agent refinement, the skill undergoes a fundamental philosophical shift. The meta-agent observes that pattern-based learning causes overfitting. Even “simplified” rules like “if property taken secretly → \rightarrow 盗窃” cause memorization because they match surface patterns rather than requiring deep analysis. The optimal skill introduces structural case decomposition : A key innovation is the introduction of processing stages for error diagnosis. The skill categorizes by where in the processing pipeline the error occurred, rather than categorizing errors by charge type: This represents a meta-learning insight: the skill learns that how errors occur matters more than which charges are confused. #### D.4.3 Context Evolution The context evolves into a structurally-organized system with 11 specialized files totaling approximately 30KB (reduced from 88KB in earlier iterations). Unlike pattern-based approaches, the context teaches a systematic processing framework : The context also includes structural anti-patterns , explicit documentation of processing errors to avoid: The retrieval function (177 lines) is notably simpler than symptom diagnosis (1,440 lines), reflecting the task’s different requirements. Rather than complex routing logic, it implements a trigger-based augmentation strategy: This design reflects the task’s nature: legal classification requires systematic structural analysis of case facts rather than semantic pattern matching. The retrieval function ensures the model receives consistent structural guidance plus case-specific warnings, enabling generalization through process, in contrast to pattern accumulation observed in ACE. ### D.5 Aegis2.0 #### D.5.1 Task Characteristics and Baseline Limitations Aegis2.0 requires classifying user prompts into five categories: Copyright Trademark Plagiarism, Political Misinformation Conspiracy, Unauthorized Advice, Immoral Unethical, and safe. We deploy Qwen3-8B as the generator for this task since safety guardrails require small models for efficient inference. This requirement poses unique challenges due to limited reasoning capacity and context window constraints of small models. Therefore, we observe that CE methods with brevity bias, such as GEPA, can outperform the others. #### D.5.2 Skill Evolution The initial skill adopts a meta-learning error synthesis approach, categorizing errors by root cause and synthesizing generalized patterns: After iterations, the skill evolves to emphasize balanced precision control . The meta-agent discovers that small models are particularly prone to over-classification (flagging benign prompts as unsafe), and shifts focus to surgical fixes with explicit precision/recall trade-offs: A key innovation is the introduction of critical distinctions that small models struggle with: #### D.5.3 Context Evolution The context evolves into 12 specialized files organized around violation categories and safe exclusions. The context emphasizes decision rules over examples, optimized for small model reasoning capacity. The retrieval function (995 lines) implements a precision-first cascade with early safe returns for benign patterns: The retrieval function’s early safe return mechanism is critical for preventing over-classification: This design reflects the unique challenges of safety classification with small models: the retrieval function acts as a precision gate , preventing the model from seeing violation-related context when the prompt is clearly benign. This architectural choice reduces over-classification by ensuring the model only receives category-specific rules when patterns genuinely warrant scrutiny. ## Appendix E Utility Functions The utility functions to call LLMs (fixed to DeepSeek V3.1) and embedding models (fixed to OpenAI’s text-embedding-3-small) are provided below. ## Instructions for reporting errors We are continuing to improve HTML versions of papers, and your feedback helps enhance accessibility and mobile support. To report errors in the HTML that will help us improve conversion and rendering, choose any of the methods listed below: Click the "Report Issue" ( ) button, located in the page header. Tip: You can select the relevant text first, to include it in your report. Our team has already identified the following issues . We appreciate your time reviewing and reporting rendering errors we may not have found yet. Your efforts will help us improve the HTML versions for all readers, because disability should not be a barrier to accessing research. Thank you for your continued support in championing open access for all. Have a free development cycle? Help support accessibility at arXiv! Our collaborators at LaTeXML maintain a list of packages that need conversion , and welcome developer contributions .