Build systems that remain coherent under entropy and teach coherence through use.
This repository implements a fractal architecture for GitHub Actions workflows that:
- ✅ Remains coherent across substrates (GitHub Actions, Docker, local machines)
- ✅ Handles entropy gracefully (disk exhaustion, memory pressure, network failures)
- ✅ Teaches through structure (learn by living in the system)
- ✅ Scales through patterns that repeat at every level
Not code that works once.
Structure that holds its shape.
- Read the mental model: docs/onboarding/MENTAL_MODEL.md
- Explore a workflow: .github/workflows/ci.yml
- See the pattern: .github/workflows/_template.yml
- Start contributing: docs/onboarding/CONTRIBUTING.md
- When things break: docs/operations/RUNBOOK.md
- How to debug: Check metrics in
.metrics/directory - System health: Run
bash scripts/core/health-check.sh
- Why this exists: docs/architecture/PHILOSOPHY.md
- Governing principles: docs/architecture/PRINCIPLES.md
- Recurring patterns: docs/architecture/PATTERNS.md
- Decision history: docs/architecture/DECISION_LOG.md
Every workflow follows the same rhythm:
Init → Prepare → Execute → Report → Cleanup → Seal
This pattern repeats at every scale:
- Workflows follow this pattern
- Actions follow this pattern internally
- Scripts follow this pattern
Same pattern, different scales. Fractal.
.
├── .github/
│ ├── workflows/ # Orchestration layer
│ │ ├── _template.yml # The canonical workflow pattern
│ │ ├── ci.yml # Continuous integration
│ │ ├── test-suite.yml # Test execution
│ │ └── deploy.yml # Deployment
│ │
│ └── actions/ # Composable building blocks
│ ├── cadence/ # Behavior Layer (phase patterns)
│ │ ├── phase-init/
│ │ ├── phase-prepare/
│ │ ├── phase-execute/
│ │ ├── phase-report/
│ │ └── phase-cleanup/
│ │
│ ├── survival/ # Reality Layer (entropy handling)
│ │ ├── resource-check/
│ │ ├── cleanup-disk/
│ │ ├── prune-cache/
│ │ ├── validate-health/
│ │ └── graceful-fail/
│ │
│ └── observability/ # Teaching Layer (visibility)
│ ├── metrics-collect/
│ ├── summary-generate/
│ ├── trace-context/
│ └── failure-report/
│
├── docs/
│ ├── architecture/ # Why it's designed this way
│ │ ├── PHILOSOPHY.md # The invariants we encode
│ │ ├── PRINCIPLES.md # The 10 laws
│ │ ├── PATTERNS.md # Recurring structures
│ │ └── DECISION_LOG.md # Design decisions
│ │
│ ├── operations/ # How to operate the system
│ │ └── RUNBOOK.md # Operational procedures
│ │
│ └── onboarding/ # How to learn the system
│ ├── MENTAL_MODEL.md # How to think about it
│ └── CONTRIBUTING.md # How to extend it
│
├── scripts/ # Substrate-agnostic tooling
│ ├── core/ # Pure behavior (runs anywhere)
│ │ ├── phase-runner.sh
│ │ ├── metric-collector.sh
│ │ └── health-check.sh
│ │
│ └── adapters/ # Context-specific wrappers
│ ├── ci-adapter.sh # For GitHub Actions
│ ├── docker-adapter.sh # For containers
│ └── local-adapter.sh # For local development
│
└── manifests/ # Configuration as data
├── phases.yml # Phase definitions
├── metrics.yml # What to measure
├── thresholds.yml # When to care
└── cleanup-policies.yml # Resource management
Handles the messy reality of execution:
- Disk fills up
- Memory exhausts
- Networks fail
- Caches corrupt
Actions: resource-check, cleanup-disk, prune-cache, validate-health, graceful-fail
Defines patterns that remain invariant:
- Init (establish context)
- Prepare (ready resources)
- Execute (do work)
- Report (communicate state)
- Cleanup (manage entropy)
Actions: phase-init, phase-prepare, phase-execute, phase-report, phase-cleanup
Makes the system comprehensible:
- Collects metrics
- Generates summaries
- Establishes trace context
- Reports failures informatively
Actions: metrics-collect, summary-generate, trace-context, failure-report
Core scripts work everywhere:
- GitHub Actions
- Docker containers
- Local machines
- CI runners
- Any system with Bash
Every action reports:
- What it's doing
- What it found
- What it decided
- Why it decided it
Metrics flow to:
- GitHub step summaries
- JSON files (
.metrics/) - Artifacts (retained 30-90 days)
When things fail:
- Failures explain themselves
- Context is preserved
- Recovery is attempted
- State is reported
The system teaches through:
- Structure: Consistent patterns make unfamiliar feel familiar
- Failure: Errors explain what happened and why
- Metrics: State is always visible
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Phase 1: Init
- uses: ./.github/actions/cadence/phase-init
with:
context: ci
# Phase 2: Prepare
- uses: ./.github/actions/cadence/phase-prepare
with:
language: python
cache-key: ${{ hashFiles('requirements.txt') }}
# Phase 3: Execute
- uses: ./.github/actions/cadence/phase-execute
with:
command: pytest
collect-coverage: true
# Phase 4: Report
- uses: ./.github/actions/cadence/phase-report
if: always()
with:
phase: execute
status: ${{ job.status }}
# Phase 5: Cleanup
- uses: ./.github/actions/cadence/phase-cleanup
if: always()We optimize for sustained coherence, not short-term speed.
- Behavior is invariant — Tools change, behavior doesn't
- Structure teaches — People learn by living in the system
- Failure is information — Systems fail informatively, not silently
- Coherence under pressure — Elegance during crisis, not just calm
Read more: docs/architecture/PHILOSOPHY.md
bash scripts/core/health-check.shbash scripts/core/metric-collector.sh --type resource# Use adapters for local execution
bash scripts/adapters/local-adapter.sh phase-runner --phase init --command "echo test"# After workflow completes
gh run view <run-id>
gh run download <run-id> --name metrics-*
cat .metrics/*.json- Mental Model - How to think about the system
- Contributing - How to extend it
- Runbook - What to do when things break
- Philosophy - Why it exists
- Principles - The 10 laws
- Patterns - Recurring structures
- Decisions - Why we chose X over Y
Every workflow looks the same. Learn once, use everywhere.
Always know what's happening. Metrics, summaries, reports.
Handles failure gracefully. Informative errors. Recovery hints.
New contributors productive in hours, not weeks.
Same code works in GitHub Actions, Docker, local machines.
Repository (manifests → scripts → actions → workflows → docs)
↓
Workflow (init → prepare → execute → report → cleanup → seal)
↓
Action (inputs → validate → execute → report → outputs)
↓
Script (args → check → run → log → exit)
Same rhythm at every level.
- ✅ "How do I make workflows consistent?" → Use the cadence pattern
- ✅ "How do I handle failure gracefully?" → Use survival actions
- ✅ "How do I make systems observable?" → Use observability actions
- ✅ "How do I teach new people?" → Structure teaches through use
- ✅ "How do I scale this?" → Fractal patterns repeat everywhere
This architecture is a pattern, not code. Use it, adapt it, share it.
Start here: docs/onboarding/MENTAL_MODEL.md
This is not just a CI/CD setup.
This is an architecture for systems that hold their shape.