Skip to content

Context Engineering

Context engineering answers one question: within a limited context window, what should the agent see, ignore, remember, and verify?

Context layers

LayerContentMaintained by
GoalUser task, acceptance criteria, constraintsOpenSpec or task list
Project knowledgeArchitecture, conventions, run commandsREADME, AGENTS, project memory
Working stateAssumptions, completed steps, failuresNotes, traces, task list
External knowledgeDocs, APIs, search resultsMCP resource or retrieval
EvidenceTests, builds, logs, screenshotsHarness and verification report

Principles

  • Information closer to the task has higher priority.
  • Summarize large context before injecting it.
  • Keep secrets and irrelevant logs out of model context.
  • Tool results should update working state.
  • Important assumptions need sources, tests, or documentation.

Practice

Design a context pack for an agent fixing documentation 404s:

  1. Which files are mandatory?
  2. Which logs only need summaries?
  3. Which external facts need current verification?
  4. What should never enter context?

Next: Workflow Orchestration.

基于 MIT 许可发布