# Context-as-Code
Context-as-Code is the practice of treating AI context definitions as version-controlled, reviewable, testable code rather than ephemeral prompt text. Just as Infrastructure-as-Code brought software engineering discipline to infrastructure, Context-as-Code brings the same discipline to AI context management.
## Manifestations
- **CLAUDE.md / AGENTS.md files**: AI behavior rules, conventions, and context stored in version-controlled files alongside code
- **Skill definitions**: codified procedures (SKILL.md files) that define exactly how AI should perform specific tasks
- **Agent configurations**: agent identity, memory, and capabilities defined in structured files
- **MCP server configs**: tool and integration definitions stored as configuration
- **Hook definitions**: event-driven behaviors defined in settings files
## Why it matters
When context is code:
- It can be **reviewed** in pull requests (someone changing AI behavior should be reviewed like any code change)
- It can be **versioned** (you can roll back to a previous AI configuration)
- It can be **tested** (verify that context changes produce expected outputs)
- It can be **shared** (teams inherit and extend context through standard version control workflows)
- It can be **audited** (compliance teams can inspect exactly what context AI operates with)
## Connection to the context management hierarchy
Context-as-Code is the implementation pattern that makes [[Team Context Management (TCM)]] and [[Enterprise Context Management (ECM)]] practical. Without it, context management stays informal and fragile. With it, context management becomes an engineering discipline.
At the [[Personal Context Management (PCM)|PCM]] level, a vault like this one (with CLAUDE.md, skills, agent configurations, and memory systems) is already practicing Context-as-Code.
## References
-
## Related
- [[Context Engineering]]
- [[Personal Context Management (PCM)]]
- [[Team Context Management (TCM)]]
- [[Enterprise Context Management (ECM)]]
- [[Harness Engineering]]
- [[Claude Code]]
- [[AI Agent Skills]]
- [[AI Agent Identity]]
- [[Model Context Protocol (MCP)]]