惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
H
Help Net Security
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The GitHub Blog
The GitHub Blog
V
V2EX
M
MIT News - Artificial intelligence
Vercel News
Vercel News
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
阮一峰的网络日志
阮一峰的网络日志
B
Blog RSS Feed
D
Docker
V
Visual Studio Blog
博客园 - 叶小钗
美团技术团队
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
The Discipline Nobody Teaches AI Agents: Context Engineering
MrClaw207 · 2026-05-13 · via DEV Community

The Discipline Nobody Teaches AI Agents: Context Engineering

Your AI agent isn't slow. Your context is bloated. Here's the invisible problem degrading everything you run.


Last week, my agent started producing garbage output.

Not consistently. Not obviously. Just often enough to be annoying. Tasks that should have taken 30 seconds were returning wrong information. Summaries were missing key details. The agent would confidently declare completion while leaving obvious gaps.

I almost blamed the model.

Then I read about context engineering — and realized the problem wasn't the AI. It was the context window.

What Is Context Engineering?

Context engineering is the discipline of managing what enters the language model's context window. Unlike prompt engineering (which focuses on crafting effective instructions), context engineering addresses everything that enters the model's limited attention budget:

  • System prompts
  • Tool definitions
  • Retrieved documents
  • Message history
  • Tool outputs

The fundamental insight: context windows are constrained not by raw token capacity, but by attention mechanics. As context length increases, models exhibit predictable degradation patterns:

  • Lost-in-the-middle: Important information in the middle of a long context gets ignored
  • U-shaped attention curves: Models remember the beginning and end of contexts best, forget the middle
  • Attention scarcity: The more you put in, the less the model can properly weigh any single piece

Effective context engineering means finding the smallest possible set of high-signal tokens that maximize the likelihood of desired outcomes.

Why Context Degradation Happens

Here's the concrete example that made this click for me:

A researcher at Peking University published "Meta Context Engineering via Agentic Skill Evolution" (2026) — academic research on this exact problem. The paper describes how AI agents in production environments face a fundamental challenge: the more context you give a model, the worse it performs on any single item in that context.

Traditional solutions don't solve this:

  • Summarization helps but loses nuance
  • RAG helps but introduces retrieval errors
  • Longer context windows just spread attention thinner

The better approach: progressive disclosure. Only load full content when a skill is activated for a relevant task. At startup, agents load only skill names and descriptions — not the full content of every skill.

This is the architecture behind some of the most effective agent systems in production. And it's exactly what tools like TurboQuant implement with their hot/cold memory split.

The Four Failure Patterns

Context degradation doesn't show up as an error message. It shows up as:

1. Lost-in-middle
Your agent can tell you what happened at the start and end of a project but forgets critical details from the middle. You review the output, it looks complete, but the most important decisions were made mid-project and the agent can't explain them.

2. Poisoning
A single misleading piece of context contaminates everything that follows. The model anchors on incorrect information and builds a coherent but wrong response on top of it.

3. Distraction
The agent gets pulled off-task by context elements that seem relevant but aren't. It responds to the wrong request because similar context from a previous task is activating instead.

4. Clash
Two pieces of context contradict each other, and the model arbitrates badly — either switching between contradictory conclusions or defaulting to the most recent input regardless of relevance.

The Practical Fix: Progressive Disclosure

Progressive disclosure means structuring your agent's knowledge so that:

At startup: Load only skill names and descriptions — the minimal metadata needed to know what's available.

At activation: When a specific skill is relevant to the current task, load its full content. Everything else stays compressed or offloaded.

This sounds complex, but the implementation is straightforward:

Tier 1 (Always available): Skill names, descriptions, and the current task context
Tier 2 (Loaded on demand): Full skill documentation, long-term memory, domain knowledge
Tier 3 (Compressed or archived): Older conversations, completed task logs, low-priority context

The key is knowing which tier something belongs in. A task that's actively running needs to be in Tier 1. A completed task from last week might be Tier 3 unless you're reviewing it.

How This Connects to Memory Architecture

The academic research on this (Muratcan Koylan, 2025 — cited in Peking University's paper) defines a "skill" as a unit of agent capability that can be loaded and unloaded. The skill's metadata (name, description, activation criteria) is always available. The skill's full content loads only when needed.

This maps directly to the three-level memory architecture that some agent systems implement:

Level 1 — Hot context: Current session, active task, recent outputs. Always in context.
Level 2 — Warm storage: Compressed but retrievable. Session summaries, memory fragments from recent days.
Level 3 — Cold archive: Full logs, older memories, lower-priority context. Only loaded when explicitly accessed.

The agents that perform best in production aren't the ones with the largest context windows. They're the ones with the most disciplined context management.

The System I Run

I've implemented a lightweight version of this for my own agent. Every night, a background process:

  1. Reviews the last 3 days of session logs
  2. Compresses completed tasks into summary form
  3. Archives low-signal context (routine cron outputs, repeated patterns)
  4. Promotes high-signal context (errors, corrections, decision points) to active memory

The agent wakes up each session with a clean but informed context. Not a blank slate — it remembers what matters. Not a bloated history — it has space to think.

The result: tasks that used to degrade over multi-hour sessions now maintain quality from start to finish.

What This Means For Your Agents

If your agent is producing inconsistent output, the problem is probably in your context, not your model.

Ask yourself:

  • How much of what's in context is actually relevant to the current task?
  • What's the oldest piece of context in your current session, and is it still pulling its weight?
  • Are you giving the agent everything it knows, or everything it needs?

Context engineering isn't a feature you add. It's a discipline you practice. The agents that perform reliably aren't the ones with the best models — they're the ones with the best context hygiene.


This is one of the core disciplines behind running AI agents reliably in production. If you want more on this — how to actually implement progressive disclosure, memory tiering, and context filtering — I write about AI agent systems every week. Free to subscribe. No fluff.

Tags: openclaw aiagents contextengineering automation production