Everyone designs loops. No one asks what the agent knows each tick.
Loop engineering's six building blocks are context primitives wearing new names. The scheduling is cron; what decides the outcome is the context on each tick.
56 posts tagged #context-engineering.
Loop engineering's six building blocks are context primitives wearing new names. The scheduling is cron; what decides the outcome is the context on each tick.
Session transcripts are an external memory most people delete after 30 days. A skill that greps and re-ranks them turns 'what did we decide' into an answer.
Decompose a reviewed spec into discrete tasks and spawn a fresh headless agent per task. Each unit gets a clean context window and a pass/fail gate.
Write the exact verification step into the feature spec your agent loads, so 'done' means the test passed - not that the code compiled.
Not all code is equally expensive to get wrong. Stop reviewing your agent's output uniformly and spend your scrutiny where a mistake double-charges a customer.
Taking the human out of the loop is the real unlock - but headless plus loose permissions plus production access is how you wake up to a wiped repo.
Agent-driven file discovery burns turns and fills the window with wrong guesses. A parameterized priming command loads exactly the right files in one shot.
A destructive-tool annotation plus a mid-call elicitation request gives you a human checkpoint that travels with the capability, whichever client is driving.
A single giant root rules file dilutes the agent's attention. Split context into a broad root plus directory-scoped files it loads by what it's touching.
Most AGENTS.md files defend against imagined mistakes. Mine your own transcripts, count what the agent actually gets wrong, and let that decide what to write.
A deterministic check on the agent's output, with one retry, kills a class of wrong answers no prompt rewrite reaches - and gives you a number, not a vibe.
When a tool call lacks a parameter, the agent's two instincts - fail or guess - are both wrong. Have the server elicit the missing field against a schema.
An MCP server exposes resources, tools, and prompts - context the app pulls, actions the model takes, workflows the user invokes. Most teams wire only one.
A git pre-commit hook turns 'the agent should run the tests' into 'the agent cannot commit broken code' - a deterministic gate that ships with every clone.
Scatter gating logic inline and consistency depends on luck. Collapse the policy into one named helper, make calling it a rule, and enforcement is the default.
Asking an agent to review what you say you did grades your spin, not your code. A small MCP server that reads the live diff grades reality instead.
Turn each reported agent failure into a committed synthetic scenario, then replay it headlessly on every change. The bug becomes a guardrail, not a patch.
Before you write another anti-hallucination instruction, split each wrong answer into a retrieval failure and a generation failure. They need opposite fixes.
The correction you keep re-typing into the chat is a missing command. Fold the recurring ritual into one parameterized verb backed by a rules file.
Subagents are sold as parallelism. The real win is context hygiene plus model arbitrage: cheap explorers read, and your expensive model sees only findings.
Vibe-coding a service you have never touched traps you at the first failure. Point the agent at its docs over MCP and force it to teach you back.
An unattended agent loop has no instinct for 'done.' Give it an iteration ceiling it can't argue past and a completion sentinel it can raise.
Pairing an isolated subagent with the right tools and a slice of your conventions rebuilds the proven agent loop without dragging tool logs into your thread.
The dangerous MCP server isn't the malicious one - it's the convenient all-in-one that reads untrusted data and holds privileged access to a second system.
When the window fills, agents cut corners and auto-compaction throws away the wrong things. Author a handoff file, eyeball it, restart in a session you control.
An MCP server is a trust boundary, not a passthrough. Hold every secret server-side and expose a curated verb set, so an injected agent is bounded by it.
Stop fighting the context limit with a bigger window. Write an exhaustive plan to a file, then relay fresh sessions that each tick off items until it ships.
An agent that waits for you to remember to ask it is a toy. Wire a deterministic event to a headless run that reads your rules, and routine work fires itself.
The fix for slow, flaky agent evals isn't a faster suite - it's two loops. A cheap deterministic gate on every PR, and a slow judge suite on a schedule.
Give every consequential tool a declared output schema and validate at the boundary, so the UI gates on a real success boolean instead of the agent's prose.
Ship your team's recurring workflows as server-side MCP prompts that pre-load their own data. A teammate types a slash command and the context is attached.
Build your review as a headless command with a tool allowlist, and the check you run by hand becomes the gate on every pull request. One rule, two surfaces.
A rules file is write-once and rots; auto-memory saves corrections on its own judgment. Add the human-gated layer between them so corrections compound.
Every failed agent session is a labeled example of where your context falls short. Capture them, cluster them, and fix the top category once in your rules file.
An agent reviewing its own plan shares its blind spots. Wire a different vendor's model in as a gate, and a fail verdict re-engages planning before any code.
Your debugging ability isn't intelligence, it's a procedure - and procedures are exactly what you write down once and hand to an agent. Start with a meta-skill.
Reviewing irreversible actions after the fact is too late. Split tools by reversibility, force a plan, and gate the destructive step behind a human interrupt.
Vague prompting isn't a skill gap you fix with longer prompts. It's a missing shared vocabulary - and the fix is a committed glossary, not a personal habit.
The codebase is your strongest steering signal - stronger than your prompt or your rules. Pay the exploration cost once, freeze it, and feed it to every run.
You don't author a skill from a blank page. You send a subagent to research the problem once, and the research becomes the skill - a build artifact.
The highest-leverage thing you can do for your agent isn't a better prompt - it's a better interface. Deep modules are context the agent reads at a glance.
Hand the agent two committed documents - a requirements doc that fixes the destination, a phased plan that fixes the journey - and a big feature still ships.
The blocker to running an agent overnight is never capability - it's trust. And you don't earn trust with a smarter model, but with a smaller blast radius.
Let peer agents talk freely and a query hot-potatoes between them while your bill climbs. Route everything through one orchestrator with a turn cap instead.
Your rules file is necessary but not sufficient. Persistent context degrades as the window fills - move the ignored rule into a hook that fires when it matters.
Prompt injection is a context-engineering problem. Fence untrusted tool output as data, run a guardrail hook, and cap the blast radius with permissions.
Your judgment lives in your head until something extracts it. A procedure that explores the repo, then grills you branch by branch, turns an idea into a spec.
Hand-writing an adapter per external system is the contextless agent's biggest tax. An MCP server collapses the blowup into one connection, configured once.
A plugin isn't a convenience wrapper. It's how a workflow survives leaving your laptop - the difference between a personal habit and a team standard.
Treat prompts like code: a golden dataset run headless on every change, gated by a hook that fails the build below baseline. Only a blocking eval works.
An autonomous agent isn't a bigger context window. It's a tiny window run many times, where the git log - not chat history - carries decisions between passes.
A million-token window won't fix a long build. Externalize state to a plan file and relay across fresh sessions - quality dies long before the window fills.
Hand-passing one plan per run keeps you inside the loop doing task selection. Pipe your whole issue tracker in and let the agent pick the next ticket itself.
The gap between agent capability and SME knowledge is the only problem worth solving. Context engineering is how you close it.
Copilot, Cursor, Claude Code, Codex, and OpenCode all converged on the same primitive - a rules file the agent reads on every session. Use it.
MCP is the standard protocol for plugging external systems - issue trackers, databases, design tools - into AI agents. Here's what changes when you use it.