Skip to main content
Mobile Launcher
Learning & TutorialsAdvanced AI Engineering

Context Engineering

Prompt Engineering 2.0 - Architecting the AI's Environment

Context Engineering: Prompt Engineering 2.0

Prompt Engineering is about the message. Context Engineering is about the environment in which that message is received.

What is Context Engineering?

It is the craft of shaping the information environment an AI system (like AntiGravity or Cursor) uses to reason. It involves managing:

  1. Memory: What the model remembers from previous sessions.
  2. Retrieval: What documentation or code files are actively fed into the context window.
  3. System Instructions: The role and rules the agent must follow.

The Architecture of Context (The 4 Layers)

Think of your interaction with the AI not as a chat, but as a layered system:

1. System Layer (Identity)

Defines "Who am I?". File: User Instructions / System Prompt Example: "You are a senior React Native engineer. Always use TypeScript."

2. Project Layer (Ground Truth)

Connects the model to your specific codebase conventions. File: .cursorrules, CLAUDE.md, .antigravity Content: "We use Restyle for styling. We use Redux Toolkit. We use Supabase."

3. Session Layer (Focus)

Maintains the immediate goal and relevant files. File: .memory/active.md (U-AMOS) Content: "We are currently refactoring the Auth flow. The Payments module is irrelevant right now."

4. Prompt Layer (Instruction)

The immediate request. Input: "Add a 'Forgot Password' button."

Why it Matters

Most AI "failures" aren't because the model is dumb, but because it lacks Context.

  • If the AI doesn't know you use Tailwind instead of StyleSheet, it will generate the wrong code.
  • If it doesn't know your file structure, it will suggest creating files in the wrong place.

Context Engineering is about ensuring the AI knows these things before you even ask for code.

Implementing in This Boilerplate

We use U-AMOS to automate Context Engineering:

  • .memory/: Maintains the Session Layer history.
  • .agent/rules/: Defines the Project Layer constraints.
  • src/ui/README.md: Provides a component inventory for the model to "see" existing UI.

Read full guide on Substack