{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/saltapp-ai/json-schema/saltapp-ai-strategy-schema.json",
  "title": "Strategy",
  "description": "A plan a person approves once (0.227.0, MandateStrategy). Served on the mandate as `strategy`; its mandate keeps kind \"explicit\".",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/saltapp-ai-openapi.json#/components/schemas/Strategy",
  "type": "object",
  "properties": {
    "strategy_id": {
      "type": "string",
      "maxLength": 64,
      "description": "Chosen by the agent, or minted when absent."
    },
    "goal": {
      "type": "string",
      "maxLength": 200
    },
    "plan": {
      "type": "array",
      "minItems": 1,
      "maxItems": 12,
      "items": {
        "type": "string",
        "maxLength": 200
      }
    },
    "targets": {
      "type": "array",
      "minItems": 1,
      "maxItems": 10,
      "items": {
        "type": "object",
        "properties": {
          "metric": {
            "type": "string",
            "maxLength": 80
          },
          "target": {
            "type": "number"
          },
          "unit": {
            "type": "string",
            "maxLength": 20
          },
          "deadline": {
            "type": "string",
            "format": "date",
            "description": "In the future when filed or edited."
          },
          "source": {
            "type": "string",
            "description": "A GET /api/v1/metrics source id, or service:<provider> for a connected outside service."
          },
          "baseline": {
            "type": "number"
          },
          "measure": {
            "type": "object",
            "description": "How the target is measured (0.228.0), at most 500 bytes as JSON, stored as given. `kind` salt: args {source,...params} of a GET /api/v1/metrics source; service: args {provider, tool, input}; fetch: args {url, format json|text}; browser: args {account, url, selector_hint}. `path` is the dot path to the number in the result. A `service:<provider>` source, or the runtime's `provider/tool` form (normalised to `service:<provider>`), gets a service recipe when none is given.",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "salt",
                  "service",
                  "fetch",
                  "browser"
                ]
              },
              "args": {
                "type": "object"
              },
              "path": {
                "type": "string",
                "maxLength": 200
              }
            },
            "required": [
              "kind",
              "args"
            ]
          }
        },
        "required": [
          "metric",
          "target",
          "unit",
          "deadline",
          "source"
        ]
      }
    },
    "needs": {
      "type": "array",
      "maxItems": 20,
      "items": {}
    },
    "budget": {
      "type": "object",
      "properties": {
        "amount": {
          "type": "string"
        },
        "currency": {
          "type": "string"
        },
        "period": {
          "type": "string",
          "enum": [
            "daily",
            "weekly",
            "monthly"
          ]
        }
      }
    },
    "payees": {
      "type": "array",
      "maxItems": 10,
      "description": "Who a strategy-wake payment may go to: {address (0x...), chain}. Part of what the owner approves; the owner cannot edit it on the card and the agent cannot change it without a new proposal. An agent pays on its own wake only to an address listed here.",
      "items": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "chain": {
            "type": "string"
          }
        },
        "required": [
          "address",
          "chain"
        ]
      }
    },
    "model_budget": {
      "type": "object",
      "description": "What the agent may spend on its model for this person (0.228.0). On approval the agent's model budget (persona.model_budget_usd) is raised to at least this; never lowered.",
      "properties": {
        "usd_per_month": {
          "type": "number",
          "minimum": 1,
          "maximum": 1000
        }
      },
      "required": [
        "usd_per_month"
      ]
    },
    "extend_budget": {
      "type": "boolean",
      "enum": [
        true
      ],
      "description": "0.228.1: with the strategy_id of a running strategy and a higher `model_budget`, this is an ask to raise that strategy's model budget: one card on the existing strategy, deduped while pending. 422 `strategy_not_found` when none runs, `budget_not_higher` when the budget is not above the current one. On approval the budget is raised and the `mandate_activated` event carries `model_budget` and `resume_token`."
    },
    "first_post": {
      "type": "object",
      "description": "0.244.0: the first post the plan would make on the person's own profile: `{words (plain text, at most 4000), where: \"profile\"}`. The person's Allow (POST /mandates/{id}/accept with `first_post_words`, the words as shown or their edit) approves the plan AND makes this post as them in the same step; later posts each ask on their own card. After Allow it also carries `asked_words` (the agent's own, when edited) and `posted: {exercise_id, message_id, chat_id, at}`.",
      "properties": {
        "words": {
          "type": "string",
          "maxLength": 4000
        },
        "where": {
          "type": "string",
          "enum": [
            "profile"
          ]
        }
      },
      "required": [
        "words"
      ]
    },
    "explore": {
      "type": "number",
      "minimum": 0.05,
      "maximum": 0.5,
      "default": 0.2,
      "description": "Dynamic Advantage: the share of effort spent on open questions. Tunes effort, promises nothing; the person can edit it before Allow."
    },
    "goal_kind": {
      "type": "string",
      "enum": [
        "growth",
        "sales",
        "support",
        "research",
        "content",
        "scheduling",
        "other"
      ],
      "default": "other",
      "description": "Dynamic Advantage: what kind of goal this is; picks defaults for guardrails and cost terms. Editable before Allow."
    },
    "pace": {
      "type": "string",
      "enum": [
        "careful",
        "balanced",
        "aggressive"
      ],
      "default": "balanced",
      "description": "Dynamic Advantage: how hard the plan pushes and how much evidence a test needs. Editable before Allow."
    },
    "horizon_days": {
      "type": "integer",
      "minimum": 1,
      "maximum": 90,
      "description": "Dynamic Advantage: days the plan looks ahead. When absent, the days to the latest target deadline."
    },
    "bets": {
      "type": "array",
      "maxItems": 5,
      "description": "Dynamic Advantage: claims the plan rests on, each with the response to run if it turns out wrong. Part of what the owner approves; not editable on the card, and the agent cannot change it without a new proposal.",
      "items": {
        "type": "object",
        "properties": {
          "statement": {
            "type": "string",
            "maxLength": 200
          },
          "metric": {
            "type": "string",
            "maxLength": 80
          },
          "direction": {
            "type": "string",
            "enum": [
              "up",
              "down"
            ]
          },
          "threshold": {
            "type": "number"
          },
          "by": {
            "type": "string",
            "format": "date"
          },
          "if_refuted": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "statement",
          "metric",
          "direction",
          "threshold",
          "if_refuted"
        ]
      }
    },
    "guardrails": {
      "type": "array",
      "maxItems": 5,
      "description": "Dynamic Advantage: limits the plan must not cross. Not editable on the card; changing them takes a new proposal.",
      "items": {
        "type": "object",
        "properties": {
          "metric": {
            "type": "string",
            "maxLength": 80
          },
          "limit": {
            "type": "number"
          },
          "direction": {
            "type": "string",
            "enum": [
              "up",
              "down"
            ]
          },
          "window_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30
          }
        },
        "required": [
          "metric",
          "limit",
          "direction",
          "window_days"
        ]
      }
    },
    "cost_terms": {
      "type": "array",
      "maxItems": 8,
      "description": "Dynamic Advantage: what the plan counts as cost, by metric name. Not editable on the card; changing them takes a new proposal.",
      "items": {
        "type": "object",
        "properties": {
          "metric": {
            "type": "string",
            "maxLength": 80
          },
          "weight": {
            "type": "number",
            "minimum": 0,
            "maximum": 10
          },
          "scale": {
            "type": "number",
            "exclusiveMinimum": 0
          }
        },
        "required": [
          "metric",
          "weight",
          "scale"
        ]
      }
    },
    "tunings": {
      "type": "array",
      "maxItems": 20,
      "readOnly": true,
      "description": "Served on a running plan: the newest 20 changes to explore, goal_kind or pace, one entry per key. 0.243.0: `{id, at, by: person|agent, key, from, to, text, undone_at?}`; the entries of one call share an `id`, which `POST /mandates/{id}/tunings/{tid}/undo` takes back (older entries carry only `{at, text}`). `text` is one plain sentence (\"You changed pace to careful.\", \"<agent name> set exploring to 30%.\"). Set by the API; never sent.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "by": {
            "type": "string",
            "enum": [
              "person",
              "agent"
            ]
          },
          "key": {
            "type": "string"
          },
          "from": {},
          "to": {},
          "text": {
            "type": "string"
          },
          "undone_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "review_every": {
      "type": "string",
      "enum": [
        "hourly",
        "daily",
        "weekly",
        "weekdays",
        "monthly"
      ]
    }
  },
  "required": [
    "goal",
    "plan",
    "targets",
    "review_every"
  ]
}