# Context Layering Context layering is the architectural pattern of organizing AI context into hierarchical layers where each layer has a defined scope, precedence, and inheritance relationship with other layers. It's the "how" behind the [[Personal Context Management (PCM)|PCM]] → [[Team Context Management (TCM)|TCM]] → [[Enterprise Context Management (ECM)|ECM]] hierarchy. ## Layer architecture From broadest to narrowest scope: 1. **Enterprise layer**: org-wide policies, compliance rules, shared knowledge bases. Applies to all teams and individuals 2. **Team layer**: project conventions, shared skills, team-specific rules. Inherits enterprise constraints, adds team-specific context 3. **Personal layer**: individual preferences, personal knowledge, style, identity. Inherits team context, adds personal customization 4. **Task layer**: context specific to the current task. Loaded dynamically, highest precedence for the duration of the task ## Precedence rules When layers conflict, narrower scope wins: - Task overrides Personal - Personal overrides Team - Team overrides Enterprise This mirrors how CSS specificity works, or how environment variables override defaults. The principle: context closer to the action takes priority. ## Benefits - **[[Separation of Concerns]]**: each layer manages its own scope without interfering with others - **[[Context Isolation]]**: problems in one layer don't necessarily contaminate others - **Scalability**: add new layers (e.g., department-level) without restructuring existing ones - **Maintainability**: update enterprise policies once; they propagate to all teams and individuals via [[Context Inheritance]] - **Budget management**: each layer has its own [[Context Budget]] allocation ## Practical example In [[Claude Code]], this already exists: - Enterprise: organization-wide settings and MCP servers - Team: project CLAUDE.md, AGENTS.md, shared skills - Personal: user settings, personal memory, ~/.claude config - Task: conversation context, skill loaded for current operation ## References - ## Related - [[Personal Context Management (PCM)]] - [[Team Context Management (TCM)]] - [[Enterprise Context Management (ECM)]] - [[Context Inheritance]] - [[Context Isolation]] - [[Context Engineering]] - [[Separation of Concerns]] - [[Context Budget]] - [[Context-as-Code]] - [[Harness Engineering]] - [[Claude Code]] - [[Progressive Disclosure]]