Context Rot Is a Harness Problem Last read
A walkthrough of four context-engineering techniques used inside a coding agent's harness — memory files, skills with progressive disclosure, LSP server feedback, and compaction — with implementation details from a from-scratch agent the presenter built. The argument is that degrading agent performance is usually caused by a bloated, noisy context window rather than the model, so swapping OpenAI for Anthropic won't help. Each technique is shown as both concept and code: how memory.md is appended and compressed, how skills load in three tiers, how an LSP server gives cheap syntax feedback, and how compaction and micro-compaction shrink the window at 80% and 60% thresholds.
- Agent mistakes usually come from a context window stuffed with stale files, tool outputs and unneeded history, not from the model choice.
- Memory has two flavors: a manually written agent.md that is injected every session, and an automatically extracted memory.md written as an append-only log of one-sentence summaries with dates, capped at 200 lines / 25KB; memory extraction runs on every quit and clear command, and compression is a summary-of-summaries that the presenter admits doesn't always work well.
- Skills use three-tier progressive disclosure: names and descriptions always sit in the system prompt (optionally capped at ~1% of the context window), the skill.md loads when the skill tool is called, and scripts/references/assets load only if the agent reads them.
- Progressive disclosure is really just 'all the available file paths in the context window plus read tools' — a pattern transferable to other harnesses.
- An LSP server can be wired into the agent two ways: an active LSP tool for definitions, references, hover and diagnostics, and passive diagnostics automatically run after every write or edit tool call, appended to the context as feedback.
- The passive diagnostics loop means the agent gets syntax and compile feedback without having to run the program, so it doesn't have to guess at syntax errors.
- Compaction has three options: clear (blank slate, loses everything), compaction at ~80% usage that replaces history with a summary plus the most recent 'tail' messages, and micro-compaction at ~60% that swaps older tool outputs for placeholders while leaving the tail intact.
- The implementation uses a 'reserve' buffer parameter — 20% reserved translates to triggering compaction at 80% context fill, matching Claude Code's current behavior; the code is part of a free eight-lesson open-source course on building a coding agent from scratch.
Strips a much-hyped mechanism down to its actual, portable implementation in two sentences.
The actual output that the agent sees is the skill.md file plus all the paths to the other scripts or other markdown files or other images that the agent might load if it needs... And that's basically progressive disclosure. It's a combination of having all the available paths into the context window plus read tools.
A concrete, cheap alternative to summarization that targets the biggest actual source of context bloat.
It looks at all your tool outputs, and instead of summarizing anything, it just replaces your tool outputs with a placeholder. And this works really well because your tool outputs are usually the ones that take most of your context window.
When your agent starts making mistakes, it's rarely the model, but the context window stuffed with stale files, tool outputs, and a history the model doesn't need.
Because we force the compression to one sentence, we force the LLM to extract only the high-level information and avoid being too verbose about it.
Basically, the LSP server does all the hard job, and we just put a bridge between the two.