๐ŸŒ AIๆœ็ดข & ไปฃ็† ไธป้กต
Skip to content

Petsuro85/context-hive

Repository files navigation

Context Hive

AI as Team Member from Day 0 - A practical approach to AI-driven development

Context Hive is a development methodology and template collection that treats AI as a full team member from the very beginning of a project (Day 0 / Phase 0). Instead of using AI as a tool, we collaborate with AI through comprehensive documentation that serves as shared context.

Core Philosophy

  • AI joins from Day 0: AI participates in the project from the pre-start phase, not as an afterthought
  • Documentation as shared context: Vision, requirements, design, and rules serve as the foundation for AI collaboration
  • Practical, not perfect: We share real experiences, including failures and limitations
  • Scale limits unknown: We're honest about what we don't know yet

Core Architecture

Context Hive is built around three key components working together:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     Phase 0: Pre-Start                      โ”‚
โ”‚                                                             โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
โ”‚  โ”‚ Vision.md โ”‚โ”€โ”€โ”‚Requirements  โ”‚โ”€โ”€โ”‚Design  โ”‚โ”€โ”€โ”‚Rules.md โ”‚โ”‚
โ”‚  โ”‚           โ”‚  โ”‚    .md       โ”‚  โ”‚  .md   โ”‚  โ”‚         โ”‚โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ”‚        โ”‚                โ”‚               โ”‚            โ”‚     โ”‚
โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
โ”‚                         โ–ผ               โ–ผ                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚               โ”‚
                          โ–ผ               โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚           Hub System              โ”‚
              โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
              โ”‚  โ”‚  build_graph.py             โ”‚ โ”‚
              โ”‚  โ”‚  validate_context.py        โ”‚ โ”‚
              โ”‚  โ”‚  gen_reading_list.py        โ”‚ โ”‚
              โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
              โ”‚                                   โ”‚
              โ”‚  Generates:                      โ”‚
              โ”‚  - Dependency graph (graph.json)  โ”‚
              โ”‚  - Visualizations (graph.mmd)     โ”‚
              โ”‚  - Reading lists per task         โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
           โ”‚         Service Layer                   โ”‚
           โ”‚                                          โ”‚
           โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
           โ”‚  โ”‚ Service A  โ”‚      โ”‚ Service B  โ”‚   โ”‚
           โ”‚  โ”‚            โ”‚      โ”‚            โ”‚   โ”‚
           โ”‚  โ”‚ โ”œโ”€app/     โ”‚      โ”‚ โ”œโ”€app/     โ”‚   โ”‚
           โ”‚  โ”‚ โ”œโ”€tests/   โ”‚      โ”‚ โ”œโ”€tests/   โ”‚   โ”‚
           โ”‚  โ”‚ โ””โ”€tasks/   โ”‚      โ”‚ โ””โ”€tasks/   โ”‚   โ”‚
           โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

How It Works

  1. Phase 0 (Pre-Start): Write four pillar documents

    • Vision: Project goals and purpose
    • Requirements: What needs to be built
    • Design: How it will be built
    • Rules: Development standards
  2. Hub: Manages context and dependencies

    • Scans service metadata (service.meta.yaml)
    • Generates dependency graphs
    • Creates optimized reading lists for AI
    • Validates consistency
  3. Services: Implement features with AI

    • Each service declares its dependencies
    • Tasks reference specific documents
    • AI reads in optimal order (via reading lists)
    • Humans review and iterate

Key Benefit

Traditional approach: AI gets code snippets โ†’ makes mistakes โ†’ constant corrections

Context Hive: AI gets complete context โ†’ autonomous implementation โ†’ minimal corrections

Quick Start (30 minutes)

  1. Read the getting started guide: docs/getting-started.md
  2. Try the minimal example: examples/minimal/
  3. Use the template: template/minimal/

Developer Checks

  • Run pre-commit install after cloning to enable the shared linting suite (Black, Ruff, mypy, markdownlint, codespell, prettier, etc.).
  • Execute scripts/audit_codex.sh to run the full codex audit locally. Results are written to reports/codex/audit.json and reports/codex/audit.html.
  • See docs/CODEX_AUDIT_GUIDE.md for audit criteria, pass/fail gates, and triage workflow.

Documentation

Getting Started

Core Concepts

Comparisons

Contributing

What's Inside

Hub: Context Management System

  • Hub Tools (hub/tools/) - Python scripts for managing context
    • build_graph.py - Generate dependency graphs
    • validate_context.py - Validate context consistency
    • gen_reading_list.py - Generate AI reading lists
  • Hub Metadata (hub/meta/) - Generated graphs and reading lists
    • graph.json - Machine-readable dependency graph
    • graph.mmd - Mermaid visualization
    • reading_lists/ - Generated reading orders for AI

Services

  • Sample Service (services/sample_service/) - Example service structure
    • Service metadata (service.meta.yaml)
    • Task definitions
    • Implementation example

Templates

  • Minimal Template (template/minimal/) - The essential 4-document starter kit
    • Vision document
    • Requirements document
    • Design document
    • Rules document

Examples

  • Minimal Example (examples/minimal/) - A working FastAPI Hello World built with Context Hive
    • Complete documentation set
    • Implementation code
    • Tests

Scripts

Project Structure

context-hive/
โ”œโ”€โ”€ README.md                    # This file
โ”œโ”€โ”€ THEORY.md                    # Core methodology
โ”œโ”€โ”€ APPLICABILITY.md             # When to use this approach
โ”œโ”€โ”€ CONTRIBUTING.md              # Contribution guidelines
โ”œโ”€โ”€ LICENSE                      # License information
โ”œโ”€โ”€ requirements.txt             # Python dependencies
โ”‚
โ”œโ”€โ”€ docs/                        # Documentation
โ”‚   โ”œโ”€โ”€ getting-started.md       # 30-minute tutorial
โ”‚   โ”œโ”€โ”€ concepts.md              # Core concepts and Hub architecture
โ”‚   โ”œโ”€โ”€ philosophy.md            # Design decisions and rationale
โ”‚   โ”œโ”€โ”€ process.md               # 5-phase development process
โ”‚   โ”œโ”€โ”€ comparison.md            # vs. other approaches
โ”‚   โ””โ”€โ”€ best-practices.md        # Practical guidelines
โ”‚
โ”œโ”€โ”€ hub/                         # Hub: Context Management System
โ”‚   โ”œโ”€โ”€ README.md                # Hub documentation
โ”‚   โ”œโ”€โ”€ meta/                    # Generated metadata
โ”‚   โ”‚   โ”œโ”€โ”€ graph.json           # Dependency graph (machine-readable)
โ”‚   โ”‚   โ”œโ”€โ”€ graph.mmd            # Dependency graph (Mermaid)
โ”‚   โ”‚   โ””โ”€โ”€ reading_lists/       # Generated AI reading lists
โ”‚   โ””โ”€โ”€ tools/                   # Hub management tools
โ”‚       โ”œโ”€โ”€ build_graph.py       # Generate dependency graph
โ”‚       โ”œโ”€โ”€ validate_context.py  # Validate context consistency
โ”‚       โ””โ”€โ”€ gen_reading_list.py  # Generate reading lists
โ”‚
โ”œโ”€โ”€ services/                    # Service implementations
โ”‚   โ””โ”€โ”€ sample_service/          # Example service
โ”‚       โ”œโ”€โ”€ README.md            # Service documentation
โ”‚       โ”œโ”€โ”€ service.meta.yaml    # Service metadata
โ”‚       โ”œโ”€โ”€ app/                 # Implementation
โ”‚       โ””โ”€โ”€ tasks/               # Task definitions
โ”‚
โ”œโ”€โ”€ scripts/                     # Utility scripts
โ”‚   โ””โ”€โ”€ init-project.sh          # Project initialization script
โ”‚
โ”œโ”€โ”€ template/
โ”‚   โ””โ”€โ”€ minimal/                 # Minimal template (4 documents)
โ”‚       โ”œโ”€โ”€ README.md
โ”‚       โ””โ”€โ”€ docs/
โ”‚           โ””โ”€โ”€ templates.md
โ”‚
โ””โ”€โ”€ examples/
    โ””โ”€โ”€ minimal/                 # Working example
        โ”œโ”€โ”€ README.md
        โ”œโ”€โ”€ docs/               # 4 core documents
        โ””โ”€โ”€ src/                # Implementation

Key Principles

  1. Phase 0: Pre-start - AI joins before coding begins
  2. Documentation First - Create shared context before implementation
  3. Iterative Collaboration - AI and humans iterate together
  4. Learning from Failures - We welcome and share failure stories

When to Use Context Hive

Context Hive works well for:

  • Greenfield projects starting from scratch
  • Projects with clear business goals
  • Teams open to AI collaboration
  • Iterative development processes

See APPLICABILITY.md for detailed guidance.

Development Setup

For Contributors

If you want to contribute to Context Hive itself, follow these steps:

# Clone the repository
git clone https://github.com/Petsuro85/context-hive.git
cd context-hive

# Switch to develop branch
git checkout develop

# Run the bootstrap script to set up your environment
bash scripts/bootstrap_dev.sh

# This will:
# - Create a Python virtual environment
# - Install all dependencies
# - Set up pre-commit hooks
# - Run initial validation

Development Workflow

Context Hive uses a develop โ†’ master workflow:

  • develop: Active development branch where all work happens
  • master: Protected production branch for public releases

Before submitting changes:

# Run full validation suite
bash scripts/validate_all.sh

# This runs:
# - Schema validation (strict mode)
# - Dependency graph generation
# - Reading list generation

Useful Scripts

# Generate reading list for a service/task
bash scripts/make_readinglist.sh sample_service implement_api

# Generate release notes from commits
bash scripts/release_notes.sh

# Bootstrap development environment
bash scripts/bootstrap_dev.sh

Pre-commit Hooks

Pre-commit hooks automatically run on every commit to ensure code quality:

  • Python: black (formatting), ruff (linting), mypy (type checking)
  • Markdown: mdformat (formatting)
  • General: trailing whitespace, YAML/JSON validation

If hooks fail, fix the issues and commit again.

Contributing

We welcome contributions! This includes:

  • Success stories and case studies
  • Failure stories and lessons learned
  • Template improvements
  • Documentation enhancements
  • Translation

See CONTRIBUTING.md for details.

License

MIT License - See LICENSE file for details.

Community


Remember: AI as team member, not as tool. Documentation as shared context, not as burden.