# davidkimai/context-engineering architecture

> Architecture diagram of the GitHub repository davidkimai/context-engineering, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/davidkimai/context-engineering
- Repository: https://github.com/davidkimai/context-engineering

## Overview

##### Project Type & Purpose
- This is an open-source, layered handbook-plus-toolkit for “context engineering.”
- It combines theory (Markdown), hands-on guides (Jupyter/Python), reusable templates (YAML/Python), example apps (folders of code), reference docs, protocol schemas, agent demos, integration projects, and a cognitive-tools framework.

##### Main Components
a. Foundations Layer (00_foundations)
- Core theory chapters (atoms → unified field theory).
b. Guides Layer (10_guides_zero_to_hero)
- Jupyter/Python notebooks that concretely apply foundations.
c. Templates Layer (20_templates)
- Ready-to-use YAML/JSON schemas and Python scaffolds.
d. Examples Layer (30_examples)
- Toy chatbots, RAG demos, multi-agent orchestrators, etc.
e. Reference Documentation (40_reference)
- Deep dives on token budgeting, retrieval, patterns, attractors.
f. Community Contributions (50_contrib)
- Guidelines and drop-in additions.
g. Protocols Module (60_protocols)
- Protocol shells (Markdown), protocol schemas (JSON), digest docs.
h. Agents Module (70_agents)
- Demonstrations of working agents using protocols/templates.
i. Field Integration Projects (80_field_integration)
- Full “field” systems that combine protocols, agents, cognitive-tools.
j. Cognitive-Tools Framework (cognitive-tools)
- Independent collection of reasoning templates, programs, schemas, architectures.
k. CI/CD & Meta (​.github, LICENSE, README, STRUCTURE)
- Contribution guidelines, workflows, license, high-level maps.

##### Relationships & Data Flow
Foundations → Guides → Templates → Examples
↳ Reference ↔ Examples (bidirectional link for deep dive)
Templates → Protocols → Agents → Field Integration
Cognitive-Tools sits alongside Protocols/Agents as an alternate advanced framework.
- CI/CD meta-layer wraps all components.

##### Architectural Patterns & Principles
- Layered pipeline: theory → tutorial → reusable building blocks → real implementations.
- Schema-driven: JSON/YAML protocol schemas define boundaries and integration contracts.
- Agent-oriented: protocols and templates feed into agent demos and full integration projects.

##### Technologies & Artifacts
- Markdown (.md) for theory, reference, structure maps
- Jupyter Notebooks (.ipynb) & Python (.py) for hands-on guides and examples
- YAML/JSON for context schemas and protocol definitions
- CI workflows (YAML) for testing and evaluation
- Bash/CLI shells (protocol shells) for reproducible pipelines

##### Detail Level
- At the top level, show all major modules listed in (2).
- For Protocols and Agents, expand one level: show shells, schemas, digests under 60_protocols; list agent subfolders under 70_agents.
- In cognitive-tools, illustrate the four submodules: templates, programs, schemas, architectures (and integration).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "CI/CD & Meta"
        Meta[".github, LICENSE, README, STRUCTURE"]:::meta
    end

    subgraph "Foundations Layer"
        Foundations["00_foundations"]:::foundations
    end

    subgraph "Guides Layer"
        Guides["10_guides_zero_to_hero"]:::guides
    end

    subgraph "Templates Layer"
        Templates["20_templates"]:::templates
    end

    subgraph "Examples & Reference"
        Examples["30_examples"]:::examples
        Reference["40_reference"]:::reference
    end

    subgraph "Protocols & Agents"
        subgraph "Protocols Module"
            ProtocolShells["shells"]:::protocols
            ProtocolSchemas["schemas"]:::protocols
            ProtocolDigests["digests"]:::protocols
        end
        Agents["70_agents"]:::agents
        CognitiveTools["cognitive-tools"]:::ctools
    end

    Contrib["50_contrib"]:::contrib

    %% Connections
    Meta --> Foundations
    Foundations --> Guides
    Guides --> Templates
    Templates --> Examples
    Templates --> ProtocolShells
    Examples --> Reference
    Reference --> Examples
    ProtocolShells --> ProtocolSchemas
    ProtocolSchemas --> ProtocolDigests
    ProtocolDigests --> Agents
    ProtocolDigests --> CognitiveTools
    ProtocolShells --> CognitiveTools
    Agents --> CognitiveTools

    Contrib -.-> Foundations
    Contrib -.-> Guides
    Contrib -.-> Templates
    Contrib -.-> Examples
    Contrib -.-> Reference
    Contrib -.-> ProtocolShells
    Contrib -.-> ProtocolSchemas
    Contrib -.-> ProtocolDigests
    Contrib -.-> Agents
    Contrib -.-> CognitiveTools

    %% Click Events
    click Foundations "https://github.com/davidkimai/context-engineering/tree/main/00_foundations"
    click Guides "https://github.com/davidkimai/context-engineering/tree/main/10_guides_zero_to_hero"
    click Templates "https://github.com/davidkimai/context-engineering/tree/main/20_templates"
    click Examples "https://github.com/davidkimai/context-engineering/tree/main/30_examples"
    click Reference "https://github.com/davidkimai/context-engineering/tree/main/40_reference"
    click Contrib "https://github.com/davidkimai/context-engineering/tree/main/50_contrib"
    click ProtocolShells "https://github.com/davidkimai/context-engineering/tree/main/60_protocol/shells"
    click ProtocolSchemas "https://github.com/davidkimai/context-engineering/tree/main/60_protocol/schemas"
    click ProtocolDigests "https://github.com/davidkimai/context-engineering/tree/main/60_protocol/digests"
    click Agents "https://github.com/davidkimai/context-engineering/tree/main/70_agents"
    click CognitiveTools "https://github.com/davidkimai/context-engineering/tree/main/cognitive-tools"

    %% Styles
    classDef foundations fill:#D0E7FF,stroke:#0366d6
    classDef guides fill:#DFFFE0,stroke:#28a745
    classDef templates fill:#DFFFE0,stroke:#28a745
    classDef examples fill:#FFF5D0,stroke:#dbab09
    classDef reference fill:#FFF5D0,stroke:#dbab09
    classDef protocols fill:#EBD0FF,stroke:#6f42c1
    classDef agents fill:#EBD0FF,stroke:#6f42c1
    classDef ctools fill:#F0D0E0,stroke:#d5339a
    classDef contrib fill:#F0F0F0,stroke:#6a737d
    classDef meta fill:#EEEEEE,stroke:#999999
```
