# Phase 4 — Master Orchestrator

> **Deliverable:** the master `CLAUDE.md` that serves as the single entry point and routes every task
> to the right Phase 2 component doc and Phase 3 shared rules.
> **Index:** [../README.md](../README.md)

## Where the deliverable lives
The master orchestrator is the repo-root file: **[../../../CLAUDE.md](../../../CLAUDE.md)**.

It is intentionally **not** stored inside this phase folder. Claude Code automatically loads a
`CLAUDE.md` from the repository root as the project's context entry point — moving it here would stop
that from working. So the live artifact stays at the root, and this file documents it.

## What the orchestrator does
- **Project overview** + ecosystem map (web ERP · desktop sync · shop POS).
- **Component directory** — a table linking each boundary to its Phase 2 doc.
- **Documentation map** — the phase-organized tree (points into `docs/phases/`).
- **Context-based routing** — a table that sends a task to the correct component doc.
- **Development workflows** — starting work, the canonical add-a-module path, cross-component changes,
  bug investigation.
- **Quality gates** — Pint clean, Pest green, routes gated, mutations validated + audited,
  migrations reversible, no copy/backup files.
- **Emergency protocols** and **meta-instructions for Claude**.

## How routing works
```
Read root CLAUDE.md
   ├─ identify the task's component (routing table)
   ├─ open that Phase 2 component doc  (docs/phases/phase-2-components/COMPONENT_*.md)
   ├─ apply Phase 3 shared rules        (docs/phases/phase-3-shared/MASTER_*.md)
   └─ for cross-boundary work, consult MASTER_INTEGRATION.md first
```

## Maintenance
When a component is added or a shared rule changes, update the root `CLAUDE.md` tables (Component
Directory, Documentation map, Context-based routing) so the entry point stays accurate. See
[../phase-6-implementation/IMPLEMENTATION_GUIDE.md](../phase-6-implementation/IMPLEMENTATION_GUIDE.md).
