{
  "description": "WAI-WAY context map - maps phases to required files. READ the scaffolded files, they contain inline documentation.",
  "golden_rule": "THE SCAFFOLDED FILES ARE YOUR DOCUMENTATION. Read the file. Follow the pattern. Extend.",
  "phases": {
    "0_brainstorm_spec": {
      "agent": "extractor",
      "goal": "Gather requirements through conversation and produce validated spec",
      "flow": "User idea → Agent questions → Agent fills spec → User validates",
      "done_when": "spec_template.md filled and validated by user",
      "read_files": [
        "guides/wai-way/spec_template.md",
        "guides/wai-way/presets_guide.md",
        "guides/wai-way/entity_patterns.md",
        "guides/wai-way/page_patterns.md"
      ],
      "output": "Validated spec with preset, entities, pages, auth/billing requirements"
    },
    "1_scaffold_sitemap": {
      "agent": "extractor",
      "goal": "Running app with all routes defined",
      "done_when": "All routes listed, all *Page.tsx files created with correct PageMeta",
      "read_files": [
        "src/pages/HomePage.tsx",
        "src/config/app.ts",
        "guides/wai-way/page_patterns.md"
      ],
      "output": "All *Page.tsx files created with correct PageMeta"
    },
    "2_entities": {
      "agent": "architect",
      "goal": "Define all data models",
      "done_when": "All entities defined with fields, access, visibility. Exported from index.ts",
      "read_files": [
        "entities/ExampleEntity.ts",
        "entities/index.ts",
        "guides/wai-way/entity_patterns.md"
      ],
      "output": "All entities defined in entities/"
    },
    "3_compose": {
      "agent": "builder",
      "goal": "Build pages with components (hardcoded strings)",
      "done_when": "All pages functional, CRUD uses EntityList/EntityFormRenderer, strings hardcoded",
      "read_files": [
        "src/pages/ListPageExample.tsx",
        "src/pages/FormPageExample.tsx",
        "src/pages/HomePage.tsx",
        "guides/wai-way/page_patterns.md"
      ],
      "output": "All pages functional with hardcoded content"
    },
    "4_configure_polish": {
      "agent": "polisher",
      "goal": "Finalize config, test, optional i18n",
      "done_when": "Config complete, tests pass, mobile responsive",
      "read_files": [
        "src/config/app.ts",
        "src/config/legal.ts",
        "src/themes.css",
        ".env"
      ],
      "output": "Working app with auth, CRUD, and config complete"
    }
  },
  "key_files": {
    "spec": {
      "guides/wai-way/spec_template.md": "App specification template - fill before coding",
      "guides/wai-way/presets_guide.md": "Preset decision matrix - landing/admin/moolti/docs/blog/game/plain",
      "guides/wai-way/entity_patterns.md": "Common entity schemas - UserProfile, Post, Product, Order, etc.",
      "guides/wai-way/page_patterns.md": "Common page structures - Dashboard, List, Form, Landing, Settings, etc."
    },
    "config": {
      "src/config/app.ts": "App name, preset, features, auth routes",
      "src/config/legal.ts": "Company info, legal compliance",
      ".env": "Firebase config, API keys"
    },
    "pages": {
      "src/pages/HomePage.tsx": "PageMeta pattern, basic page structure",
      "src/pages/ListPageExample.tsx": "EntityList CRUD pattern",
      "src/pages/FormPageExample.tsx": "EntityFormRenderer pattern"
    },
    "entities": {
      "entities/ExampleEntity.ts": "defineEntity pattern, field types, access rules",
      "entities/index.ts": "Entity exports"
    },
    "styling": {
      "src/themes.css": "CSS variables, light/dark themes",
      "src/globals.css": "Font overrides"
    }
  },
  "workflow": {
    "summary": "BRAINSTORM → SPEC → SCAFFOLD → ENTITIES → COMPOSE → CONFIGURE",
    "critical_rule": "Spec is OUTPUT of brainstorming. User validates before coding. Validated spec = mechanical build."
  }
}
