{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/saltapp-ai/json-schema/saltapp-ai-team-draft-request-schema.json",
  "title": "TeamDraftRequest",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/saltapp-ai-openapi.json#/components/schemas/TeamDraftRequest",
  "type": "object",
  "properties": {
    "idea": {
      "type": "string",
      "maxLength": 500,
      "description": "Required on the first call; may be omitted once `draft.idea` carries it."
    },
    "step": {
      "type": "string",
      "enum": [
        "team",
        "personality",
        "authority"
      ],
      "default": "team",
      "description": "`team`: team_name, description, how_they_work, lead_index and each member's role, name, handle, bio, brief and why (with a draft that has members and the same idea, or a nudge, the team is revised and members whose handle survives keep their later work). `personality`: each member's voice, and the lead's first_message. `authority`: each member's skills, services, budget_per_day, actions_estimate, model_budget_usd and budget_basis, and the team `totals`."
    },
    "draft": {
      "type": "object",
      "description": "The current draft as the person has edited it. Required, with 2 to 5 members each holding a brief, for `personality` and `authority`. Every field a step does not write comes back as sent (cut to its cap).",
      "properties": {
        "idea": {
          "type": "string",
          "maxLength": 500
        },
        "team_name": {
          "type": "string",
          "maxLength": 60,
          "description": "Becomes the AgentGroup's name."
        },
        "description": {
          "type": "string",
          "maxLength": 200
        },
        "how_they_work": {
          "type": "string",
          "maxLength": 300,
          "description": "Plain words: who does what and how a question moves through the team."
        },
        "rules": {
          "type": "array",
          "maxItems": 10,
          "items": {
            "type": "string",
            "maxLength": 200
          },
          "description": "The team's working agreement: 3 to 5 plain lines (who leads, who publishes, work saved in the team folder, ask before spending), written by the `team` step and kept as sent by the others. Send them as `rules` on PATCH /api/v1/agent_groups/{id} once the team exists."
        },
        "lead_index": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Index into `members` of the lead, the arbiter of the team's room; null for no lead."
        },
        "members": {
          "type": "array",
          "minItems": 0,
          "maxItems": 5,
          "items": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string",
                "maxLength": 40,
                "description": "The member's job (\"Showrunner\"). Becomes the group membership's `role`."
              },
              "name": {
                "type": "string",
                "maxLength": 40,
                "description": "Never contains \"Salt\"."
              },
              "handle": {
                "type": "string",
                "maxLength": 30,
                "description": "A suggestion: valid, not reserved, free on Salt, and unique in the team."
              },
              "bio": {
                "type": "string",
                "maxLength": 280,
                "description": "PUBLIC."
              },
              "brief": {
                "type": "string",
                "maxLength": 4000,
                "description": "PRIVATE. Ends with Salt's \"Working in the team:\" rules in plain words (the lead's, a member's or the no-lead variant), so the member behaves in the room even on a runtime that knows nothing about teams. Becomes `persona.purpose`."
              },
              "why": {
                "type": "string",
                "maxLength": 200,
                "description": "Why this member is on the team."
              },
              "voice": {
                "type": "string",
                "maxLength": 2000
              },
              "first_message": {
                "type": "string",
                "maxLength": 500,
                "description": "The lead only: the room's introduction. Empty for every other member, and for all of them when the team has no lead."
              },
              "skills": {
                "type": "object",
                "description": "Every skill Salt knows appears exactly once across the two lists (after step `authority`). `money`, `mandates` and `agents` are always optional with the why \"Always your call, never set for you\": the AI never recommends them. To create the agent, send the `recommended` keys the person left on as `persona.skills`.",
                "properties": {
                  "recommended": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "enum": [
                            "reminders",
                            "posts",
                            "memory",
                            "plugins",
                            "web_watching",
                            "files",
                            "money",
                            "mandates",
                            "agents"
                          ]
                        },
                        "why": {
                          "type": "string",
                          "maxLength": 120
                        }
                      }
                    }
                  },
                  "optional": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "enum": [
                            "reminders",
                            "posts",
                            "memory",
                            "plugins",
                            "web_watching",
                            "files",
                            "money",
                            "mandates",
                            "agents"
                          ]
                        },
                        "why": {
                          "type": "string",
                          "maxLength": 120
                        }
                      }
                    }
                  }
                }
              },
              "services": {
                "type": "array",
                "description": "The caller's own connected services, each once. A service is never granted by drafting: after the agent exists, `POST /api/v1/connections/services/{provider}/grants {agent_id}` gives it.",
                "items": {
                  "type": "object",
                  "properties": {
                    "provider": {
                      "type": "string"
                    },
                    "recommended": {
                      "type": "boolean"
                    },
                    "why": {
                      "type": "string",
                      "maxLength": 120
                    }
                  }
                }
              },
              "budget_per_day": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1,
                "maximum": 200,
                "description": "`persona.budget_per_day`. Null until step `authority` has run."
              },
              "actions_estimate": {
                "type": "string",
                "maxLength": 120,
                "description": "e.g. \"about 3: write, post, send to you\"."
              },
              "model_budget_usd": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The agent's suggested model spend per UTC month, a decimal string of whole dollars from \"10\" to \"1000\" (`persona.model_budget_usd`, the same shape GET /agents/{id}/admin returns). Sized by plain arithmetic from `actions_estimate` and the recommended skills (about $0.068 an action, 30 days, 25% headroom, up to the next $5), never by the model. Null until step `authority` has run. The owner changes it later with PATCH /api/v1/agents/{id}/persona."
              },
              "budget_basis": {
                "type": "string",
                "maxLength": 120,
                "description": "One short phrase saying what the budget was sized from, e.g. \"About 10 actions a day\". Empty until step `authority` has run."
              }
            }
          }
        },
        "totals": {
          "type": "object",
          "properties": {
            "actions_per_day": {
              "type": [
                "integer",
                "null"
              ],
              "description": "The turns a normal day is expected to take across the team."
            },
            "owner_messages_per_day": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 1,
              "maximum": 60,
              "description": "How many messages the owner is expected to send the team in a day (the model's estimate, clamped); every member's daily budget is sized from it."
            },
            "model_budget_usd": {
              "type": [
                "string",
                "null"
              ],
              "description": "The sum of the members' monthly model limits, a decimal string."
            },
            "budget_basis": {
              "type": "string"
            }
          }
        }
      }
    },
    "nudge": {
      "type": "string",
      "maxLength": 120,
      "description": "Steers a revision or a rewrite, e.g. \"Add a researcher\" or \"More playful\"."
    }
  }
}