{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Project Guidelines Schema",
  "description": "Legacy schema - project guidelines now managed by spec system (`ccw spec load --dimension specs`)",
  "type": "object",
  "required": ["conventions", "constraints", "_metadata"],
  "properties": {
    "conventions": {
      "type": "object",
      "description": "Coding conventions and standards",
      "required": ["coding_style", "naming_patterns", "file_structure", "documentation"],
      "properties": {
        "coding_style": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Coding style rules (e.g., 'Use strict TypeScript mode', 'Prefer const over let')"
        },
        "naming_patterns": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Naming conventions (e.g., 'Use camelCase for variables', 'Use PascalCase for components')"
        },
        "file_structure": {
          "type": "array",
          "items": { "type": "string" },
          "description": "File organization rules (e.g., 'One component per file', 'Tests alongside source files')"
        },
        "documentation": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Documentation requirements (e.g., 'JSDoc for public APIs', 'README for each module')"
        }
      }
    },
    "constraints": {
      "type": "object",
      "description": "Technical constraints and boundaries",
      "required": ["architecture", "tech_stack", "performance", "security"],
      "properties": {
        "architecture": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Architecture constraints (e.g., 'No circular dependencies', 'Services must be stateless')"
        },
        "tech_stack": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Technology constraints (e.g., 'No new dependencies without review', 'Use native fetch over axios')"
        },
        "performance": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Performance requirements (e.g., 'API response < 200ms', 'Bundle size < 500KB')"
        },
        "security": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Security requirements (e.g., 'Sanitize all user input', 'No secrets in code')"
        }
      }
    },
    "quality_rules": {
      "type": "array",
      "description": "Enforceable quality rules",
      "items": {
        "type": "object",
        "required": ["rule", "scope"],
        "properties": {
          "rule": {
            "type": "string",
            "description": "The quality rule statement"
          },
          "scope": {
            "type": "string",
            "description": "Where the rule applies (e.g., 'all', 'src/**', 'tests/**')"
          },
          "enforced_by": {
            "type": "string",
            "description": "How the rule is enforced (e.g., 'eslint', 'pre-commit', 'code-review')"
          }
        }
      }
    },
    "learnings": {
      "type": "array",
      "description": "Project learnings captured from workflow sessions",
      "items": {
        "type": "object",
        "required": ["date", "insight"],
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "description": "Date the learning was captured (YYYY-MM-DD)"
          },
          "session_id": {
            "type": "string",
            "description": "WFS session ID where the learning originated"
          },
          "insight": {
            "type": "string",
            "description": "The learning or insight captured"
          },
          "context": {
            "type": "string",
            "description": "Additional context about when/why this learning applies"
          },
          "category": {
            "type": "string",
            "enum": ["architecture", "performance", "security", "testing", "workflow", "other"],
            "description": "Category of the learning"
          }
        }
      }
    },
    "_metadata": {
      "type": "object",
      "required": ["created_at", "version"],
      "properties": {
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 timestamp of creation"
        },
        "version": {
          "type": "string",
          "description": "Schema version (e.g., '1.0.0')"
        },
        "last_updated": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 timestamp of last update"
        },
        "updated_by": {
          "type": "string",
          "description": "Who/what last updated the file (e.g., 'user', 'workflow:session:solidify')"
        }
      }
    }
  }
}
