---
id: "concept-context-engineering-d23"
type: "concept"
source_timestamps: ["00:11:18", "00:11:31"]
tags: ["software-architecture", "code-readability"]
related: ["concept-structural-context", "concept-semantic-context", "action-create-module-manifests", "action-define-rules-of-engagement", "framework-dark-code-solution"]
definition: "The practice of restructuring codebases to embed structural and semantic comprehension directly into the code, making it legible to both humans and AI agents."
sources: ["s23-amazon-16k-engineers"]
sourceVaultSlug: "s23-amazon-16k-engineers"
originDay: 23
---
# Context Engineering

## Definition

**Context Engineering** is the practice of restructuring a codebase so that comprehension is embedded directly within the code itself — rather than existing solely in external documentation or in the heads of senior engineers.

## Why It Matters Now

As AI agents become primary contributors to codebases, the code must be immediately legible to *both* humans and machines. External wikis, tribal knowledge, and Confluence pages do not survive an AI-driven authorship pipeline. The codebase itself must teach.

## The Two Pillars

### 1. [[concept-structural-context]] — answers *where*

Manifests at every module/service boundary explaining what the module does, what it depends on, and what depends on it. Operationalized in [[action-create-module-manifests]].

### 2. [[concept-semantic-context]] — answers *what*

Rules of engagement embedded in interfaces — performance expectations, failure modes, retry semantics, behavioral contracts. Operationalized in [[action-define-rules-of-engagement]].

## The Goal: Self-Describing Systems

A codebase that is properly context-engineered does not require oral tradition or onboarding sessions. An AI agent (or new human engineer) reading any module can determine:

- Where this code fits architecturally
- What it is allowed to do
- What it must never do
- How it must behave under failure

This directly suppresses [[concept-dark-code]] generation because every AI contribution is constrained by machine-readable architectural guardrails.

## Where It Sits in the 3-Layer Defense

Layer 2 of [[framework-dark-code-solution]].


## Related across days
- [[concept-context-engineering-d24]]
- [[framework-ai-skill-hierarchy]]
- [[concept-harness-engineering]]
