{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "OpenClaw Configuration Package Schema",
  "description": "Structural validation for the 8 markdown files generated by openclaw-configurator",
  "type": "object",
  "required": ["BOOTSTRAP.md", "AGENTS.md", "SOUL.md", "IDENTITY.md", "USER.md", "TOOLS.md", "HEARTBEAT.md", "MEMORY.md"],
  "properties": {
    "BOOTSTRAP.md": {
      "type": "object",
      "description": "One-time onboarding ritual. Deleted after completion.",
      "required": ["loading_timing", "sections"],
      "properties": {
        "loading_timing": { "const": "one-time first-run only" },
        "sections": {
          "type": "object",
          "required": ["initial_setup", "verification", "awakening_script"],
          "properties": {
            "initial_setup": { "type": "string", "description": "Setup steps or first-contact dialogue" },
            "verification": { "type": "string", "description": "Logic to verify initial settings" },
            "awakening_script": { "type": "string", "description": "Self-introduction script" }
          }
        }
      }
    },
    "AGENTS.md": {
      "type": "object",
      "description": "Agent operation guide & memory rules. Loaded at session start.",
      "required": ["loading_timing", "sections"],
      "properties": {
        "loading_timing": { "const": "every session start" },
        "sections": {
          "type": "object",
          "required": ["code_of_conduct", "memory_rules", "decision_logic"],
          "properties": {
            "code_of_conduct": { "type": "string", "minLength": 50 },
            "memory_rules": {
              "type": "object",
              "required": ["trigger_format"],
              "properties": {
                "trigger_format": {
                  "type": "string",
                  "description": "e.g. 'remember this' -> update memory/YYYY-MM-DD.md"
                },
                "priority_order": { "type": "string" }
              }
            },
            "decision_logic": { "type": "string" },
            "tool_strategy": { "type": "string" }
          }
        },
        "best_practice": {
          "type": "string",
          "description": "Must mention git repo initialization for backup"
        }
      }
    },
    "SOUL.md": {
      "type": "object",
      "description": "Soul/persona definition. Loaded every session.",
      "required": ["loading_timing", "sections"],
      "properties": {
        "loading_timing": { "const": "every session" },
        "sections": {
          "type": "object",
          "required": ["personality", "emotional_boundaries", "values"],
          "properties": {
            "personality": {
              "type": "object",
              "required": ["traits", "tone"],
              "properties": {
                "traits": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
                "tone": { "type": "string" }
              }
            },
            "emotional_boundaries": {
              "type": "object",
              "required": ["taboo_topics"],
              "properties": {
                "taboo_topics": { "type": "array", "items": { "type": "string" } }
              }
            },
            "values": { "type": "string" },
            "linguistic_habits": { "type": "string" }
          }
        }
      }
    },
    "IDENTITY.md": {
      "type": "object",
      "description": "Identity markers. Created/updated during onboarding.",
      "required": ["loading_timing", "sections"],
      "properties": {
        "loading_timing": { "const": "created/updated during onboarding ritual" },
        "sections": {
          "type": "object",
          "required": ["name", "emoji", "signature"],
          "properties": {
            "name": { "type": "string", "minLength": 1 },
            "nicknames": { "type": "array", "items": { "type": "string" } },
            "vibe": { "type": "string" },
            "emoji": { "type": "string", "minLength": 1 },
            "signature": { "type": "string" }
          }
        }
      }
    },
    "USER.md": {
      "type": "object",
      "description": "User profile. Loaded every session.",
      "required": ["loading_timing", "sections"],
      "properties": {
        "loading_timing": { "const": "every session" },
        "sections": {
          "type": "object",
          "required": ["name", "background"],
          "properties": {
            "name": { "type": "string", "minLength": 1 },
            "preferred_address": { "type": "string" },
            "background": {
              "type": "object",
              "properties": {
                "profession": { "type": "string" },
                "interests": { "type": "array", "items": { "type": "string" } }
              }
            },
            "privacy_sensitivity": { "type": "string" }
          }
        }
      }
    },
    "TOOLS.md": {
      "type": "object",
      "description": "Tools guide & skill notes. Reference as needed.",
      "required": ["loading_timing", "sections"],
      "properties": {
        "loading_timing": { "const": "reference as needed" },
        "sections": {
          "type": "object",
          "required": ["local_tool_conventions"],
          "properties": {
            "local_tool_conventions": { "type": "string" },
            "skill_notes": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "skill_name": { "type": "string" },
                  "environment_details": { "type": "string" }
                }
              }
            },
            "error_handling": { "type": "string" }
          }
        }
      }
    },
    "HEARTBEAT.md": {
      "type": "object",
      "description": "Heartbeat check. Periodic (every 30 min).",
      "required": ["loading_timing", "sections"],
      "properties": {
        "loading_timing": { "const": "periodic every 30 minutes" },
        "sections": {
          "type": "object",
          "required": ["productive_checklist"],
          "properties": {
            "productive_checklist": {
              "type": "array",
              "items": { "type": "string" },
              "minItems": 3,
              "description": "Must NOT be just 'HEARTBEAT_OK'"
            },
            "health_status": { "type": "string" },
            "long_term_reminders": { "type": "string" }
          }
        }
      }
    },
    "MEMORY.md": {
      "type": "object",
      "description": "Long-term memory. Only loaded in main private session.",
      "required": ["loading_timing", "sections"],
      "properties": {
        "loading_timing": { "const": "main private session only" },
        "sections": {
          "type": "object",
          "required": ["persistent_memories"],
          "properties": {
            "persistent_memories": { "type": "array", "items": { "type": "string" } },
            "user_preferences": { "type": "array", "items": { "type": "string" } },
            "relationship_milestones": { "type": "array", "items": { "type": "string" } }
          }
        }
      }
    }
  },
  "output_constraints": {
    "workspace_path": "~/.openclaw/workspace/",
    "format": "markdown",
    "security_keywords_required_when_public_channel": ["dmPolicy", "allowFrom"],
    "pii_must_not_be_stored_in_plaintext": true
  }
}
