project:
  name: CA Grow Ops Manager
  version: 0.1.0
  description: |
    A web + mobile application that reduces cognitive load for managing licensed 
    California cannabis cultivation facilities. Centralizes grow operations, labor 
    tracking, compliance recordkeeping, scheduling, and team communication.

objectives:
  - Centralize and templatize cultivation tasks by room and batch (veg, flower, dry, facility)
  - Track labor hours and associate time to rooms/batches for cost visibility
  - Support compliance-adjacent recordkeeping required by California regulators (METRC remains system of record)
  - Provide a shared schedule and communication layer for facility staff
  - Integrate with environmental monitoring and control systems (read-only dashboards initially)

actors:
  - name: Owner
    description: Facility owner with full access to all features, financial reports, and compliance exports
  - name: Compliance Manager
    description: Manages compliance records, audit packets, and regulatory documentation
  - name: Head Grower
    description: Oversees cultivation operations, creates task templates, manages batches and rooms
  - name: Staff / Trimmers
    description: Floor workers who complete tasks, clock in/out, and log batch data
  - name: Accountant
    description: Reviews labor cost reports, exports payroll data, and analyzes batch profitability

domains:
  - name: CultivationOps
    description: Tasks, batches, rooms, and cultivation workflows
    features:
      - Task templates and scheduling
      - Batch lifecycle management
      - Room management and transitions
      - Weight logging and yield tracking
      - Photo and note attachments
    
  - name: Compliance
    description: Recordkeeping and audit readiness for California DCC regulations
    features:
      - Document storage (PDFs, images) with structured metadata
      - Monthly/quarterly compliance views
      - Audit packet generation (ZIP exports)
      - METRC tag mapping (read-only in v1)
    
  - name: Labor
    description: Time tracking and labor cost analysis
    features:
      - Web/mobile timeclock
      - Role and wage rate management
      - Hours reporting (per user, per period)
      - Labor cost per room/batch
      - CSV exports for payroll systems
    
  - name: Inventory
    description: Materials, nutrients, and supplies tracking
    features:
      - Item catalog (nutrients, pots, IPM, PPE, CO₂, media, packaging)
      - Quantity, location, and supplier tracking
      - Min/max thresholds and restock alerts
      - Lot/serial tracking for recall support
    
  - name: Integrations
    description: External system connections and hardware monitoring
    features:
      - Environmental dashboards (temperature, humidity, VPD)
      - Lighting schedule status widgets
      - METRC connector (future phase)
      - Hardware adapter framework
    
  - name: Communications
    description: Team collaboration and notifications
    features:
      - Task comments and @mentions
      - Daily digest emails/notifications
      - Announcements channel
      - Role-based notification preferences

tech_stack:
  backend:
    language: TypeScript
    runtime: Node.js
    framework: Express or Fastify
    database: PostgreSQL
    orm: Prisma
    testing: Jest + Supertest
  
  frontend:
    language: TypeScript
    framework: React
    build_tool: Vite or Next.js
    components: Radix UI or shadcn-style
    styling: Tailwind CSS or modern CSS-in-JS
    testing: Vitest + React Testing Library
  
  mobile:
    approach: Web-first (tablet-optimized)
    stretch_goal: React Native or Capacitor PWA

phases:
  - name: Phase 1 - Foundation
    version: 0.1.0
    features:
      - Authentication and RBAC
      - Task templates and scheduling
      - Basic batch and room management
      - Timeclock and labor tracking
      - Compliance document storage
    
  - name: Phase 2 - Operations
    version: 0.2.0
    features:
      - Advanced batch lifecycle
      - Weight logging and yield analytics
      - Inventory management
      - Environmental dashboards
      - Notification system
    
  - name: Phase 3 - Integrations
    version: 0.3.0
    features:
      - METRC connector (read/write)
      - Hardware integrations
      - Advanced reporting
      - Mobile app (if not PWA)
      - Multi-facility support

out_of_scope_v1:
  - Direct METRC write integration (read-only mapping only)
  - Payroll processing (exports only)
  - Financial accounting beyond labor cost tracking
  - Customer-facing features (B2C)
  - Automated environmental control (read-only dashboards only)

compliance_notes:
  - METRC is the authoritative system of record for California cannabis track-and-trace
  - This platform supports compliance-adjacent workflows but does not replace METRC
  - All compliance features align with California DCC guidance
  - Audit logs are immutable and exportable

repository:
  url: https://github.com/your-org/ca-grow-ops-manager
  structure:
    - .specify/memory/constitution.md
    - constitution.md
    - spec.yml
    - specs/
    - backend/
    - frontend/
    - docs/
