liveBook · Manning

Context-as-code

As explained in Context Engineering

An approach that treats persistent instructions for AI agents as maintainable engineering artifacts.

Context as code treats persistent instructions and other agent context sources as maintainable software artifacts. It applies engineering controls to system instructions, retrieval configurations, state schemas, memory policies, and tool definitions so changes can be reviewed, tested, promoted, and traced. section 9.3.7

Operationalize context changes with four practices:

  • Version-control context assets in Git to preserve an auditable history and enable review through pull requests. section 9.3.7
  • Make shared context components modular and reusable rather than duplicating policies or identities. section 9.3.7
  • Separate context definitions from application binaries and validate configurations across development, staging, and production. section 9.3.7
  • Run evaluation suites in CI/CD to check prompt templates and retrieval configurations before merging or deployment. section 9.3.7

For agent instructions, place shared repository rules in version-controlled files, keep tool-specific adaptations separate, and reserve private preferences or tokens for untracked local configuration. Use nested instruction files for subprojects, clarify whether they extend or override root guidance, and prune stale directives during review. section 2.4.2

Listing 9.1 Example directory structure for context-as-code artifacts
context/
  prompts/
  retrievers/
  policies/
  tools/
  schemas/
  memory/
  evals/
  environments/
    dev/
    test/
    prod/

A sample repository layout groups context assets by function and separates environment-specific configurations. section 9.3.7

How Context Engineering covers it

How deep it goes
Defines version control, modularity, environment promotion, and CI quality gates without prescribing specific implementation tools.
Examples
Uses context directories for prompts, retrievers, policies, tools, schemas, memory, evaluations, and environments.
What you can do after
Operate context changes through reviewed commits, automated regression checks, environment promotion, and rollback.
How it connects
Connects context assets to Git, CI/CD, retrieval configurations, and agent instruction files.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Context Engineering. The section links point to the parts of the book it draws on.