{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/domani-run/json-schema/domani-run-assistant-brief-schema.json",
  "title": "AssistantBrief",
  "description": "The situation brief of one Work item: everything an agent needs to act without reading the mail",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/domani-run-openapi.json#/components/schemas/AssistantBrief",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "version": {
      "type": "integer"
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "title": {
      "type": "string"
    },
    "summary": {
      "type": "string"
    },
    "ask": {
      "type": [
        "string",
        "null"
      ]
    },
    "mailbox": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "operator": {
          "type": "string",
          "enum": [
            "human",
            "agent"
          ]
        }
      }
    },
    "delegated_to": {
      "type": [
        "string",
        "null"
      ]
    },
    "situation": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "attention": {
          "type": "object",
          "properties": {
            "level": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            },
            "confidence": {
              "type": "string"
            },
            "deadline": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "occurrences": {
          "type": "integer"
        },
        "first_seen_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_seen_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "sender": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "address": {
              "type": "string"
            },
            "name": {
              "type": [
                "string",
                "null"
              ]
            },
            "kind": {
              "type": "string"
            }
          }
        }
      }
    },
    "story": {
      "type": "array",
      "description": "Every mail of the situation, oldest first, with the one-line title the analysis gave it",
      "items": {
        "type": "object",
        "properties": {
          "message_id": {
            "type": "string"
          },
          "occurred_at": {
            "type": "string"
          },
          "sender": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "analysed": {
            "type": "boolean"
          }
        }
      }
    },
    "facts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "predicate": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "type": [
              "string",
              "null"
            ]
          },
          "value": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "type": {
                "type": "string"
              },
              "value": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "currency": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "basis": {
            "type": [
              "string",
              "null"
            ]
          },
          "confidence": {
            "type": [
              "number",
              "null"
            ]
          },
          "valid_from": {
            "type": [
              "string",
              "null"
            ]
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ]
          },
          "sensitivity": {
            "type": "string"
          },
          "evidence_refs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "seen_at": {
            "type": "string"
          }
        }
      }
    },
    "entities": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ref": {
            "type": "string"
          }
        }
      }
    },
    "commitments": {
      "type": "array",
      "description": "Open promises made by the owner's side",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "who": {
            "type": "string"
          },
          "owed_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "what": {
            "type": "string"
          },
          "due_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "overdue": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          }
        }
      }
    },
    "expectations": {
      "type": "array",
      "description": "Open things awaited from others",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "who": {
            "type": "string"
          },
          "what": {
            "type": "string"
          },
          "due_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "overdue": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          }
        }
      }
    },
    "settled": {
      "type": "array",
      "description": "Closed loops and receipts, newest first",
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "commitment",
              "expectation",
              "receipt"
            ]
          },
          "who": {
            "type": "string"
          },
          "what": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "at": {
            "type": "string"
          }
        }
      }
    },
    "awaiting": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "who": {
            "type": "string"
          },
          "what": {
            "type": "string"
          },
          "since": {
            "type": "string"
          },
          "due_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "overdue": {
            "type": "boolean"
          }
        }
      }
    },
    "decision": {
      "type": [
        "object",
        "null"
      ],
      "description": "The current prepared Decision with its options"
    },
    "summary_source": {
      "type": "string",
      "enum": [
        "model",
        "pipeline"
      ],
      "description": "Whether the summary is the model's reading of the evidence or the pipeline's own sentence"
    },
    "suggested_next": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "action": {
          "type": "string"
        },
        "reason": {
          "type": "string"
        },
        "source": {
          "type": "string",
          "enum": [
            "decision",
            "rule",
            "model"
          ]
        },
        "links": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The URLs the next action needs, verbatim from the evidence (model source only)"
        },
        "options": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The options on offer when the next action is a choice (model source only)"
        }
      }
    },
    "open_questions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "What only the owner can decide before the next action, at most three questions"
    },
    "synthesis": {
      "type": [
        "object",
        "null"
      ],
      "description": "The model call that wrote the summary and next action, null when the brief is deterministic only",
      "properties": {
        "model": {
          "type": "string"
        },
        "cached": {
          "type": "boolean"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "evidence": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "type": "string"
          },
          "received_at": {
            "type": "string"
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "excerpt": {
            "type": [
              "string",
              "null"
            ],
            "description": "The first 500 characters of the message's own words, quoted text and signatures removed"
          },
          "details": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "links": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "signature",
                        "calendar",
                        "payment",
                        "document",
                        "other"
                      ]
                    }
                  }
                }
              },
              "amounts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "number"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    }
                  }
                }
              },
              "dates": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "asks": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "owner_replies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "thread_id": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "sent_at": {
            "type": "string",
            "format": "date-time"
          },
          "excerpt": {
            "type": "string"
          }
        }
      }
    },
    "evidence_refs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "id",
    "version",
    "generated_at",
    "title",
    "summary",
    "situation",
    "story",
    "facts",
    "entities",
    "commitments",
    "expectations",
    "settled",
    "awaiting",
    "suggested_next",
    "evidence"
  ]
}