{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/geniffy-com/json-schema/geniffy-com-briefing-out-schema.json",
  "title": "BriefingOut",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/geniffy-com-openapi.json#/components/schemas/BriefingOut",
  "properties": {
    "project": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Project"
    },
    "briefing": {
      "type": "string",
      "title": "Briefing",
      "description": "Put this straight into your prompt: what was said last, when the memory has not read it yet; where things stand, its status and next steps first; last time; what is due; the rules that apply; what happened before; then the memories, each with its date"
    },
    "now": {
      "items": {
        "$ref": "#/$defs/StateOut"
      },
      "type": "array",
      "title": "Now"
    },
    "due": {
      "items": {
        "$ref": "#/$defs/IntentionOut"
      },
      "type": "array",
      "title": "Due"
    },
    "lessons": {
      "items": {
        "$ref": "#/$defs/LessonOut"
      },
      "type": "array",
      "title": "Lessons"
    },
    "episodes": {
      "items": {
        "$ref": "#/$defs/EpisodeOut"
      },
      "type": "array",
      "title": "Episodes"
    },
    "last": {
      "items": {
        "$ref": "#/$defs/EpisodeOut"
      },
      "type": "array",
      "title": "Last",
      "description": "Last time: the latest stretch of work, oldest first, each with its source (also in episodes)"
    },
    "unread": {
      "anyOf": [
        {
          "$ref": "#/$defs/UnreadOut"
        },
        {
          "type": "null"
        }
      ],
      "description": "The words said last that the memory has not read yet, in the minute after a session stops; null when it has read everything"
    },
    "memories": {
      "items": {
        "$ref": "#/$defs/Memory"
      },
      "type": "array",
      "title": "Memories"
    },
    "cursor": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cursor",
      "description": "Where the changes feed stood when this was read: GET /v1/changes with since set to it says what has changed since"
    }
  },
  "type": "object",
  "required": [
    "briefing",
    "now",
    "due",
    "lessons",
    "episodes",
    "memories"
  ],
  "$defs": {
    "EpisodeOut": {
      "properties": {
        "id": {
          "type": "integer",
          "title": "Id"
        },
        "project": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Project"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Title"
        },
        "what_happened": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "What Happened"
        },
        "outcome": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Outcome",
          "description": "How it ended"
        },
        "led_to": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Led To",
          "description": "What it led to"
        },
        "people": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "People"
        },
        "decisions": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array",
          "title": "Decisions",
          "description": "{what, why}"
        },
        "revised": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array",
          "title": "Revised",
          "description": "Endings a later conversation corrected, oldest first: {was, why, at}"
        },
        "started_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Started At"
        },
        "ended_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ended At"
        },
        "source": {
          "$ref": "#/$defs/SourceRef"
        }
      },
      "type": "object",
      "required": [
        "id",
        "source"
      ],
      "title": "EpisodeOut"
    },
    "IntentionOut": {
      "properties": {
        "id": {
          "type": "integer",
          "title": "Id"
        },
        "project": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Project"
        },
        "what": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "What"
        },
        "owner": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Owner",
          "description": "Who promised or planned it"
        },
        "trigger": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Trigger",
          "description": "time, context, person or event"
        },
        "at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "At",
          "description": "When it is due: a day (2026-10-31), or a time of day with its offset (2026-11-03T15:00:00-08:00) when one was said"
        },
        "due": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Due",
          "description": "That day in words: \"31 October 2026\", \"the end of Q1 2027\", \"Tuesday 3 November 2026 at 15:00\""
        },
        "overdue": {
          "type": "boolean",
          "title": "Overdue",
          "description": "Still open, and its day has gone by where the user is",
          "default": false
        },
        "when": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "When",
          "description": "Its trigger in words: \"when testing ends\""
        },
        "status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Status",
          "description": "open, done or dropped"
        },
        "moved_from": {
          "items": {
            "$ref": "#/$defs/MovedFrom"
          },
          "type": "array",
          "title": "Moved From",
          "description": "When it was due before a later conversation moved it, oldest first: {at, when}. Empty when it was never moved"
        },
        "sources": {
          "items": {
            "$ref": "#/$defs/SourceRef"
          },
          "type": "array",
          "title": "Sources",
          "description": "The five sources it came from last, the oldest of them first"
        },
        "sources_total": {
          "type": "integer",
          "title": "Sources Total",
          "description": "How many sources it came from in all",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "id"
      ],
      "title": "IntentionOut"
    },
    "LessonOut": {
      "properties": {
        "id": {
          "type": "integer",
          "title": "Id"
        },
        "project": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Project"
        },
        "kind": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Kind",
          "description": "rule, how_to or lesson"
        },
        "statement": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Statement"
        },
        "applies_when": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Applies When"
        },
        "why": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Why"
        },
        "strength": {
          "type": "integer",
          "title": "Strength",
          "description": "How many times it was learned again",
          "default": 1
        },
        "sources": {
          "items": {
            "$ref": "#/$defs/SourceRef"
          },
          "type": "array",
          "title": "Sources",
          "description": "The five sources it was learned from last, the oldest of them first"
        },
        "sources_total": {
          "type": "integer",
          "title": "Sources Total",
          "description": "How many sources it was learned from in all",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "id"
      ],
      "title": "LessonOut"
    },
    "Memory": {
      "properties": {
        "id": {
          "type": "integer",
          "title": "Id"
        },
        "text": {
          "type": "string",
          "title": "Text"
        },
        "about": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "About"
        },
        "kind": {
          "type": "string",
          "title": "Kind",
          "description": "people, plan, pref or detail"
        },
        "learned_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Learned At"
        },
        "said_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Said At",
          "description": "When it was said"
        },
        "date": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Date",
          "description": "The day it is about, when it is about one, worked out from the words on the clock of whoever said them: 2027-03-12, 2027-03 for a month, 2027-Q1, 2027, or --02-14 for a day every year"
        },
        "status": {
          "type": "string",
          "title": "Status",
          "description": "current, or clash when two memories disagree"
        },
        "source": {
          "anyOf": [
            {
              "$ref": "#/$defs/SourceRef"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "id",
        "text",
        "kind",
        "status"
      ],
      "title": "Memory"
    },
    "MovedFrom": {
      "properties": {
        "at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "At",
          "description": "When it was due before, for a time"
        },
        "when": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "When",
          "description": "Its trigger before, in words: \"on Friday\""
        }
      },
      "type": "object",
      "title": "MovedFrom"
    },
    "SourceRef": {
      "properties": {
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Id"
        },
        "kind": {
          "type": "string",
          "title": "Kind"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "labels": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "title": "Labels",
          "description": "The labels on the source it came from"
        }
      },
      "type": "object",
      "required": [
        "kind",
        "title"
      ],
      "title": "SourceRef"
    },
    "StateOut": {
      "properties": {
        "project": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Project",
          "description": "The project, as its sources were labelled; null: no project"
        },
        "goal": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Goal"
        },
        "focus": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Focus",
          "description": "What is being worked on right now"
        },
        "status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Status",
          "description": "Where the work stands, in one sentence: what works, what fails or is half done, what it waits on"
        },
        "open": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array",
          "title": "Open",
          "description": "What is still open: {text, since}"
        },
        "decisions": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array",
          "title": "Decisions",
          "description": "{what, why, when}, latest last"
        },
        "next_steps": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Next Steps",
          "description": "What comes next, in the order it was said"
        },
        "blockers": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Blockers"
        },
        "done": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array",
          "title": "Done",
          "description": "What was finished: {text, when, by}. when is a day (2026-11-02) when only a day was said; by: the words that settled it, when known"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updated At"
        }
      },
      "type": "object",
      "title": "StateOut"
    },
    "UnreadOut": {
      "properties": {
        "at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "At",
          "description": "When the last of them was said"
        },
        "turns": {
          "items": {
            "$ref": "#/$defs/UnreadTurn"
          },
          "type": "array",
          "title": "Turns",
          "description": "The person's and the assistant's last words, as said, oldest first"
        }
      },
      "type": "object",
      "title": "UnreadOut"
    },
    "UnreadTurn": {
      "properties": {
        "speaker": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Speaker"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Text"
        }
      },
      "type": "object",
      "title": "UnreadTurn"
    }
  }
}